@lunora/studio 1.0.0-alpha.50 → 1.0.0-alpha.52
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.
- package/dist/index.js +3 -3
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +20 -14
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-CxJxRRf2.js → GlobalDataBrowser-f5Ll2AQK.js} +6 -2
- package/dist/packem_shared/{Studio-xJLTlLpf.js → Studio-BNGjxLVo.js} +1 -1
- package/dist/packem_shared/{StudioApp-oCQholCL.js → StudioApp-K9dn1Q9d.js} +71 -5
- package/dist/packem_shared/{studio-WZUOecDv.js → studio-Cd21fp4v.js} +36 -15
- package/dist/standalone/{chunk-A66LI6OV.js → chunk-2ZL6MXBC.js} +2 -2
- package/dist/standalone/chunk-4ELN4RE4.js +1 -0
- package/dist/standalone/{chunk-PS3XCCZD.js → chunk-4QA5TWYJ.js} +1 -1
- package/dist/standalone/{chunk-HQM6MBPS.js → chunk-6TYT447C.js} +1 -1
- package/dist/standalone/{chunk-BGG56IF5.js → chunk-7SN6J4DZ.js} +1 -1
- package/dist/standalone/{chunk-JUDPYSJZ.js → chunk-AJ2B326V.js} +1 -1
- package/dist/standalone/chunk-AVONJCNY.js +4 -0
- package/dist/standalone/{chunk-X2TQRMQV.js → chunk-BE24FXAK.js} +1 -1
- package/dist/standalone/{chunk-U26QNHMO.js → chunk-CP2EQVLU.js} +1 -1
- package/dist/standalone/chunk-DANDBL6P.js +3 -0
- package/dist/standalone/{chunk-KJFFID72.js → chunk-DBLAQC32.js} +1 -1
- package/dist/standalone/{chunk-P2ERTKMB.js → chunk-DTPFXYHG.js} +1 -1
- package/dist/standalone/{chunk-NW6SZZ5O.js → chunk-E3FVNRH7.js} +1 -1
- package/dist/standalone/{chunk-YLHDKM2P.js → chunk-FJV4UNYY.js} +1 -1
- package/dist/standalone/{chunk-LX7KONE3.js → chunk-FWTZYHX4.js} +1 -1
- package/dist/standalone/{chunk-IO2XEI6T.js → chunk-G465LTLD.js} +1 -1
- package/dist/standalone/{chunk-2CCWLKQW.js → chunk-IMZKGRPW.js} +1 -1
- package/dist/standalone/{chunk-4BVRLBEW.js → chunk-KDZJ5A3R.js} +1 -1
- package/dist/standalone/{chunk-X4676IX6.js → chunk-KGQGNJJ2.js} +1 -1
- package/dist/standalone/{chunk-5OZQHQ26.js → chunk-KKJZL75J.js} +1 -1
- package/dist/standalone/chunk-L2YBC2BV.js +11 -0
- package/dist/standalone/{chunk-RS7S7XVP.js → chunk-LDEVBRDZ.js} +1 -1
- package/dist/standalone/{chunk-4AXW2ECS.js → chunk-LVH4KLXS.js} +1 -1
- package/dist/standalone/{chunk-TYN6SQ73.js → chunk-N4NG7HGI.js} +1 -1
- package/dist/standalone/{chunk-6ZBU3JWR.js → chunk-ONSKQCYN.js} +1 -1
- package/dist/standalone/{chunk-HAJSYWFT.js → chunk-OSPEOESV.js} +1 -1
- package/dist/standalone/{chunk-S7AB7Y75.js → chunk-Q7PYLDZU.js} +1 -1
- package/dist/standalone/{chunk-2JTPX3CV.js → chunk-Q7TKOAGT.js} +1 -1
- package/dist/standalone/{chunk-W666BB6V.js → chunk-RXVQJ4DO.js} +1 -1
- package/dist/standalone/{chunk-UTHHHJYS.js → chunk-T3UCZ5PJ.js} +1 -1
- package/dist/standalone/{chunk-SHJUAHC6.js → chunk-TSLR3ZU2.js} +1 -1
- package/dist/standalone/{chunk-DR6LGPXE.js → chunk-UX53GWGU.js} +1 -1
- package/dist/standalone/{chunk-CJXJIRSN.js → chunk-VC5RNEHU.js} +1 -1
- package/dist/standalone/{chunk-XJU5SRNL.js → chunk-VLIRTNLA.js} +1 -1
- package/dist/standalone/{chunk-3CPQ5IQU.js → chunk-VN2PDOMK.js} +1 -1
- package/dist/standalone/{chunk-7LDYSHOU.js → chunk-VZFJI6XE.js} +1 -1
- package/dist/standalone/{chunk-LJAAZNQ6.js → chunk-WJ6OBCUM.js} +1 -1
- package/dist/standalone/{chunk-VL6HOZHF.js → chunk-XOANGJJP.js} +1 -1
- package/dist/standalone/{chunk-NS23QR4W.js → chunk-YA6POZJD.js} +1 -1
- package/dist/standalone/{chunk-A2DBMISD.js → chunk-ZECNJ4FG.js} +1 -1
- package/dist/standalone/{chunk-FAUN4Z72.js → chunk-ZETIKSQJ.js} +1 -1
- package/dist/standalone/{chunk-6RREMPQX.js → chunk-ZZMGCPXE.js} +1 -1
- package/dist/standalone/studio.js +36 -36
- package/package.json +6 -6
- package/dist/standalone/chunk-HTQNZXDT.js +0 -1
- package/dist/standalone/chunk-K4S652EQ.js +0 -4
- package/dist/standalone/chunk-SDMZKBTD.js +0 -1
- package/dist/standalone/chunk-XWPZBZSZ.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as At,b as re}from"./chunk-BGG56IF5.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as ce}from"./chunk-W666BB6V.js";import{a as pt,b as yt,c as Ct,d as Ze,e as ae,f as ne}from"./chunk-GTM65MVX.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import{a as xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as me}from"./chunk-TAD43CG5.js";import{d as X,k as z,l as St,p as Nt}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as n,e as vt,f as Rt,g as Et,h as Lt}from"./chunk-RRCPZMC2.js";var W=vt(Et(),1);var L=vt(Rt(),1);var o=vt(Lt(),1);var Tt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),jt=n(t=>{let e=Tt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Mt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),K=n(t=>{let e=(0,W.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(zt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),de=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=X();return(0,o.jsxDEV)(Dt,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(E,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Ot=n(t=>{let e=(0,W.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=ie(),s=X(),{busy:a,error:m,run:c}=re(),k;e[0]!==r?(k=r?z(r.name):"",e[0]=r,e[1]=k):k=e[1];let[u,g]=(0,L.useState)(k),y;e[2]!==r?(y=r?z(r.slug):"",e[2]=r,e[3]=y):y=e[3];let[h,b]=(0,L.useState)(y),w;e[4]!==r?(w=r?z(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[p,I]=(0,L.useState)(w),[v,S]=(0,L.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Mt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,L.useState)(C),_;e[9]!==i||e[10]!==p||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let V=x.trim()===""?void 0:Tt(x);l==="create"?await i.createAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim()===""?void 0:u.trim(),organizationId:z(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=p,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let A=_,D;e[21]!==l||e[22]!==u?(D=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==l||e[25]!==s?(T=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=T):T=e[26];let $;e[27]!==l||e[28]!==s?($=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=$):$=e[29];let j;e[30]!==s?(j=s("name"),e[30]=s,e[31]=j):j=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=n(V=>{g(V.target.value)},"t10"),e[32]=U):U=e[32];let P;e[33]!==u?(P=(0,o.jsxDEV)(Y,{"data-testid":"org-form-name",id:"org-form-name",onChange:U,value:u},void 0,!1),e[33]=u,e[34]=P):P=e[34];let Q;e[35]!==P||e[36]!==j?(Q=(0,o.jsxDEV)(K,{htmlFor:"org-form-name",label:j,children:P},void 0,!1),e[35]=P,e[36]=j,e[37]=Q):Q=e[37];let J;e[38]!==s?(J=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=J):J=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=n(V=>{b(V.target.value)},"t14"),e[40]=q):q=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(Y,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:q,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==J||e[44]!==M?(F=(0,o.jsxDEV)(K,{htmlFor:"org-form-slug",label:J,children:M},void 0,!1),e[43]=J,e[44]=M,e[45]=F):F=e[45];let B;e[46]!==s?(B=s("Logo URL (optional)"),e[46]=s,e[47]=B):B=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=n(V=>{I(V.target.value)},"t18"),e[48]=oe):oe=e[48];let Z;e[49]!==p?(Z=(0,o.jsxDEV)(Y,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:oe,value:p},void 0,!1),e[49]=p,e[50]=Z):Z=e[50];let ee;e[51]!==B||e[52]!==Z?(ee=(0,o.jsxDEV)(K,{htmlFor:"org-form-logo",label:B,children:Z},void 0,!1),e[51]=B,e[52]=Z,e[53]=ee):ee=e[53];let O;e[54]!==l||e[55]!==v||e[56]!==s?(O=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(V=>{S(V.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=O):O=e[57];let te;e[58]!==s?(te=s("Metadata (JSON, optional)"),e[58]=s,e[59]=te):te=e[59];let G;e[60]===Symbol.for("react.memo_cache_sentinel")?(G=n(V=>{N(V.target.value)},"t23"),e[60]=G):G=e[60];let le;e[61]!==x?(le=(0,o.jsxDEV)(xt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:G,value:x},void 0,!1),e[61]=x,e[62]=le):le=e[62];let H;e[63]!==te||e[64]!==le?(H=(0,o.jsxDEV)(K,{htmlFor:"org-form-metadata",label:te,children:le},void 0,!1),e[63]=te,e[64]=le,e[65]=H):H=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==A||e[70]!==Q||e[71]!==F||e[72]!==ee||e[73]!==O||e[74]!==H||e[75]!==D||e[76]!==T||e[77]!==$?(se=(0,o.jsxDEV)(de,{busy:a,canSubmit:D,error:m,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:$,children:[Q,F,ee,O,H]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=A,e[70]=Q,e[71]=F,e[72]=ee,e[73]=O,e[74]=H,e[75]=D,e[76]=T,e[77]=$,e[78]=se):se=e[78],se},"OrgFormDialog"),Pt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(y=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Add member"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-add-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberAddDialog"),Qt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(y=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Send invitation"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-invite-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberInviteDialog"),Jt=n(t=>{let e=(0,W.c)(32),{member:l,onClose:d,onDone:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),c;e[0]!==l.role?(c=z(l.role),e[0]=l.role,e[1]=c):c=e[1];let[k,u]=(0,L.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==k||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:z(l.id),role:k.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=k,e[7]=m,e[8]=g):g=e[8];let y=g,h;e[9]!==k?(h=k.trim(),e[9]=k,e[10]=h):h=e[10];let b=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("Change member role"),e[13]=i,e[14]=p):p=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==k?(S=(0,o.jsxDEV)(Y,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:k},void 0,!1),e[18]=k,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(K,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==y||e[27]!==C||e[28]!==b||e[29]!==w||e[30]!==p?(x=(0,o.jsxDEV)(de,{busy:s,canSubmit:b,error:a,onClose:d,onSubmit:y,submitLabel:w,testId:"org-member-role",title:p,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=y,e[27]=C,e[28]=b,e[29]=w,e[30]=p,e[31]=x):x=e[31],x},"MemberRoleDialog"),_t=n(t=>{let e=(0,W.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==k||e[9]!==i?.id?(h=n(()=>{k(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:z(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=k,e[9]=i?.id,e[10]=h):h=e[10];let b=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let p=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(A=>{y(A.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(Y,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(K,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==b||e[31]!==N||e[32]!==p||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(de,{busy:m,canSubmit:p,error:c,onClose:d,onSubmit:b,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=b,e[31]=N,e[32]=p,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Ut=n(t=>{let e=(0,W.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,y;e[7]!==c?(y=c.trim(),e[7]=c,e[8]=y):y=e[8];let h=y!=="",b;e[9]!==i?(b=i("Add member"),e[9]=i,e[10]=b):b=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("User id"),e[13]=i,e[14]=p):p=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{k(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(Y,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==p||e[19]!==v?(S=(0,o.jsxDEV)(K,{htmlFor:"org-team-add-member-user",label:p,children:v},void 0,!1),e[18]=p,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==b||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(de,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=b,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),$t=n(t=>{let e=(0,W.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Mt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[b,w]=(0,L.useState)(h),p;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==b||e[12]!==i?.id||e[13]!==k?(p=n(()=>{k(async()=>{let $=jt(b);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:$,role:g.trim()}):s.updateAuthOrgRole({permission:$,roleId:z(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=b,e[12]=i?.id,e[13]=k,e[14]=p):p=e[14];let I=p,v;e[15]!==l||e[16]!==g||e[17]!==b?(v=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n($=>{y($.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{w($.target.value)},"t9"),e[31]=_):_=e[31];let A;e[32]!==b?(A=(0,o.jsxDEV)(xt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:b},void 0,!1),e[32]=b,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,o.jsxDEV)(K,{htmlFor:"org-role-form-permission",label:N,children:A},void 0,!1),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?(T=(0,o.jsxDEV)(de,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,D]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=D,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=T):T=e[46],T},"RoleFormDialog"),Ft=n(t=>{let e=(0,W.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==k?(u=n(()=>{k(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=k,e[4]=u):u=e[4];let g=u,y;e[5]!==a?(y=a("Delete"),e[5]=a,e[6]=y):y=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let b;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==y||e[14]!==h||e[15]!==i||e[16]!==s?(b=(0,o.jsxDEV)(de,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:y,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=y,e[14]=h,e[15]=i,e[16]=s,e[17]=b):b=e[17],b},"ConfirmDialog"),et=n(t=>{let e=(0,W.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(bt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),tt=n(t=>{let e=(0,W.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=X(),s;e[0]!==l?(s=l.map(Ht),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ae,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let k;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let y;e[14]!==l||e[15]!==d||e[16]!==f?(y=n(h=>{let b=z(h.id);return(0,o.jsxDEV)(Ze,{"data-testid":`${f}-${b}`,children:[l.map(w=>(0,o.jsxDEV)(ne,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},b,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=y):y=e[17],k=r.map(y),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=k}else k=e[13];let u;e[18]!==k?(u=(0,o.jsxDEV)(Ct,{children:k},void 0,!1),e[18]=k,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(pt,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Bt=n(t=>{let e=(0,W.c)(213),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=ie(),i=X(),[s,a]=(0,L.useState)(null),[m,c]=(0,L.useState)(null),k;e[0]!==l?(k=["lunora-auth-org-members",l],e[0]=l,e[1]=k):k=e[1];let u;e[2]!==r||e[3]!==l?(u=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=u):u=e[4];let g=ce(k,u),y;e[5]!==l?(y=["lunora-auth-org-invitations",l],e[5]=l,e[6]=y):y=e[6];let h;e[7]!==r||e[8]!==l?(h=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=h):h=e[9];let b=ce(y,h),w;e[10]!==l?(w=["lunora-auth-org-teams",l],e[10]=l,e[11]=w):w=e[11];let p;e[12]!==r||e[13]!==l?(p=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=p):p=e[14];let I;e[15]!==f?(I={enabled:f},e[15]=f,e[16]=I):I=e[16];let v=ce(w,p,I),S;e[17]!==l?(S=["lunora-auth-org-roles",l],e[17]=l,e[18]=S):S=e[18];let C;e[19]!==r||e[20]!==l?(C=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=C):C=e[21];let x;e[22]!==d?(x={enabled:d},e[22]=d,e[23]=x):x=e[23];let N=ce(S,C,x),_;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let A;e[26]!==r||e[27]!==m?(A=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=A):A=e[28];let D=m!==null,T;e[29]!==D?(T={enabled:D},e[29]=D,e[30]=T):T=e[30];let $=ce(_,A,T),j;e[31]!==g.data?.rows?(j=g.data?.rows??[],e[31]=g.data?.rows,e[32]=j):j=e[32];let U=j,P;e[33]!==b.data?.rows?(P=b.data?.rows??[],e[33]=b.data?.rows,e[34]=P):P=e[34];let Q=P,J;e[35]!==v.data?.rows?(J=v.data?.rows??[],e[35]=v.data?.rows,e[36]=J):J=e[36];let q=J,M;e[37]!==N.data?.rows?(M=N.data?.rows??[],e[37]=N.data?.rows,e[38]=M):M=e[38];let F=M,B;e[39]!==m||e[40]!==$?(B=m===null?[]:$.data?.rows??[],e[39]=m,e[40]=$,e[41]=B):B=e[41];let oe=B,Z=g.error??b.error??v.error??N.error??$.error,ee;e[42]!==b||e[43]!==g||e[44]!==d||e[45]!==N||e[46]!==m||e[47]!==$||e[48]!==f||e[49]!==v?(ee=n(()=>{g.refetch(),b.refetch(),f&&v.refetch(),d&&N.refetch(),m!==null&&$.refetch()},"t20"),e[42]=b,e[43]=g,e[44]=d,e[45]=N,e[46]=m,e[47]=$,e[48]=f,e[49]=v,e[50]=ee):ee=e[50];let O=ee;It(O,!0);let te;e[51]===Symbol.for("react.memo_cache_sentinel")?(te=n(()=>{a(null)},"t21"),e[51]=te):te=e[51];let G=te,le;e[52]!==O?(le=n(R=>{St((async()=>{await R(),O()})())},"t22"),e[52]=O,e[53]=le):le=e[53];let H=le,se;e[54]!==r||e[55]!==i?(se=n(R=>{let kt=z(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:kt}),c(wt=>wt===kt?null:wt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=se):se=e[56];let V=se,fe;e[57]!==i?(fe=i("userId"),e[57]=i,e[58]=fe):fe=e[58];let ue;e[59]!==fe?(ue={head:fe,render:Vt},e[59]=fe,e[60]=ue):ue=e[60];let ge;e[61]!==i?(ge=i("role"),e[61]=i,e[62]=ge):ge=e[62];let ve;e[63]!==ge?(ve={head:ge,render:qt},e[63]=ge,e[64]=ve):ve=e[64];let lt;e[65]!==ue||e[66]!==ve?(lt=[ue,ve],e[65]=ue,e[66]=ve,e[67]=lt):lt=e[67];let mt=lt,he;e[68]!==i?(he=i("email"),e[68]=i,e[69]=he):he=e[69];let be;e[70]!==he?(be={head:he,render:Gt},e[70]=he,e[71]=be):be=e[71];let pe;e[72]!==i?(pe=i("role"),e[72]=i,e[73]=pe):pe=e[73];let ye;e[74]!==pe?(ye={head:pe,render:Kt},e[74]=pe,e[75]=ye):ye=e[75];let Ce;e[76]!==i?(Ce=i("status"),e[76]=i,e[77]=Ce):Ce=e[77];let xe;e[78]!==Ce?(xe={head:Ce,render:Wt},e[78]=Ce,e[79]=xe):xe=e[79];let it;e[80]!==be||e[81]!==ye||e[82]!==xe?(it=[be,ye,xe],e[80]=be,e[81]=ye,e[82]=xe,e[83]=it):it=e[83];let ct=it,Ie;e[84]!==i?(Ie=i("id"),e[84]=i,e[85]=Ie):Ie=e[85];let ke;e[86]!==Ie?(ke={className:"font-mono text-xs",head:Ie,render:Xt},e[86]=Ie,e[87]=ke):ke=e[87];let we;e[88]!==i?(we=i("name"),e[88]=i,e[89]=we):we=e[89];let Se;e[90]!==we?(Se={head:we,render:Yt},e[90]=we,e[91]=Se):Se=e[91];let ot;e[92]!==ke||e[93]!==Se?(ot=[ke,Se],e[92]=ke,e[93]=Se,e[94]=ot):ot=e[94];let ft=ot,Ne;e[95]!==i?(Ne=i("userId"),e[95]=i,e[96]=Ne):Ne=e[96];let st;e[97]!==Ne?(st=[{head:Ne,render:Zt}],e[97]=Ne,e[98]=st):st=e[98];let ut=st,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let Ae;e[101]!==ze?(Ae={head:ze,render:el},e[101]=ze,e[102]=Ae):Ae=e[102];let De;e[103]!==i?(De=i("Permission"),e[103]=i,e[104]=De):De=e[104];let Oe;e[105]!==De?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:De,render:tl},e[105]=De,e[106]=Oe):Oe=e[106];let rt;e[107]!==Ae||e[108]!==Oe?(rt=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=rt):rt=e[109];let gt=rt,_e;e[110]!==Z?(_e=Z!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:Z},void 0,!1),e[110]=Z,e[111]=_e):_e=e[111];let at;e[112]===Symbol.for("react.memo_cache_sentinel")?(at=n(()=>{a({kind:"add-member"})},"t49"),e[112]=at):at=e[112];let $e;e[113]!==i?($e=i("Add member"),e[113]=i,e[114]=$e):$e=e[114];let Te;e[115]!==$e?(Te=(0,o.jsxDEV)(E,{"data-testid":"org-open-add-member",onClick:at,size:"xs",type:"button",variant:"outline",children:$e},void 0,!1),e[115]=$e,e[116]=Te):Te=e[116];let nt;e[117]===Symbol.for("react.memo_cache_sentinel")?(nt=n(()=>{a({kind:"invite-member"})},"t52"),e[117]=nt):nt=e[117];let Me;e[118]!==i?(Me=i("Invite member"),e[118]=i,e[119]=Me):Me=e[119];let Fe;e[120]!==Me?(Fe=(0,o.jsxDEV)(E,{"data-testid":"org-open-invite-member",onClick:nt,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[120]=Me,e[121]=Fe):Fe=e[121];let Re;e[122]!==Te||e[123]!==Fe?(Re=(0,o.jsxDEV)(o.Fragment,{children:[Te,Fe]},void 0,!0),e[122]=Te,e[123]=Fe,e[124]=Re):Re=e[124];let Ee;e[125]!==i?(Ee=i("Members"),e[125]=i,e[126]=Ee):Ee=e[126];let Le;e[127]!==r||e[128]!==mt||e[129]!==U||e[130]!==H||e[131]!==i?(Le=U.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:mt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-member-role-${z(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgMember({memberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:U},void 0,!1),e[127]=r,e[128]=mt,e[129]=U,e[130]=H,e[131]=i,e[132]=Le):Le=e[132];let je;e[133]!==Re||e[134]!==Ee||e[135]!==Le?(je=(0,o.jsxDEV)(et,{action:Re,heading:Ee,testId:"org-members",children:Le},void 0,!1),e[133]=Re,e[134]=Ee,e[135]=Le,e[136]=je):je=e[136];let Pe;e[137]!==r||e[138]!==ct||e[139]!==Q||e[140]!==H||e[141]!==i?(Pe=Q.length>0&&(0,o.jsxDEV)(et,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(tt,{columns:ct,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-cancel-invitation-${z(R.id)}`,onClick:n(()=>{H(()=>r.cancelAuthOrgInvitation({invitationId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:Q},void 0,!1)},void 0,!1),e[137]=r,e[138]=ct,e[139]=Q,e[140]=H,e[141]=i,e[142]=Pe):Pe=e[142];let Qe;e[143]!==V||e[144]!==m||e[145]!==i||e[146]!==ft||e[147]!==q||e[148]!==f?(Qe=f&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:q.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ft,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"aria-pressed":m===z(R.id),"data-testid":`org-team-select-${z(R.id)}`,onClick:n(()=>{c(z(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-rename-${z(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-delete-${z(R.id)}`,onClick:n(()=>{V(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:q},void 0,!1)},void 0,!1),e[143]=V,e[144]=m,e[145]=i,e[146]=ft,e[147]=q,e[148]=f,e[149]=Qe):Qe=e[149];let Je;e[150]!==r||e[151]!==H||e[152]!==m||e[153]!==i||e[154]!==ut||e[155]!==oe||e[156]!==f?(Je=f&&m!==null&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:oe.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ut,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-team-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgTeamMember({teamMemberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:oe},void 0,!1)},void 0,!1),e[150]=r,e[151]=H,e[152]=m,e[153]=i,e[154]=ut,e[155]=oe,e[156]=f,e[157]=Je):Je=e[157];let Ue;e[158]!==r||e[159]!==gt||e[160]!==F||e[161]!==d||e[162]!==i?(Ue=d&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:F.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:gt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-role-edit-${z(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-role-delete-${z(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:z(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:F},void 0,!1)},void 0,!1),e[158]=r,e[159]=gt,e[160]=F,e[161]=d,e[162]=i,e[163]=Ue):Ue=e[163];let Be;e[164]!==s?.kind||e[165]!==l||e[166]!==O?(Be=s?.kind==="add-member"&&(0,o.jsxDEV)(Pt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[164]=s?.kind,e[165]=l,e[166]=O,e[167]=Be):Be=e[167];let He;e[168]!==s?.kind||e[169]!==l||e[170]!==O?(He=s?.kind==="invite-member"&&(0,o.jsxDEV)(Qt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[168]=s?.kind,e[169]=l,e[170]=O,e[171]=He):He=e[171];let Ve;e[172]!==s||e[173]!==O?(Ve=s?.kind==="member-role"&&(0,o.jsxDEV)(Jt,{member:s.member,onClose:G,onDone:O},void 0,!1),e[172]=s,e[173]=O,e[174]=Ve):Ve=e[174];let qe;e[175]!==s?.kind||e[176]!==l||e[177]!==O?(qe=s?.kind==="team-create"&&(0,o.jsxDEV)(_t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[175]=s?.kind,e[176]=l,e[177]=O,e[178]=qe):qe=e[178];let Ge;e[179]!==s||e[180]!==l||e[181]!==O?(Ge=s?.kind==="team-rename"&&(0,o.jsxDEV)(_t,{mode:"edit",onClose:G,onDone:O,organizationId:l,team:s.team},void 0,!1),e[179]=s,e[180]=l,e[181]=O,e[182]=Ge):Ge=e[182];let Ke;e[183]!==s||e[184]!==O?(Ke=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Ut,{onClose:G,onDone:O,teamId:s.teamId},void 0,!1),e[183]=s,e[184]=O,e[185]=Ke):Ke=e[185];let We;e[186]!==s?.kind||e[187]!==l||e[188]!==O?(We=s?.kind==="role-create"&&(0,o.jsxDEV)($t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[186]=s?.kind,e[187]=l,e[188]=O,e[189]=We):We=e[189];let Xe;e[190]!==s||e[191]!==l||e[192]!==O?(Xe=s?.kind==="role-edit"&&(0,o.jsxDEV)($t,{mode:"edit",onClose:G,onDone:O,organizationId:l,role:s.role},void 0,!1),e[190]=s,e[191]=l,e[192]=O,e[193]=Xe):Xe=e[193];let Ye;e[194]!==s||e[195]!==O?(Ye=s?.kind==="confirm"&&(0,o.jsxDEV)(Ft,{action:s.action,message:s.message,onClose:G,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[194]=s,e[195]=O,e[196]=Ye):Ye=e[196];let dt;return e[197]!==_e||e[198]!==je||e[199]!==Pe||e[200]!==Qe||e[201]!==Je||e[202]!==Ue||e[203]!==Be||e[204]!==He||e[205]!==Ve||e[206]!==qe||e[207]!==Ge||e[208]!==Ke||e[209]!==We||e[210]!==Xe||e[211]!==Ye?(dt=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[_e,je,Pe,Qe,Je,Ue,Be,He,Ve,qe,Ge,Ke,We,Xe,Ye]},void 0,!0),e[197]=_e,e[198]=je,e[199]=Pe,e[200]=Qe,e[201]=Je,e[202]=Ue,e[203]=Be,e[204]=He,e[205]=Ve,e[206]=qe,e[207]=Ge,e[208]=Ke,e[209]=We,e[210]=Xe,e[211]=Ye,e[212]=dt):dt=e[212],dt},"OrganizationDetail");function Ht(t){return(0,o.jsxDEV)(ae,{children:t.head},t.head,!1)}n(Ht,"_temp");function Vt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Vt,"_temp2");function qt(t){return z(t.role)}n(qt,"_temp3");function Gt(t){return z(t.email)}n(Gt,"_temp4");function Kt(t){return z(t.role)}n(Kt,"_temp5");function Wt(t){return z(t.status)}n(Wt,"_temp6");function Xt(t){return z(t.id)}n(Xt,"_temp7");function Yt(t){return z(t.name)}n(Yt,"_temp8");function Zt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Zt,"_temp9");function el(t){return z(t.role)}n(el,"_temp0");function tl(t){return z(t.permission)}n(tl,"_temp1");var hl=n(()=>{let t=(0,W.c)(62),e=ie(),l=X(),{config:d,ready:f}=At(),r=d.capabilities.organization,[i,s]=(0,L.useState)(null),[a,m]=(0,L.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let k;t[1]!==e?(k=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=k):k=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=ce(c,k,u),y=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],It(h,r);let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=n(()=>{m(null)},"t4"),t[7]=b):b=t[7];let w=b,p;t[8]!==g?(p=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=p):p=t[9];let I=p,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let B;return t[15]!==M||t[16]!==F?(B=(0,o.jsxDEV)(me,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=B):B=t[17],B}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let A;t[25]!==_?(A=(0,o.jsxDEV)(E,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==x?(D=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,A]},void 0,!0),t[27]=A,t[28]=x,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=T):T=t[31];let $;t[32]!==y||t[33]!==l?($=y!==null&&y.length===0&&(0,o.jsxDEV)(me,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=y,t[33]=l,t[34]=$):$=t[34];let j;t[35]!==y||t[36]!==i||t[37]!==l?(j=y!==null&&y.length>0&&(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(bt,{className:"px-0",children:(0,o.jsxDEV)(pt,{"data-testid":"org-table",children:[(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[(0,o.jsxDEV)(ae,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ae,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(Ct,{children:y.map(M=>{let F=z(M.id);return(0,o.jsxDEV)(Ze,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(ne,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.name)},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.slug)},void 0,!1),(0,o.jsxDEV)(ne,{className:"text-muted-foreground tabular-nums",children:Nt(M.createdAt)},void 0,!1),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(E,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=y,t[36]=i,t[37]=l,t[38]=j):j=t[38];let U;t[39]!==d.organization||t[40]!==i?(U=i!==null&&(0,o.jsxDEV)(Bt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=U):U=t[41];let P;t[42]!==a?.kind||t[43]!==I?(P=a?.kind==="create"&&(0,o.jsxDEV)(Ot,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=P):P=t[44];let Q;t[45]!==a||t[46]!==I?(Q=a?.kind==="edit"&&(0,o.jsxDEV)(Ot,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=Q):Q=t[47];let J;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(J=a?.kind==="delete"&&(0,o.jsxDEV)(Ft,{action:n(async()=>{let M=z(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=J):J=t[52];let q;return t[53]!==D||t[54]!==T||t[55]!==$||t[56]!==j||t[57]!==U||t[58]!==P||t[59]!==Q||t[60]!==J?(q=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,$,j,U,P,Q,J]},void 0,!0),t[53]=D,t[54]=T,t[55]=$,t[56]=j,t[57]=U,t[58]=P,t[59]=Q,t[60]=J,t[61]=q):q=t[61],q},"OrganizationsPanel");export{hl as OrganizationsPanel};
|
|
1
|
+
import{a as At,b as re}from"./chunk-7SN6J4DZ.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as ce}from"./chunk-RXVQJ4DO.js";import{a as pt,b as yt,c as Ct,d as Ze,e as ae,f as ne}from"./chunk-GTM65MVX.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import{a as xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as me}from"./chunk-TAD43CG5.js";import{d as X,k as z,l as St,p as Nt}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as n,e as vt,f as Rt,g as Et,h as Lt}from"./chunk-RRCPZMC2.js";var W=vt(Et(),1);var L=vt(Rt(),1);var o=vt(Lt(),1);var Tt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),jt=n(t=>{let e=Tt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Mt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),K=n(t=>{let e=(0,W.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(zt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),de=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=X();return(0,o.jsxDEV)(Dt,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(E,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Ot=n(t=>{let e=(0,W.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=ie(),s=X(),{busy:a,error:m,run:c}=re(),k;e[0]!==r?(k=r?z(r.name):"",e[0]=r,e[1]=k):k=e[1];let[u,g]=(0,L.useState)(k),y;e[2]!==r?(y=r?z(r.slug):"",e[2]=r,e[3]=y):y=e[3];let[h,b]=(0,L.useState)(y),w;e[4]!==r?(w=r?z(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[p,I]=(0,L.useState)(w),[v,S]=(0,L.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Mt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,L.useState)(C),_;e[9]!==i||e[10]!==p||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let V=x.trim()===""?void 0:Tt(x);l==="create"?await i.createAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim()===""?void 0:u.trim(),organizationId:z(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=p,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let A=_,D;e[21]!==l||e[22]!==u?(D=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==l||e[25]!==s?(T=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=T):T=e[26];let $;e[27]!==l||e[28]!==s?($=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=$):$=e[29];let j;e[30]!==s?(j=s("name"),e[30]=s,e[31]=j):j=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=n(V=>{g(V.target.value)},"t10"),e[32]=U):U=e[32];let P;e[33]!==u?(P=(0,o.jsxDEV)(Y,{"data-testid":"org-form-name",id:"org-form-name",onChange:U,value:u},void 0,!1),e[33]=u,e[34]=P):P=e[34];let Q;e[35]!==P||e[36]!==j?(Q=(0,o.jsxDEV)(K,{htmlFor:"org-form-name",label:j,children:P},void 0,!1),e[35]=P,e[36]=j,e[37]=Q):Q=e[37];let J;e[38]!==s?(J=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=J):J=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=n(V=>{b(V.target.value)},"t14"),e[40]=q):q=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(Y,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:q,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==J||e[44]!==M?(F=(0,o.jsxDEV)(K,{htmlFor:"org-form-slug",label:J,children:M},void 0,!1),e[43]=J,e[44]=M,e[45]=F):F=e[45];let B;e[46]!==s?(B=s("Logo URL (optional)"),e[46]=s,e[47]=B):B=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=n(V=>{I(V.target.value)},"t18"),e[48]=oe):oe=e[48];let Z;e[49]!==p?(Z=(0,o.jsxDEV)(Y,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:oe,value:p},void 0,!1),e[49]=p,e[50]=Z):Z=e[50];let ee;e[51]!==B||e[52]!==Z?(ee=(0,o.jsxDEV)(K,{htmlFor:"org-form-logo",label:B,children:Z},void 0,!1),e[51]=B,e[52]=Z,e[53]=ee):ee=e[53];let O;e[54]!==l||e[55]!==v||e[56]!==s?(O=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(V=>{S(V.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=O):O=e[57];let te;e[58]!==s?(te=s("Metadata (JSON, optional)"),e[58]=s,e[59]=te):te=e[59];let G;e[60]===Symbol.for("react.memo_cache_sentinel")?(G=n(V=>{N(V.target.value)},"t23"),e[60]=G):G=e[60];let le;e[61]!==x?(le=(0,o.jsxDEV)(xt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:G,value:x},void 0,!1),e[61]=x,e[62]=le):le=e[62];let H;e[63]!==te||e[64]!==le?(H=(0,o.jsxDEV)(K,{htmlFor:"org-form-metadata",label:te,children:le},void 0,!1),e[63]=te,e[64]=le,e[65]=H):H=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==A||e[70]!==Q||e[71]!==F||e[72]!==ee||e[73]!==O||e[74]!==H||e[75]!==D||e[76]!==T||e[77]!==$?(se=(0,o.jsxDEV)(de,{busy:a,canSubmit:D,error:m,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:$,children:[Q,F,ee,O,H]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=A,e[70]=Q,e[71]=F,e[72]=ee,e[73]=O,e[74]=H,e[75]=D,e[76]=T,e[77]=$,e[78]=se):se=e[78],se},"OrgFormDialog"),Pt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(y=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Add member"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-add-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberAddDialog"),Qt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(y=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Send invitation"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-invite-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberInviteDialog"),Jt=n(t=>{let e=(0,W.c)(32),{member:l,onClose:d,onDone:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),c;e[0]!==l.role?(c=z(l.role),e[0]=l.role,e[1]=c):c=e[1];let[k,u]=(0,L.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==k||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:z(l.id),role:k.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=k,e[7]=m,e[8]=g):g=e[8];let y=g,h;e[9]!==k?(h=k.trim(),e[9]=k,e[10]=h):h=e[10];let b=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("Change member role"),e[13]=i,e[14]=p):p=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==k?(S=(0,o.jsxDEV)(Y,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:k},void 0,!1),e[18]=k,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(K,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==y||e[27]!==C||e[28]!==b||e[29]!==w||e[30]!==p?(x=(0,o.jsxDEV)(de,{busy:s,canSubmit:b,error:a,onClose:d,onSubmit:y,submitLabel:w,testId:"org-member-role",title:p,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=y,e[27]=C,e[28]=b,e[29]=w,e[30]=p,e[31]=x):x=e[31],x},"MemberRoleDialog"),_t=n(t=>{let e=(0,W.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==k||e[9]!==i?.id?(h=n(()=>{k(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:z(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=k,e[9]=i?.id,e[10]=h):h=e[10];let b=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let p=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(A=>{y(A.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(Y,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(K,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==b||e[31]!==N||e[32]!==p||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(de,{busy:m,canSubmit:p,error:c,onClose:d,onSubmit:b,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=b,e[31]=N,e[32]=p,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Ut=n(t=>{let e=(0,W.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,y;e[7]!==c?(y=c.trim(),e[7]=c,e[8]=y):y=e[8];let h=y!=="",b;e[9]!==i?(b=i("Add member"),e[9]=i,e[10]=b):b=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("User id"),e[13]=i,e[14]=p):p=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{k(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(Y,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==p||e[19]!==v?(S=(0,o.jsxDEV)(K,{htmlFor:"org-team-add-member-user",label:p,children:v},void 0,!1),e[18]=p,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==b||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(de,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=b,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),$t=n(t=>{let e=(0,W.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Mt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[b,w]=(0,L.useState)(h),p;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==b||e[12]!==i?.id||e[13]!==k?(p=n(()=>{k(async()=>{let $=jt(b);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:$,role:g.trim()}):s.updateAuthOrgRole({permission:$,roleId:z(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=b,e[12]=i?.id,e[13]=k,e[14]=p):p=e[14];let I=p,v;e[15]!==l||e[16]!==g||e[17]!==b?(v=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n($=>{y($.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{w($.target.value)},"t9"),e[31]=_):_=e[31];let A;e[32]!==b?(A=(0,o.jsxDEV)(xt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:b},void 0,!1),e[32]=b,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,o.jsxDEV)(K,{htmlFor:"org-role-form-permission",label:N,children:A},void 0,!1),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?(T=(0,o.jsxDEV)(de,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,D]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=D,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=T):T=e[46],T},"RoleFormDialog"),Ft=n(t=>{let e=(0,W.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==k?(u=n(()=>{k(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=k,e[4]=u):u=e[4];let g=u,y;e[5]!==a?(y=a("Delete"),e[5]=a,e[6]=y):y=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let b;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==y||e[14]!==h||e[15]!==i||e[16]!==s?(b=(0,o.jsxDEV)(de,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:y,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=y,e[14]=h,e[15]=i,e[16]=s,e[17]=b):b=e[17],b},"ConfirmDialog"),et=n(t=>{let e=(0,W.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(bt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),tt=n(t=>{let e=(0,W.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=X(),s;e[0]!==l?(s=l.map(Ht),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ae,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let k;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let y;e[14]!==l||e[15]!==d||e[16]!==f?(y=n(h=>{let b=z(h.id);return(0,o.jsxDEV)(Ze,{"data-testid":`${f}-${b}`,children:[l.map(w=>(0,o.jsxDEV)(ne,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},b,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=y):y=e[17],k=r.map(y),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=k}else k=e[13];let u;e[18]!==k?(u=(0,o.jsxDEV)(Ct,{children:k},void 0,!1),e[18]=k,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(pt,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Bt=n(t=>{let e=(0,W.c)(213),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=ie(),i=X(),[s,a]=(0,L.useState)(null),[m,c]=(0,L.useState)(null),k;e[0]!==l?(k=["lunora-auth-org-members",l],e[0]=l,e[1]=k):k=e[1];let u;e[2]!==r||e[3]!==l?(u=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=u):u=e[4];let g=ce(k,u),y;e[5]!==l?(y=["lunora-auth-org-invitations",l],e[5]=l,e[6]=y):y=e[6];let h;e[7]!==r||e[8]!==l?(h=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=h):h=e[9];let b=ce(y,h),w;e[10]!==l?(w=["lunora-auth-org-teams",l],e[10]=l,e[11]=w):w=e[11];let p;e[12]!==r||e[13]!==l?(p=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=p):p=e[14];let I;e[15]!==f?(I={enabled:f},e[15]=f,e[16]=I):I=e[16];let v=ce(w,p,I),S;e[17]!==l?(S=["lunora-auth-org-roles",l],e[17]=l,e[18]=S):S=e[18];let C;e[19]!==r||e[20]!==l?(C=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=C):C=e[21];let x;e[22]!==d?(x={enabled:d},e[22]=d,e[23]=x):x=e[23];let N=ce(S,C,x),_;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let A;e[26]!==r||e[27]!==m?(A=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=A):A=e[28];let D=m!==null,T;e[29]!==D?(T={enabled:D},e[29]=D,e[30]=T):T=e[30];let $=ce(_,A,T),j;e[31]!==g.data?.rows?(j=g.data?.rows??[],e[31]=g.data?.rows,e[32]=j):j=e[32];let U=j,P;e[33]!==b.data?.rows?(P=b.data?.rows??[],e[33]=b.data?.rows,e[34]=P):P=e[34];let Q=P,J;e[35]!==v.data?.rows?(J=v.data?.rows??[],e[35]=v.data?.rows,e[36]=J):J=e[36];let q=J,M;e[37]!==N.data?.rows?(M=N.data?.rows??[],e[37]=N.data?.rows,e[38]=M):M=e[38];let F=M,B;e[39]!==m||e[40]!==$?(B=m===null?[]:$.data?.rows??[],e[39]=m,e[40]=$,e[41]=B):B=e[41];let oe=B,Z=g.error??b.error??v.error??N.error??$.error,ee;e[42]!==b||e[43]!==g||e[44]!==d||e[45]!==N||e[46]!==m||e[47]!==$||e[48]!==f||e[49]!==v?(ee=n(()=>{g.refetch(),b.refetch(),f&&v.refetch(),d&&N.refetch(),m!==null&&$.refetch()},"t20"),e[42]=b,e[43]=g,e[44]=d,e[45]=N,e[46]=m,e[47]=$,e[48]=f,e[49]=v,e[50]=ee):ee=e[50];let O=ee;It(O,!0);let te;e[51]===Symbol.for("react.memo_cache_sentinel")?(te=n(()=>{a(null)},"t21"),e[51]=te):te=e[51];let G=te,le;e[52]!==O?(le=n(R=>{St((async()=>{await R(),O()})())},"t22"),e[52]=O,e[53]=le):le=e[53];let H=le,se;e[54]!==r||e[55]!==i?(se=n(R=>{let kt=z(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:kt}),c(wt=>wt===kt?null:wt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=se):se=e[56];let V=se,fe;e[57]!==i?(fe=i("userId"),e[57]=i,e[58]=fe):fe=e[58];let ue;e[59]!==fe?(ue={head:fe,render:Vt},e[59]=fe,e[60]=ue):ue=e[60];let ge;e[61]!==i?(ge=i("role"),e[61]=i,e[62]=ge):ge=e[62];let ve;e[63]!==ge?(ve={head:ge,render:qt},e[63]=ge,e[64]=ve):ve=e[64];let lt;e[65]!==ue||e[66]!==ve?(lt=[ue,ve],e[65]=ue,e[66]=ve,e[67]=lt):lt=e[67];let mt=lt,he;e[68]!==i?(he=i("email"),e[68]=i,e[69]=he):he=e[69];let be;e[70]!==he?(be={head:he,render:Gt},e[70]=he,e[71]=be):be=e[71];let pe;e[72]!==i?(pe=i("role"),e[72]=i,e[73]=pe):pe=e[73];let ye;e[74]!==pe?(ye={head:pe,render:Kt},e[74]=pe,e[75]=ye):ye=e[75];let Ce;e[76]!==i?(Ce=i("status"),e[76]=i,e[77]=Ce):Ce=e[77];let xe;e[78]!==Ce?(xe={head:Ce,render:Wt},e[78]=Ce,e[79]=xe):xe=e[79];let it;e[80]!==be||e[81]!==ye||e[82]!==xe?(it=[be,ye,xe],e[80]=be,e[81]=ye,e[82]=xe,e[83]=it):it=e[83];let ct=it,Ie;e[84]!==i?(Ie=i("id"),e[84]=i,e[85]=Ie):Ie=e[85];let ke;e[86]!==Ie?(ke={className:"font-mono text-xs",head:Ie,render:Xt},e[86]=Ie,e[87]=ke):ke=e[87];let we;e[88]!==i?(we=i("name"),e[88]=i,e[89]=we):we=e[89];let Se;e[90]!==we?(Se={head:we,render:Yt},e[90]=we,e[91]=Se):Se=e[91];let ot;e[92]!==ke||e[93]!==Se?(ot=[ke,Se],e[92]=ke,e[93]=Se,e[94]=ot):ot=e[94];let ft=ot,Ne;e[95]!==i?(Ne=i("userId"),e[95]=i,e[96]=Ne):Ne=e[96];let st;e[97]!==Ne?(st=[{head:Ne,render:Zt}],e[97]=Ne,e[98]=st):st=e[98];let ut=st,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let Ae;e[101]!==ze?(Ae={head:ze,render:el},e[101]=ze,e[102]=Ae):Ae=e[102];let De;e[103]!==i?(De=i("Permission"),e[103]=i,e[104]=De):De=e[104];let Oe;e[105]!==De?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:De,render:tl},e[105]=De,e[106]=Oe):Oe=e[106];let rt;e[107]!==Ae||e[108]!==Oe?(rt=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=rt):rt=e[109];let gt=rt,_e;e[110]!==Z?(_e=Z!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:Z},void 0,!1),e[110]=Z,e[111]=_e):_e=e[111];let at;e[112]===Symbol.for("react.memo_cache_sentinel")?(at=n(()=>{a({kind:"add-member"})},"t49"),e[112]=at):at=e[112];let $e;e[113]!==i?($e=i("Add member"),e[113]=i,e[114]=$e):$e=e[114];let Te;e[115]!==$e?(Te=(0,o.jsxDEV)(E,{"data-testid":"org-open-add-member",onClick:at,size:"xs",type:"button",variant:"outline",children:$e},void 0,!1),e[115]=$e,e[116]=Te):Te=e[116];let nt;e[117]===Symbol.for("react.memo_cache_sentinel")?(nt=n(()=>{a({kind:"invite-member"})},"t52"),e[117]=nt):nt=e[117];let Me;e[118]!==i?(Me=i("Invite member"),e[118]=i,e[119]=Me):Me=e[119];let Fe;e[120]!==Me?(Fe=(0,o.jsxDEV)(E,{"data-testid":"org-open-invite-member",onClick:nt,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[120]=Me,e[121]=Fe):Fe=e[121];let Re;e[122]!==Te||e[123]!==Fe?(Re=(0,o.jsxDEV)(o.Fragment,{children:[Te,Fe]},void 0,!0),e[122]=Te,e[123]=Fe,e[124]=Re):Re=e[124];let Ee;e[125]!==i?(Ee=i("Members"),e[125]=i,e[126]=Ee):Ee=e[126];let Le;e[127]!==r||e[128]!==mt||e[129]!==U||e[130]!==H||e[131]!==i?(Le=U.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:mt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-member-role-${z(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgMember({memberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:U},void 0,!1),e[127]=r,e[128]=mt,e[129]=U,e[130]=H,e[131]=i,e[132]=Le):Le=e[132];let je;e[133]!==Re||e[134]!==Ee||e[135]!==Le?(je=(0,o.jsxDEV)(et,{action:Re,heading:Ee,testId:"org-members",children:Le},void 0,!1),e[133]=Re,e[134]=Ee,e[135]=Le,e[136]=je):je=e[136];let Pe;e[137]!==r||e[138]!==ct||e[139]!==Q||e[140]!==H||e[141]!==i?(Pe=Q.length>0&&(0,o.jsxDEV)(et,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(tt,{columns:ct,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-cancel-invitation-${z(R.id)}`,onClick:n(()=>{H(()=>r.cancelAuthOrgInvitation({invitationId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:Q},void 0,!1)},void 0,!1),e[137]=r,e[138]=ct,e[139]=Q,e[140]=H,e[141]=i,e[142]=Pe):Pe=e[142];let Qe;e[143]!==V||e[144]!==m||e[145]!==i||e[146]!==ft||e[147]!==q||e[148]!==f?(Qe=f&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:q.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ft,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"aria-pressed":m===z(R.id),"data-testid":`org-team-select-${z(R.id)}`,onClick:n(()=>{c(z(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-rename-${z(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-delete-${z(R.id)}`,onClick:n(()=>{V(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:q},void 0,!1)},void 0,!1),e[143]=V,e[144]=m,e[145]=i,e[146]=ft,e[147]=q,e[148]=f,e[149]=Qe):Qe=e[149];let Je;e[150]!==r||e[151]!==H||e[152]!==m||e[153]!==i||e[154]!==ut||e[155]!==oe||e[156]!==f?(Je=f&&m!==null&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:oe.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ut,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-team-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgTeamMember({teamMemberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:oe},void 0,!1)},void 0,!1),e[150]=r,e[151]=H,e[152]=m,e[153]=i,e[154]=ut,e[155]=oe,e[156]=f,e[157]=Je):Je=e[157];let Ue;e[158]!==r||e[159]!==gt||e[160]!==F||e[161]!==d||e[162]!==i?(Ue=d&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:F.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:gt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-role-edit-${z(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-role-delete-${z(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:z(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:F},void 0,!1)},void 0,!1),e[158]=r,e[159]=gt,e[160]=F,e[161]=d,e[162]=i,e[163]=Ue):Ue=e[163];let Be;e[164]!==s?.kind||e[165]!==l||e[166]!==O?(Be=s?.kind==="add-member"&&(0,o.jsxDEV)(Pt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[164]=s?.kind,e[165]=l,e[166]=O,e[167]=Be):Be=e[167];let He;e[168]!==s?.kind||e[169]!==l||e[170]!==O?(He=s?.kind==="invite-member"&&(0,o.jsxDEV)(Qt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[168]=s?.kind,e[169]=l,e[170]=O,e[171]=He):He=e[171];let Ve;e[172]!==s||e[173]!==O?(Ve=s?.kind==="member-role"&&(0,o.jsxDEV)(Jt,{member:s.member,onClose:G,onDone:O},void 0,!1),e[172]=s,e[173]=O,e[174]=Ve):Ve=e[174];let qe;e[175]!==s?.kind||e[176]!==l||e[177]!==O?(qe=s?.kind==="team-create"&&(0,o.jsxDEV)(_t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[175]=s?.kind,e[176]=l,e[177]=O,e[178]=qe):qe=e[178];let Ge;e[179]!==s||e[180]!==l||e[181]!==O?(Ge=s?.kind==="team-rename"&&(0,o.jsxDEV)(_t,{mode:"edit",onClose:G,onDone:O,organizationId:l,team:s.team},void 0,!1),e[179]=s,e[180]=l,e[181]=O,e[182]=Ge):Ge=e[182];let Ke;e[183]!==s||e[184]!==O?(Ke=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Ut,{onClose:G,onDone:O,teamId:s.teamId},void 0,!1),e[183]=s,e[184]=O,e[185]=Ke):Ke=e[185];let We;e[186]!==s?.kind||e[187]!==l||e[188]!==O?(We=s?.kind==="role-create"&&(0,o.jsxDEV)($t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[186]=s?.kind,e[187]=l,e[188]=O,e[189]=We):We=e[189];let Xe;e[190]!==s||e[191]!==l||e[192]!==O?(Xe=s?.kind==="role-edit"&&(0,o.jsxDEV)($t,{mode:"edit",onClose:G,onDone:O,organizationId:l,role:s.role},void 0,!1),e[190]=s,e[191]=l,e[192]=O,e[193]=Xe):Xe=e[193];let Ye;e[194]!==s||e[195]!==O?(Ye=s?.kind==="confirm"&&(0,o.jsxDEV)(Ft,{action:s.action,message:s.message,onClose:G,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[194]=s,e[195]=O,e[196]=Ye):Ye=e[196];let dt;return e[197]!==_e||e[198]!==je||e[199]!==Pe||e[200]!==Qe||e[201]!==Je||e[202]!==Ue||e[203]!==Be||e[204]!==He||e[205]!==Ve||e[206]!==qe||e[207]!==Ge||e[208]!==Ke||e[209]!==We||e[210]!==Xe||e[211]!==Ye?(dt=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[_e,je,Pe,Qe,Je,Ue,Be,He,Ve,qe,Ge,Ke,We,Xe,Ye]},void 0,!0),e[197]=_e,e[198]=je,e[199]=Pe,e[200]=Qe,e[201]=Je,e[202]=Ue,e[203]=Be,e[204]=He,e[205]=Ve,e[206]=qe,e[207]=Ge,e[208]=Ke,e[209]=We,e[210]=Xe,e[211]=Ye,e[212]=dt):dt=e[212],dt},"OrganizationDetail");function Ht(t){return(0,o.jsxDEV)(ae,{children:t.head},t.head,!1)}n(Ht,"_temp");function Vt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Vt,"_temp2");function qt(t){return z(t.role)}n(qt,"_temp3");function Gt(t){return z(t.email)}n(Gt,"_temp4");function Kt(t){return z(t.role)}n(Kt,"_temp5");function Wt(t){return z(t.status)}n(Wt,"_temp6");function Xt(t){return z(t.id)}n(Xt,"_temp7");function Yt(t){return z(t.name)}n(Yt,"_temp8");function Zt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Zt,"_temp9");function el(t){return z(t.role)}n(el,"_temp0");function tl(t){return z(t.permission)}n(tl,"_temp1");var hl=n(()=>{let t=(0,W.c)(62),e=ie(),l=X(),{config:d,ready:f}=At(),r=d.capabilities.organization,[i,s]=(0,L.useState)(null),[a,m]=(0,L.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let k;t[1]!==e?(k=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=k):k=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=ce(c,k,u),y=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],It(h,r);let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=n(()=>{m(null)},"t4"),t[7]=b):b=t[7];let w=b,p;t[8]!==g?(p=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=p):p=t[9];let I=p,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let B;return t[15]!==M||t[16]!==F?(B=(0,o.jsxDEV)(me,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=B):B=t[17],B}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let A;t[25]!==_?(A=(0,o.jsxDEV)(E,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==x?(D=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,A]},void 0,!0),t[27]=A,t[28]=x,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=T):T=t[31];let $;t[32]!==y||t[33]!==l?($=y!==null&&y.length===0&&(0,o.jsxDEV)(me,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=y,t[33]=l,t[34]=$):$=t[34];let j;t[35]!==y||t[36]!==i||t[37]!==l?(j=y!==null&&y.length>0&&(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(bt,{className:"px-0",children:(0,o.jsxDEV)(pt,{"data-testid":"org-table",children:[(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[(0,o.jsxDEV)(ae,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ae,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(Ct,{children:y.map(M=>{let F=z(M.id);return(0,o.jsxDEV)(Ze,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(ne,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.name)},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.slug)},void 0,!1),(0,o.jsxDEV)(ne,{className:"text-muted-foreground tabular-nums",children:Nt(M.createdAt)},void 0,!1),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(E,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=y,t[36]=i,t[37]=l,t[38]=j):j=t[38];let U;t[39]!==d.organization||t[40]!==i?(U=i!==null&&(0,o.jsxDEV)(Bt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=U):U=t[41];let P;t[42]!==a?.kind||t[43]!==I?(P=a?.kind==="create"&&(0,o.jsxDEV)(Ot,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=P):P=t[44];let Q;t[45]!==a||t[46]!==I?(Q=a?.kind==="edit"&&(0,o.jsxDEV)(Ot,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=Q):Q=t[47];let J;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(J=a?.kind==="delete"&&(0,o.jsxDEV)(Ft,{action:n(async()=>{let M=z(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=J):J=t[52];let q;return t[53]!==D||t[54]!==T||t[55]!==$||t[56]!==j||t[57]!==U||t[58]!==P||t[59]!==Q||t[60]!==J?(q=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,$,j,U,P,Q,J]},void 0,!0),t[53]=D,t[54]=T,t[55]=$,t[56]=j,t[57]=U,t[58]=P,t[59]=Q,t[60]=J,t[61]=q):q=t[61],q},"OrganizationsPanel");export{hl as OrganizationsPanel};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as Pe}from"./chunk-SDQE2IUJ.js";import{a as Be}from"./chunk-JM7XBQVK.js";import{a as $e}from"./chunk-TO6D2PJC.js";import"./chunk-V43BLH4J.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-X4QFAAZ5.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-EEWKIQUE.js";import"./chunk-KEGAWN6Y.js";import{a as Re}from"./chunk-XNJNSCLM.js";import{a as Le,b as Ae,c as Oe,d as xe,e as Me,f as De}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ie}from"./chunk-LUP4YTBS.js";import{b as qe}from"./chunk-4PC7IXNY.js";import{d as re,e as ve,f as ge}from"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as le}from"./chunk-G7ZBM54M.js";import{f as he}from"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,f as ne,g as se,h as Ee,l as Q}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as be,f as It,g as Rt,h as Lt,j as oe}from"./chunk-RRCPZMC2.js";var K=be(Rt(),1);var I=be(It(),1);var n=be(Lt(),1);var At=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Ot=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),Mt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),Dt=At.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Bt=Ot.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
|
|
2
|
+
${s}`})),$t=r(s=>{let e=[],o=s.replaceAll(/'(?:[^']|'')*'/gu,l=>(e.push(l),`${ae}${(e.length-1).toString()}${ae}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:l,replacement:a}of Dt)o=o.replaceAll(l,a);for(let{pattern:l,replacement:a}of Bt)o=o.replaceAll(l,a);return o=o.replaceAll(Mt,(l,a)=>e[Number(a)]??""),o},"formatSql"),ie=8,Pt=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],Wt=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Ht=/[\w$]/,_e=r(s=>s!==void 0&&Ht.test(s),"isWordChar"),Fe=r(s=>{let e=s.length;for(;e>0&&_e(s[e-1]);)e-=1;return s.slice(e)},"trailingWord"),ze=r((s,e)=>{let t=e;for(;t>0&&_e(s[t-1]);)t-=1;return{end:e,start:t,text:s.slice(t,e)}},"tokenAt"),We=r((s,e)=>{let t=s.slice(0,e).trimEnd();return t.endsWith(".")||Wt.has(Fe(t).toUpperCase())},"prefersColumns"),_t=r((s,e)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=Fe(t.slice(0,-1));return o===""?void 0:o},"qualifierTable"),Se=r((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"matches"),He=r((s,e,t,o)=>{let l=[];for(let a of s)if(Se(a,e)&&(l.push(o(a)),l.length>=t))break;return l},"takeMatches"),Ft=r((s,e,t)=>{let o=new Map;for(let[l,a]of Object.entries(s.columns))for(let d of a)if(Se(d,e)&&!o.has(d)&&(o.set(d,l),o.size>=t))return[...o].map(([p,c])=>({detail:c,kind:"column",label:p}));return[...o].map(([l,a])=>({detail:a,kind:"column",label:l}))},"takeColumnMatches"),zt=r((s,e,t)=>{let o=ze(s,e),l=_t(s,o.start);if(l!==void 0){let u=t.columns[l]??t.columns[l.toLowerCase()]??[];return He(u,o.text,ie,y=>({detail:l,kind:"column",label:y}))}if(o.text===""&&!We(s,o.start))return[];let a=He(t.tables,o.text,ie,u=>({kind:"table",label:u})),d=Ft(t,o.text,ie),p=Pt.filter(u=>o.text!==""&&Se(u,o.text)&&u.toLowerCase()!==o.text.toLowerCase()).map(u=>({kind:"keyword",label:u}));return(We(s,o.start)?[...d,...a,...p]:[...a,...d,...p]).slice(0,ie)},"suggestionsFor"),Ut=r((s,e,t)=>{let o=ze(s,e),l=s.slice(0,o.start)+t.label+s.slice(o.end);return{caret:o.start+t.label.length,value:l}},"acceptSuggestion"),Yt=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],jt=r((s,e)=>{let t=globalThis.getComputedStyle(s),o=globalThis.document.createElement("div"),{style:l}=o;l.position="absolute",l.visibility="hidden",l.whiteSpace="pre-wrap",l.overflowWrap="break-word";for(let c of Yt)l[c]=t[c];o.textContent=s.value.slice(0,Math.max(0,e));let a=globalThis.document.createElement("span");a.textContent=s.value.slice(Math.max(0,e))||".",o.append(a),globalThis.document.body.append(o);let d=a.offsetLeft-s.scrollLeft,p=a.offsetTop-s.scrollTop;return o.remove(),{left:d,top:p}},"caretOffset"),Kt=r((s,e,t)=>{let o=(0,K.c)(13),[l,a]=(0,I.useState)(null),d;o[0]!==s||o[1]!==e?(d=r((N,x)=>{let k=zt(N,x,s);if(k.length===0){a(null);return}let h=e.current,{left:w,top:C}=h===null?{left:0,top:0}:jt(h,x);a(T=>T!==null&&T.active===0&&T.left===w&&T.top===C&&T.suggestions.length===k.length&&T.suggestions.every((O,D)=>{let A=k.at(D);return O.kind===A?.kind&&O.label===A.label&&O.detail===A.detail})?T:{active:0,left:w,suggestions:k,top:C})},"t0"),o[0]=s,o[1]=e,o[2]=d):d=o[2];let p=d,c;o[3]===Symbol.for("react.memo_cache_sentinel")?(c=r(()=>{a(null)},"t1"),o[3]=c):c=o[3];let u=c,y;o[4]===Symbol.for("react.memo_cache_sentinel")?(y=r(N=>{a(x=>{if(x===null)return x;let k=x.suggestions.length,h=(x.active+N+k)%k;return{...x,active:h}})},"t2"),o[4]=y):y=o[4];let g=y,v;o[5]!==t||o[6]!==l||o[7]!==e?(v=r(()=>{let N=e.current;if(l===null||N===null)return!1;let x=l.suggestions[l.active];if(x===void 0)return!1;let k=Ut(N.value,N.selectionStart,x);return t(k.value),a(null),requestAnimationFrame(()=>{let h=e.current;h!==null&&(h.focus(),h.setSelectionRange(k.caret,k.caret))}),!0},"t3"),o[5]=t,o[6]=l,o[7]=e,o[8]=v):v=o[8];let m=v,f;return o[9]!==m||o[10]!==p||o[11]!==l?(f={close:u,commit:m,move:g,refresh:p,state:l},o[9]=m,o[10]=p,o[11]=l,o[12]=f):f=o[12],f},"useSqlAutocomplete"),Gt={column:"column",keyword:"keyword",table:"table"},Vt=20,Jt=r(s=>{let e=(0,K.c)(17),{listboxId:t,onPick:o,state:l}=s,a=G(),d;e[0]!==l?(d=l===null?void 0:{left:l.left,top:l.top+Vt},e[0]=l,e[1]=d):d=e[1];let p=d;if(l===null)return null;let c;if(e[2]!==t||e[3]!==o||e[4]!==l.active||e[5]!==l.suggestions||e[6]!==a){let y;e[8]!==t||e[9]!==o||e[10]!==l.active||e[11]!==a?(y=r((g,v)=>(0,n.jsxDEV)("li",{"aria-selected":v===l.active,className:oe("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",v===l.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${t}-opt-${v.toString()}`,onMouseDown:r(m=>{m.preventDefault(),o(v)},"onMouseDown"),role:"option",children:[(0,n.jsxDEV)("span",{className:"truncate font-mono",children:g.label},void 0,!1),g.detail!==void 0&&(0,n.jsxDEV)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:g.detail},void 0,!1),(0,n.jsxDEV)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:a(Gt[g.kind])},void 0,!1)]},`${g.kind}:${g.label}`,!0),"t32"),e[8]=t,e[9]=o,e[10]=l.active,e[11]=a,e[12]=y):y=e[12],c=l.suggestions.map(y),e[2]=t,e[3]=o,e[4]=l.active,e[5]=l.suggestions,e[6]=a,e[7]=c}else c=e[7];let u;return e[13]!==t||e[14]!==p||e[15]!==c?(u=(0,n.jsxDEV)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:t,role:"listbox",style:p,children:c},void 0,!1),e[13]=t,e[14]=p,e[15]=c,e[16]=u):u=e[16],u},"AutocompletePopover"),Ue=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Qt=r(s=>{let e=(0,K.c)(29),{active:t,onDelete:o,onSelect:l,query:a}=s,d=G(),p;e[0]!==l||e[1]!==a.id?(p=r(()=>{l(a.id)},"t1"),e[0]=l,e[1]=a.id,e[2]=p):p=e[2];let c=p,u;e[3]!==o||e[4]!==a.id?(u=r(E=>{E.stopPropagation(),o(a.id)},"t2"),e[3]=o,e[4]=a.id,e[5]=u):u=e[5];let y=u,g=t?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",v;e[6]!==g?(v=oe("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",g),e[6]=g,e[7]=v):v=e[7];let m=`sql-query-${a.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M4 6h16M4 12h10M4 18h7"},void 0,!1)},void 0,!1),e[8]=f):f=e[8];let N;e[9]!==a.name?(N=(0,n.jsxDEV)("span",{className:"truncate",children:a.name},void 0,!1),e[9]=a.name,e[10]=N):N=e[10];let x;e[11]!==t||e[12]!==c||e[13]!==v||e[14]!==m||e[15]!==N?(x=(0,n.jsxDEV)("button",{"aria-pressed":t,className:v,"data-testid":m,onClick:c,type:"button",children:[f,N]},void 0,!0),e[11]=t,e[12]=c,e[13]=v,e[14]=m,e[15]=N,e[16]=x):x=e[16];let k;e[17]!==d?(k=d("Delete query"),e[17]=d,e[18]=k):k=e[18];let h;e[19]!==d?(h=d("Delete query"),e[19]=d,e[20]=h):h=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[21]=w):w=e[21];let C;e[22]!==y||e[23]!==h||e[24]!==k?(C=(0,n.jsxDEV)("button",{"aria-label":k,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:y,title:h,type:"button",children:w},void 0,!1),e[22]=y,e[23]=h,e[24]=k,e[25]=C):C=e[25];let T;return e[26]!==C||e[27]!==x?(T=(0,n.jsxDEV)("li",{className:"group/q flex items-center",children:[x,C]},void 0,!0),e[26]=C,e[27]=x,e[28]=T):T=e[28],T},"QueryRow"),Xt=r(s=>{let e=(0,K.c)(58),{activeId:t,history:o,listRef:l,onClearHistory:a,onDelete:d,onLoadHistory:p,onLoadTemplate:c,onNew:u,onSearchChange:y,onSelect:g,queries:v,search:m}=s,f=G(),N;if(e[0]!==v||e[1]!==m){let q=m.trim().toLowerCase();N=q===""?[...v]:v.filter(L=>L.name.toLowerCase().includes(q)),e[0]=v,e[1]=m,e[2]=N}else N=e[2];let x=N,k;e[3]!==f?(k=f("Search queries\u2026"),e[3]=f,e[4]=k):k=e[4];let h;e[5]!==y||e[6]!==m||e[7]!==k?(h=(0,n.jsxDEV)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:y,placeholder:k,type:"text",value:m},void 0,!1),e[5]=y,e[6]=m,e[7]=k,e[8]=h):h=e[8];let w;e[9]!==f?(w=f("New query"),e[9]=f,e[10]=w):w=e[10];let C;e[11]!==f?(C=f("New query"),e[11]=f,e[12]=C):C=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1),e[13]=T):T=e[13];let E;e[14]!==u||e[15]!==w||e[16]!==C?(E=(0,n.jsxDEV)("button",{"aria-label":w,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:u,title:C,type:"button",children:T},void 0,!1),e[14]=u,e[15]=w,e[16]=C,e[17]=E):E=e[17];let O;e[18]!==h||e[19]!==E?(O=(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[h,E]},void 0,!0),e[18]=h,e[19]=E,e[20]=O):O=e[20];let D;e[21]!==f?(D=f("Private"),e[21]=f,e[22]=D):D=e[22];let A;e[23]!==D?(A=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:D},void 0,!1),e[23]=D,e[24]=A):A=e[24];let B;e[25]!==t||e[26]!==x||e[27]!==l||e[28]!==d||e[29]!==g||e[30]!==f?(B=x.length===0?(0,n.jsxDEV)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:f("No saved queries yet \u2014 they save to this browser as you type.")},void 0,!1):(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:l,children:x.map(q=>(0,n.jsxDEV)(Qt,{active:t===q.id,onDelete:d,onSelect:g,query:q},q.id,!1))},void 0,!1),e[25]=t,e[26]=x,e[27]=l,e[28]=d,e[29]=g,e[30]=f,e[31]=B):B=e[31];let P;e[32]!==A||e[33]!==B?(P=(0,n.jsxDEV)("div",{children:[A,B]},void 0,!0),e[32]=A,e[33]=B,e[34]=P):P=e[34];let W;e[35]!==f?(W=f("Reference"),e[35]=f,e[36]=W):W=e[36];let Y;e[37]!==W?(Y=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:W},void 0,!1),e[37]=W,e[38]=Y):Y=e[38];let F;e[39]!==c?(F=Ue.map(q=>(0,n.jsxDEV)("li",{children:(0,n.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":q.sql,onClick:c,type:"button",children:[(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"},void 0,!1)},void 0,!1),q.label]},void 0,!0)},q.label,!1)),e[39]=c,e[40]=F):F=e[40];let $;e[41]!==F?($=(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px",children:F},void 0,!1),e[41]=F,e[42]=$):$=e[42];let R;e[43]!==Y||e[44]!==$?(R=(0,n.jsxDEV)("div",{children:[Y,$]},void 0,!0),e[43]=Y,e[44]=$,e[45]=R):R=e[45];let M;e[46]!==o||e[47]!==a||e[48]!==p||e[49]!==f?(M=o.length>0&&(0,n.jsxDEV)("div",{children:[(0,n.jsxDEV)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,n.jsxDEV)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")},void 0,!1),(0,n.jsxDEV)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:a,type:"button",children:f("Clear history")},void 0,!1)]},void 0,!0),(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:o.map(q=>(0,n.jsxDEV)("li",{children:(0,n.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":q.sql,"data-testid":"sql-history-item",onClick:p,title:q.sql,type:"button",children:[(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"},void 0,!1)},void 0,!1),(0,n.jsxDEV)("span",{className:"truncate font-mono",children:q.sql},void 0,!1)]},void 0,!0)},`${q.at.toString()}:${q.sql}`,!1))},void 0,!1)]},void 0,!0),e[46]=o,e[47]=a,e[48]=p,e[49]=f,e[50]=M):M=e[50];let H;e[51]!==P||e[52]!==R||e[53]!==M?(H=(0,n.jsxDEV)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-2",children:[P,R,M]},void 0,!0),e[51]=P,e[52]=R,e[53]=M,e[54]=H):H=e[54];let _;return e[55]!==H||e[56]!==O?(_=(0,n.jsxDEV)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",children:[O,H]},void 0,!0),e[55]=H,e[56]=O,e[57]=_):_=e[57],_},"SqlQuerySidebar"),Zt=ne(le.listTables),eo=ne(le.readTablePage),to=r(s=>{let e=(0,K.c)(16),t=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let[l,a]=(0,I.useState)(o),d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];let[p,c]=(0,I.useState)(d),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let y=(0,I.useRef)(u),g,v;e[3]!==t||e[4]!==s?(g=r(()=>{let h={cancelled:!1};return Q(r(async()=>{try{let C=await t.query(Zt,{},se(s));h.cancelled||(a(C.map(no)),c({}),y.current=new Set)}catch{h.cancelled||(a([]),c({}),y.current=new Set)}},"load")()),()=>{h.cancelled=!0}},"t3"),v=[t,s],e[3]=t,e[4]=s,e[5]=g,e[6]=v):(g=e[5],v=e[6]),(0,I.useEffect)(g,v);let m;e[7]!==t||e[8]!==s?(m=r(h=>{if(y.current.has(h))return;y.current.add(h),Q(r(async()=>{try{let C=await t.query(eo,{limit:1,offset:0,table:h},se(s));c(T=>({...T,[h]:C.columns}))}catch{y.current.delete(h)}},"fetchColumns")())},"t5"),e[7]=t,e[8]=s,e[9]=m):m=e[9];let f=m,N;e[10]!==p||e[11]!==l?(N={columns:p,tables:l},e[10]=p,e[11]=l,e[12]=N):N=e[12];let x=N,k;return e[13]!==f||e[14]!==x?(k={probe:f,schema:x},e[13]=f,e[14]=x,e[15]=k):k=e[15],k},"useSqlSchema"),ye=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,oo=r(s=>{let e=new Set;ye.lastIndex=0;let t=ye.exec(s);for(;t!==null;)e.add(t[1]??t[2]),t=ye.exec(s);return[...e]},"referencedTables");function no(s){return s.name}r(no,"_temp$2");var so="lunora-studio-sql-tabs",lo="lunora-studio-sql-active-tab",ke=12,X=r((s="",e="")=>({activeId:null,id:ge("tab"),name:e,sql:s}),"makeTab"),ro=r(()=>ve(lo,""),"usePersistedActive"),io=r(s=>{let[e,t]=re(so),[o,l]=ro(),a=(0,I.useRef)(null);e.length===0&&a.current===null&&(a.current=s()),(0,I.useEffect)(()=>{if(e.length===0&&a.current!==null){let c=a.current;t([c])}},[t,e.length]);let d=e.length===0&&a.current!==null?[a.current]:e;return{activeId:d.some(c=>c.id===o)?o:d[0]?.id??"",setActiveId:l,setTabs:t,tabs:d}},"usePersistedTabs"),Ye=r(s=>s.activeId===null&&s.sql.trim()!=="","isDirty"),ao=r((s,e)=>[...s,e].slice(-ke),"addTab"),co=r((s,e,t)=>{let o=s.findIndex(d=>d.id===e);if(o===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let l=s.filter(d=>d.id!==e);if(l.length===0){let d=t();return{activeId:d.id,tabs:[d]}}return{activeId:l[Math.min(o,l.length-1)].id,tabs:l}},"closeTab"),uo=r((s,e)=>{let t=s.filter(o=>o.id===e);return t.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:t}},"closeOtherTabs"),fo=r((s,e,t)=>{let o=s.findIndex(a=>a.id===e);if(o===-1)return{activeId:t,tabs:[...s]};let l=s.slice(0,o+1);return{activeId:l.some(a=>a.id===t)?t:e,tabs:l}},"closeTabsToRight"),mo=r(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"closeAllTabs"),po=r((s,e,t)=>{if(s==="others")return e.filter(o=>o.id!==t);if(s==="right"){let o=e.findIndex(l=>l.id===t);return o===-1?[]:e.slice(o+1)}return[...e]},"tabsClosedBy"),bo=r((s,e)=>s.trim()===""?e:(s.split(`
|
|
3
|
+
`)[0]??s).slice(0,24),"derivedTabLabel"),ho=r(s=>{let e=(0,K.c)(14),{initial:t,onCancel:o,onCommit:l,placeholder:a,testId:d}=s,p=G(),c=xo,u;e[0]!==l?(u=r(N=>{l(N.currentTarget.value.trim())},"t1"),e[0]=l,e[1]=u):u=e[1];let y=u,g;e[2]!==o||e[3]!==l?(g=r(N=>{N.key==="Enter"?l(N.currentTarget.value.trim()):N.key==="Escape"&&o()},"t2"),e[2]=o,e[3]=l,e[4]=g):g=e[4];let v=g,m;e[5]!==p?(m=p("Tab title"),e[5]=p,e[6]=m):m=e[6];let f;return e[7]!==t||e[8]!==y||e[9]!==v||e[10]!==a||e[11]!==m||e[12]!==d?(f=(0,n.jsxDEV)("input",{"aria-label":m,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":d,defaultValue:t,onBlur:y,onKeyDown:v,placeholder:a,ref:c,type:"text"},void 0,!1),e[7]=t,e[8]=y,e[9]=v,e[10]=a,e[11]=m,e[12]=d,e[13]=f):f=e[13],f},"TabRenameInput"),vo=r(s=>{let e=(0,K.c)(29),{idBase:t,onDiscard:o,onKeep:l}=s,a=G(),d=`sql-tab-close-prompt-${t}`,p;e[0]!==a?(p=a("Discard?"),e[0]=a,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,n.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:p},void 0,!1),e[2]=p,e[3]=c):c=e[3];let u;e[4]!==a?(u=a("Discard changes"),e[4]=a,e[5]=u):u=e[5];let y=`sql-tab-close-confirm-${t}`,g;e[6]!==a?(g=a("Discard changes"),e[6]=a,e[7]=g):g=e[7];let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M5 13l4 4L19 7"},void 0,!1)},void 0,!1),e[8]=v):v=e[8];let m;e[9]!==o||e[10]!==u||e[11]!==y||e[12]!==g?(m=(0,n.jsxDEV)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":y,onClick:o,title:g,type:"button",children:v},void 0,!1),e[9]=o,e[10]=u,e[11]=y,e[12]=g,e[13]=m):m=e[13];let f;e[14]!==a?(f=a("Keep editing"),e[14]=a,e[15]=f):f=e[15];let N=`sql-tab-close-cancel-${t}`,x;e[16]!==a?(x=a("Keep editing"),e[16]=a,e[17]=x):x=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1),e[18]=k):k=e[18];let h;e[19]!==l||e[20]!==N||e[21]!==x||e[22]!==f?(h=(0,n.jsxDEV)("button",{"aria-label":f,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":N,onClick:l,title:x,type:"button",children:k},void 0,!1),e[19]=l,e[20]=N,e[21]=x,e[22]=f,e[23]=h):h=e[23];let w;return e[24]!==d||e[25]!==h||e[26]!==c||e[27]!==m?(w=(0,n.jsxDEV)("span",{className:"flex shrink-0 items-center gap-1","data-testid":d,role:"group",children:[c,m,h]},void 0,!0),e[24]=d,e[25]=h,e[26]=c,e[27]=m,e[28]=w):w=e[28],w},"TabCloseConfirm"),go=r(s=>{let e=(0,K.c)(47),{active:t,canClose:o,onClose:l,onMenu:a,onRename:d,onSelect:p,tab:c}=s,u=G(),[y,g]=(0,I.useState)(!1),[v,m]=(0,I.useState)(!1),f;e[0]!==a||e[1]!==c.id?(f=r(z=>{a(c.id,z)},"t1"),e[0]=a,e[1]=c.id,e[2]=f):f=e[2];let N=f,x;e[3]!==p||e[4]!==c.id?(x=r(()=>{p(c.id)},"t2"),e[3]=p,e[4]=c.id,e[5]=x):x=e[5];let k=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=r(()=>{g(!0)},"t3"),e[6]=h):h=e[6];let w=h,C;e[7]!==l||e[8]!==c?(C=r(z=>{z.stopPropagation(),Ye(c)?m(!0):l(c.id)},"t4"),e[7]=l,e[8]=c,e[9]=C):C=e[9];let T=C,E;e[10]!==l||e[11]!==c.id?(E=r(z=>{z.stopPropagation(),m(!1),l(c.id)},"t5"),e[10]=l,e[11]=c.id,e[12]=E):E=e[12];let O=E,D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=r(z=>{z.stopPropagation(),m(!1)},"t6"),e[13]=D):D=e[13];let A=D,B;e[14]!==d||e[15]!==c.id?(B=r(z=>{d(c.id,z),g(!1)},"t7"),e[14]=d,e[15]=c.id,e[16]=B):B=e[16];let P=B,W;e[17]===Symbol.for("react.memo_cache_sentinel")?(W=r(()=>{g(!1)},"t8"),e[17]=W):W=e[17];let Y=W,F;e[18]!==c.name?(F=c.name.trim(),e[18]=c.name,e[19]=F):F=e[19];let $=F,R;e[20]!==u||e[21]!==c.sql?(R=bo(c.sql,u("Untitled")),e[20]=u,e[21]=c.sql,e[22]=R):R=e[22];let M=R,H=t?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",_;e[23]!==H?(_=oe("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",H),e[23]=H,e[24]=_):_=e[24];let q=`sql-tab-${c.id}`,L;e[25]!==t||e[26]!==P||e[27]!==$||e[28]!==M||e[29]!==y||e[30]!==k||e[31]!==u||e[32]!==c.id?(L=y?(0,n.jsxDEV)(ho,{initial:$,onCancel:Y,onCommit:P,placeholder:M,testId:`sql-tab-rename-${c.id}`},void 0,!1):(0,n.jsxDEV)("button",{"aria-pressed":t,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${c.id}`,onClick:k,onDoubleClick:w,title:u("Double-click to rename"),type:"button",children:$===""?M:$},void 0,!1),e[25]=t,e[26]=P,e[27]=$,e[28]=M,e[29]=y,e[30]=k,e[31]=u,e[32]=c.id,e[33]=L):L=e[33];let j;e[34]!==o||e[35]!==O||e[36]!==v||e[37]!==T||e[38]!==u||e[39]!==c.id?(j=o&&(v?(0,n.jsxDEV)(vo,{idBase:c.id,onDiscard:O,onKeep:A},void 0,!1):(0,n.jsxDEV)("button",{"aria-label":u("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${c.id}`,onClick:T,title:u("Close tab"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1)},void 0,!1)),e[34]=o,e[35]=O,e[36]=v,e[37]=T,e[38]=u,e[39]=c.id,e[40]=j):j=e[40];let J;return e[41]!==N||e[42]!==_||e[43]!==q||e[44]!==L||e[45]!==j?(J=(0,n.jsxDEV)("div",{className:_,"data-testid":q,onContextMenu:N,children:[L,j]},void 0,!0),e[41]=N,e[42]=_,e[43]=q,e[44]=L,e[45]=j,e[46]=J):J=e[46],J},"TabButton");function xo(s){s?.focus(),s?.select()}r(xo,"_temp$1");var yo=ne(le.runSql),No="lunora-studio-sql-queries",ko="lunora-studio-sql-history",So="lunora-studio-sql-split-view",Co=25,wo={minWidth:"2.75rem",paddingInline:"0.5rem"},Ne={error:null,pane:"results",result:null},To=r(s=>{let e=(0,K.c)(16),{result:t}=s;if(t.columns.length===0){let c=t.rowCount===0?"0 rows":"",u;return e[0]!==c?(u=(0,n.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground",children:c},void 0,!1),e[0]=c,e[1]=u):u=e[1],u}let o;e[2]!==t.columns?(o=t.columns.map(Eo),e[2]=t.columns,e[3]=o):o=e[3];let l;e[4]!==o?(l=(0,n.jsxDEV)(Ae,{className:"sticky top-0 z-10 bg-muted",children:(0,n.jsxDEV)(xe,{children:o},void 0,!1)},void 0,!1),e[4]=o,e[5]=l):l=e[5];let a;if(e[6]!==t.columns||e[7]!==t.rows){let c;e[9]!==t.columns?(c=r((u,y)=>(0,n.jsxDEV)(xe,{"data-testid":"sql-row",children:t.columns.map(g=>(0,n.jsxDEV)(De,{className:"max-w-md truncate font-mono text-xs",children:(0,n.jsxDEV)(Be,{value:u[g]},void 0,!1)},g,!1))},y,!1),"t42"),e[9]=t.columns,e[10]=c):c=e[10],a=t.rows.map(c),e[6]=t.columns,e[7]=t.rows,e[8]=a}else a=e[8];let d;e[11]!==a?(d=(0,n.jsxDEV)(Oe,{children:a},void 0,!1),e[11]=a,e[12]=d):d=e[12];let p;return e[13]!==l||e[14]!==d?(p=(0,n.jsxDEV)(Le,{"data-testid":"sql-rows",children:[l,d]},void 0,!0),e[13]=l,e[14]=d,e[15]=p):p=e[15],p},"SqlResultTable"),_o=r(({initialShardKey:s})=>{let e=he(),t=G(),[o,l]=re(No),[a,d]=re(ko),[p,c]=(0,I.useState)(""),u=r(()=>X(Ue[0]?.sql??""),"seedTab"),{activeId:y,setActiveId:g,setTabs:v,tabs:m}=io(u),[f,N]=(0,I.useState)({}),[x,k]=(0,I.useState)(s??""),[h,w]=(0,I.useState)(!1),[C,T]=ve(So,!1),[E,O]=(0,I.useState)(null),[D,A]=(0,I.useState)(null),B=(0,I.useRef)(null),P=(0,I.useRef)(null),W=(0,I.useRef)(null),Y=(0,I.useId)(),{probe:F,schema:$}=to(x),R=m.find(i=>i.id===y)??m[0]??X(),M=R.sql,{activeId:H}=R,_=f[R.id]??Ne,{error:q,result:L}=_,j=_.pane,J=r(i=>{v(b=>b.map(S=>S.id===R.id?{...S,...i}:S))},"patchActiveTab"),z=r(i=>{N(b=>{let S=b[R.id]??Ne;return{...b,[R.id]:{error:i.error,pane:i.pane??S.pane,result:i.result}}})},"setActiveOutput"),Ce=r(i=>{N(b=>{let S=b[R.id]??Ne;return{...b,[R.id]:{...S,pane:i}}})},"setActivePane"),ce=r(i=>{J({sql:i}),H!==null&&l(b=>b.map(S=>S.id===H?{...S,sql:i}:S))},"setDraft"),je=Kt($,P,ce),{close:de,commit:we,move:ue,refresh:Z,state:V}=je,Ke=r(i=>{ue(i-(V?.active??0)),we()},"onPickSuggestion");(0,I.useEffect)(()=>{let i=P.current;i!==null&&i===document.activeElement&&Z(i.value,i.selectionStart)},[Z,$]);let Ge=r(i=>{d(b=>b[0]?.sql===i?b:[{at:Date.now(),sql:i},...b.filter(U=>U.sql!==i)].slice(0,Co))},"recordHistory"),fe=r(async i=>{if(M.trim()==="")return;w(!0);let b=i==="explain"?`EXPLAIN QUERY PLAN ${M}`:M;try{let S=await e.query(yo,{sql:b},se(x));z({error:null,pane:i,result:S}),qe(x),Ge(b)}catch(S){z({error:Ee(S),pane:i,result:null})}finally{w(!1)}},"run"),Ve=r(()=>{Q(fe("results"))},"onRun"),Je=r(i=>{let{selectionStart:b,value:S}=i.target;ce(S);for(let U of oo(S))F(U);Z(S,b)},"onDraftChange"),Qe=r(i=>{let b=i.currentTarget;Z(b.value,b.selectionStart)},"onEditorSelect"),Xe=r(i=>{if(V!==null){if(i.key==="ArrowDown"){i.preventDefault(),ue(1);return}if(i.key==="ArrowUp"){i.preventDefault(),ue(-1);return}if(i.key==="Escape"){i.preventDefault(),de();return}if((i.key==="Enter"||i.key==="Tab")&&!i.metaKey&&!i.ctrlKey&&we()){i.preventDefault();return}}(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),Q(fe(j)))},"onEditorKeyDown"),Ze=r(()=>{requestAnimationFrame(()=>{de()})},"onEditorBlur"),et=r(i=>{B.current!==null&&(B.current.scrollTop=i.currentTarget.scrollTop)},"onEditorScroll"),ee=r((i,b)=>{v(S=>S.map(U=>U.id===R.id?{...U,activeId:b,sql:i}:U)),z({error:null,result:null})},"loadIntoActiveTab"),tt=r(()=>{let i={id:ge("q"),name:t("Untitled query"),sql:""};l(b=>[i,...b]),ee("",i.id)},"newQuery"),ot=r(i=>{let b=o.find(S=>S.id===i);b!==void 0&&(ee(b.sql,i),W.current?.querySelector(`[data-testid="sql-query-${i}"]`)?.scrollIntoView({block:"nearest"}))},"selectQuery"),nt=r(i=>{l(b=>b.filter(S=>S.id!==i)),v(b=>b.map(S=>S.activeId===i?{...S,activeId:null}:S))},"deleteQuery"),st=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadTemplate"),lt=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadFromHistory"),rt=r(()=>{d([])},"clearHistory"),it=r(()=>{ce($t(M))},"formatDraft"),at=r(()=>{if(m.length>=ke)return;let i=X();v(b=>ao(b,i)),g(i.id)},"addEditorTab"),te=r(i=>{O(null),A(null),v(i.tabs),g(i.activeId);let b=new Set(i.tabs.map(S=>S.id));N(S=>Object.fromEntries(Object.entries(S).filter(([U])=>b.has(U))))},"commitTabs"),ct=r(i=>{te(co(m,i,X))},"closeEditorTab"),Te=r((i,b)=>{te(i==="others"?uo(m,b):i==="right"?fo(m,b,y):mo(X))},"applyBulk"),me=r(i=>{E!==null&&(po(i,m,E.id).some(b=>Ye(b))?A(i):Te(i,E.id))},"requestBulk"),dt=r((i,b)=>{b.preventDefault(),A(null),O({id:i,x:b.clientX,y:b.clientY})},"openTabMenu"),ut=r(()=>{O(null),A(null)},"closeTabMenu"),ft=r(i=>{i.preventDefault(),O(null),A(null)},"onBackdropContextMenu"),mt=r(()=>{me("others")},"onCloseOthers"),pt=r(()=>{me("right")},"onCloseToRight"),bt=r(()=>{me("all")},"onCloseAll"),ht=r(()=>{E!==null&&D!==null&&Te(D,E.id),A(null)},"confirmBulk"),vt=r(()=>{A(null)},"cancelBulk"),gt=E===null?void 0:{left:E.x,top:E.y},xt=r(i=>{de(),g(i)},"selectTab"),yt=r((i,b)=>{v(S=>S.map(U=>U.id===i?{...U,name:b}:U))},"renameTab"),Nt=r(()=>{Ce("results")},"showResults"),kt=r(()=>{Q(fe("explain"))},"showExplain"),St=r(()=>{Ce("chart")},"showChart"),Ct=r(()=>{T(!C)},"toggleSplit"),wt=M.split(`
|
|
4
|
+
`).length,Tt=r(i=>{c(i.target.value)},"onSearchChange"),pe=r(i=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${i?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"tabClass"),Et=C?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",qt=C?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";return(0,n.jsxDEV)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,n.jsxDEV)(Xt,{activeId:H,history:a,listRef:W,onClearHistory:rt,onDelete:nt,onLoadHistory:lt,onLoadTemplate:st,onNew:tt,onSearchChange:Tt,onSelect:ot,queries:o,search:p},void 0,!1),(0,n.jsxDEV)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxDEV)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[m.map(i=>(0,n.jsxDEV)(go,{active:i.id===R.id,canClose:m.length>1,onClose:ct,onMenu:dt,onRename:yt,onSelect:xt,tab:i},i.id,!1)),(0,n.jsxDEV)("button",{"aria-label":t("New tab"),className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:m.length>=ke,onClick:at,title:t("New tab"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0),E!==null&&(0,n.jsxDEV)(n.Fragment,{children:[(0,n.jsxDEV)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:ut,onContextMenu:ft,role:"presentation"},void 0,!1),(0,n.jsxDEV)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:gt,children:D===null?(0,n.jsxDEV)(n.Fragment,{children:[(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:m.length<=1,onClick:mt,role:"menuitem",type:"button",children:t("Close other tabs")},void 0,!1),(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:m.findIndex(i=>i.id===E.id)>=m.length-1,onClick:pt,role:"menuitem",type:"button",children:t("Close tabs to the right")},void 0,!1),(0,n.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:bt,role:"menuitem",type:"button",children:t("Close all tabs")},void 0,!1)]},void 0,!0):(0,n.jsxDEV)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,n.jsxDEV)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:t("Discard unsaved tabs?")},void 0,!1),(0,n.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:ht,type:"button",children:t("Discard")},void 0,!1),(0,n.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:vt,type:"button",children:t("Cancel")},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,n.jsxDEV)("div",{className:Et,children:[(0,n.jsxDEV)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,n.jsxDEV)("div",{"aria-hidden":"true",className:"shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",ref:B,style:wo,children:Array.from({length:wt},(i,b)=>(0,n.jsxDEV)("div",{children:b+1},b,!1))},void 0,!1),(0,n.jsxDEV)("div",{className:"relative min-w-0 flex-1",children:[(0,n.jsxDEV)("textarea",{"aria-activedescendant":V===null?void 0:`${Y}-opt-${V.active.toString()}`,"aria-autocomplete":"list","aria-controls":V===null?void 0:Y,"aria-expanded":V!==null,"aria-label":t("SQL query"),className:"size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none","data-testid":"sql-input",onBlur:Ze,onChange:Je,onKeyDown:Xe,onScroll:et,onSelect:Qe,placeholder:"SELECT * FROM \u2026",ref:P,role:"combobox",spellCheck:!1,value:M},void 0,!1),(0,n.jsxDEV)(Jt,{listboxId:Y,onPick:Ke,state:V},void 0,!1)]},void 0,!0)]},void 0,!0),(0,n.jsxDEV)("div",{className:qt,children:[(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[(0,n.jsxDEV)("button",{className:pe(j==="results"),"data-testid":"sql-tab-results",onClick:Nt,type:"button",children:t("Results")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="chart"),"data-testid":"sql-tab-chart",onClick:St,type:"button",children:t("Chart")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="explain"),"data-testid":"sql-tab-explain",onClick:kt,type:"button",children:t("Explain")},void 0,!1),(0,n.jsxDEV)("div",{className:"ms-auto flex items-center gap-2",children:[(0,n.jsxDEV)("button",{"aria-label":t("Split editor and results"),"aria-pressed":C,className:`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${C?"bg-accent text-foreground":"text-muted-foreground"}`,"data-testid":"sql-split-toggle",onClick:Ct,title:t("Split editor and results"),type:"button",children:(0,n.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,n.jsxDEV)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"},void 0,!1),(0,n.jsxDEV)("path",{d:"M12 4v16"},void 0,!1)]},void 0,!0)},void 0,!1),L!==null&&L.columns.length>0&&(0,n.jsxDEV)($e,{columns:L.columns,name:"query-result",rows:L.rows},void 0,!1),(0,n.jsxDEV)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:h,onClick:it,type:"button",children:t("Format")},void 0,!1),(0,n.jsxDEV)(Ie,{onChange:k,testId:"sql-shard-input",value:x},void 0,!1),(0,n.jsxDEV)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:h,onClick:Ve,type:"button",children:[t(h?"Running\u2026":"Run"),(0,n.jsxDEV)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,n.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto",children:[q!==null&&(0,n.jsxDEV)(Re,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:q},void 0,!1),q===null&&L===null&&(0,n.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:t("Click Run to execute your query.")},void 0,!1),q===null&&L!==null&&(0,n.jsxDEV)("div",{"data-testid":"sql-result",children:[j==="chart"?(0,n.jsxDEV)(Pe,{result:L},void 0,!1):(0,n.jsxDEV)(To,{result:L},void 0,!1),(0,n.jsxDEV)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:L.truncated?t("Showing the first {max} of {count} rows.",{count:L.rowCount,max:L.rows.length}):t("{count} rows",{count:L.rowCount})},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"SqlEditorPanel");function Eo(s){return(0,n.jsxDEV)(Me,{children:s},s,!1)}r(Eo,"_temp");export{_o as SqlEditorPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as h}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as h}from"./chunk-RXVQJ4DO.js";import{a as C,b as w,c as I,d as u,e as o,f as n}from"./chunk-GTM65MVX.js";import{a as A,e as S}from"./chunk-SEU5V7I6.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as N}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as g}from"./chunk-G7ZBM54M.js";import"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as E}from"./chunk-TAD43CG5.js";import{d as D,p as H}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as d,e as M,f as X,h as Y}from"./chunk-RRCPZMC2.js";var q=M(X(),1);var e=M(Y(),1);var G="agent_threads",Z="agent_messages",_=100,ee=250,te={},ae={filters:[],limit:_,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:G},l=d((r,t)=>{let a=r[t];return typeof a=="string"?a:void 0},"readString"),B=d((r,t)=>{let a=r[t];return typeof a=="number"?a:void 0},"readNumber"),P=d(r=>{let{usage:t}=r;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"readTotalTokens"),se=d(r=>{let{toolCalls:t}=r;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"readToolNames"),re=d(r=>{switch(r){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"threadStatusVariant"),oe=d(r=>{switch(r){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"approvalVariant"),ge=d(({initialShardKey:r=""})=>{let t=D(),[a,R]=(0,q.useState)(void 0),{data:p}=h(g.listTables,te,{live:!0,shardKey:r}),U=p!==void 0,m=Array.isArray(p)&&p.some(s=>s.name===G),{data:$,error:V,errorSource:z,liveError:O}=h(g.readTablePage,ae,{enabled:m,live:!0,shardKey:r}),F={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:ee,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:Z},{data:j,error:Q,errorSource:J}=h(g.readTablePage,F,{enabled:m&&a!==void 0,live:!0,shardKey:r}),x=Array.isArray($?.rows)?$.rows:[],K=Array.isArray(j?.rows)?j.rows:[],L=x.find(s=>l(s,"key")===a),f;return U&&!m?f=(0,e.jsxDEV)(E,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")},void 0,!1):m&&x.length===0?f=(0,e.jsxDEV)(E,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")},void 0,!1):f=(0,e.jsxDEV)("div",{className:"flex flex-col gap-6",children:[(0,e.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(S,{className:"px-0",children:(0,e.jsxDEV)(C,{"data-testid":"agents-threads-table",children:[(0,e.jsxDEV)(w,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(o,{children:t("Agent")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Status")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Messages")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Tokens")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Updated")},void 0,!1),(0,e.jsxDEV)(o,{"aria-label":t("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(I,{children:x.map(s=>{let i=l(s,"key")??"",c=l(s,"status"),v=P(s);return(0,e.jsxDEV)(u,{"data-active":i===a?"":void 0,"data-testid":`agents-thread-${i}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:l(s,"agent")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs text-muted-foreground",children:i},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(N,{"data-testid":`agents-thread-status-${i}`,variant:re(c),children:c??"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:B(s,"messageCount")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums text-muted-foreground",children:v??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:H(B(s,"updatedAt"),"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{className:"text-right",children:(0,e.jsxDEV)(T,{"data-testid":`agents-thread-open-${i}`,onClick:d(()=>{R(i)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")},void 0,!1)},void 0,!1)]},i,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),Q!==null&&(0,e.jsxDEV)(k,{error:J,testId:"agents-messages-error"},void 0,!1),a!==void 0&&(0,e.jsxDEV)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxDEV)(S,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,L!==void 0&&(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",P(L)??0," ",t("Tokens")]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{R(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")},void 0,!1)]},void 0,!0),K.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")},void 0,!1):(0,e.jsxDEV)(C,{"data-testid":"agents-messages-table",children:[(0,e.jsxDEV)(w,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(o,{children:t("Role")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Content")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Tool")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Approval")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(I,{children:K.map((s,i)=>{let c=l(s,"role")??"\u2014",v=se(s),W=l(s,"toolName"),y=l(s,"status"),b=B(s,"seq")??i;return(0,e.jsxDEV)(u,{"data-testid":`agents-message-${String(b)}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs align-top text-muted-foreground",children:c},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(s,"content")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs align-top text-muted-foreground",children:W??(v.length>0?v.join(", "):"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{className:"align-top",children:y===void 0?(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:"\u2014"},void 0,!1):(0,e.jsxDEV)(N,{"data-testid":`agents-message-approval-${String(b)}`,variant:oe(y),children:y},void 0,!1)},void 0,!1)]},l(s,"messageKey")??`${c}:${String(b)}`,!0)})},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[V!==null&&(0,e.jsxDEV)(k,{error:z,testId:"agents-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")},void 0,!1),O!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1),f]},void 0,!0)},"AgentsPanel");export{ge as AgentsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ae}from"./chunk-W666BB6V.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-G7ZBM54M.js";import{f as Q}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
1
|
+
import{b as ae}from"./chunk-RXVQJ4DO.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-G7ZBM54M.js";import{f as Q}from"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|