@lunora/studio 1.0.0-alpha.36 → 1.0.0-alpha.38
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/LICENSE.md +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/packem_chunks/auth-config-panel.js +290 -104
- package/dist/packem_chunks/organizations-panel.js +3002 -494
- package/dist/packem_chunks/users-panel.js +576 -110
- package/dist/packem_shared/use-async-submit-BWMDwRa4.js +91 -0
- package/dist/standalone/{chunk-PACH5AHG.js → chunk-2F4VYKM6.js} +1 -1
- package/dist/standalone/{chunk-OIZ4CHPN.js → chunk-2GFAOIC3.js} +1 -1
- package/dist/standalone/{chunk-OY3GVYS7.js → chunk-2SAZ5BZ5.js} +1 -1
- package/dist/standalone/chunk-2SE7II7A.js +1 -0
- package/dist/standalone/{chunk-5OH3VPZF.js → chunk-34OQUHSV.js} +1 -1
- package/dist/standalone/{chunk-2THHW7BC.js → chunk-3DBG4RIV.js} +1 -1
- package/dist/standalone/{chunk-EUIHTPKI.js → chunk-3UFZCRWL.js} +1 -1
- package/dist/standalone/{chunk-QLM6FYZW.js → chunk-4FL3EDN5.js} +1 -1
- package/dist/standalone/{chunk-ILCTSAOB.js → chunk-4JOKDSPU.js} +1 -1
- package/dist/standalone/{chunk-BQUQS7QN.js → chunk-7FF76BYY.js} +1 -1
- package/dist/standalone/chunk-7YXOPTWI.js +1 -0
- package/dist/standalone/chunk-AJKR6PY7.js +1 -0
- package/dist/standalone/{chunk-TOJ3TC35.js → chunk-FA3CCTXK.js} +1 -1
- package/dist/standalone/chunk-GLUNBZRI.js +1 -0
- package/dist/standalone/chunk-GM4NPF3W.js +1 -0
- package/dist/standalone/{chunk-XLQ4BHBD.js → chunk-HLZ4YLRK.js} +1 -1
- package/dist/standalone/{chunk-RRAFQ5G2.js → chunk-I3VXCZZL.js} +1 -1
- package/dist/standalone/{chunk-7VF3IAAW.js → chunk-IJPFHUJK.js} +1 -1
- package/dist/standalone/chunk-IQ466Q6W.js +1 -0
- package/dist/standalone/{chunk-LD2R263D.js → chunk-IU6GTBPD.js} +1 -1
- package/dist/standalone/{chunk-764T6X6X.js → chunk-IXDH4GL5.js} +1 -1
- package/dist/standalone/{chunk-6WRZP62V.js → chunk-JTTVXBLU.js} +1 -1
- package/dist/standalone/{chunk-7SLSB2TS.js → chunk-KQTCLPLO.js} +2 -2
- package/dist/standalone/chunk-KSKXW5PX.js +1 -0
- package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
- package/dist/standalone/{chunk-BI35RXKQ.js → chunk-LEHGGJP2.js} +1 -1
- package/dist/standalone/chunk-LNZIB2MD.js +1 -0
- package/dist/standalone/{chunk-OCHNCAXJ.js → chunk-MZ756AFF.js} +1 -1
- package/dist/standalone/chunk-N7G5I47W.js +1 -0
- package/dist/standalone/{chunk-TO4JQX7W.js → chunk-NV6RHG5L.js} +1 -1
- package/dist/standalone/chunk-O3I57FXK.js +1 -0
- package/dist/standalone/{chunk-YEVCU7TB.js → chunk-OES45DFG.js} +1 -1
- package/dist/standalone/{chunk-DVKPRFIJ.js → chunk-OIC7EJWI.js} +1 -1
- package/dist/standalone/{chunk-ZU4DZ6NK.js → chunk-OLE2AYTD.js} +1 -1
- package/dist/standalone/{chunk-U4OAQPBT.js → chunk-P3ZMBPCY.js} +1 -1
- package/dist/standalone/{chunk-VTGBPW24.js → chunk-P5JW7HKP.js} +1 -1
- package/dist/standalone/{chunk-MPTM7ZU3.js → chunk-Q3PTSVVU.js} +1 -1
- package/dist/standalone/chunk-QKQABJBE.js +1 -0
- package/dist/standalone/{chunk-JE2YOAB7.js → chunk-R5OQZYSW.js} +1 -1
- package/dist/standalone/{chunk-ATYUMPDM.js → chunk-SE2TQAHJ.js} +1 -1
- package/dist/standalone/{chunk-DVC6YWVP.js → chunk-TI7SE33D.js} +1 -1
- package/dist/standalone/{chunk-DWTBY343.js → chunk-VFJPO4UO.js} +1 -1
- package/dist/standalone/chunk-VON7JUPG.js +1 -0
- package/dist/standalone/{chunk-46K3NKPA.js → chunk-X7RPB4K4.js} +1 -1
- package/dist/standalone/{chunk-X5P2WRYI.js → chunk-XFSUINL3.js} +1 -1
- package/dist/standalone/{chunk-SLKF2L74.js → chunk-XGUOXHX4.js} +1 -1
- package/dist/standalone/{chunk-M55U7NHO.js → chunk-ZL4E2WVF.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
- package/dist/standalone/chunk-22W5VKZ6.js +0 -1
- package/dist/standalone/chunk-2GGMGPEP.js +0 -1
- package/dist/standalone/chunk-BACPICH6.js +0 -1
- package/dist/standalone/chunk-DORBUITF.js +0 -1
- package/dist/standalone/chunk-IOFMK4D7.js +0 -1
- package/dist/standalone/chunk-LI43EKM6.js +0 -1
- package/dist/standalone/chunk-MPYFGAOW.js +0 -1
- package/dist/standalone/chunk-NKJDGOM3.js +0 -1
- package/dist/standalone/chunk-PN5NCZDX.js +0 -1
- package/dist/standalone/chunk-RSEEHNFI.js +0 -1
- package/dist/standalone/chunk-X7MMBSNW.js +0 -1
- package/dist/standalone/chunk-XUGSA2NG.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as At,b as re}from"./chunk-GM4NPF3W.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.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 xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-3CJW6NWG.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as me}from"./chunk-TAD43CG5.js";import{a as ce}from"./chunk-OIC7EJWI.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as X,j as z,k as St,n as Nt}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.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,4 +1,4 @@
|
|
|
1
|
-
import{a as Ae}from"./chunk-VLXV72QE.js";import{a as xe}from"./chunk-JSEXCW5Q.js";import{a as X}from"./chunk-KZ6INM5M.js";import{d as we,f as Oe,g as $e,k as ae}from"./chunk-4QHKBC77.js";import{a as Ce}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as ke}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Te}from"./chunk-BOXSWNXZ.js";import{a as W}from"./chunk-TAD43CG5.js";import{b as Se}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as G}from"./chunk-
|
|
1
|
+
import{a as Ae}from"./chunk-VLXV72QE.js";import{a as xe}from"./chunk-JSEXCW5Q.js";import{a as X}from"./chunk-KZ6INM5M.js";import{d as we,f as Oe,g as $e,k as ae}from"./chunk-4QHKBC77.js";import{a as Ce}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as ke}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Te}from"./chunk-BOXSWNXZ.js";import{a as W}from"./chunk-TAD43CG5.js";import{b as Se}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as G}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as M,e as le,f as de,g as ce,k as Ie,l as re}from"./chunk-PVZI3CXP.js";import{b as Ne}from"./chunk-GMSGZDDH.js";import{a as p,e as q,f as he,g as oe,h as ne,j as ge}from"./chunk-RRCPZMC2.js";var Ue=q(oe(),1),ye=q(he(),1);var ee=q(oe(),1);var Z=q(he(),1);var B=q(ne(),1);var Ye=le(Te.listTables),Qe=["react","client","cli"],Xe=!1,Ze={action:"action",mutation:"mutation",query:"query"},Pe=p(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"splitPath"),Ee=p(({file:t,fn:e,kind:o})=>`await client.${Ze[o]}(api.${t}.${e}, { /* args */ });`,"buildClientSnippet"),et=p(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return Ee(t);case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"buildReactSnippet"),tt=p(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"buildCliSnippet"),st=p(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
|
|
2
2
|
`),"buildTableSnippet"),ot=p((t,e)=>{switch(t){case"cli":return tt(e);case"client":return Ee(e);default:return et(e)}},"snippetForTab"),_e=p(t=>{let e=(0,ee.c)(19),{code:o,label:s,testId:n}=t,r=M(),l;e[0]!==o?(l=p(()=>{re(o)},"t1"),e[0]=o,e[1]=l):l=e[1];let i=l,d;e[2]!==s?(d=(0,B.jsxDEV)("span",{className:"text-xs font-medium text-muted-foreground",children:s},void 0,!1),e[2]=s,e[3]=d):d=e[3];let c=`${n}-copy`,m;e[4]!==r?(m=r("Copy"),e[4]=r,e[5]=m):m=e[5];let a;e[6]!==i||e[7]!==c||e[8]!==m?(a=(0,B.jsxDEV)(H,{"data-testid":c,onClick:i,size:"xs",type:"button",variant:"ghost",children:m},void 0,!1),e[6]=i,e[7]=c,e[8]=m,e[9]=a):a=e[9];let u;e[10]!==d||e[11]!==a?(u=(0,B.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[d,a]},void 0,!0),e[10]=d,e[11]=a,e[12]=u):u=e[12];let v;e[13]!==o||e[14]!==n?(v=(0,B.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:o},void 0,!1),e[13]=o,e[14]=n,e[15]=v):v=e[15];let k;return e[16]!==u||e[17]!==v?(k=(0,B.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[u,v]},void 0,!0),e[16]=u,e[17]=v,e[18]=k):k=e[18],k},"SnippetBlock"),nt=p(t=>{let e=(0,ee.c)(50),{file:o,fn:s,kind:n}=t,r=M(),[l,i]=(0,Z.useState)("react"),d,c,m;if(e[0]!==o||e[1]!==s||e[2]!==n||e[3]!==r||e[4]!==l){let T={file:o,fn:s,kind:n},I;e[8]!==r?(I=r("CLI"),e[8]=r,e[9]=I):I=e[9];let P;e[10]!==r?(P=r("Client"),e[10]=r,e[11]=P):P=e[11];let E;e[12]!==r?(E=r("React"),e[12]=r,e[13]=E):E=e[13];let j;e[14]!==I||e[15]!==P||e[16]!==E?(j={cli:I,client:P,react:E},e[14]=I,e[15]=P,e[16]=E,e[17]=j):j=e[17],m=j;let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=p(L=>{i(L.currentTarget.dataset.tab)},"t62"),e[18]=R):R=e[18],d=R,c=ot(l,T),e[0]=o,e[1]=s,e[2]=n,e[3]=r,e[4]=l,e[5]=d,e[6]=c,e[7]=m}else d=e[5],c=e[6],m=e[7];let a=c,u=n==="action"&&l==="react"&&!Xe,v=`api.${o}.${s}`,k;e[19]!==v?(k=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:v},void 0,!1),e[19]=v,e[20]=k):k=e[20];let O;e[21]!==n||e[22]!==r?(O=r("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=r,e[23]=O):O=e[23];let h;e[24]!==O?(h=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:O},void 0,!1),e[24]=O,e[25]=h):h=e[25];let g;e[26]!==k||e[27]!==h?(g=(0,B.jsxDEV)("div",{children:[k,h]},void 0,!0),e[26]=k,e[27]=h,e[28]=g):g=e[28];let x;e[29]!==r?(x=r("Snippet flavour"),e[29]=r,e[30]=x):x=e[30];let b;e[31]!==d||e[32]!==l||e[33]!==m?(b=Qe.map(T=>(0,B.jsxDEV)(H,{"aria-selected":l===T,"data-tab":T,"data-testid":`api-tab-${T}`,onClick:d,role:"tab",size:"xs",type:"button",variant:l===T?"default":"outline",children:m[T]},T,!1)),e[31]=d,e[32]=l,e[33]=m,e[34]=b):b=e[34];let S;e[35]!==x||e[36]!==b?(S=(0,B.jsxDEV)("div",{"aria-label":x,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:b},void 0,!1),e[35]=x,e[36]=b,e[37]=S):S=e[37];let y=m[l],$=`api-snippet-${l}`,N;e[38]!==a||e[39]!==y||e[40]!==$?(N=(0,B.jsxDEV)(_e,{code:a,label:y,testId:$},void 0,!1),e[38]=a,e[39]=y,e[40]=$,e[41]=N):N=e[41];let w;e[42]!==u||e[43]!==r?(w=u&&(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:r("Actions have no React hook \u2014 call them through the client.")},void 0,!1),e[42]=u,e[43]=r,e[44]=w):w=e[44];let C;return e[45]!==N||e[46]!==w||e[47]!==g||e[48]!==S?(C=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[g,S,N,w]},void 0,!0),e[45]=N,e[46]=w,e[47]=g,e[48]=S,e[49]=C):C=e[49],C},"FunctionDoc"),rt=p(t=>{let e=(0,ee.c)(19),{name:o}=t,s=M(),n;e[0]!==o?(n=st(o),e[0]=o,e[1]=n):n=e[1];let r=n,l;e[2]!==o?(l=(0,B.jsxDEV)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:o},void 0,!1),e[2]=o,e[3]=l):l=e[3];let i;e[4]!==s?(i=s("Read and write this table through the typed data model."),e[4]=s,e[5]=i):i=e[5];let d;e[6]!==i?(d=(0,B.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i},void 0,!1),e[6]=i,e[7]=d):d=e[7];let c;e[8]!==l||e[9]!==d?(c=(0,B.jsxDEV)("div",{children:[l,d]},void 0,!0),e[8]=l,e[9]=d,e[10]=c):c=e[10];let m;e[11]!==s?(m=s("Data model"),e[11]=s,e[12]=m):m=e[12];let a;e[13]!==r||e[14]!==m?(a=(0,B.jsxDEV)(_e,{code:r,label:m,testId:"api-snippet-table"},void 0,!1),e[13]=r,e[14]=m,e[15]=a):a=e[15];let u;return e[16]!==c||e[17]!==a?(u=(0,B.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,a]},void 0,!0),e[16]=c,e[17]=a,e[18]=u):u=e[18],u},"TableDoc"),Re=p(t=>{let e=(0,ee.c)(8),{active:o,label:s,onSelect:n,testId:r,value:l}=t,i;e[0]!==n||e[1]!==l?(i=p(()=>{n(l)},"t1"),e[0]=n,e[1]=l,e[2]=i):i=e[2];let d=i,c=o?"page":void 0,m;return e[3]!==s||e[4]!==d||e[5]!==c||e[6]!==r?(m=(0,B.jsxDEV)("button",{"aria-current":c,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":r,onClick:d,type:"button",children:s},void 0,!1),e[3]=s,e[4]=d,e[5]=c,e[6]=r,e[7]=m):m=e[7],m},"RailButton"),je=p(t=>{let e=(0,ee.c)(67),{functions:o,initialShardKey:s}=t,n=M(),r=G(),[l,i]=(0,Z.useState)(null),[d,c]=(0,Z.useState)(null),m,a;e[0]!==r||e[1]!==s?(m=p(()=>{let _=!1;return r.query(Ye,{},de(s??"")).then(D=>(_||i(D),D)).catch(()=>{_||i([])}),()=>{_=!0}},"t1"),a=[r,s],e[0]=r,e[1]=s,e[2]=m,e[3]=a):(m=e[2],a=e[3]),(0,Z.useEffect)(m,a);let u;e[4]!==o?(u=o??[],e[4]=o,e[5]=u):u=e[5];let v=u,k;if(e[6]!==v){let _=new Map;for(let D of v){let{file:V,fn:U}=Pe(D.path),ie=_.get(V)??[];ie.push({fn:U,kind:D.kind,path:D.path}),_.set(V,ie)}k=[..._.entries()].map(at).toSorted(lt),e[6]=v,e[7]=k}else k=e[7];let O=k,h,g,x,b,S,y,$,N,w,C;if(e[8]!==v||e[9]!==O||e[10]!==d||e[11]!==n||e[12]!==l){let _=(l??[]).map(dt).toSorted(ct),D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=p(F=>{c({kind:"fn",path:F})},"t122"),e[23]=D):D=e[23];let V=D,U;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=p(F=>{c({kind:"table",name:F})},"t132"),e[24]=U):U=e[24];let ie=U;if(g=d?.kind==="fn"?v.find(F=>F.path===d.path):void 0,h=v.length>0||_.length>0,x=g===void 0?void 0:Pe(g.path),b="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",S="lunora-api-docs",e[25]!==n?(y=n("API resources"),e[25]=n,e[26]=y):y=e[26],$="flex flex-col gap-4 overflow-y-auto",N="api-rail",e[27]!==O||e[28]!==d||e[29]!==n){let F;e[31]!==d||e[32]!==n?(F=p(ve=>(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:ve.file||n("(root)")},void 0,!1),ve.items.map(se=>(0,B.jsxDEV)(Re,{active:d?.kind==="fn"&&d.path===se.path,label:se.fn,onSelect:V,testId:`api-rail-fn-${se.path}`,value:se.path},se.path,!1))]},ve.file,!0),"t142"),e[31]=d,e[32]=n,e[33]=F):F=e[33],w=O.map(F),e[27]=O,e[28]=d,e[29]=n,e[30]=w}else w=e[30];C=_.length>0&&(0,B.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,B.jsxDEV)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")},void 0,!1),_.map(F=>(0,B.jsxDEV)(Re,{active:d?.kind==="table"&&d.name===F,label:F,onSelect:ie,testId:`api-rail-table-${F}`,value:F},F,!1))]},void 0,!0),e[8]=v,e[9]=O,e[10]=d,e[11]=n,e[12]=l,e[13]=h,e[14]=g,e[15]=x,e[16]=b,e[17]=S,e[18]=y,e[19]=$,e[20]=N,e[21]=w,e[22]=C}else h=e[13],g=e[14],x=e[15],b=e[16],S=e[17],y=e[18],$=e[19],N=e[20],w=e[21],C=e[22];let T;e[34]!==h||e[35]!==n?(T=!h&&(0,B.jsxDEV)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")},void 0,!1),e[34]=h,e[35]=n,e[36]=T):T=e[36];let I;e[37]!==T||e[38]!==y||e[39]!==$||e[40]!==N||e[41]!==w||e[42]!==C?(I=(0,B.jsxDEV)("nav",{"aria-label":y,className:$,"data-testid":N,children:[w,C,T]},void 0,!0),e[37]=T,e[38]=y,e[39]=$,e[40]=N,e[41]=w,e[42]=C,e[43]=I):I=e[43];let P;e[44]!==d||e[45]!==n?(P=d===null&&(0,B.jsxDEV)(W,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[44]=d,e[45]=n,e[46]=P):P=e[46];let E;e[47]!==d?.kind||e[48]!==g||e[49]!==x?(E=d?.kind==="fn"&&g!==void 0&&x!==void 0&&(0,B.jsxDEV)(nt,{file:x.file,fn:x.fn,kind:g.kind},g.path,!1),e[47]=d?.kind,e[48]=g,e[49]=x,e[50]=E):E=e[50];let j;e[51]!==d?.kind||e[52]!==g||e[53]!==n?(j=d?.kind==="fn"&&g===void 0&&(0,B.jsxDEV)(W,{testId:"api-empty",title:n("API usage snippets")},void 0,!1),e[51]=d?.kind,e[52]=g,e[53]=n,e[54]=j):j=e[54];let R;e[55]!==d?(R=d?.kind==="table"&&(0,B.jsxDEV)(rt,{name:d.name},void 0,!1),e[55]=d,e[56]=R):R=e[56];let L;e[57]!==P||e[58]!==E||e[59]!==j||e[60]!==R?(L=(0,B.jsxDEV)("div",{className:"min-w-0",children:[P,E,j,R]},void 0,!0),e[57]=P,e[58]=E,e[59]=j,e[60]=R,e[61]=L):L=e[61];let A;return e[62]!==b||e[63]!==S||e[64]!==I||e[65]!==L?(A=(0,B.jsxDEV)("div",{className:b,"data-testid":S,children:[I,L]},void 0,!0),e[62]=b,e[63]=S,e[64]=I,e[65]=L,e[66]=A):A=e[66],A},"ApiDocsPanel");function it(t,e){return t.fn.localeCompare(e.fn)}p(it,"_temp");function at(t){let[e,o]=t;return{file:e,items:o.toSorted(it)}}p(at,"_temp2");function lt(t,e){return t.file.localeCompare(e.file)}p(lt,"_temp3");function dt(t){return t.name}p(dt,"_temp4");function ct(t,e){return t.localeCompare(e)}p(ct,"_temp5");var Ve=q(oe(),1);var J=q(oe(),1),K=q(he(),1);var f=q(ne(),1);var ue=p(function(t,e,o){let s=(0,J.c)(10),n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];let[r,l]=(0,K.useState)(n),i,d;s[1]!==o||s[2]!==e||s[3]!==t?(i=p(()=>{if(t!==void 0)return;let m=!1;return e().then(a=>(m||l(o(a)),a)).catch(a=>{m||l({kind:"error",message:ce(a)})}),()=>{m=!0}},"t1"),d=[o,e,t],s[1]=o,s[2]=e,s[3]=t,s[4]=i,s[5]=d):(i=s[4],d=s[5]),(0,K.useEffect)(i,d);let c;return s[6]!==o||s[7]!==r||s[8]!==t?(c=t===void 0?r:o(t),s[6]=o,s[7]=r,s[8]=t,s[9]=c):c=s[9],c},"useAdminSpec"),ft=p(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","scalarOf"),De=p(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"enumValues"),pe=p(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>pe(e)).join(" | "):t.type==="array"?`array<${pe(t.items)}>`:t.type??"any","typeLabel"),pt=p(t=>{let e=De(t);return e!==void 0?t.type??ft(e[0]):pe(t)},"fieldTypeLabel"),ut=p(t=>{let e=De(t);return e===void 0?void 0:e.map(o=>JSON.stringify(o)).join(" | ")},"valueInText"),mt=p(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let o=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let s=e.length>(o?2:1);return o||s?e.join(" "):void 0},"rangeText"),vt=p(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"childObject"),te=p(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return te(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[o,s]of Object.entries(t.properties??{}))e[o]=te(s);return e}case"string":return"";default:return null}},"exampleForSchema"),fe=p(t=>{let e=(0,J.c)(7),{label:o,value:s}=t,n;e[0]!==o?(n=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=n):n=e[1];let r;e[2]!==s?(r=(0,f.jsxDEV)("span",{className:"text-foreground",children:s},void 0,!1),e[2]=s,e[3]=r):r=e[3];let l;return e[4]!==n||e[5]!==r?(l=(0,f.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,r]},void 0,!0),e[4]=n,e[5]=r,e[6]=l):l=e[6],l},"Badge"),ht=p(t=>{let e=(0,J.c)(40),{name:o,required:s,schema:n}=t,r=M(),l;e[0]!==n?(l=mt(n),e[0]=n,e[1]=l):l=e[1];let i=l,d;e[2]!==n?(d=ut(n),e[2]=n,e[3]=d):d=e[3];let c=d,m=n["x-lunora-table"],a=n.format!==void 0||i!==void 0||c!==void 0||m!==void 0,u;e[4]!==n?(u=vt(n),e[4]=n,e[5]=u):u=e[5];let v=u,k=s?"*":"?",O;e[6]!==k?(O=(0,f.jsxDEV)("span",{className:"text-muted-foreground",children:k},void 0,!1),e[6]=k,e[7]=O):O=e[7];let h;e[8]!==o||e[9]!==O?(h=(0,f.jsxDEV)("span",{className:"font-mono text-foreground",children:[o,O]},void 0,!0),e[8]=o,e[9]=O,e[10]=h):h=e[10];let g;e[11]!==n?(g=pt(n),e[11]=n,e[12]=g):g=e[12];let x;e[13]!==g?(x=(0,f.jsxDEV)("span",{className:"font-mono text-muted-foreground",children:g},void 0,!1),e[13]=g,e[14]=x):x=e[14];let b;e[15]!==h||e[16]!==x?(b=(0,f.jsxDEV)("div",{className:"flex items-baseline gap-2",children:[h,x]},void 0,!0),e[15]=h,e[16]=x,e[17]=b):b=e[17];let S;e[18]!==n.description?(S=n.description!==void 0&&(0,f.jsxDEV)("p",{className:"max-w-prose text-muted-foreground",children:n.description},void 0,!1),e[18]=n.description,e[19]=S):S=e[19];let y;e[20]!==a||e[21]!==i||e[22]!==m||e[23]!==n.format||e[24]!==r||e[25]!==c?(y=a&&(0,f.jsxDEV)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,f.jsxDEV)(fe,{label:r("Format"),value:n.format},void 0,!1),i!==void 0&&(0,f.jsxDEV)(fe,{label:r("Range"),value:i},void 0,!1),c!==void 0&&(0,f.jsxDEV)(fe,{label:r("Value in"),value:c},void 0,!1),m!==void 0&&(0,f.jsxDEV)(fe,{label:r("relation"),value:m},void 0,!1)]},void 0,!0),e[20]=a,e[21]=i,e[22]=m,e[23]=n.format,e[24]=r,e[25]=c,e[26]=y):y=e[26];let $;e[27]!==S||e[28]!==y||e[29]!==b?($=(0,f.jsxDEV)("div",{className:"flex flex-col gap-1 py-2",children:[b,S,y]},void 0,!0),e[27]=S,e[28]=y,e[29]=b,e[30]=$):$=e[30];let N=$;if(v===void 0){let I;return e[31]!==N?(I=(0,f.jsxDEV)("div",{className:"border-b border-border/50 last:border-b-0",children:N},void 0,!1),e[31]=N,e[32]=I):I=e[32],I}let w;e[33]!==N?(w=(0,f.jsxDEV)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:N},void 0,!1),e[33]=N,e[34]=w):w=e[34];let C;e[35]!==v?(C=(0,f.jsxDEV)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,f.jsxDEV)(Me,{schema:v},void 0,!1)},void 0,!1),e[35]=v,e[36]=C):C=e[36];let T;return e[37]!==w||e[38]!==C?(T=(0,f.jsxDEV)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,C]},void 0,!0),e[37]=w,e[38]=C,e[39]=T):T=e[39],T},"FieldRow"),Me=p(t=>{let e=(0,J.c)(7),{schema:o}=t,s;e[0]!==o.required?(s=new Set(o.required),e[0]=o.required,e[1]=s):s=e[1];let n=s,r;e[2]!==o.properties?(r=Object.entries(o.properties??{}),e[2]=o.properties,e[3]=r):r=e[3];let l=r,i;return e[4]!==n||e[5]!==l?(i=(0,f.jsxDEV)("div",{className:"flex flex-col",children:l.map(d=>{let[c,m]=d;return(0,f.jsxDEV)(ht,{name:c,required:n.has(c),schema:m},c,!1)})},void 0,!1),e[4]=n,e[5]=l,e[6]=i):i=e[6],i},"SchemaFields"),Le=p(t=>{let e=(0,J.c)(10),{schema:o,testId:s}=t;if(o?.type!=="object"||Object.keys(o.properties??{}).length===0){let l;e[0]!==o?(l=pe(o),e[0]=o,e[1]=l):l=e[1];let i;return e[2]!==l||e[3]!==s?(i=(0,f.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l},void 0,!1),e[2]=l,e[3]=s,e[4]=i):i=e[4],i}let n;e[5]!==o?(n=(0,f.jsxDEV)(Me,{schema:o},void 0,!1),e[5]=o,e[6]=n):n=e[6];let r;return e[7]!==n||e[8]!==s?(r=(0,f.jsxDEV)("div",{className:"text-xs","data-testid":s,children:n},void 0,!1),e[7]=n,e[8]=s,e[9]=r):r=e[9],r},"SchemaTable"),gt=["curl","javascript","lunora"],xt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},bt=p(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"apiReferenceOf"),yt=p(t=>{let e=te(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"requestBody"),Nt=p((t,e,o)=>{let s=`${o}${e.httpPath}`,n=JSON.stringify(yt(e),void 0,2),r=JSON.stringify(te(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let l=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
|
|
3
3
|
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
4
4
|
import { api } from "./_generated/api";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,c as v,d as g,f as D}from"./chunk-
|
|
1
|
+
import{b,c as v,d as g,f as D}from"./chunk-GLUNBZRI.js";import{e as y,f as p,g as P,k as O}from"./chunk-PVZI3CXP.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-WXPWVBIY.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as X}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{b as G}from"./chunk-
|
|
1
|
+
import{a as le}from"./chunk-WXPWVBIY.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as X}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{b as G}from"./chunk-OIC7EJWI.js";import{a as z,e as Q}from"./chunk-SEU5V7I6.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as H,n as W}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-OIC7EJWI.js";import{a as C,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as A}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as g,k as I,n as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as m,e as T,g as j,h as z}from"./chunk-RRCPZMC2.js";var Q=T(j(),1);var t=T(z(),1);var L=200,K=m(()=>{let e=(0,Q.c)(21),d=A(),s=g(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",L],e[0]=u):u=e[0];let h;e[1]!==d?(h=m(()=>d.listAuthSessions({limit:L}),"t1"),e[1]=d,e[2]=h):h=e[2];let l=E(u,h),{error:v}=l,i=l.data?.rows??null,p;e[3]!==l?(p=m(()=>{l.refetch()},"t2"),e[3]=l,e[4]=p):p=e[4],H(p,!0);let x;e[5]!==d||e[6]!==l?(x=m(a=>{I((async()=>{await d.revokeAuthSession({sessionId:a}),l.refetch()})())},"t3"),e[5]=d,e[6]=l,e[7]=x):x=e[7];let y=x,n;e[8]!==v?(n=v!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:v},void 0,!1),e[8]=v,e[9]=n):n=e[9];let c;e[10]!==i||e[11]!==s?(c=i!==null&&i.length===0&&(0,t.jsxDEV)(w,{testId:"auth-sessions-empty",title:s("No active sessions.")},void 0,!1),e[10]=i,e[11]=s,e[12]=c):c=e[12];let f;e[13]!==y||e[14]!==i||e[15]!==s?(f=i!==null&&i.length>0&&(0,t.jsxDEV)(C,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(k,{className:"px-0",children:(0,t.jsxDEV)(R,{"data-testid":"auth-sessions-table",children:[(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(N,{children:[(0,t.jsxDEV)(o,{children:s("user")},void 0,!1),(0,t.jsxDEV)(o,{children:s("expires")},void 0,!1),(0,t.jsxDEV)(o,{children:s("ip")},void 0,!1),(0,t.jsxDEV)(o,{children:s("user agent")},void 0,!1),(0,t.jsxDEV)(o,{children:s("impersonated by")},void 0,!1),(0,t.jsxDEV)(o,{"aria-label":s("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($,{children:i.map(a=>(0,t.jsxDEV)(N,{"data-testid":`auth-session-${a.id}`,children:[(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.userId},void 0,!1),(0,t.jsxDEV)(r,{className:"text-muted-foreground tabular-nums",children:B(a.expiresAt)},void 0,!1),(0,t.jsxDEV)(r,{children:a.ipAddress??""},void 0,!1),(0,t.jsxDEV)(r,{className:"max-w-40 truncate",children:a.userAgent??""},void 0,!1),(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.impersonatedBy??""},void 0,!1),(0,t.jsxDEV)(r,{children:(0,t.jsxDEV)(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:m(()=>{y(a.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")},void 0,!1)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[13]=y,e[14]=i,e[15]=s,e[16]=f):f=e[16];let b;return e[17]!==n||e[18]!==c||e[19]!==f?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[n,c,f]},void 0,!0),e[17]=n,e[18]=c,e[19]=f,e[20]=b):b=e[20],b},"AuthSessionsPanel");export{K as AuthSessionsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-OIC7EJWI.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as J}from"./chunk-TDL7NEWA.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-K3GNLVYK.js";import{b as j}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as D}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-BOXSWNXZ.js";import{c as L}from"./chunk-
|
|
1
|
+
import{a as J}from"./chunk-TDL7NEWA.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-K3GNLVYK.js";import{b as j}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as D}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-BOXSWNXZ.js";import{c as L}from"./chunk-OIC7EJWI.js";import{a as v,e as y}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as _}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as E,e as S,f as w,g as b,k as I}from"./chunk-PVZI3CXP.js";import{b as N}from"./chunk-GMSGZDDH.js";import{a as o,e as R,f as K,h as U}from"./chunk-RRCPZMC2.js";var c=R(K(),1);var e=R(U(),1);var V=S(f.exportShard),X=S(f.importShard),z=o(m=>m.map(a=>JSON.stringify(a)).join(`
|
|
2
2
|
`),"toNdjson"),G=o(m=>{let a=[],x=m.split(`
|
|
3
3
|
`);for(let[r,n]of x.entries()){let h=n.trim();if(h==="")continue;let l=JSON.parse(h);if(typeof l!="object"||l===null)throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);let s=l;if(typeof s.table!="string"||typeof s.doc!="object"||s.doc===null||Array.isArray(s.doc))throw new N("INTERNAL",`line ${(r+1).toString()}: expected a { table, doc } object`);a.push(s)}return a},"parseNdjson"),ie=o(({initialShardKey:m})=>{let a=_(),x=L(),r=E(),[n,h]=(0,c.useState)(m??""),[l,s]=(0,c.useState)(""),[C,p]=(0,c.useState)(!1),[T,u]=(0,c.useState)(null),[i,g]=(0,c.useState)(null),[A,O]=(0,c.useState)(null),$=o(async()=>{p(!0),u(null),g(null);try{let t=await a.query(V,{},w(n));j(n),s(z(t.rows)),O(t.rows.length)}catch(t){u(b(t))}finally{p(!1)}},"exportShard"),k=o(async()=>{p(!0),u(null),g(null),O(null);let t;try{t=G(l)}catch(d){u(r("Invalid NDJSON: {message}",{message:b(d)})),p(!1);return}try{let d=await a.query(X,{rows:t},w(n));j(n),g(d),x(f.readTablePage),x(f.listTables)}catch(d){u(b(d))}finally{p(!1)}},"importShard"),M=i===null?0:Object.values(i.inserted).reduce((t,d)=>t+d,0),q=o(()=>{I($())},"runExport"),F=o(()=>{I(k())},"runImport"),H=o(t=>{s(t.target.value)},"onNdjsonChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Export")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(B,{onChange:h,testId:"ei-shard-input",value:n},void 0,!1),(0,e.jsxDEV)(D,{"data-testid":"ei-export",disabled:C,onClick:q,type:"button",children:r("Export")},void 0,!1)]},void 0,!0),A!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:r("Exported {count} rows.",{count:A})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Import")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(y,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)(P,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:H,placeholder:'{"table":"messages","doc":{\u2026}}',value:l},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsxDEV)(J,{confirmLabel:r("Import (writes rows)?"),disabled:C||l.trim()==="",onConfirm:F,testId:"ei-import",children:r("Import")},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:r("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:M})},void 0,!1),i.errors.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(t=>(0,e.jsxDEV)("li",{className:"text-xs text-destructive",children:r("line {line} ({table}): {message}",{line:t.line,message:t.message,table:t.table})},`${t.table}-${t.line.toString()}`,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),T!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:T},void 0,!1)]},void 0,!0)},"ExportImportPanel");export{ie as ExportImportPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as dt,b as nt,c as ct,d as ut,e as Me}from"./chunk-VON7JUPG.js";import{a as ft,b as mt,c as vt,d as ht,e as gt}from"./chunk-SG3ALJJU.js";import"./chunk-DWDILV2E.js";import"./chunk-QBAT52GB.js";import{e as ot}from"./chunk-TQ36RWOP.js";import"./chunk-QAFAJBAW.js";import{a as it}from"./chunk-WXPWVBIY.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import{a as rt}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{a as st,b as lt,c as at,d as je,e as $e,f as Te}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as tt}from"./chunk-K3GNLVYK.js";import{a as Ze,b as et}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as Oe}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Pe}from"./chunk-BOXSWNXZ.js";import{b as Ye}from"./chunk-OIC7EJWI.js";import{a as B,b as Re,c as _e,d as Ve,e as P}from"./chunk-SEU5V7I6.js";import{b as Ke}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Ue}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Qe,e as Ge,f as Je,g as We,k as Xe,m as Ae}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as Be,f as pt,g as xt,h as bt}from"./chunk-RRCPZMC2.js";var Le=Be(xt(),1);var v=Be(pt(),1);var t=Be(bt(),1);var ze=n(l=>l>=100?"critical":l>=50?"warning":"good","performanceLevel"),He=n(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"formatLatency"),Ee=n(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"formatCount"),Nt=n(l=>{let e=(0,Le.c)(3),{level:s}=l;if(s==="critical"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxDEV)(Ke,{variant:"destructive",children:"Slow"},void 0,!1),e[0]=i):i=e[0],i}if(s==="warning"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"},void 0,!1),e[1]=i):i=e[1],i}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"},void 0,!1),e[2]=r):r=e[2],r},"PerformanceBadge"),yt=n(l=>{let e=(0,Le.c)(152),{queryStats:s}=l,r=Qe(),[i,Q]=(0,v.useState)("totalTime"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=new Set,e[0]=C):C=e[0];let[h,T]=(0,v.useState)(C),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=n(o=>{o!==null&&Q(o)},"t2"),e[1]=p):p=e[1];let S=p,u;if(e[2]!==s||e[3]!==i){u=[...s];let o;e[5]!==i?(o=n((m,c)=>{switch(i){case"avgTime":return c.avgDurationMs-m.avgDurationMs;case"execCount":return c.execCount-m.execCount;case"rowsRead":return c.rowsRead-m.rowsRead;default:return c.totalDurationMs-m.totalDurationMs}},"t310"),e[5]=i,e[6]=o):o=e[6],u.sort(o),e[2]=s,e[3]=i,e[4]=u}else u=e[4];let g=u,$;e[7]!==s?($=s.filter(St),e[7]=s,e[8]=$):$=e[8];let j=$.length,H;e[9]!==s?(H=s.filter(wt),e[9]=s,e[10]=H):H=e[10];let d=H.length,_;e[11]!==s?(_=s.filter(qt),e[11]=s,e[12]=_):_=e[12];let U=_.length,O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=n(o=>{T(m=>{let c=new Set(m);return c.has(o)?c.delete(o):c.add(o),c})},"t6"),e[13]=O):O=e[13];let Fe=O;if(s.length===0){let o;e[14]!==r?(o=r("No query insights yet"),e[14]=r,e[15]=o):o=e[15];let m;e[16]!==o?(m=(0,t.jsxDEV)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:o},void 0,!1),e[16]=o,e[17]=m):m=e[17];let c;e[18]!==r?(c=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=c):c=e[19];let z;e[20]!==c?(z=(0,t.jsxDEV)("p",{className:"mt-1 text-sm",children:c},void 0,!1),e[20]=c,e[21]=z):z=e[21];let ke;return e[22]!==z||e[23]!==m?(ke=(0,t.jsxDEV)(B,{children:(0,t.jsxDEV)(P,{className:"py-12",children:(0,t.jsxDEV)("div",{className:"text-center text-muted-foreground",children:[m,z]},void 0,!0)},void 0,!1)},void 0,!1),e[22]=z,e[23]=m,e[24]=ke):ke=e[24],ke}let I;e[25]!==r?(I=r("Critical queries"),e[25]=r,e[26]=I):I=e[26];let f;e[27]!==I?(f=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:I},void 0,!1)},void 0,!1),e[27]=I,e[28]=f):f=e[28];let M;e[29]!==j?(M=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:j},void 0,!1),e[29]=j,e[30]=M):M=e[30];let D;e[31]!==r?(D=r(">100ms avg execution"),e[31]=r,e[32]=D):D=e[32];let R;e[33]!==D?(R=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:D},void 0,!1),e[33]=D,e[34]=R):R=e[34];let F;e[35]!==R||e[36]!==M?(F=(0,t.jsxDEV)(P,{children:[M,R]},void 0,!0),e[35]=R,e[36]=M,e[37]=F):F=e[37];let b;e[38]!==F||e[39]!==f?(b=(0,t.jsxDEV)(B,{children:[f,F]},void 0,!0),e[38]=F,e[39]=f,e[40]=b):b=e[40];let N;e[41]!==r?(N=r("Moderate queries"),e[41]=r,e[42]=N):N=e[42];let k;e[43]!==N?(k=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:N},void 0,!1)},void 0,!1),e[43]=N,e[44]=k):k=e[44];let A;e[45]!==d?(A=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:d},void 0,!1),e[45]=d,e[46]=A):A=e[46];let E;e[47]!==r?(E=r("50\u2013100ms avg execution"),e[47]=r,e[48]=E):E=e[48];let L;e[49]!==E?(L=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:E},void 0,!1),e[49]=E,e[50]=L):L=e[50];let a;e[51]!==A||e[52]!==L?(a=(0,t.jsxDEV)(P,{children:[A,L]},void 0,!0),e[51]=A,e[52]=L,e[53]=a):a=e[53];let w;e[54]!==k||e[55]!==a?(w=(0,t.jsxDEV)(B,{children:[k,a]},void 0,!0),e[54]=k,e[55]=a,e[56]=w):w=e[56];let x;e[57]!==r?(x=r("Fast queries"),e[57]=r,e[58]=x):x=e[58];let y;e[59]!==x?(y=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:x},void 0,!1)},void 0,!1),e[59]=x,e[60]=y):y=e[60];let K;e[61]!==U?(K=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:U},void 0,!1),e[61]=U,e[62]=K):K=e[62];let V;e[63]!==r?(V=r("<50ms avg execution"),e[63]=r,e[64]=V):V=e[64];let G;e[65]!==V?(G=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:V},void 0,!1),e[65]=V,e[66]=G):G=e[66];let J;e[67]!==K||e[68]!==G?(J=(0,t.jsxDEV)(P,{children:[K,G]},void 0,!0),e[67]=K,e[68]=G,e[69]=J):J=e[69];let W;e[70]!==y||e[71]!==J?(W=(0,t.jsxDEV)(B,{children:[y,J]},void 0,!0),e[70]=y,e[71]=J,e[72]=W):W=e[72];let X;e[73]!==b||e[74]!==w||e[75]!==W?(X=(0,t.jsxDEV)("div",{className:"grid gap-4 md:grid-cols-3",children:[b,w,W]},void 0,!0),e[73]=b,e[74]=w,e[75]=W,e[76]=X):X=e[76];let Y;e[77]!==r?(Y=r("Query leaderboard"),e[77]=r,e[78]=Y):Y=e[78];let Z;e[79]!==Y?(Z=(0,t.jsxDEV)("h3",{className:"text-lg font-semibold",children:Y},void 0,!1),e[79]=Y,e[80]=Z):Z=e[80];let ee;e[81]!==i||e[82]!==r?(ee=r("Slow queries sorted by {sortField}",{sortField:r(i)}),e[81]=i,e[82]=r,e[83]=ee):ee=e[83];let te;e[84]!==ee?(te=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:ee},void 0,!1),e[84]=ee,e[85]=te):te=e[85];let re;e[86]!==Z||e[87]!==te?(re=(0,t.jsxDEV)("div",{children:[Z,te]},void 0,!0),e[86]=Z,e[87]=te,e[88]=re):re=e[88];let se;e[89]!==r?(se=r("Sort by"),e[89]=r,e[90]=se):se=e[90];let le;e[91]!==se?(le=(0,t.jsxDEV)("span",{className:"text-sm text-muted-foreground",children:se},void 0,!1),e[91]=se,e[92]=le):le=e[92];let ae;e[93]!==r?(ae=r("Sort queries by"),e[93]=r,e[94]=ae):ae=e[94];let Ie;e[95]===Symbol.for("react.memo_cache_sentinel")?(Ie=(0,t.jsxDEV)(nt,{},void 0,!1),e[95]=Ie):Ie=e[95];let ie;e[96]!==ae?(ie=(0,t.jsxDEV)(ct,{"aria-label":ae,className:"w-[140px]","data-testid":"qi-sort",children:Ie},void 0,!1),e[96]=ae,e[97]=ie):ie=e[97];let oe;e[98]!==r?(oe=r("Total time"),e[98]=r,e[99]=oe):oe=e[99];let de;e[100]!==oe?(de=(0,t.jsxDEV)(Me,{value:"totalTime",children:oe},void 0,!1),e[100]=oe,e[101]=de):de=e[101];let ne;e[102]!==r?(ne=r("Avg time"),e[102]=r,e[103]=ne):ne=e[103];let ce;e[104]!==ne?(ce=(0,t.jsxDEV)(Me,{value:"avgTime",children:ne},void 0,!1),e[104]=ne,e[105]=ce):ce=e[105];let ue;e[106]!==r?(ue=r("Execution count"),e[106]=r,e[107]=ue):ue=e[107];let fe;e[108]!==ue?(fe=(0,t.jsxDEV)(Me,{value:"execCount",children:ue},void 0,!1),e[108]=ue,e[109]=fe):fe=e[109];let me;e[110]!==r?(me=r("Rows read"),e[110]=r,e[111]=me):me=e[111];let ve;e[112]!==me?(ve=(0,t.jsxDEV)(Me,{value:"rowsRead",children:me},void 0,!1),e[112]=me,e[113]=ve):ve=e[113];let he;e[114]!==de||e[115]!==ce||e[116]!==fe||e[117]!==ve?(he=(0,t.jsxDEV)(ut,{children:[de,ce,fe,ve]},void 0,!0),e[114]=de,e[115]=ce,e[116]=fe,e[117]=ve,e[118]=he):he=e[118];let ge;e[119]!==i||e[120]!==ie||e[121]!==he?(ge=(0,t.jsxDEV)(dt,{onValueChange:S,value:i,children:[ie,he]},void 0,!0),e[119]=i,e[120]=ie,e[121]=he,e[122]=ge):ge=e[122];let pe;e[123]!==le||e[124]!==ge?(pe=(0,t.jsxDEV)("div",{className:"flex items-center gap-2",children:[le,ge]},void 0,!0),e[123]=le,e[124]=ge,e[125]=pe):pe=e[125];let xe;e[126]!==re||e[127]!==pe?(xe=(0,t.jsxDEV)("div",{className:"flex items-center justify-between",children:[re,pe]},void 0,!0),e[126]=re,e[127]=pe,e[128]=xe):xe=e[128];let be;e[129]!==r?(be=r("Statements"),e[129]=r,e[130]=be):be=e[130];let Ne;e[131]!==be?(Ne=(0,t.jsxDEV)(_e,{children:be},void 0,!1),e[131]=be,e[132]=Ne):Ne=e[132];let ye;e[133]!==g.length||e[134]!==r?(ye=r("{count} tracked statements",{count:g.length}),e[133]=g.length,e[134]=r,e[135]=ye):ye=e[135];let Se;e[136]!==ye?(Se=(0,t.jsxDEV)(Ve,{children:ye},void 0,!1),e[136]=ye,e[137]=Se):Se=e[137];let we;e[138]!==Ne||e[139]!==Se?(we=(0,t.jsxDEV)(Re,{children:[Ne,Se]},void 0,!0),e[138]=Ne,e[139]=Se,e[140]=we):we=e[140];let qe;e[141]!==h||e[142]!==g||e[143]!==r?(qe=(0,t.jsxDEV)(P,{children:(0,t.jsxDEV)("div",{className:"space-y-2",children:g.map(o=>{let m=o.normalizedSql,c=h.has(m),z=ze(o.avgDurationMs);return(0,t.jsxDEV)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxDEV)("button",{"aria-expanded":c,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:n(()=>{Fe(m)},"onClick"),type:"button",children:[(0,t.jsxDEV)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsxDEV)(Nt,{level:z},void 0,!1),(0,t.jsxDEV)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:o.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:He(o.totalDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("total")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:He(o.avgDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("avg")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:Ee(o.execCount)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("calls")},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),c&&(0,t.jsxDEV)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")},void 0,!1),(0,t.jsxDEV)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:o.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Exec count")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.execCount)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Total time")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:He(o.totalDurationMs)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows read")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.rowsRead)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows written")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.rowsWritten)},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},m,!0)})},void 0,!1)},void 0,!1),e[141]=h,e[142]=g,e[143]=r,e[144]=qe):qe=e[144];let Ce;e[145]!==we||e[146]!==qe?(Ce=(0,t.jsxDEV)(B,{children:[we,qe]},void 0,!0),e[145]=we,e[146]=qe,e[147]=Ce):Ce=e[147];let De;return e[148]!==X||e[149]!==xe||e[150]!==Ce?(De=(0,t.jsxDEV)("div",{className:"space-y-4","data-testid":"qi-root",children:[X,xe,Ce]},void 0,!0),e[148]=X,e[149]=xe,e[150]=Ce,e[151]=De):De=e[151],De},"QueryInsights");function St(l){return ze(l.avgDurationMs)==="critical"}n(St,"_temp");function wt(l){return ze(l.avgDurationMs)==="warning"}n(wt,"_temp2");function qt(l){return ze(l.avgDurationMs)==="good"}n(qt,"_temp3");var Ct=Ge(Pe.getMetrics),Tt=n(l=>{let e=Math.floor(l/1e3),s=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return s>0?`${s.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${i.toString()}s`:`${i.toString()}s`},"formatDuration"),Rt=n((l,e)=>l?e:"overview","resolveTab"),_t=n((l,e)=>{let s=l+e;return s===0?"\u2014":`${(l/s*100).toFixed(1)}%`},"hitRate"),q=n(l=>{let e=(0,Le.c)(16),{chart:s,footer:r,label:i,testId:Q,value:C}=l,h;e[0]!==i?(h=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=h):h=e[1];let T;e[2]!==Q||e[3]!==C?(T=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":Q,children:C},void 0,!1),e[2]=Q,e[3]=C,e[4]=T):T=e[4];let p;e[5]!==s||e[6]!==T?(p=(0,t.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[T,s]},void 0,!0),e[5]=s,e[6]=T,e[7]=p):p=e[7];let S;e[8]!==h||e[9]!==p?(S=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[h,p]},void 0,!0),e[8]=h,e[9]=p,e[10]=S):S=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r},void 0,!1),e[11]=r,e[12]=u):u=e[12];let g;return e[13]!==S||e[14]!==u?(g=(0,t.jsxDEV)(B,{className:"justify-between gap-0 py-0",children:[S,u]},void 0,!0),e[13]=S,e[14]=u,e[15]=g):g=e[15],g},"StatCard"),Kt=n(({initialShardKey:l})=>{let e=Ue(),s=Qe(),[r,i]=(0,v.useState)(l??""),[Q,C]=(0,v.useState)("overview"),[h,T]=(0,v.useState)([]),p=(0,v.useRef)(null),S=(0,v.useRef)(null),u=(0,v.useRef)(!0);(0,v.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let g=rt(r.trim(),400),{data:$,error:j,liveError:H}=Ye(Pe.getMetrics,{},{live:!0,shardKey:g}),d=$??null;(0,v.useEffect)(()=>{if($===void 0)return;et(g);let a=$,w=p.current,x=S.current!==null&&S.current!==a.shard;if(S.current=a.shard,p.current=a.requests,x){T([]);return}w!==null&&a.requests>=w&&T(y=>[...y,a.requests-w].slice(-30))},[$,g]);let[_,U]=(0,v.useState)(null),[O,Fe]=(0,v.useState)(!1),I=n(async()=>{Fe(!0);let a=mt(r,Ze());try{let w=await Promise.all(a.map(async x=>{try{let y=await e.query(Ct,{},Je(x));return{error:null,metrics:y,shard:x===""?y.shard:x}}catch(y){return{error:We(y),metrics:null,shard:x===""?"__root__":x}}}));u.current&&U(w)}finally{u.current&&Fe(!1)}},"aggregateAll"),f=_===null?null:ft(_),M=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,D=h.length>0?h.at(-1):0,R=d?vt(d):{p90:0,p95:0},F=n(a=>a<=0?"\u2014":a<1?`${(a*1e3).toFixed(0)}\u03BCs`:a<1e3?`${a.toFixed(1)}ms`:`${(a/1e3).toFixed(2)}s`,"formatMs"),b=(0,v.useMemo)(()=>{if(!d||!("queryStats"in d))return;let a=d.queryStats;if(!(!a||!Array.isArray(a)))return ht(a)},[d]),N=Rt(b!==void 0,Q),k=n(()=>{Xe(I())},"runAggregate"),A=n(()=>{U(null)},"clearAggregate"),E=n(()=>{C("overview")},"switchToOverview"),L=n(()=>{C("query-insights")},"switchToQueryInsights");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(tt,{onChange:i,testId:"mt-shard-input",value:r},void 0,!1),(0,t.jsxDEV)(it,{message:H,prefix:"mt"},void 0,!1),(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate",disabled:O,onClick:k,size:"sm",type:"button",variant:"secondary",children:s(O?"Aggregating\u2026":"All shards")},void 0,!1),_!==null&&(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:s("Hide")},void 0,!1),(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:ot,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)]},void 0,!0),j!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:j},void 0,!1),b!==void 0&&(0,t.jsxDEV)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:E,type:"button",children:s("Overview")},void 0,!1),(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:L,type:"button",children:[s("Query insights"),b.length>0&&(0,t.jsxDEV)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:b.length},void 0,!1)]},void 0,!0)]},void 0,!0),N==="query-insights"&&b!==void 0&&(0,t.jsxDEV)(yt,{queryStats:b},void 0,!1),N==="overview"&&d!==null&&(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsxDEV)(q,{chart:h.length>=2?(0,t.jsxDEV)(gt,{ariaLabel:s("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:h,testId:"mt-sparkline"},void 0,!1):void 0,footer:h.length>=2?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("span",{className:"font-semibold text-foreground",children:`+${D.toLocaleString()}`},void 0,!1)," ",s("last interval")]},void 0,!0):(0,t.jsxDEV)("span",{"data-testid":"mt-sparkline-empty",children:s("collecting samples\u2026")},void 0,!1),label:s("Requests"),testId:"mt-requests",value:d.requests},void 0,!1),(0,t.jsxDEV)(q,{footer:s("{rate} error rate",{rate:M}),label:s("Errors"),testId:"mt-errors",value:(0,t.jsxDEV)(t.Fragment,{children:[d.errors," (",M,")"]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(q,{footer:R.p90>0?`P90 ${F(R.p90)}`:void 0,label:s("P95 latency"),testId:"mt-p95",value:R.p95>0?F(R.p95):"\u2014"},void 0,!1),(0,t.jsxDEV)(q,{footer:d.cache===null?void 0:`${d.cache.entries.toLocaleString()} ${s("cache entries")}`,label:s("Database size"),testId:"mt-db-size",value:Ae(d.databaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Shard"),testId:"mt-shard",value:d.shard},void 0,!1),(0,t.jsxDEV)(q,{label:s("Uptime"),testId:"mt-uptime",value:Tt(d.uptimeMs)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Cache hit rate"),testId:"mt-cache",value:d.cache===null?s("no cache configured"):s("{rate} ({count} entries)",{count:d.cache.entries,rate:_t(d.cache.hits,d.cache.misses)})},void 0,!1)]},void 0,!0),N==="overview"&&d===null&&null,N==="overview"&&f!==null&&_!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsxDEV)(q,{label:s("Shards"),testId:"mt-agg-shards",value:f.failed>0?s("{reachable} reachable, {failed} unreachable",{failed:f.failed,reachable:f.reachable}):s("{reachable} reachable",{reachable:f.reachable})},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total requests"),testId:"mt-agg-requests",value:f.totalRequests},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total errors"),testId:"mt-agg-errors",value:f.totalErrors},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total database size"),testId:"mt-agg-db-size",value:Ae(f.totalDatabaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Combined cache hit rate"),testId:"mt-agg-cache",value:f.hitRate===null?s("no cache configured"):`${(f.hitRate*100).toFixed(1)}%`},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(B,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(P,{className:"px-0",children:(0,t.jsxDEV)(st,{"data-testid":"mt-agg-table",children:[(0,t.jsxDEV)(lt,{children:(0,t.jsxDEV)(je,{children:[(0,t.jsxDEV)($e,{children:s("shard")},void 0,!1),(0,t.jsxDEV)($e,{children:s("requests")},void 0,!1),(0,t.jsxDEV)($e,{children:s("errors")},void 0,!1),(0,t.jsxDEV)($e,{children:s("db size")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(at,{children:_.map(a=>(0,t.jsxDEV)(je,{"data-testid":`mt-agg-row-${a.shard}`,children:[(0,t.jsxDEV)(Te,{children:a.shard},void 0,!1),a.metrics===null?(0,t.jsxDEV)(Te,{className:"text-destructive",colSpan:3,children:a.error??s("unreachable")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.requests},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.errors},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:Ae(a.metrics.databaseSize)},void 0,!1)]},void 0,!0)]},a.shard,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"MetricsPanel");export{Kt as MetricsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as De}from"./chunk-
|
|
1
|
+
import{b as De}from"./chunk-IJPFHUJK.js";import"./chunk-LNZIB2MD.js";import"./chunk-QBAT52GB.js";import{c as Re}from"./chunk-TQ36RWOP.js";import"./chunk-QAFAJBAW.js";import{a as pe}from"./chunk-7YXOPTWI.js";import"./chunk-AHILM3ZP.js";import{a as Fe}from"./chunk-J6J54MBP.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import{a as $e}from"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Te,b as _e,c as Ee,d as ie,e as te,f as Q}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ne}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as Se}from"./chunk-3CJW6NWG.js";import{c as ee}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as ge}from"./chunk-BOXSWNXZ.js";import{a as fe}from"./chunk-TAD43CG5.js";import{a as we,e as Ce}from"./chunk-SEU5V7I6.js";import{b as oe}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as xe}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as ke,e as ue,f as he,g as J,k as H,m as me}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as g,e as de,f as ft,g as ut,h as ht}from"./chunk-RRCPZMC2.js";var j=de(ut(),1),_=de(ft(),1);var l=de(ht(),1);var Be=g((a,e,s)=>{let t=(0,j.c)(21),{onCopy:r,onDelete:o,onDownload:u,onToggleSelect:c}=s,n;t[0]!==a.key||t[1]!==r?(n=g(()=>{r(a.key)},"t0"),t[0]=a.key,t[1]=r,t[2]=n):n=t[2];let d=n,h;t[3]!==a.key||t[4]!==u?(h=g(()=>{u(a.key)},"t1"),t[3]=a.key,t[4]=u,t[5]=h):h=t[5];let f=h,m;t[6]!==a.key||t[7]!==o?(m=g(()=>{o(a.key)},"t2"),t[6]=a.key,t[7]=o,t[8]=m):m=t[8];let S=m,i;t[9]!==a.key||t[10]!==c?(i=g(()=>{c(a.key)},"t3"),t[9]=a.key,t[10]=c,t[11]=i):i=t[11];let x=i,y;t[12]!==a.key||t[13]!==e.length?(y=a.key.slice(e.length),t[12]=a.key,t[13]=e.length,t[14]=y):y=t[14];let v;return t[15]!==d||t[16]!==f||t[17]!==S||t[18]!==y||t[19]!==x?(v={copy:d,download:f,name:y,remove:S,toggle:x},t[15]=d,t[16]=f,t[17]=S,t[18]=y,t[19]=x,t[20]=v):v=t[20],v},"useFileItem"),Ie=g(a=>{let e=(0,j.c)(31),{busy:s,buttonClassName:t,copied:r,objectKey:o,onCopy:u,onDelete:c,onDownload:n,t:d}=a,h=`storage-copy-${o}`,f;e[0]!==r||e[1]!==d?(f=d(r?"Copied":"Copy URL"),e[0]=r,e[1]=d,e[2]=f):f=e[2];let m;e[3]!==s||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==f?(m=(0,l.jsxDEV)(ee,{className:t,"data-testid":h,disabled:s,onClick:u,size:"sm",type:"button",variant:"ghost",children:f},void 0,!1),e[3]=s,e[4]=t,e[5]=u,e[6]=h,e[7]=f,e[8]=m):m=e[8];let S=`storage-download-${o}`,i;e[9]!==d?(i=d("Download"),e[9]=d,e[10]=i):i=e[10];let x;e[11]!==s||e[12]!==t||e[13]!==n||e[14]!==S||e[15]!==i?(x=(0,l.jsxDEV)(ee,{className:t,"data-testid":S,disabled:s,onClick:n,size:"sm",type:"button",variant:"ghost",children:i},void 0,!1),e[11]=s,e[12]=t,e[13]=n,e[14]=S,e[15]=i,e[16]=x):x=e[16];let y;e[17]!==d?(y=d("Delete object?"),e[17]=d,e[18]=y):y=e[18];let v=`storage-delete-${o}`,b;e[19]!==d?(b=d("Delete"),e[19]=d,e[20]=b):b=e[20];let k;e[21]!==s||e[22]!==c||e[23]!==y||e[24]!==v||e[25]!==b?(k=(0,l.jsxDEV)($e,{confirmLabel:y,disabled:s,onConfirm:c,testId:v,children:b},void 0,!1),e[21]=s,e[22]=c,e[23]=y,e[24]=v,e[25]=b,e[26]=k):k=e[26];let w;return e[27]!==k||e[28]!==m||e[29]!==x?(w=(0,l.jsxDEV)(l.Fragment,{children:[m,x,k]},void 0,!0),e[27]=k,e[28]=m,e[29]=x,e[30]=w):w=e[30],w},"FileActions"),Oe=g(a=>{let e=(0,j.c)(14),{objectKey:s,references:t,t:r}=a;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${s}`,f;e[0]!==r?(f=r("Orphan"),e[0]=r,e[1]=f):f=e[1];let m;return e[2]!==h||e[3]!==f?(m=(0,l.jsxDEV)(oe,{"data-testid":h,variant:"warning",children:f},void 0,!1),e[2]=h,e[3]=f,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(mt).join(`
|
|
2
2
|
`),e[5]=t,e[6]=o):o=e[6];let u=o,c=`storage-refs-${s}`,n;e[7]!==t.length||e[8]!==r?(n=t.length===1?r("1 record"):r("{count} records",{count:t.length}),e[7]=t.length,e[8]=r,e[9]=n):n=e[9];let d;return e[10]!==u||e[11]!==c||e[12]!==n?(d=(0,l.jsxDEV)(oe,{"data-testid":c,title:u,variant:"secondary",children:n},void 0,!1),e[10]=u,e[11]=c,e[12]=n,e[13]=d):d=e[13],d},"FileReferences"),je=g(a=>{let e=(0,j.c)(7),{objectKey:s,onToggle:t,selected:r,t:o}=a,u;e[0]!==o?(u=o("Select row"),e[0]=o,e[1]=u):u=e[1];let c=`storage-select-${s}`,n;return e[2]!==t||e[3]!==r||e[4]!==u||e[5]!==c?(n=(0,l.jsxDEV)(pe,{"aria-label":u,checked:r,"data-testid":c,onCheckedChange:t},void 0,!1),e[2]=t,e[3]=r,e[4]=u,e[5]=c,e[6]=n):n=e[6],n},"FileSelect");function mt(a){return`${a.table}\xB7${a.id}`}g(mt,"_temp$2");var gt=g(a=>{let e=(0,j.c)(10),{colSpan:s,name:t,onEnter:r}=a,o;e[0]!==t||e[1]!==r?(o=g(()=>{r(t)},"t1"),e[0]=t,e[1]=r,e[2]=o):o=e[2];let u=o,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1),e[3]=c):c=e[3];let n;e[4]!==u||e[5]!==t?(n=(0,l.jsxDEV)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:u,type:"button",children:[c,t]},void 0,!0),e[4]=u,e[5]=t,e[6]=n):n=e[6];let d;return e[7]!==s||e[8]!==n?(d=(0,l.jsxDEV)(ie,{children:(0,l.jsxDEV)(Q,{colSpan:s,children:n},void 0,!1)},void 0,!1),e[7]=s,e[8]=n,e[9]=d):d=e[9],d},"FolderRow"),pt=g(a=>{let e=(0,j.c)(33),{busy:s,copiedKey:t,handlers:r,object:o,prefix:u,references:c,selected:n,showReferences:d,t:h}=a,{copy:f,download:m,name:S,remove:i,toggle:x}=Be(o,u,r),y;e[0]!==o.key||e[1]!==n||e[2]!==h||e[3]!==x?(y=(0,l.jsxDEV)(Q,{className:"w-8",children:(0,l.jsxDEV)(je,{objectKey:o.key,onToggle:x,selected:n,t:h},void 0,!1)},void 0,!1),e[0]=o.key,e[1]=n,e[2]=h,e[3]=x,e[4]=y):y=e[4];let v;e[5]!==S?(v=(0,l.jsxDEV)(Q,{className:"font-mono text-xs",children:S},void 0,!1),e[5]=S,e[6]=v):v=e[6];let b;e[7]!==o.size?(b=me(o.size),e[7]=o.size,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(Q,{className:"tabular-nums text-muted-foreground",children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w=o.httpMetadata?.contentType??"",T;e[11]!==w?(T=(0,l.jsxDEV)(Q,{children:w},void 0,!1),e[11]=w,e[12]=T):T=e[12];let C;e[13]!==o.key||e[14]!==c||e[15]!==d||e[16]!==h?(C=d&&(0,l.jsxDEV)(Q,{children:(0,l.jsxDEV)(Oe,{objectKey:o.key,references:c,t:h},void 0,!1)},void 0,!1),e[13]=o.key,e[14]=c,e[15]=d,e[16]=h,e[17]=C):C=e[17];let N=t===o.key,E;e[18]!==s||e[19]!==f||e[20]!==m||e[21]!==o.key||e[22]!==i||e[23]!==h||e[24]!==N?(E=(0,l.jsxDEV)(Q,{className:"text-right",children:(0,l.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:(0,l.jsxDEV)(Ie,{busy:s,copied:N,objectKey:o.key,onCopy:f,onDelete:i,onDownload:m,t:h},void 0,!1)},void 0,!1)},void 0,!1),e[18]=s,e[19]=f,e[20]=m,e[21]=o.key,e[22]=i,e[23]=h,e[24]=N,e[25]=E):E=e[25];let $;return e[26]!==y||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==C||e[31]!==E?($=(0,l.jsxDEV)(ie,{"data-testid":"fb-row",children:[y,v,k,T,C,E]},void 0,!0),e[26]=y,e[27]=v,e[28]=k,e[29]=T,e[30]=C,e[31]=E,e[32]=$):$=e[32],$},"FileRow"),vt=g(a=>{let e=(0,j.c)(65),{allSelected:s,busy:t,copiedKey:r,files:o,folders:u,handlers:c,onEnterFolder:n,prefix:d,references:h,selected:f,showReferences:m,someSelected:S,t:i,toggleSelectAll:x}=a,y;e[0]!==i?(y=i("Select all rows"),e[0]=i,e[1]=y):y=e[1];let v;e[2]!==s||e[3]!==S||e[4]!==y||e[5]!==x?(v=(0,l.jsxDEV)(te,{className:"w-8",children:(0,l.jsxDEV)(pe,{"aria-label":y,checked:s,"data-testid":"storage-select-all",indeterminate:S,onCheckedChange:x},void 0,!1)},void 0,!1),e[2]=s,e[3]=S,e[4]=y,e[5]=x,e[6]=v):v=e[6];let b;e[7]!==i?(b=i("key"),e[7]=i,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(te,{children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=i("size"),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==w?(T=(0,l.jsxDEV)(te,{children:w},void 0,!1),e[13]=w,e[14]=T):T=e[14];let C;e[15]!==i?(C=i("content-type"),e[15]=i,e[16]=C):C=e[16];let N;e[17]!==C?(N=(0,l.jsxDEV)(te,{children:C},void 0,!1),e[17]=C,e[18]=N):N=e[18];let E;e[19]!==m||e[20]!==i?(E=m&&(0,l.jsxDEV)(te,{children:i("used by")},void 0,!1),e[19]=m,e[20]=i,e[21]=E):E=e[21];let $;e[22]!==i?($=i("Actions"),e[22]=i,e[23]=$):$=e[23];let R;e[24]!==$?(R=(0,l.jsxDEV)(te,{"aria-label":$},void 0,!1),e[24]=$,e[25]=R):R=e[25];let D;e[26]!==R||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==N||e[31]!==E?(D=(0,l.jsxDEV)(_e,{children:(0,l.jsxDEV)(ie,{children:[v,k,T,N,E,R]},void 0,!0)},void 0,!1),e[26]=R,e[27]=v,e[28]=k,e[29]=T,e[30]=N,e[31]=E,e[32]=D):D=e[32];let B;if(e[33]!==u||e[34]!==n||e[35]!==m){let z;e[37]!==n||e[38]!==m?(z=g(L=>(0,l.jsxDEV)(gt,{colSpan:m?6:5,name:L,onEnter:n},L,!1),"t142"),e[37]=n,e[38]=m,e[39]=z):z=e[39],B=u.map(z),e[33]=u,e[34]=n,e[35]=m,e[36]=B}else B=e[36];let I;if(e[40]!==t||e[41]!==r||e[42]!==o||e[43]!==c||e[44]!==d||e[45]!==h||e[46]!==f||e[47]!==m||e[48]!==i){let z;e[50]!==t||e[51]!==r||e[52]!==c||e[53]!==d||e[54]!==h||e[55]!==f||e[56]!==m||e[57]!==i?(z=g(L=>(0,l.jsxDEV)(pt,{busy:t,copiedKey:r,handlers:c,object:L,prefix:d,references:h[L.key],selected:f.has(L.key),showReferences:m,t:i},L.key,!1),"t152"),e[50]=t,e[51]=r,e[52]=c,e[53]=d,e[54]=h,e[55]=f,e[56]=m,e[57]=i,e[58]=z):z=e[58],I=o.map(z),e[40]=t,e[41]=r,e[42]=o,e[43]=c,e[44]=d,e[45]=h,e[46]=f,e[47]=m,e[48]=i,e[49]=I}else I=e[49];let K;e[59]!==B||e[60]!==I?(K=(0,l.jsxDEV)(Ee,{children:[B,I]},void 0,!0),e[59]=B,e[60]=I,e[61]=K):K=e[61];let O;return e[62]!==D||e[63]!==K?(O=(0,l.jsxDEV)(we,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(Ce,{className:"px-0",children:(0,l.jsxDEV)(Te,{"data-testid":"fb-table",children:[D,K]},void 0,!0)},void 0,!1)},void 0,!1),e[62]=D,e[63]=K,e[64]=O):O=e[64],O},"FileBrowserList"),bt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],yt=3600,ze=g((a,e)=>{if(e==="size")return a.size;if(e==="type")return a.httpMetadata?.contentType??"";if(e==="date"){if(a.uploaded===void 0)return 0;let s=new Date(a.uploaded).getTime();return Number.isNaN(s)?0:s}return e.startsWith("tag:")?a.customMetadata?.[e.slice(4)]??"":a.key},"fileSortValue"),xt=g((a,e,s)=>{let t=s==="desc"?-1:1;return a.toSorted((r,o)=>{let u=ze(r,e),c=ze(o,e);return(typeof u=="number"&&typeof c=="number"?u-c:String(u).localeCompare(String(c)))*t})},"sortFiles"),kt=g((a,e)=>{let s=new Set,t=[];for(let r of a){let o=r.key.slice(e.length),u=o.indexOf("/");u===-1?t.push(r):s.add(o.slice(0,u+1))}return{files:t,folders:[...s].toSorted((r,o)=>r.localeCompare(o))}},"deriveEntries"),St=g(a=>{let e=(0,j.c)(59),{bucket:s,buckets:t,busy:r,draftPrefix:o,expiry:u,fileInputRef:c,onBucketChange:n,onExpiryChange:d,onFileChange:h,onList:f,onPrefixChange:m,onUploadClick:S,t:i}=a,x;e[0]!==m?(x=g(G=>{m(G.target.value)},"t1"),e[0]=m,e[1]=x):x=e[1];let y=x,v;e[2]!==n?(v=g(G=>{n(G.target.value)},"t2"),e[2]=n,e[3]=v):v=e[3];let b=v,k;e[4]!==d?(k=g(G=>{d(Number.parseInt(G.target.value,10))},"t3"),e[4]=d,e[5]=k):k=e[5];let w=k,T;e[6]!==s||e[7]!==t||e[8]!==b||e[9]!==i?(T=t.length>0&&(0,l.jsxDEV)("select",{"aria-label":i("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:s,children:t.map(Ct)},void 0,!1),e[6]=s,e[7]=t,e[8]=b,e[9]=i,e[10]=T):T=e[10];let C;e[11]!==i?(C=i("Key prefix"),e[11]=i,e[12]=C):C=e[12];let N;e[13]!==i?(N=i("key prefix (optional)"),e[13]=i,e[14]=N):N=e[14];let E;e[15]!==o||e[16]!==y||e[17]!==C||e[18]!==N?(E=(0,l.jsxDEV)(Se,{"aria-label":C,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:y,placeholder:N,value:o},void 0,!1),e[15]=o,e[16]=y,e[17]=C,e[18]=N,e[19]=E):E=e[19];let $;e[20]!==i?($=i("List"),e[20]=i,e[21]=$):$=e[21];let R;e[22]!==r||e[23]!==f||e[24]!==$?(R=(0,l.jsxDEV)(ee,{"data-testid":"fb-list",disabled:r,onClick:f,size:"sm",type:"button",children:$},void 0,!1),e[22]=r,e[23]=f,e[24]=$,e[25]=R):R=e[25];let D;e[26]!==r||e[27]!==i?(D=i(r?"Uploading\u2026":"Upload"),e[26]=r,e[27]=i,e[28]=D):D=e[28];let B;e[29]!==r||e[30]!==S||e[31]!==D?(B=(0,l.jsxDEV)(ee,{"data-testid":"storage-upload",disabled:r,onClick:S,size:"sm",type:"button",variant:"outline",children:D},void 0,!1),e[29]=r,e[30]=S,e[31]=D,e[32]=B):B=e[32];let I;e[33]!==c||e[34]!==h?(I=(0,l.jsxDEV)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:c,type:"file"},void 0,!1),e[33]=c,e[34]=h,e[35]=I):I=e[35];let K;e[36]!==i?(K=i("Link expiry"),e[36]=i,e[37]=K):K=e[37];let O;e[38]!==i?(O=bt.map(G=>(0,l.jsxDEV)("option",{value:G.seconds,children:i(G.label)},G.seconds,!1)),e[38]=i,e[39]=O):O=e[39];let z;e[40]!==u||e[41]!==w||e[42]!==O?(z=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:w,value:u,children:O},void 0,!1),e[40]=u,e[41]=w,e[42]=O,e[43]=z):z=e[43];let L;e[44]!==K||e[45]!==z?(L=(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[K,z]},void 0,!0),e[44]=K,e[45]=z,e[46]=L):L=e[46];let U;e[47]!==i?(U=i("Open in Cloudflare"),e[47]=i,e[48]=U):U=e[48];let M;e[49]!==U?(M=(0,l.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Re,rel:"noreferrer",target:"_blank",children:U},void 0,!1),e[49]=U,e[50]=M):M=e[50];let P;return e[51]!==B||e[52]!==I||e[53]!==L||e[54]!==M||e[55]!==T||e[56]!==E||e[57]!==R?(P=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[T,E,R,B,I,L,M]},void 0,!0),e[51]=B,e[52]=I,e[53]=L,e[54]=M,e[55]=T,e[56]=E,e[57]=R,e[58]=P):P=e[58],P},"FileBrowserToolbar"),wt=g(a=>{let e=(0,j.c)(66),{onSortKeyChange:s,onThumbSizeChange:t,showGrid:r,showList:o,sortDirection:u,sortKey:c,t:n,tagKeys:d,thumbSize:h,toggleSortDirection:f,view:m}=a,S;e[0]!==s?(S=g(Z=>{s(Z.target.value)},"t1"),e[0]=s,e[1]=S):S=e[1];let i=S,x;e[2]!==t?(x=g(Z=>{t(Number.parseInt(Z.target.value,10))},"t2"),e[2]=t,e[3]=x):x=e[3];let y=x,v=m==="list",b;e[4]!==n?(b=n("List"),e[4]=n,e[5]=b):b=e[5];let k;e[6]!==o||e[7]!==v||e[8]!==b?(k=(0,l.jsxDEV)("button",{"aria-pressed":v,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:b},void 0,!1),e[6]=o,e[7]=v,e[8]=b,e[9]=k):k=e[9];let w=m==="grid",T;e[10]!==n?(T=n("Grid"),e[10]=n,e[11]=T):T=e[11];let C;e[12]!==r||e[13]!==w||e[14]!==T?(C=(0,l.jsxDEV)("button",{"aria-pressed":w,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:r,type:"button",children:T},void 0,!1),e[12]=r,e[13]=w,e[14]=T,e[15]=C):C=e[15];let N;e[16]!==k||e[17]!==C?(N=(0,l.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[k,C]},void 0,!0),e[16]=k,e[17]=C,e[18]=N):N=e[18];let E;e[19]!==n?(E=n("Sort"),e[19]=n,e[20]=E):E=e[20];let $;e[21]!==n?($=n("Name"),e[21]=n,e[22]=$):$=e[22];let R;e[23]!==$?(R=(0,l.jsxDEV)("option",{value:"name",children:$},void 0,!1),e[23]=$,e[24]=R):R=e[24];let D;e[25]!==n?(D=n("size"),e[25]=n,e[26]=D):D=e[26];let B;e[27]!==D?(B=(0,l.jsxDEV)("option",{value:"size",children:D},void 0,!1),e[27]=D,e[28]=B):B=e[28];let I;e[29]!==n?(I=n("Type"),e[29]=n,e[30]=I):I=e[30];let K;e[31]!==I?(K=(0,l.jsxDEV)("option",{value:"type",children:I},void 0,!1),e[31]=I,e[32]=K):K=e[32];let O;e[33]!==n?(O=n("Modified"),e[33]=n,e[34]=O):O=e[34];let z;e[35]!==O?(z=(0,l.jsxDEV)("option",{value:"date",children:O},void 0,!1),e[35]=O,e[36]=z):z=e[36];let L;e[37]!==d?(L=d.map(Nt),e[37]=d,e[38]=L):L=e[38];let U;e[39]!==i||e[40]!==c||e[41]!==R||e[42]!==B||e[43]!==K||e[44]!==z||e[45]!==L?(U=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:i,value:c,children:[R,B,K,z,L]},void 0,!0),e[39]=i,e[40]=c,e[41]=R,e[42]=B,e[43]=K,e[44]=z,e[45]=L,e[46]=U):U=e[46];let M;e[47]!==E||e[48]!==U?(M=(0,l.jsxDEV)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[E,U]},void 0,!0),e[47]=E,e[48]=U,e[49]=M):M=e[49];let P;e[50]!==n?(P=n("Toggle sort direction"),e[50]=n,e[51]=P):P=e[51];let G=u==="asc"?"\u2191":"\u2193",W;e[52]!==P||e[53]!==G||e[54]!==f?(W=(0,l.jsxDEV)("button",{"aria-label":P,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:G},void 0,!1),e[52]=P,e[53]=G,e[54]=f,e[55]=W):W=e[55];let Y;e[56]!==y||e[57]!==n||e[58]!==h||e[59]!==m?(Y=m==="grid"&&(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[n("Thumbnail size"),(0,l.jsxDEV)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:y,step:8,type:"range",value:h},void 0,!1)]},void 0,!0),e[56]=y,e[57]=n,e[58]=h,e[59]=m,e[60]=Y):Y=e[60];let se;return e[61]!==M||e[62]!==W||e[63]!==Y||e[64]!==N?(se=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,M,W,Y]},void 0,!0),e[61]=M,e[62]=W,e[63]=Y,e[64]=N,e[65]=se):se=e[65],se},"FileBrowserControls");function Ct(a){return(0,l.jsxDEV)("option",{value:a,children:a},a,!1)}g(Ct,"_temp$1");function Nt(a){return(0,l.jsxDEV)("option",{value:`tag:${a}`,children:a},a,!1)}g(Nt,"_temp2");var Tt=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,_t=g(a=>(a.httpMetadata?.contentType??"").startsWith("image/")||Tt.test(a.key),"isImage"),Et=g(()=>{let a=(0,j.c)(1),e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"},void 0,!1)},void 0,!1),a[0]=e):e=a[0],e},"FileGlyph"),$t=g(a=>{let e=(0,j.c)(13),{object:s,resolveUrl:t}=a,[r,o]=(0,_.useState)(null),[u,c]=(0,_.useState)(!1),n;e[0]!==s?(n=_t(s),e[0]=s,e[1]=n):n=e[1];let d=n,h,f;e[2]!==d||e[3]!==s.key||e[4]!==t?(h=g(()=>{if(!d)return;let x={cancelled:!1};return H((async()=>{try{let y=await t(s.key);x.cancelled||o(y)}catch{x.cancelled||c(!0)}})()),()=>{x.cancelled=!0}},"t2"),f=[d,s.key,t],e[2]=d,e[3]=s.key,e[4]=t,e[5]=h,e[6]=f):(h=e[5],f=e[6]),(0,_.useEffect)(h,f);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{c(!0)},"t4"),e[7]=m):m=e[7];let S=m,i;return e[8]!==u||e[9]!==d||e[10]!==s.key||e[11]!==r?(i=(0,l.jsxDEV)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:d&&r!==null&&!u?(0,l.jsxDEV)("img",{alt:s.key,className:"size-full object-cover",loading:"lazy",onError:S,src:r},void 0,!1):(0,l.jsxDEV)(Et,{},void 0,!1)},void 0,!1),e[8]=u,e[9]=d,e[10]=s.key,e[11]=r,e[12]=i):i=e[12],i},"Thumbnail"),Ft=g(a=>{let e=(0,j.c)(38),{busy:s,copiedKey:t,handlers:r,object:o,prefix:u,references:c,resolveUrl:n,selected:d,showReferences:h,t:f}=a,{copy:m,download:S,name:i,remove:x,toggle:y}=Be(o,u,r),v;e[0]!==o||e[1]!==n?(v=(0,l.jsxDEV)($t,{object:o,resolveUrl:n},void 0,!1),e[0]=o,e[1]=n,e[2]=v):v=e[2];let b;e[3]!==o.key||e[4]!==d||e[5]!==f||e[6]!==y?(b=(0,l.jsxDEV)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,l.jsxDEV)(je,{objectKey:o.key,onToggle:y,selected:d,t:f},void 0,!1)},void 0,!1),e[3]=o.key,e[4]=d,e[5]=f,e[6]=y,e[7]=b):b=e[7];let k;e[8]!==v||e[9]!==b?(k=(0,l.jsxDEV)("div",{className:"relative",children:[v,b]},void 0,!0),e[8]=v,e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=(0,l.jsxDEV)("p",{className:"truncate font-mono text-xs",title:i,children:i},void 0,!1),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==o.size?(T=me(o.size),e[13]=o.size,e[14]=T):T=e[14];let C;e[15]!==T?(C=(0,l.jsxDEV)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:T},void 0,!1),e[15]=T,e[16]=C):C=e[16];let N;e[17]!==o.key||e[18]!==c||e[19]!==h||e[20]!==f?(N=h&&(0,l.jsxDEV)("div",{className:"mt-1",children:(0,l.jsxDEV)(Oe,{objectKey:o.key,references:c,t:f},void 0,!1)},void 0,!1),e[17]=o.key,e[18]=c,e[19]=h,e[20]=f,e[21]=N):N=e[21];let E;e[22]!==w||e[23]!==C||e[24]!==N?(E=(0,l.jsxDEV)("div",{className:"min-w-0",children:[w,C,N]},void 0,!0),e[22]=w,e[23]=C,e[24]=N,e[25]=E):E=e[25];let $=t===o.key,R;e[26]!==s||e[27]!==m||e[28]!==S||e[29]!==o.key||e[30]!==x||e[31]!==f||e[32]!==$?(R=(0,l.jsxDEV)("div",{className:"flex items-center gap-1",children:(0,l.jsxDEV)(Ie,{busy:s,buttonClassName:"h-7 px-2 text-xs",copied:$,objectKey:o.key,onCopy:m,onDelete:x,onDownload:S,t:f},void 0,!1)},void 0,!1),e[26]=s,e[27]=m,e[28]=S,e[29]=o.key,e[30]=x,e[31]=f,e[32]=$,e[33]=R):R=e[33];let D;return e[34]!==R||e[35]!==k||e[36]!==E?(D=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[k,E,R]},void 0,!0),e[34]=R,e[35]=k,e[36]=E,e[37]=D):D=e[37],D},"GalleryTile"),Dt=g(a=>{let e=(0,j.c)(9),{name:s,onEnter:t}=a,r;e[0]!==s||e[1]!==t?(r=g(()=>{t(s)},"t1"),e[0]=s,e[1]=t,e[2]=r):r=e[2];let o=r,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsxDEV)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1)},void 0,!1),e[3]=u):u=e[3];let c;e[4]!==s?(c=(0,l.jsxDEV)("span",{className:"truncate font-mono text-xs",title:s,children:s},void 0,!1),e[4]=s,e[5]=c):c=e[5];let n;return e[6]!==o||e[7]!==c?(n=(0,l.jsxDEV)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[u,c]},void 0,!0),e[6]=o,e[7]=c,e[8]=n):n=e[8],n},"FolderTile"),Rt=g(a=>{let e=(0,j.c)(34),{busy:s,copiedKey:t,files:r,folders:o,handlers:u,onEnterFolder:c,prefix:n,references:d,resolveUrl:h,selected:f,showReferences:m,size:S,t:i}=a,x;e[0]!==S?(x=S.toString(),e[0]=S,e[1]=x):x=e[1];let y=`repeat(auto-fill, minmax(${x}px, 1fr))`,v;e[2]!==y?(v={gridTemplateColumns:y},e[2]=y,e[3]=v):v=e[3];let b=v,k;if(e[4]!==o||e[5]!==c){let C;e[7]!==c?(C=g(N=>(0,l.jsxDEV)(Dt,{name:N,onEnter:c},N,!1),"t52"),e[7]=c,e[8]=C):C=e[8],k=o.map(C),e[4]=o,e[5]=c,e[6]=k}else k=e[6];let w;if(e[9]!==s||e[10]!==t||e[11]!==r||e[12]!==u||e[13]!==n||e[14]!==d||e[15]!==h||e[16]!==f||e[17]!==m||e[18]!==i){let C;e[20]!==s||e[21]!==t||e[22]!==u||e[23]!==n||e[24]!==d||e[25]!==h||e[26]!==f||e[27]!==m||e[28]!==i?(C=g(N=>(0,l.jsxDEV)(Ft,{busy:s,copiedKey:t,handlers:u,object:N,prefix:n,references:d[N.key],resolveUrl:h,selected:f.has(N.key),showReferences:m,t:i},N.key,!1),"t62"),e[20]=s,e[21]=t,e[22]=u,e[23]=n,e[24]=d,e[25]=h,e[26]=f,e[27]=m,e[28]=i,e[29]=C):C=e[29],w=r.map(C),e[9]=s,e[10]=t,e[11]=r,e[12]=u,e[13]=n,e[14]=d,e[15]=h,e[16]=f,e[17]=m,e[18]=i,e[19]=w}else w=e[19];let T;return e[30]!==b||e[31]!==k||e[32]!==w?(T=(0,l.jsxDEV)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[k,w]},void 0,!0),e[30]=b,e[31]=k,e[32]=w,e[33]=T):T=e[33],T},"FileGallery"),zt=g(a=>{let e=(0,j.c)(23),{reference:s,t}=a,r=`fb-dangling-${s.table}-${s.id}-${s.column}`,o=`${s.table}\xB7${s.id}`,u;e[0]!==o?(u=(0,l.jsxDEV)(oe,{variant:"secondary",children:o},void 0,!1),e[0]=o,e[1]=u):u=e[1];let c;e[2]!==s.column?(c=(0,l.jsxDEV)("span",{className:"text-muted-foreground",children:s.column},void 0,!1),e[2]=s.column,e[3]=c):c=e[3];let n;e[4]!==t?(n=t("\u2192"),e[4]=t,e[5]=n):n=e[5];let d;e[6]!==n?(d=(0,l.jsxDEV)("span",{className:"text-muted-foreground/60",children:n},void 0,!1),e[6]=n,e[7]=d):d=e[7];let h;e[8]!==s.key?(h=(0,l.jsxDEV)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:s.key},void 0,!1),e[8]=s.key,e[9]=h):h=e[9];let f;e[10]!==u||e[11]!==c||e[12]!==d||e[13]!==h?(f=(0,l.jsxDEV)("span",{className:"flex flex-wrap items-center gap-1.5",children:[u,c,d,h]},void 0,!0),e[10]=u,e[11]=c,e[12]=d,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==t?(m=t("Missing object"),e[15]=t,e[16]=m):m=e[16];let S;e[17]!==m?(S=(0,l.jsxDEV)(oe,{className:"border-destructive/40 text-destructive",variant:"outline",children:m},void 0,!1),e[17]=m,e[18]=S):S=e[18];let i;return e[19]!==r||e[20]!==S||e[21]!==f?(i=(0,l.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":r,children:[f,S]},void 0,!0),e[19]=r,e[20]=S,e[21]=f,e[22]=i):i=e[22],i},"DanglingRow"),Kt=g(a=>{let e=(0,j.c)(37),{busy:s,onCheck:t,references:r,t:o,truncated:u}=a,c;e[0]!==o?(c=o("Integrity"),e[0]=o,e[1]=c):c=e[1];let n;e[2]!==c?(n=(0,l.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:c},void 0,!1),e[2]=c,e[3]=n):n=e[3];let d;e[4]!==o?(d=o("Orphaned objects"),e[4]=o,e[5]=d):d=e[5];let h;e[6]!==d?(h=(0,l.jsxDEV)("span",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:f},void 0,!1),e[10]=f,e[11]=m):m=e[11];let S;e[12]!==n||e[13]!==h||e[14]!==m?(S=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1",children:[n,h,m]},void 0,!0),e[12]=n,e[13]=h,e[14]=m,e[15]=S):S=e[15];let i;e[16]!==s||e[17]!==o?(i=o(s?"Checking\u2026":"Check for orphans"),e[16]=s,e[17]=o,e[18]=i):i=e[18];let x;e[19]!==s||e[20]!==t||e[21]!==i?(x=(0,l.jsxDEV)(ee,{"data-testid":"fb-orphans-check",disabled:s,onClick:t,size:"sm",type:"button",variant:"outline",children:i},void 0,!1),e[19]=s,e[20]=t,e[21]=i,e[22]=x):x=e[22];let y;e[23]!==S||e[24]!==x?(y=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[S,x]},void 0,!0),e[23]=S,e[24]=x,e[25]=y):y=e[25];let v;e[26]!==r?.length||e[27]!==o?(v=r?.length===0&&(0,l.jsxDEV)(fe,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")},void 0,!1),e[26]=r?.length,e[27]=o,e[28]=v):v=e[28];let b;e[29]!==r||e[30]!==o||e[31]!==u?(b=r!==void 0&&r.length>0&&(0,l.jsxDEV)(l.Fragment,{children:[u&&(0,l.jsxDEV)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:r.length})},void 0,!1),(0,l.jsxDEV)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:r.map(w=>(0,l.jsxDEV)(zt,{reference:w,t:o},`${w.table}\xB7${w.id}\xB7${w.column}`,!1))},void 0,!1)]},void 0,!0),e[29]=r,e[30]=o,e[31]=u,e[32]=b):b=e[32];let k;return e[33]!==y||e[34]!==v||e[35]!==b?(k=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[y,v,b]},void 0,!0),e[33]=y,e[34]=v,e[35]=b,e[36]=k):k=e[36],k},"OrphanedObjectsSection"),Lt=g(function(a,e){let s=(0,j.c)(18),t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,s[0]=t):t=s[0];let[r,o]=(0,_.useState)(t),u;s[1]===Symbol.for("react.memo_cache_sentinel")?(u=g(v=>{o(b=>{let k=new Set(b);return k.has(v)?k.delete(v):k.add(v),k})},"t1"),s[1]=u):u=s[1];let c=u,n;s[2]===Symbol.for("react.memo_cache_sentinel")?(n=g(()=>{o(new Set)},"t2"),s[2]=n):n=s[2];let d=n,h,f,m;if(s[3]!==a||s[4]!==e||s[5]!==r){let v;s[9]!==e?(v=g(b=>e(b),"t42"),s[9]=e,s[10]=v):v=s[10],f=a.map(v),h=f.length>0&&f.every(b=>r.has(b)),m=!h&&f.some(b=>r.has(b)),s[3]=a,s[4]=e,s[5]=r,s[6]=h,s[7]=f,s[8]=m}else h=s[6],f=s[7],m=s[8];let S=m,i;s[11]!==f?(i=g(()=>{o(v=>f.every(b=>v.has(b))?new Set:new Set(f))},"t4"),s[11]=f,s[12]=i):i=s[12];let x=i,y;return s[13]!==h||s[14]!==r||s[15]!==S||s[16]!==x?(y={allSelected:h,clear:d,selected:r,someSelected:S,toggle:c,toggleAll:x},s[13]=h,s[14]=r,s[15]=S,s[16]=x,s[17]=y):y=s[17],y},"useKeySelection"),Bt=ue(ge.storageReferences),It=ue(ge.storageOrphans),Ke=1e4,Ot=1e3,jt=3600,At=g((a,e)=>{if(!("document"in globalThis))return;let s=globalThis.document.createElement("a");s.href=a,s.download=e,s.rel="noopener",globalThis.document.body.append(s),s.click(),s.remove()},"triggerDownload"),Ut=g(async a=>{"navigator"in globalThis&&"clipboard"in globalThis.navigator&&await globalThis.navigator.clipboard.writeText(a)},"copyToClipboard"),Mt=g(({initialPrefix:a,pageSize:e})=>{let s=xe(),[t,r]=(0,_.useState)(a??""),[o,u]=(0,_.useState)(a??""),[c,n]=(0,_.useState)(yt),[d,h]=(0,_.useState)("list"),[f,m]=(0,_.useState)(128),[S,i]=(0,_.useState)("name"),[x,y]=(0,_.useState)("asc"),[v,b]=(0,_.useState)(void 0),[k,w]=(0,_.useState)(void 0),[T,C]=(0,_.useState)(!1),[N,E]=(0,_.useState)(void 0),[$,R]=(0,_.useState)(void 0),[D,B]=(0,_.useState)(""),[I,K]=(0,_.useState)({}),[O,z]=(0,_.useState)(!1),[L,U]=(0,_.useState)(void 0),[M,P]=(0,_.useState)(!1),[G,W]=(0,_.useState)(!1),[Y,se]=(0,_.useState)([]),[Z,ve]=(0,_.useState)("");(0,_.useEffect)(()=>{let p={cancelled:!1};return H((async()=>{try{let F=await s.listStorageBuckets();if(!p.cancelled){se(F);let[A]=F;A!==void 0&&ve(V=>V===""?A:V)}}catch{}})()),()=>{p.cancelled=!0}},[s]);let q=(0,_.useMemo)(()=>({list:g(p=>s.listStorageObjects({...p,bucket:Z}),"list"),remove:g(p=>s.deleteStorageObject(p,{bucket:Z}),"remove"),signedUrl:g((p,F)=>s.signedStorageUrl(p,{...F,bucket:Z}),"signedUrl"),upload:g(p=>s.uploadStorageObject({...p,bucket:Z}),"upload")}),[Z,s]),X=(0,_.useCallback)(async(p,F,A)=>{w(void 0),C(!0);try{let V=await q.list({cursor:F,limit:e,prefix:p});b(re=>A&&re!==void 0?[...re,...V.objects]:V.objects),R(V.cursor)}catch(V){A||b(void 0),w(J(V))}finally{C(!1)}},[e,q]);(0,_.useEffect)(()=>{H(X(a??"",void 0,!1))},[X,a]);let Ae=(v?.length??0)<=e;Fe(()=>{H(X(t,void 0,!1))},Ae);let{files:ae,folders:Ue}=kt(v??[],t),Me=(0,_.useMemo)(()=>{let p=new Set;for(let F of ae)for(let A of Object.keys(F.customMetadata??{}))p.add(A);return[...p].toSorted((F,A)=>F.localeCompare(A))},[ae]),ne=xt(ae,S,x),ce=(0,_.useMemo)(()=>[...new Set(ne.map(p=>p.key))].toSorted((p,F)=>p.localeCompare(F)).join(`
|
|
3
3
|
`),[ne]);(0,_.useEffect)(()=>{let p=ce===""?[]:ce.split(`
|
|
4
4
|
`);if(p.length===0){K({});return}let F={current:!0};return H((async()=>{try{let A=await s.query(Bt,{keys:p},he(D));F.current&&(K(A.references??{}),z(Object.keys(A.storageColumns??{}).length>0))}catch{F.current&&(K({}),z(!1))}})()),()=>{F.current=!1}},[s,ce,D]);let Ge=g(p=>p.key,"keyOf"),{allSelected:He,clear:le,selected:be,someSelected:Pe,toggle:Ve,toggleAll:We}=Lt(ne,Ge),Ze=g(()=>{r(o),le(),H(X(o,void 0,!1))},"listFirst"),qe=g(()=>{H(X(t,$,!0))},"loadMore"),ye=g(p=>{r(p),u(p),le(),H(X(p,void 0,!1))},"navigate"),Xe=g(p=>{ye(`${t}${p}`)},"enterFolder"),Ye=g(p=>q.signedUrl(p,{expiresInSeconds:jt}),"resolveUrl"),Je=g(()=>{h("list")},"showList"),Qe=g(()=>{h("grid")},"showGrid"),et=g(p=>{i(p)},"onSortKeyChange"),tt=g(()=>{y(p=>p==="asc"?"desc":"asc")},"toggleSortDirection"),st=g(p=>{m(p)},"onThumbSizeChange"),lt=g(p=>{n(p)},"onExpiryChange"),ot=g(()=>{w(void 0),C(!0),H((async()=>{try{for(let p of be)await q.remove(p);await X(t,void 0,!1),le()}catch(p){w(J(p))}finally{C(!1)}})())},"bulkDelete"),nt=g(p=>{w(void 0),H((async()=>{try{let F=await q.signedUrl(p,{expiresInSeconds:c});await Ut(F),E(p)}catch(F){w(J(F))}})())},"onCopy"),rt=g(p=>{w(void 0),H((async()=>{try{let F=await q.signedUrl(p,{expiresInSeconds:c}),A=p.slice(p.lastIndexOf("/")+1)||p;At(F,A)}catch(F){w(J(F))}})())},"onDownload");(0,_.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{E(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let it=g(p=>{w(void 0),C(!0),H((async()=>{try{await q.remove(p),await X(t,void 0,!1)}catch(F){w(J(F))}finally{C(!1)}})())},"onDelete"),at=g(p=>{let F=`${t}${p.name}`;w(void 0),C(!0),H((async()=>{try{let A=await p.arrayBuffer();await q.upload({body:A,contentType:p.type===""?void 0:p.type,key:F}),await X(t,void 0,!1)}catch(A){w(J(A))}finally{C(!1)}})())},"onFile");(0,_.useEffect)(()=>{U(void 0),W(!1)},[D]);let ct=g(()=>{w(void 0),P(!0),H((async()=>{try{let p=[],F;do{let V=await q.list({cursor:F,limit:Ot});for(let re of V.objects)p.push(re.key);F=p.length>=Ke?void 0:V.cursor}while(F!==void 0);if(p.length>=Ke)U([]),W(!0);else{let V=await s.query(It,{liveKeys:p},he(D));U(V.references??[]),W(V.truncated===!0)}}catch(p){U([]),W(!1),w(J(p))}finally{P(!1)}})())},"checkOrphans"),dt=g(p=>{ve(p),r(a??""),u(a??""),b(void 0),le()},"selectBucket");return{allSelected:He,bucket:Z,buckets:Y,bulkDelete:ot,busy:T,checkOrphans:ct,clearSelection:le,copiedKey:N,danglingBusy:M,danglingReferences:L,danglingTruncated:G,draftPrefix:o,enterFolder:Xe,error:k,expiry:c,files:ne,folders:Ue,hasObjects:v!==void 0&&v.length>0,hasStorageColumns:O,listFirst:Ze,loaded:v!==void 0,loadMore:qe,navigate:ye,nextCursor:$,onCopy:nt,onDelete:it,onDownload:rt,onExpiryChange:lt,onFile:at,onSortKeyChange:et,onThumbSizeChange:st,prefix:t,referenceShard:D,references:I,resolveUrl:Ye,selectBucket:dt,selected:be,setDraftPrefix:u,setReferenceShard:B,showGrid:Qe,showList:Je,someSelected:Pe,sortDirection:x,sortKey:S,tagKeys:Me,thumbSize:f,toggleSelect:Ve,toggleSelectAll:We,toggleSortDirection:tt,view:d}},"useFileBrowser"),Gt=100,Le=g(a=>{let e=(0,j.c)(6),{label:s,onNavigate:t,target:r}=a,o;e[0]!==t||e[1]!==r?(o=g(()=>{t(r)},"t1"),e[0]=t,e[1]=r,e[2]=o):o=e[2];let u=o,c;return e[3]!==u||e[4]!==s?(c=(0,l.jsxDEV)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:u,type:"button",children:s},void 0,!1),e[3]=u,e[4]=s,e[5]=c):c=e[5],c},"Crumb"),Ht=g(a=>{let e=(0,j.c)(11),{onNavigate:s,prefix:t,t:r}=a,o;if(e[0]!==s||e[1]!==t||e[2]!==r){let u=t.split("/").filter(Pt),c;e[4]!==r?(c=r("Folder path"),e[4]=r,e[5]=c):c=e[5];let n;e[6]!==r?(n=r("root"),e[6]=r,e[7]=n):n=e[7];let d;e[8]!==s||e[9]!==n?(d=(0,l.jsxDEV)(Le,{label:n,onNavigate:s,target:""},void 0,!1),e[8]=s,e[9]=n,e[10]=d):d=e[10],o=(0,l.jsxDEV)("nav",{"aria-label":c,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[d,u.map((h,f)=>(0,l.jsxDEV)("span",{className:"flex items-center gap-0.5",children:[(0,l.jsxDEV)("span",{className:"text-muted-foreground/50",children:"/"},void 0,!1),(0,l.jsxDEV)(Le,{label:h,onNavigate:s,target:`${u.slice(0,f+1).join("/")}/`},void 0,!1)]},`${h}-${f.toString()}`,!0))]},void 0,!0),e[0]=s,e[1]=t,e[2]=r,e[3]=o}else o=e[3];return o},"Breadcrumbs"),as=g(({initialPrefix:a,pageSize:e=Gt})=>{let s=ke(),t=Mt({initialPrefix:a,pageSize:e}),r=(0,_.useRef)(null),{onCopy:o,onDelete:u,onDownload:c,onFile:n,toggleSelect:d}=t,h={onCopy:o,onDelete:u,onDownload:c,onToggleSelect:d},f=g(()=>{r.current?.click()},"onUploadClick"),m=g(i=>{let x=i.target,y=x.files?.[0];x.value="",y&&n(y)},"onFileChange"),S=t.loaded&&!t.hasObjects;return(0,l.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,l.jsxDEV)(St,{bucket:t.bucket,buckets:t.buckets,busy:t.busy,draftPrefix:t.draftPrefix,expiry:t.expiry,fileInputRef:r,onBucketChange:t.selectBucket,onExpiryChange:t.onExpiryChange,onFileChange:m,onList:t.listFirst,onPrefixChange:t.setDraftPrefix,onUploadClick:f,t:s},void 0,!1),t.loaded&&(0,l.jsxDEV)(Ht,{onNavigate:t.navigate,prefix:t.prefix,t:s},void 0,!1),t.hasObjects&&(0,l.jsxDEV)(wt,{onSortKeyChange:t.onSortKeyChange,onThumbSizeChange:t.onThumbSizeChange,showGrid:t.showGrid,showList:t.showList,sortDirection:t.sortDirection,sortKey:t.sortKey,t:s,tagKeys:t.tagKeys,thumbSize:t.thumbSize,toggleSortDirection:t.toggleSortDirection,view:t.view},void 0,!1),t.hasStorageColumns&&(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,l.jsxDEV)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:s("References shard")},void 0,!1),(0,l.jsxDEV)(Ne,{id:"fb-reference-shard-input",onChange:t.setReferenceShard,testId:"fb-reference-shard-input",value:t.referenceShard},void 0,!1),(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:s("Which shard's records are checked for references to these files. Empty = root shard.")},void 0,!1)]},void 0,!0),t.hasStorageColumns&&(0,l.jsxDEV)(Kt,{busy:t.danglingBusy,onCheck:t.checkOrphans,references:t.danglingReferences,t:s,truncated:t.danglingTruncated},void 0,!1),t.selected.size>0&&(0,l.jsxDEV)(De,{count:t.selected.size,editable:!0,onClear:t.clearSelection,onDelete:t.bulkDelete},void 0,!1),t.error!==void 0&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:t.error},void 0,!1),S&&(0,l.jsxDEV)(fe,{description:s("Objects you upload to your R2 buckets will appear here."),icon:(0,l.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1),(0,l.jsxDEV)("path",{d:"M12 11v5m-2.5-2.5h5"},void 0,!1)]},void 0,!0),testId:"fb-empty",title:s("No objects.")},void 0,!1),t.hasObjects&&t.view==="list"&&(0,l.jsxDEV)(vt,{allSelected:t.allSelected,busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,selected:t.selected,showReferences:t.hasStorageColumns,someSelected:t.someSelected,t:s,toggleSelectAll:t.toggleSelectAll},void 0,!1),t.hasObjects&&t.view==="grid"&&(0,l.jsxDEV)(Rt,{busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,resolveUrl:t.resolveUrl,selected:t.selected,showReferences:t.hasStorageColumns,size:t.thumbSize,t:s},void 0,!1),t.nextCursor!==void 0&&(0,l.jsxDEV)("div",{children:(0,l.jsxDEV)(ee,{"data-testid":"fb-next",disabled:t.busy,onClick:t.loadMore,size:"sm",type:"button",variant:"outline",children:s("Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"FileBrowser");function Pt(a){return a!==""}g(Pt,"_temp");export{as as FileBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,b as te,c as se}from"./chunk-ZYRGPDZB.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as X}from"./chunk-XNJNSCLM.js";import{c as I}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{a as z,b as V,c as P,e as D}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as O,e as H,f as Y,g as G,k as Z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as k,e as j,f as ie,g as le,h as oe}from"./chunk-RRCPZMC2.js";var W=j(le(),1),T=j(ie(),1);var o=j(oe(),1);var de=H(J.runSql),ae=k(($,e)=>{let s=Q(),[f,t]=(0,T.useState)(void 0),[i,d]=(0,T.useState)(void 0),[l,c]=(0,T.useState)(!0),q=(0,T.useCallback)(async a=>{c(!0);try{let x=await s.query(de,{sql:$},Y(e));a.cancelled||(t(x),d(void 0))}catch(x){a.cancelled||(t(void 0),d(G(x)))}finally{a.cancelled||c(!1)}},[s,$,e]);return(0,T.useEffect)(()=>{let a={cancelled:!1};return Z(q(a)),()=>{a.cancelled=!0}},[q]),{error:i,loading:l,result:f}},"useRunSql"),re="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k($=>{let e=(0,W.c)(54),{onEdit:s,onRemove:f,widget:t}=$,i=O(),{error:d,loading:l,result:c}=ae(t.sql,t.shardKey??""),q;e[0]!==s||e[1]!==t.id?(q=k(()=>{s(t.id)},"t1"),e[0]=s,e[1]=t.id,e[2]=q):q=e[2];let a=q,x;e[3]!==f||e[4]!==t.id?(x=k(()=>{f(t.id)},"t2"),e[3]=f,e[4]=t.id,e[5]=x):x=e[5];let K=x,M=`dashboards-widget-${t.id}`,S;e[6]!==t.title?(S=(0,o.jsxDEV)(P,{className:"min-w-0 truncate",title:t.title,children:t.title},void 0,!1),e[6]=t.title,e[7]=S):S=e[7];let L;e[8]!==i?(L=i("Edit widget"),e[8]=i,e[9]=L):L=e[9];let R=`dashboards-widget-edit-${t.id}`,A;e[10]!==i?(A=i("Edit widget"),e[10]=i,e[11]=A):A=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==a||e[14]!==L||e[15]!==R||e[16]!==A?(C=(0,o.jsxDEV)(I,{"aria-label":L,"data-testid":R,onClick:a,size:"icon-xs",title:A,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=a,e[14]=L,e[15]=R,e[16]=A,e[17]=C):C=e[17];let b;e[18]!==i?(b=i("Remove widget"),e[18]=i,e[19]=b):b=e[19];let E=`dashboards-widget-remove-${t.id}`,m;e[20]!==i?(m=i("Remove widget"),e[20]=i,e[21]=m):m=e[21];let p;e[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=p):p=e[22];let u;e[23]!==K||e[24]!==b||e[25]!==E||e[26]!==m?(u=(0,o.jsxDEV)(I,{"aria-label":b,"data-testid":E,onClick:K,size:"icon-xs",title:m,type:"button",variant:"ghost",children:p},void 0,!1),e[23]=K,e[24]=b,e[25]=E,e[26]=m,e[27]=u):u=e[27];let h;e[28]!==u||e[29]!==C?(h=(0,o.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,u]},void 0,!0),e[28]=u,e[29]=C,e[30]=h):h=e[30];let v;e[31]!==h||e[32]!==S?(v=(0,o.jsxDEV)(V,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[S,h]},void 0,!0),e[31]=h,e[32]=S,e[33]=v):v=e[33];let g;e[34]!==d||e[35]!==t.id?(g=d!==void 0&&(0,o.jsxDEV)(X,{className:"font-mono text-xs",testId:`dashboards-widget-error-${t.id}`,variant:"destructive",children:d},void 0,!1),e[34]=d,e[35]=t.id,e[36]=g):g=e[36];let N;e[37]!==d||e[38]!==l||e[39]!==c||e[40]!==i||e[41]!==t.id?(N=d===void 0&&l&&c===void 0&&(0,o.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${t.id}`,children:i("Running\u2026")},void 0,!1),e[37]=d,e[38]=l,e[39]=c,e[40]=i,e[41]=t.id,e[42]=N):N=e[42];let r;e[43]!==d||e[44]!==c?(r=d===void 0&&c!==void 0&&(0,o.jsxDEV)(ee,{result:c},void 0,!1),e[43]=d,e[44]=c,e[45]=r):r=e[45];let n;e[46]!==g||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(D,{className:"min-h-32 py-2",children:[g,N,r]},void 0,!0),e[46]=g,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;return e[50]!==v||e[51]!==n||e[52]!==M?(y=(0,o.jsxDEV)(z,{"data-testid":M,children:[v,n]},void 0,!0),e[50]=v,e[51]=n,e[52]=M,e[53]=y):y=e[53],y},"WidgetCard"),ce=k($=>{let e=(0,W.c)(58),{draft:s,editing:f,onCancel:t,onChange:i,onSubmit:d}=$,l=O(),c;e[0]!==s||e[1]!==i?(c=k(_=>{i({...s,title:_.target.value})},"t1"),e[0]=s,e[1]=i,e[2]=c):c=e[2];let q=c,a;e[3]!==s||e[4]!==i?(a=k(_=>{i({...s,sql:_.target.value})},"t2"),e[3]=s,e[4]=i,e[5]=a):a=e[5];let x=a,K;e[6]!==s||e[7]!==i?(K=k(_=>{i({...s,shardKey:_.target.value})},"t3"),e[6]=s,e[7]=i,e[8]=K):K=e[8];let M=K,S;e[9]!==d?(S=k(()=>{d()},"t4"),e[9]=d,e[10]=S):S=e[10];let L=S,R;e[11]!==s.sql||e[12]!==s.title?(R=s.title.trim()!==""&&s.sql.trim()!=="",e[11]=s.sql,e[12]=s.title,e[13]=R):R=e[13];let A=R,w;e[14]!==l?(w=l("Widget title"),e[14]=l,e[15]=w):w=e[15];let C;e[16]!==l?(C=l("Widget title"),e[16]=l,e[17]=C):C=e[17];let b;e[18]!==s.title||e[19]!==q||e[20]!==w||e[21]!==C?(b=(0,o.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:q,placeholder:C,type:"text",value:s.title},void 0,!1),e[18]=s.title,e[19]=q,e[20]=w,e[21]=C,e[22]=b):b=e[22];let E;e[23]!==l?(E=l("SQL query"),e[23]=l,e[24]=E):E=e[24];let m;e[25]!==s.sql||e[26]!==x||e[27]!==E?(m=(0,o.jsxDEV)("textarea",{"aria-label":E,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:x,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:s.sql},void 0,!1),e[25]=s.sql,e[26]=x,e[27]=E,e[28]=m):m=e[28];let p;e[29]!==l?(p=l("Shard key (optional)"),e[29]=l,e[30]=p):p=e[30];let u;e[31]!==l?(u=l("Shard key (optional)"),e[31]=l,e[32]=u):u=e[32];let h;e[33]!==s.shardKey||e[34]!==M||e[35]!==p||e[36]!==u?(h=(0,o.jsxDEV)("input",{"aria-label":p,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:M,placeholder:u,type:"text",value:s.shardKey},void 0,!1),e[33]=s.shardKey,e[34]=M,e[35]=p,e[36]=u,e[37]=h):h=e[37];let v;e[38]!==l?(v=l("Cancel"),e[38]=l,e[39]=v):v=e[39];let g;e[40]!==t||e[41]!==v?(g=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:v},void 0,!1),e[40]=t,e[41]=v,e[42]=g):g=e[42];let N=!A,r;e[43]!==f||e[44]!==l?(r=l(f?"Save widget":"Add widget"),e[43]=f,e[44]=l,e[45]=r):r=e[45];let n;e[46]!==L||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-save",disabled:N,onClick:L,size:"sm",type:"button",children:r},void 0,!1),e[46]=L,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;e[50]!==g||e[51]!==n?(y=(0,o.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[g,n]},void 0,!0),e[50]=g,e[51]=n,e[52]=y):y=e[52];let F;return e[53]!==m||e[54]!==h||e[55]!==y||e[56]!==b?(F=(0,o.jsxDEV)(z,{"data-testid":"dashboards-form",children:(0,o.jsxDEV)(D,{className:"flex flex-col gap-3 py-4",children:[b,m,h,y]},void 0,!0)},void 0,!1),e[53]=m,e[54]=h,e[55]=y,e[56]=b,e[57]=F):F=e[57],F},"WidgetForm"),Ce=k($=>{let e=(0,W.c)(39),{initialShardKey:s}=$,f=O(),[t,i]=te(re),[d,l]=(0,T.useState)(B),[c,q]=(0,T.useState)(null),[a,x]=(0,T.useState)(!1),K;e[0]!==s?(K=k(()=>{q(null),l({...B,shardKey:s??""}),x(!0)},"t1"),e[0]=s,e[1]=K):K=e[1];let M=K,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=k(()=>{x(!1),q(null),l(B)},"t2"),e[2]=S):S=e[2];let L=S,R;e[3]!==t?(R=k(r=>{let n=t.find(y=>y.id===r);n!==void 0&&(q(r),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),x(!0))},"t3"),e[3]=t,e[4]=R):R=e[4];let A=R,w;e[5]!==i?(w=k(r=>{i(n=>n.filter(y=>y.id!==r))},"t4"),e[5]=i,e[6]=w):w=e[6];let C=w,b;e[7]!==d.shardKey||e[8]!==d.sql||e[9]!==d.title||e[10]!==c||e[11]!==i?(b=k(()=>{let r=d.title.trim(),n=d.sql.trim();if(r===""||n==="")return;let y=d.shardKey.trim();i(c===null?F=>[...F,{id:se("w"),shardKey:y,sql:n,title:r}]:F=>F.map(_=>_.id===c?{..._,shardKey:y,sql:n,title:r}:_)),L()},"t5"),e[7]=d.shardKey,e[8]=d.sql,e[9]=d.title,e[10]=c,e[11]=i,e[12]=b):b=e[12];let E=b,m;e[13]!==f?(m=f("Chart widgets backed by saved read-only SQL queries."),e[13]=f,e[14]=m):m=e[14];let p;e[15]!==m?(p=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[15]=m,e[16]=p):p=e[16];let u;e[17]!==a||e[18]!==M||e[19]!==f?(u=!a&&(0,o.jsxDEV)(I,{"data-testid":"dashboards-add",onClick:M,size:"sm",type:"button",children:f("Add widget")},void 0,!1),e[17]=a,e[18]=M,e[19]=f,e[20]=u):u=e[20];let h;e[21]!==p||e[22]!==u?(h=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[p,u]},void 0,!0),e[21]=p,e[22]=u,e[23]=h):h=e[23];let v;e[24]!==d||e[25]!==c||e[26]!==a||e[27]!==E?(v=a&&(0,o.jsxDEV)(ce,{draft:d,editing:c!==null,onCancel:L,onChange:l,onSubmit:E},void 0,!1),e[24]=d,e[25]=c,e[26]=a,e[27]=E,e[28]=v):v=e[28];let g;e[29]!==a||e[30]!==A||e[31]!==C||e[32]!==f||e[33]!==t?(g=t.length===0&&!a?(0,o.jsxDEV)(U,{description:f("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:f("No widgets yet")},void 0,!1):(0,o.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:t.map(r=>(0,o.jsxDEV)(ne,{onEdit:A,onRemove:C,widget:r},r.id,!1))},void 0,!1),e[29]=a,e[30]=A,e[31]=C,e[32]=f,e[33]=t,e[34]=g):g=e[34];let N;return e[35]!==v||e[36]!==g||e[37]!==h?(N=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[h,v,g]},void 0,!0),e[35]=v,e[36]=g,e[37]=h,e[38]=N):N=e[38],N},"DashboardsPanel");export{Ce as default};
|
|
1
|
+
import{a as ee,b as te,c as se}from"./chunk-ZYRGPDZB.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as X}from"./chunk-XNJNSCLM.js";import{c as I}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{a as z,b as V,c as P,e as D}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as O,e as H,f as Y,g as G,k as Z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as k,e as j,f as ie,g as le,h as oe}from"./chunk-RRCPZMC2.js";var W=j(le(),1),T=j(ie(),1);var o=j(oe(),1);var de=H(J.runSql),ae=k(($,e)=>{let s=Q(),[f,t]=(0,T.useState)(void 0),[i,d]=(0,T.useState)(void 0),[l,c]=(0,T.useState)(!0),q=(0,T.useCallback)(async a=>{c(!0);try{let x=await s.query(de,{sql:$},Y(e));a.cancelled||(t(x),d(void 0))}catch(x){a.cancelled||(t(void 0),d(G(x)))}finally{a.cancelled||c(!1)}},[s,$,e]);return(0,T.useEffect)(()=>{let a={cancelled:!1};return Z(q(a)),()=>{a.cancelled=!0}},[q]),{error:i,loading:l,result:f}},"useRunSql"),re="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k($=>{let e=(0,W.c)(54),{onEdit:s,onRemove:f,widget:t}=$,i=O(),{error:d,loading:l,result:c}=ae(t.sql,t.shardKey??""),q;e[0]!==s||e[1]!==t.id?(q=k(()=>{s(t.id)},"t1"),e[0]=s,e[1]=t.id,e[2]=q):q=e[2];let a=q,x;e[3]!==f||e[4]!==t.id?(x=k(()=>{f(t.id)},"t2"),e[3]=f,e[4]=t.id,e[5]=x):x=e[5];let K=x,M=`dashboards-widget-${t.id}`,S;e[6]!==t.title?(S=(0,o.jsxDEV)(P,{className:"min-w-0 truncate",title:t.title,children:t.title},void 0,!1),e[6]=t.title,e[7]=S):S=e[7];let L;e[8]!==i?(L=i("Edit widget"),e[8]=i,e[9]=L):L=e[9];let R=`dashboards-widget-edit-${t.id}`,A;e[10]!==i?(A=i("Edit widget"),e[10]=i,e[11]=A):A=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==a||e[14]!==L||e[15]!==R||e[16]!==A?(C=(0,o.jsxDEV)(I,{"aria-label":L,"data-testid":R,onClick:a,size:"icon-xs",title:A,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=a,e[14]=L,e[15]=R,e[16]=A,e[17]=C):C=e[17];let b;e[18]!==i?(b=i("Remove widget"),e[18]=i,e[19]=b):b=e[19];let E=`dashboards-widget-remove-${t.id}`,m;e[20]!==i?(m=i("Remove widget"),e[20]=i,e[21]=m):m=e[21];let p;e[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=p):p=e[22];let u;e[23]!==K||e[24]!==b||e[25]!==E||e[26]!==m?(u=(0,o.jsxDEV)(I,{"aria-label":b,"data-testid":E,onClick:K,size:"icon-xs",title:m,type:"button",variant:"ghost",children:p},void 0,!1),e[23]=K,e[24]=b,e[25]=E,e[26]=m,e[27]=u):u=e[27];let h;e[28]!==u||e[29]!==C?(h=(0,o.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,u]},void 0,!0),e[28]=u,e[29]=C,e[30]=h):h=e[30];let v;e[31]!==h||e[32]!==S?(v=(0,o.jsxDEV)(V,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[S,h]},void 0,!0),e[31]=h,e[32]=S,e[33]=v):v=e[33];let g;e[34]!==d||e[35]!==t.id?(g=d!==void 0&&(0,o.jsxDEV)(X,{className:"font-mono text-xs",testId:`dashboards-widget-error-${t.id}`,variant:"destructive",children:d},void 0,!1),e[34]=d,e[35]=t.id,e[36]=g):g=e[36];let N;e[37]!==d||e[38]!==l||e[39]!==c||e[40]!==i||e[41]!==t.id?(N=d===void 0&&l&&c===void 0&&(0,o.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${t.id}`,children:i("Running\u2026")},void 0,!1),e[37]=d,e[38]=l,e[39]=c,e[40]=i,e[41]=t.id,e[42]=N):N=e[42];let r;e[43]!==d||e[44]!==c?(r=d===void 0&&c!==void 0&&(0,o.jsxDEV)(ee,{result:c},void 0,!1),e[43]=d,e[44]=c,e[45]=r):r=e[45];let n;e[46]!==g||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(D,{className:"min-h-32 py-2",children:[g,N,r]},void 0,!0),e[46]=g,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;return e[50]!==v||e[51]!==n||e[52]!==M?(y=(0,o.jsxDEV)(z,{"data-testid":M,children:[v,n]},void 0,!0),e[50]=v,e[51]=n,e[52]=M,e[53]=y):y=e[53],y},"WidgetCard"),ce=k($=>{let e=(0,W.c)(58),{draft:s,editing:f,onCancel:t,onChange:i,onSubmit:d}=$,l=O(),c;e[0]!==s||e[1]!==i?(c=k(_=>{i({...s,title:_.target.value})},"t1"),e[0]=s,e[1]=i,e[2]=c):c=e[2];let q=c,a;e[3]!==s||e[4]!==i?(a=k(_=>{i({...s,sql:_.target.value})},"t2"),e[3]=s,e[4]=i,e[5]=a):a=e[5];let x=a,K;e[6]!==s||e[7]!==i?(K=k(_=>{i({...s,shardKey:_.target.value})},"t3"),e[6]=s,e[7]=i,e[8]=K):K=e[8];let M=K,S;e[9]!==d?(S=k(()=>{d()},"t4"),e[9]=d,e[10]=S):S=e[10];let L=S,R;e[11]!==s.sql||e[12]!==s.title?(R=s.title.trim()!==""&&s.sql.trim()!=="",e[11]=s.sql,e[12]=s.title,e[13]=R):R=e[13];let A=R,w;e[14]!==l?(w=l("Widget title"),e[14]=l,e[15]=w):w=e[15];let C;e[16]!==l?(C=l("Widget title"),e[16]=l,e[17]=C):C=e[17];let b;e[18]!==s.title||e[19]!==q||e[20]!==w||e[21]!==C?(b=(0,o.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:q,placeholder:C,type:"text",value:s.title},void 0,!1),e[18]=s.title,e[19]=q,e[20]=w,e[21]=C,e[22]=b):b=e[22];let E;e[23]!==l?(E=l("SQL query"),e[23]=l,e[24]=E):E=e[24];let m;e[25]!==s.sql||e[26]!==x||e[27]!==E?(m=(0,o.jsxDEV)("textarea",{"aria-label":E,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:x,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:s.sql},void 0,!1),e[25]=s.sql,e[26]=x,e[27]=E,e[28]=m):m=e[28];let p;e[29]!==l?(p=l("Shard key (optional)"),e[29]=l,e[30]=p):p=e[30];let u;e[31]!==l?(u=l("Shard key (optional)"),e[31]=l,e[32]=u):u=e[32];let h;e[33]!==s.shardKey||e[34]!==M||e[35]!==p||e[36]!==u?(h=(0,o.jsxDEV)("input",{"aria-label":p,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:M,placeholder:u,type:"text",value:s.shardKey},void 0,!1),e[33]=s.shardKey,e[34]=M,e[35]=p,e[36]=u,e[37]=h):h=e[37];let v;e[38]!==l?(v=l("Cancel"),e[38]=l,e[39]=v):v=e[39];let g;e[40]!==t||e[41]!==v?(g=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:v},void 0,!1),e[40]=t,e[41]=v,e[42]=g):g=e[42];let N=!A,r;e[43]!==f||e[44]!==l?(r=l(f?"Save widget":"Add widget"),e[43]=f,e[44]=l,e[45]=r):r=e[45];let n;e[46]!==L||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-save",disabled:N,onClick:L,size:"sm",type:"button",children:r},void 0,!1),e[46]=L,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;e[50]!==g||e[51]!==n?(y=(0,o.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[g,n]},void 0,!0),e[50]=g,e[51]=n,e[52]=y):y=e[52];let F;return e[53]!==m||e[54]!==h||e[55]!==y||e[56]!==b?(F=(0,o.jsxDEV)(z,{"data-testid":"dashboards-form",children:(0,o.jsxDEV)(D,{className:"flex flex-col gap-3 py-4",children:[b,m,h,y]},void 0,!0)},void 0,!1),e[53]=m,e[54]=h,e[55]=y,e[56]=b,e[57]=F):F=e[57],F},"WidgetForm"),Ce=k($=>{let e=(0,W.c)(39),{initialShardKey:s}=$,f=O(),[t,i]=te(re),[d,l]=(0,T.useState)(B),[c,q]=(0,T.useState)(null),[a,x]=(0,T.useState)(!1),K;e[0]!==s?(K=k(()=>{q(null),l({...B,shardKey:s??""}),x(!0)},"t1"),e[0]=s,e[1]=K):K=e[1];let M=K,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=k(()=>{x(!1),q(null),l(B)},"t2"),e[2]=S):S=e[2];let L=S,R;e[3]!==t?(R=k(r=>{let n=t.find(y=>y.id===r);n!==void 0&&(q(r),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),x(!0))},"t3"),e[3]=t,e[4]=R):R=e[4];let A=R,w;e[5]!==i?(w=k(r=>{i(n=>n.filter(y=>y.id!==r))},"t4"),e[5]=i,e[6]=w):w=e[6];let C=w,b;e[7]!==d.shardKey||e[8]!==d.sql||e[9]!==d.title||e[10]!==c||e[11]!==i?(b=k(()=>{let r=d.title.trim(),n=d.sql.trim();if(r===""||n==="")return;let y=d.shardKey.trim();i(c===null?F=>[...F,{id:se("w"),shardKey:y,sql:n,title:r}]:F=>F.map(_=>_.id===c?{..._,shardKey:y,sql:n,title:r}:_)),L()},"t5"),e[7]=d.shardKey,e[8]=d.sql,e[9]=d.title,e[10]=c,e[11]=i,e[12]=b):b=e[12];let E=b,m;e[13]!==f?(m=f("Chart widgets backed by saved read-only SQL queries."),e[13]=f,e[14]=m):m=e[14];let p;e[15]!==m?(p=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[15]=m,e[16]=p):p=e[16];let u;e[17]!==a||e[18]!==M||e[19]!==f?(u=!a&&(0,o.jsxDEV)(I,{"data-testid":"dashboards-add",onClick:M,size:"sm",type:"button",children:f("Add widget")},void 0,!1),e[17]=a,e[18]=M,e[19]=f,e[20]=u):u=e[20];let h;e[21]!==p||e[22]!==u?(h=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[p,u]},void 0,!0),e[21]=p,e[22]=u,e[23]=h):h=e[23];let v;e[24]!==d||e[25]!==c||e[26]!==a||e[27]!==E?(v=a&&(0,o.jsxDEV)(ce,{draft:d,editing:c!==null,onCancel:L,onChange:l,onSubmit:E},void 0,!1),e[24]=d,e[25]=c,e[26]=a,e[27]=E,e[28]=v):v=e[28];let g;e[29]!==a||e[30]!==A||e[31]!==C||e[32]!==f||e[33]!==t?(g=t.length===0&&!a?(0,o.jsxDEV)(U,{description:f("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:f("No widgets yet")},void 0,!1):(0,o.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:t.map(r=>(0,o.jsxDEV)(ne,{onEdit:A,onRemove:C,widget:r},r.id,!1))},void 0,!1),e[29]=a,e[30]=A,e[31]=C,e[32]=f,e[33]=t,e[34]=g):g=e[34];let N;return e[35]!==v||e[36]!==g||e[37]!==h?(N=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[h,v,g]},void 0,!0),e[35]=v,e[36]=g,e[37]=h,e[38]=N):N=e[38],N},"DashboardsPanel");export{Ce as default};
|