@lunora/studio 1.0.0-alpha.310 → 1.0.0-alpha.312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/{chunk-NXGPDLDU.js → chunk-2BXYYWFF.js} +1 -1
- package/dist/standalone/{chunk-KB4LDWU5.js → chunk-2KCU3R63.js} +1 -1
- package/dist/standalone/{chunk-F7GN7PFX.js → chunk-2MLBXX35.js} +1 -1
- package/dist/standalone/{chunk-2SJZZH4H.js → chunk-3MUG4ZHJ.js} +1 -1
- package/dist/standalone/{chunk-M2ZMWQFY.js → chunk-43KOF4CQ.js} +1 -1
- package/dist/standalone/{chunk-JH36CKFQ.js → chunk-465XOUP7.js} +1 -1
- package/dist/standalone/{chunk-3QX3JY3V.js → chunk-4OSK5JED.js} +1 -1
- package/dist/standalone/{chunk-YPWBHX2E.js → chunk-4SONVRCI.js} +1 -1
- package/dist/standalone/{chunk-XOFQMNBS.js → chunk-4VXO6PEW.js} +1 -1
- package/dist/standalone/{chunk-AD2DJJC3.js → chunk-53NRDRMS.js} +1 -1
- package/dist/standalone/{chunk-JRGRIQ7P.js → chunk-5QLHJ63L.js} +1 -1
- package/dist/standalone/{chunk-AV7OEKJ6.js → chunk-6L2GY26N.js} +2 -2
- package/dist/standalone/{chunk-H3BZ3JO6.js → chunk-72K3I5WQ.js} +1 -1
- package/dist/standalone/{chunk-RHRUDVZJ.js → chunk-7QW4APH4.js} +1 -1
- package/dist/standalone/{chunk-6RUR4ENY.js → chunk-B56FJPX3.js} +1 -1
- package/dist/standalone/{chunk-3PZCWECC.js → chunk-BTU2DO4W.js} +1 -1
- package/dist/standalone/{chunk-PJSLU6LL.js → chunk-CSPLK3YB.js} +1 -1
- package/dist/standalone/{chunk-GHZ2JWYN.js → chunk-CSX53SBE.js} +1 -1
- package/dist/standalone/{chunk-XL2AUAZA.js → chunk-D5V2I2AG.js} +1 -1
- package/dist/standalone/{chunk-WOBRELSS.js → chunk-DPTYTQR4.js} +1 -1
- package/dist/standalone/{chunk-IEDJDJCP.js → chunk-EHIBZBUU.js} +1 -1
- package/dist/standalone/{chunk-MOC6MEKG.js → chunk-EOLEL3WN.js} +1 -1
- package/dist/standalone/{chunk-K72WUXVL.js → chunk-FECB2R4V.js} +1 -1
- package/dist/standalone/{chunk-QBE5USC3.js → chunk-G7SKQQMQ.js} +1 -1
- package/dist/standalone/{chunk-GD2NG5PX.js → chunk-GI2ASB4F.js} +1 -1
- package/dist/standalone/{chunk-K6564T6V.js → chunk-GP4Y7JTA.js} +1 -1
- package/dist/standalone/{chunk-3GWYCFNE.js → chunk-GUICDCZY.js} +1 -1
- package/dist/standalone/{chunk-5LZ7ITPY.js → chunk-GVHNP2GX.js} +1 -1
- package/dist/standalone/{chunk-7DQRMMWU.js → chunk-IKA6U6M6.js} +1 -1
- package/dist/standalone/{chunk-QEMJIJCD.js → chunk-IKF6SZS6.js} +1 -1
- package/dist/standalone/{chunk-BSHTZR6K.js → chunk-IKMM2GHN.js} +1 -1
- package/dist/standalone/{chunk-MWIKSOHW.js → chunk-IOKJXFIU.js} +1 -1
- package/dist/standalone/{chunk-225UTWUC.js → chunk-IQHFRVZM.js} +1 -1
- package/dist/standalone/{chunk-D4ZXRW2I.js → chunk-JPDDVVP6.js} +1 -1
- package/dist/standalone/{chunk-BV2EBCUX.js → chunk-LILVP4NU.js} +1 -1
- package/dist/standalone/{chunk-2R4BRJGM.js → chunk-MAGV5WWM.js} +1 -1
- package/dist/standalone/{chunk-AVACONK5.js → chunk-MHJKGEKR.js} +1 -1
- package/dist/standalone/{chunk-IFEMFSLN.js → chunk-MZU5M2TO.js} +1 -1
- package/dist/standalone/{chunk-FUGLFWLW.js → chunk-NNSCCLU4.js} +1 -1
- package/dist/standalone/{chunk-7474UICL.js → chunk-OHMGKCDA.js} +1 -1
- package/dist/standalone/{chunk-YVNIQ7OG.js → chunk-PXBXNIM2.js} +1 -1
- package/dist/standalone/{chunk-IY6US3YF.js → chunk-QXRMBK26.js} +1 -1
- package/dist/standalone/{chunk-AD7GTQBR.js → chunk-R2TAO7Q4.js} +1 -1
- package/dist/standalone/{chunk-7RPU77RS.js → chunk-SMIU5HX6.js} +1 -1
- package/dist/standalone/{chunk-MVS7RWFI.js → chunk-TGZBBSZG.js} +1 -1
- package/dist/standalone/{chunk-76BXZLNG.js → chunk-U6QBSDND.js} +1 -1
- package/dist/standalone/{chunk-HXBFXMPI.js → chunk-VABBWB42.js} +1 -1
- package/dist/standalone/{chunk-M2FQTDR4.js → chunk-W36YKEUZ.js} +1 -1
- package/dist/standalone/{chunk-L254SW7Y.js → chunk-WCAUFFIX.js} +1 -1
- package/dist/standalone/{chunk-ZQPAHCMA.js → chunk-WK5TYZAF.js} +1 -1
- package/dist/standalone/{chunk-TPHEVTCW.js → chunk-WQMS7276.js} +1 -1
- package/dist/standalone/{chunk-2D5PY4GN.js → chunk-WV4V42RT.js} +1 -1
- package/dist/standalone/{chunk-VS4MTIRN.js → chunk-XDC2SWYS.js} +1 -1
- package/dist/standalone/{chunk-SFDYCSQW.js → chunk-XYBZYLQL.js} +1 -1
- package/dist/standalone/{chunk-4IGNK2QW.js → chunk-Y4CGNYC5.js} +1 -1
- package/dist/standalone/{chunk-QPTUTBNA.js → chunk-YC5NRN4O.js} +1 -1
- package/dist/standalone/{chunk-V24V4CZ4.js → chunk-Z4XHXX73.js} +1 -1
- package/dist/standalone/{chunk-SZCVCB4X.js → chunk-ZHLX75F6.js} +1 -1
- package/dist/standalone/{chunk-ZYKSTQC7.js → chunk-ZLVANF7H.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as be,b as fe,c as xe,d as Ne,e as Ce}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as ce}from"./chunk-FPI7AMQJ.js";import{a as ue}from"./chunk-7RKB5KS7.js";import{a as q}from"./chunk-37WYCOQ2.js";import{g as me,h as ve,i as pe,j as ye}from"./chunk-L254SW7Y.js";import"./chunk-XGCIDUJF.js";import"./chunk-SZCVCB4X.js";import"./chunk-CCDX5RYT.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-WJRYEML4.js";import"./chunk-FUYEZFBP.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as $}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as he}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import"./chunk-4ZEL6BYL.js";import"./chunk-M2FQTDR4.js";import{l as G}from"./chunk-AV7OEKJ6.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as ke}from"./chunk-RWVIV3U7.js";import{a as se,b as ie,c as oe,d as Q,e as X,f as Y}from"./chunk-HCTJKP5J.js";import{a as re,e as ne}from"./chunk-2IKDEUCX.js";import{d as R,h as Z,l as ge,p as z,s as de}from"./chunk-HJHSQPHW.js";import{a as i,d as le,e as Oe,f as _e,g as De}from"./chunk-I26MS5PJ.js";var P=le(Oe(),1);var ee=le(_e(),1);var a=le(De(),1);var Be=i(l=>{let e=l.trim();if(e==="")return;let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):void 0},"Be"),Le=i(l=>l===void 0?"\u2014":new Date(l*1e3).toISOString(),"Oe"),Je=i(l=>new TextEncoder().encode(l).length,"Ae"),Fe=i(l=>{if(l.trim()!=="")try{return JSON.stringify(JSON.parse(l),void 0,2)}catch{return}},"ge"),Ke=i(l=>{if(l.trim()==="")return!0;try{return JSON.parse(l),!0}catch{return!1}},"xe"),Ee=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],we=i((l,e)=>{let n=l.trim();if(n==="")return"";let u=Number(n),s=Ee.find(p=>p.key===e)?.seconds??1;return Number.isFinite(u)&&u>0?String(Math.round(u*s)):n},"ue"),Ve=i(l=>{let e=l.trim();if(e==="")return!0;let n=Number(e);return Number.isInteger(n)&&n>=60},"Ce"),Te=i((l,e,n,u)=>{let s=Be(l.ttl);return{expiration:s===void 0?u:void 0,expirationTtl:s,key:e,metadata:l.metadata.trim()===""?void 0:JSON.parse(l.metadata),namespace:n,value:l.value}},"Se"),Me=i(l=>{let e=(0,ee.c)(60),{helper:n,id:u,invalid:s,onChange:p,testId:o}=l,t=R(),[r,y]=(0,P.useState)(""),[c,x]=(0,P.useState)("seconds"),b;e[0]!==p||e[1]!==c?(b=i(f=>{y(f.target.value),p(we(f.target.value,c))},"k"),e[0]=p,e[1]=c,e[2]=b):b=e[2];let _=b,V;e[3]!==r||e[4]!==p?(V=i(f=>{f!==null&&(x(f),p(we(r,f)))},"K"),e[3]=r,e[4]=p,e[5]=V):V=e[5];let T=V,h;e[6]!==t?(h=t("days"),e[6]=t,e[7]=h):h=e[7];let v;e[8]!==t?(v=t("hours"),e[8]=t,e[9]=v):v=e[9];let k;e[10]!==t?(k=t("minutes"),e[10]=t,e[11]=k):k=e[11];let N;e[12]!==t?(N=t("seconds"),e[12]=t,e[13]=N):N=e[13];let C;e[14]!==h||e[15]!==v||e[16]!==k||e[17]!==N?(C={days:h,hours:v,minutes:k,seconds:N},e[14]=h,e[15]=v,e[16]=k,e[17]=N,e[18]=C):C=e[18];let w=C,g;e[19]!==t?(g=t("Expires after"),e[19]=t,e[20]=g):g=e[20];let S;e[21]!==u||e[22]!==g?(S=(0,a.jsx)(q,{className:"text-xs",htmlFor:u,children:g}),e[21]=u,e[22]=g,e[23]=S):S=e[23];let E;e[24]!==t?(E=t("No expiration"),e[24]=t,e[25]=E):E=e[25];let B;e[26]!==r||e[27]!==u||e[28]!==s||e[29]!==_||e[30]!==E||e[31]!==o?(B=(0,a.jsx)(ae,{"aria-invalid":s,className:"flex-1","data-testid":o,id:u,inputMode:"numeric",onChange:_,placeholder:E,value:r}),e[26]=r,e[27]=u,e[28]=s,e[29]=_,e[30]=E,e[31]=o,e[32]=B):B=e[32];let M;e[33]!==t?(M=t("TTL unit"),e[33]=t,e[34]=M):M=e[34];let J=`${o}-unit`,L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(fe,{}),e[35]=L):L=e[35];let I;e[36]!==M||e[37]!==J?(I=(0,a.jsx)(xe,{"aria-label":M,className:"w-[7.5rem]","data-testid":J,children:L}),e[36]=M,e[37]=J,e[38]=I):I=e[38];let d;e[39]!==w?(d=Ee.map(f=>(0,a.jsx)(Ce,{value:f.key,children:w[f.key]},f.key)),e[39]=w,e[40]=d):d=e[40];let m;e[41]!==d?(m=(0,a.jsx)(Ne,{children:d}),e[41]=d,e[42]=m):m=e[42];let F;e[43]!==T||e[44]!==I||e[45]!==m||e[46]!==c?(F=(0,a.jsxs)(be,{onValueChange:T,value:c,children:[I,m]}),e[43]=T,e[44]=I,e[45]=m,e[46]=c,e[47]=F):F=e[47];let O;e[48]!==B||e[49]!==F?(O=(0,a.jsxs)("div",{className:"flex gap-2",children:[B,F]}),e[48]=B,e[49]=F,e[50]=O):O=e[50];let K;e[51]!==n||e[52]!==s||e[53]!==t||e[54]!==o?(K=s?(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":`${o}-invalid`,children:t("TTL must be at least 60 seconds.")}):n!==void 0&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:n}),e[51]=n,e[52]=s,e[53]=t,e[54]=o,e[55]=K):K=e[55];let D;return e[56]!==O||e[57]!==K||e[58]!==S?(D=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[S,O,K]}),e[56]=O,e[57]=K,e[58]=S,e[59]=D):D=e[59],D},"we"),Ie=i(l=>{let e=(0,ee.c)(36),{id:n,invalidTestId:u,onChange:s,testId:p,valid:o,value:t}=l,r=R(),y;e[0]!==t?(y=Fe(t),e[0]=t,e[1]=y):y=e[1];let c=y,x;e[2]!==r?(x=r("Metadata (JSON)"),e[2]=r,e[3]=x):x=e[3];let b;e[4]!==n||e[5]!==x?(b=(0,a.jsx)(q,{className:"text-xs",htmlFor:n,children:x}),e[4]=n,e[5]=x,e[6]=b):b=e[6];let _=`${p}-format`,V=c===void 0,T;e[7]!==c||e[8]!==s?(T=i(()=>{c!==void 0&&s(c)},"V"),e[7]=c,e[8]=s,e[9]=T):T=e[9];let h;e[10]!==r?(h=r("Format JSON"),e[10]=r,e[11]=h):h=e[11];let v;e[12]!==_||e[13]!==V||e[14]!==T||e[15]!==h?(v=(0,a.jsx)($,{"data-testid":_,disabled:V,onClick:T,size:"sm",variant:"outline",children:h}),e[12]=_,e[13]=V,e[14]=T,e[15]=h,e[16]=v):v=e[16];let k;e[17]!==b||e[18]!==v?(k=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[b,v]}),e[17]=b,e[18]=v,e[19]=k):k=e[19];let N=!o,C;e[20]!==s?(C=i(E=>{s(E.target.value)},"N"),e[20]=s,e[21]=C):C=e[21];let w;e[22]!==n||e[23]!==N||e[24]!==C||e[25]!==p||e[26]!==t?(w=(0,a.jsx)(ce,{"aria-invalid":N,className:"min-h-[4rem] font-mono text-xs","data-testid":p,id:n,onChange:C,value:t}),e[22]=n,e[23]=N,e[24]=C,e[25]=p,e[26]=t,e[27]=w):w=e[27];let g;e[28]!==u||e[29]!==r||e[30]!==o?(g=!o&&(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":u,children:r("Metadata must be valid JSON.")}),e[28]=u,e[29]=r,e[30]=o,e[31]=g):g=e[31];let S;return e[32]!==w||e[33]!==g||e[34]!==k?(S=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[k,w,g]}),e[32]=w,e[33]=g,e[34]=k,e[35]=S):S=e[35],S},"Te"),Pe={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},$e=i((l,e)=>{switch(e.type){case"setField":return{...l,[e.field]:e.value};case"submitFailed":return{...l,busy:!1,error:e.error};case"submitStart":return{...l,busy:!0,error:null};default:return l}},"Je"),je=i(l=>{let e=(0,ee.c)(73),{namespace:n,onCancel:u,onCreated:s}=l,p=G(),o=R(),[t,r]=(0,P.useReducer)($e,Pe),y;e[0]!==t.metadata?(y=Ke(t.metadata),e[0]=t.metadata,e[1]=y):y=e[1];let c=y,x;e[2]!==t.ttl?(x=Ve(t.ttl),e[2]=t.ttl,e[3]=x):x=e[3];let b=x,_;e[4]!==c||e[5]!==t.busy||e[6]!==t.name||e[7]!==b?(_=t.name.trim()!==""&&c&&b&&!t.busy,e[4]=c,e[5]=t.busy,e[6]=t.name,e[7]=b,e[8]=_):_=e[8];let V=_,T;e[9]!==V||e[10]!==p||e[11]!==n||e[12]!==s||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(T=i(()=>{V&&(r({type:"submitStart"}),z((async()=>{try{await p.putKvValue(Te({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,n)),s()}catch(A){r({error:Z(A),type:"submitFailed"})}})()))},"V"),e[9]=V,e[10]=p,e[11]=n,e[12]=s,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=T):T=e[17];let h=T,v;e[18]!==o?(v=o("Key name"),e[18]=o,e[19]=v):v=e[19];let k;e[20]!==v?(k=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-name",children:v}),e[20]=v,e[21]=k):k=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=i(A=>{r({field:"name",type:"setField",value:A.target.value})},"x"),e[22]=N):N=e[22];let C;e[23]!==o?(C=o("Key name"),e[23]=o,e[24]=C):C=e[24];let w;e[25]!==t.name||e[26]!==C?(w=(0,a.jsx)(ae,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:N,placeholder:C,value:t.name}),e[25]=t.name,e[26]=C,e[27]=w):w=e[27];let g;e[28]!==k||e[29]!==w?(g=(0,a.jsxs)("div",{className:"grid gap-1",children:[k,w]}),e[28]=k,e[29]=w,e[30]=g):g=e[30];let S;e[31]!==o?(S=o("Value"),e[31]=o,e[32]=S):S=e[32];let E;e[33]!==S?(E=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-value",children:S}),e[33]=S,e[34]=E):E=e[34];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=i(A=>{r({field:"value",type:"setField",value:A.target.value})},"O"),e[35]=B):B=e[35];let M;e[36]!==t.value?(M=(0,a.jsx)(ce,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:B,value:t.value}),e[36]=t.value,e[37]=M):M=e[37];let J;e[38]!==E||e[39]!==M?(J=(0,a.jsxs)("div",{className:"grid gap-1",children:[E,M]}),e[38]=E,e[39]=M,e[40]=J):J=e[40];let L=!b,I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=i(A=>{r({field:"ttl",type:"setField",value:A})},"_"),e[41]=I):I=e[41];let d;e[42]!==L?(d=(0,a.jsx)(Me,{id:"kv-create-ttl",invalid:L,onChange:I,testId:"kv-create-ttl"}),e[42]=L,e[43]=d):d=e[43];let m;e[44]===Symbol.for("react.memo_cache_sentinel")?(m=i(A=>{r({field:"metadata",type:"setField",value:A})},"u"),e[44]=m):m=e[44];let F;e[45]!==c||e[46]!==t.metadata?(F=(0,a.jsx)(Ie,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:m,testId:"kv-create-metadata",valid:c,value:t.metadata}),e[45]=c,e[46]=t.metadata,e[47]=F):F=e[47];let O=!V,K;e[48]!==t.busy||e[49]!==o?(K=t.busy?o("Creating\u2026"):o("Create key"),e[48]=t.busy,e[49]=o,e[50]=K):K=e[50];let D;e[51]!==h||e[52]!==O||e[53]!==K?(D=(0,a.jsx)($,{"data-testid":"kv-create-submit",disabled:O,onClick:h,children:K}),e[51]=h,e[52]=O,e[53]=K,e[54]=D):D=e[54];let f=t.busy,j;e[55]!==o?(j=o("Cancel"),e[55]=o,e[56]=j):j=e[56];let H;e[57]!==u||e[58]!==t.busy||e[59]!==j?(H=(0,a.jsx)($,{"data-testid":"kv-create-cancel",disabled:f,onClick:u,variant:"outline",children:j}),e[57]=u,e[58]=t.busy,e[59]=j,e[60]=H):H=e[60];let U;e[61]!==D||e[62]!==H?(U=(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[D,H]}),e[61]=D,e[62]=H,e[63]=U):U=e[63];let W;e[64]!==t.error?(W=t.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error}),e[64]=t.error,e[65]=W):W=e[65];let te;return e[66]!==g||e[67]!==J||e[68]!==d||e[69]!==F||e[70]!==U||e[71]!==W?(te=(0,a.jsxs)("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[g,J,d,F,U,W]}),e[66]=g,e[67]=J,e[68]=d,e[69]=F,e[70]=U,e[71]=W,e[72]=te):te=e[72],te},"Pe"),Ae={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},ze=i((l,e)=>{switch(e.type){case"deleteStart":return{...l,busy:"deleting",writeError:null};case"editMetadata":return{...l,editedMetadata:e.value};case"editTtl":return{...l,editedTtl:e.value};case"editValue":return{...l,editedValue:e.value};case"loaded":return{...l,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...l,loadError:e.error,loading:!1};case"saveOk":return{...l,busy:"",value:l.editedValue};case"saveStart":return{...l,busy:"saving",writeError:null};case"writeFailed":return{...l,busy:"",writeError:e.error};default:return l}},"je"),He=i(l=>{let e=(0,ee.c)(67),{expiration:n,keyName:u,namespace:s,onDeleted:p}=l,o=G(),t=R(),[r,y]=(0,P.useReducer)(ze,Ae),c,x;e[0]!==o||e[1]!==u||e[2]!==s?(c=i(()=>{let f={cancelled:!1};return z((async()=>{try{let j=await o.getKvValue({key:u,namespace:s});f.cancelled||y({metadata:j.metadata,type:"loaded",value:j.value})}catch(j){let H=j;f.cancelled||y({error:Z(H),type:"loadFailed"})}})()),()=>{f.cancelled=!0}},"o"),x=[o,s,u],e[0]=o,e[1]=u,e[2]=s,e[3]=c,e[4]=x):(c=e[3],x=e[4]),(0,P.useEffect)(c,x);let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=i(f=>{y({type:"editValue",value:f.target.value})},"k"),e[5]=b):b=e[5];let _=b,V;e[6]===Symbol.for("react.memo_cache_sentinel")?(V=i(f=>{y({type:"editMetadata",value:f})},"K"),e[6]=V):V=e[6];let T=V,h;e[7]!==r.editedValue?(h=Fe(r.editedValue),e[7]=r.editedValue,e[8]=h):h=e[8];let v=h,k;e[9]!==r.editedMetadata?(k=Ke(r.editedMetadata),e[9]=r.editedMetadata,e[10]=k):k=e[10];let N=k,C;e[11]!==r.editedTtl?(C=Ve(r.editedTtl),e[11]=r.editedTtl,e[12]=C):C=e[12];let w=C,g;e[13]!==v?(g=i(()=>{v!==void 0&&y({type:"editValue",value:v})},"y"),e[13]=v,e[14]=g):g=e[14];let S=g,E;e[15]!==o||e[16]!==n||e[17]!==u||e[18]!==N||e[19]!==s||e[20]!==r.editedMetadata||e[21]!==r.editedTtl||e[22]!==r.editedValue||e[23]!==t?(E=i(()=>{if(!N){y({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}y({type:"saveStart"}),z((async()=>{try{await o.putKvValue(Te({metadata:r.editedMetadata,ttl:r.editedTtl,value:r.editedValue},u,s,n)),y({type:"saveOk"})}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"F"),e[15]=o,e[16]=n,e[17]=u,e[18]=N,e[19]=s,e[20]=r.editedMetadata,e[21]=r.editedTtl,e[22]=r.editedValue,e[23]=t,e[24]=E):E=e[24];let B=E,M;e[25]!==o||e[26]!==u||e[27]!==s||e[28]!==p?(M=i(()=>{y({type:"deleteStart"}),z((async()=>{try{await o.deleteKvKey({key:u,namespace:s}),p(u)}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"I"),e[25]=o,e[26]=u,e[27]=s,e[28]=p,e[29]=M):M=e[29];let J=M,L;e[30]!==u?(L=i(()=>{de(u)},"A"),e[30]=u,e[31]=L):L=e[31];let I;e[32]!==t?(I=t("Copy key"),e[32]=t,e[33]=I):I=e[33];let d;e[34]!==L||e[35]!==I?(d=(0,a.jsx)("div",{className:"mb-2 flex justify-end",children:(0,a.jsx)($,{"data-testid":"kv-copy-key-btn",onClick:L,size:"sm",variant:"outline",children:I})}),e[34]=L,e[35]=I,e[36]=d):d=e[36];let m;e[37]!==r.loadError?(m=r.loadError!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:r.loadError}),e[37]=r.loadError,e[38]=m):m=e[38];let F;e[39]!==r.loading||e[40]!==t?(F=r.loading&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading\u2026")}),e[39]=r.loading,e[40]=t,e[41]=F):F=e[41];let O;e[42]!==v||e[43]!==N||e[44]!==J||e[45]!==S||e[46]!==B||e[47]!==r.busy||e[48]!==r.editedMetadata||e[49]!==r.editedValue||e[50]!==r.loading||e[51]!==r.value||e[52]!==r.writeError||e[53]!==t||e[54]!==w?(O=!r.loading&&r.value!==null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")}),v!==void 0&&(0,a.jsx)(he,{variant:"secondary",children:t("JSON")}),(0,a.jsx)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:ge(Je(r.editedValue))})]}),(0,a.jsx)("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:_,value:r.editedValue}),(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-format-btn",disabled:v===void 0,onClick:S,size:"sm",variant:"outline",children:t("Format JSON")}),(0,a.jsx)($,{"data-testid":"kv-copy-value-btn",onClick:i(()=>{de(r.editedValue)},"onClick"),size:"sm",variant:"outline",children:t("Copy value")})]}),(0,a.jsx)(Me,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!w,onChange:i(f=>{y({type:"editTtl",value:f})},"onChange"),testId:"kv-ttl-input"}),(0,a.jsx)(Ie,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:T,testId:"kv-metadata-editor",valid:N,value:r.editedMetadata}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-save-btn",disabled:r.busy!==""||!N||!w,onClick:B,children:r.busy==="saving"?t("Saving\u2026"):t("Save")}),(0,a.jsx)($,{"data-testid":"kv-delete-btn",disabled:r.busy!=="",onClick:J,variant:"destructive",children:r.busy==="deleting"?t("Deleting\u2026"):t("Delete")})]}),r.writeError!==null&&(0,a.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:r.writeError})]}),e[42]=v,e[43]=N,e[44]=J,e[45]=S,e[46]=B,e[47]=r.busy,e[48]=r.editedMetadata,e[49]=r.editedValue,e[50]=r.loading,e[51]=r.value,e[52]=r.writeError,e[53]=t,e[54]=w,e[55]=O):O=e[55];let K;e[56]!==r.loadError||e[57]!==r.loading||e[58]!==r.value||e[59]!==t?(K=!r.loading&&r.value===null&&r.loadError===null&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")}),e[56]=r.loadError,e[57]=r.loading,e[58]=r.value,e[59]=t,e[60]=K):K=e[60];let D;return e[61]!==d||e[62]!==m||e[63]!==F||e[64]!==O||e[65]!==K?(D=(0,a.jsxs)("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[d,m,F,O,K]}),e[61]=d,e[62]=m,e[63]=F,e[64]=O,e[65]=K,e[66]=D):D=e[66],D},"He"),Se=100,Ze={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},Re=i((l,e)=>{switch(e.type){case"appendPage":return e.generation!==l.reloadNonce?l:{...l,cursor:e.cursor,keys:[...l.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...l,appliedPrefix:l.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,reloadNonce:l.reloadNonce+1,selectedKey:null};case"bulkDeleted":{let n=new Set(e.deleted);return{...l,bulk:l.bulk.filter(u=>!n.has(u)),bulkBusy:!1,bulkError:e.error,keys:l.keys===null?null:l.keys.filter(u=>!n.has(u.name)),selectedKey:l.selectedKey!==null&&n.has(l.selectedKey)?null:l.selectedKey}}case"bulkDeleteStart":return{...l,bulkBusy:!0,bulkError:null};case"firstPage":return{...l,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...l,bulk:l.bulk.filter(n=>n!==e.name),keys:l.keys===null?null:l.keys.filter(n=>n.name!==e.name),selectedKey:null};case"loadFailed":return e.generation!==void 0&&e.generation!==l.reloadNonce?l:{...l,loadError:e.error,loading:!1};case"loadStart":return{...l,loadError:null,loading:!0};case"prefixInput":return{...l,prefixInput:e.value};case"reload":return{...l,bulk:[],bulkError:null,reloadNonce:l.reloadNonce+1,selectedKey:null};case"selectKey":return{...l,selectedKey:e.name};case"toggleAllBulk":return{...l,bulk:e.names};case"toggleBulk":return{...l,bulk:l.bulk.includes(e.name)?l.bulk.filter(n=>n!==e.name):[...l.bulk,e.name]};default:return l}},"ze"),Ue=i(({namespace:l})=>{let e=G(),n=R(),[u,s]=(0,P.useReducer)(Re,Ze),{appliedPrefix:p,bulk:o,bulkBusy:t,bulkError:r,cursor:y,keys:c,listComplete:x,loadError:b,loading:_,prefixInput:V,reloadNonce:T,selectedKey:h}=u,[v,k]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let d={cancelled:!1};return z((async()=>{s({type:"loadStart"});try{let m=await e.listKvKeys({limit:Se,namespace:l,prefix:p===""?void 0:p});d.cancelled||s({cursor:m.cursor??null,keys:m.keys,listComplete:m.listComplete,type:"firstPage"})}catch(m){d.cancelled||s({error:Z(m),type:"loadFailed"})}})()),()=>{d.cancelled=!0}},[e,l,p,T]);let N=i(d=>{s({type:"prefixInput",value:d.target.value})},"x"),C=i(()=>{s({type:"applyFilter"})},"N"),w=i(d=>{s({name:d.currentTarget.dataset.key??null,type:"selectKey"})},"C"),g=i(()=>{if(y===null)return;s({type:"loadStart"});let d=T;z((async()=>{try{let m=await e.listKvKeys({cursor:y,limit:Se,namespace:l,prefix:p===""?void 0:p});s({cursor:m.cursor??null,generation:d,keys:m.keys,listComplete:m.listComplete,type:"appendPage"})}catch(m){s({error:Z(m),generation:d,type:"loadFailed"})}})())},"y"),S=i(d=>{s({name:d,type:"keyDeleted"})},"S"),E=i(d=>{s({name:d,type:"toggleBulk"})},"F"),B=i(d=>{s({names:d&&c!==null?c.map(m=>m.name):[],type:"toggleAllBulk"})},"O"),M=i(()=>{if(o.length===0)return;let d=[...o];s({type:"bulkDeleteStart"}),z((async()=>{let m=await Promise.allSettled(d.map(K=>e.deleteKvKey({key:K,namespace:l}))),F=d.filter((K,D)=>m[D]?.status==="fulfilled"),O=d.length-F.length;s({deleted:F,error:O>0?n("Failed to delete {count} keys.",{count:O}):null,type:"bulkDeleted"})})())},"I"),J=i(()=>{k(!1),s({type:"reload"})},"D"),L=c!==null&&c.length>0&&o.length===c.length,I=new Set(o);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(ae,{"aria-label":n("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:N,placeholder:n("Filter by prefix\u2026"),value:V}),(0,a.jsx)($,{"data-testid":"kv-filter-btn",disabled:_,onClick:C,children:n("Filter")}),(0,a.jsx)($,{"data-testid":"kv-new-key-btn",onClick:i(()=>{k(d=>!d)},"onClick"),variant:"outline",children:n("New key")}),o.length>0&&(0,a.jsx)($,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:M,variant:"destructive",children:t?n("Deleting\u2026"):n("Delete {count}",{count:o.length})})]}),r!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:r}),b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:b}),c!==null&&c.length===0&&!_&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:n("No keys.")}),c!==null&&c.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-key-table",children:[(0,a.jsx)(ie,{children:(0,a.jsxs)(Q,{children:[(0,a.jsx)(X,{className:"w-10",children:(0,a.jsx)(ue,{"aria-label":n("Select all"),checked:L,"data-testid":"kv-select-all",onCheckedChange:B})}),(0,a.jsx)(X,{children:n("Key")}),(0,a.jsx)(X,{children:n("Expiration")})]})}),(0,a.jsx)(oe,{children:c.map(d=>(0,a.jsxs)(Q,{className:d.name===h?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":d.name,"data-testid":`kv-key-row-${d.name}`,onClick:w,children:[(0,a.jsx)(Y,{onClick:i(m=>{m.stopPropagation()},"onClick"),children:(0,a.jsx)(ue,{"aria-label":n("Select {name}",{name:d.name}),checked:I.has(d.name),"data-testid":`kv-select-${d.name}`,onCheckedChange:i(()=>{E(d.name)},"onCheckedChange")})}),(0,a.jsx)(Y,{className:"font-mono text-xs",children:d.name}),(0,a.jsx)(Y,{className:"tabular-nums text-xs",children:Le(d.expiration)})]},d.name))})]})})}),!x&&y!==null&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)($,{"data-testid":"kv-load-more",disabled:_,onClick:g,variant:"outline",children:n(_?"Loading\u2026":"Load more")})})]}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||k(!1)},"onOpenChange"),open:v,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{children:n("New key")})}),(0,a.jsx)(je,{namespace:l,onCancel:i(()=>{k(!1)},"onCancel"),onCreated:J})]})}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||s({name:null,type:"selectKey"})},"onOpenChange"),open:h!==null,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{className:"truncate font-mono text-xs",children:h})}),h!==null&&(0,a.jsx)(He,{expiration:c?.find(d=>d.name===h)?.expiration,keyName:h,namespace:l,onDeleted:S},`${l}:${h}`)]})})]})},"Ue"),it=i(({loadNamespaces:l}={})=>{let e=G(),n=R(),[u,s]=(0,P.useState)(null),[p,o]=(0,P.useState)(null),[t,r]=(0,P.useState)(null);(0,P.useEffect)(()=>{let c={cancelled:!1};return z((async()=>{try{let x=await(l??(()=>e.listKvNamespaces()))();c.cancelled||(s(x),o(null),r(b=>b??x[0]?.binding??null))}catch(x){c.cancelled||(s(null),o(Z(x)))}})()),()=>{c.cancelled=!0}},[e,l]);let y=i(c=>{r(c.currentTarget.dataset.ns??null)},"f");return(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[p!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:p}),u!==null&&u.length===0&&(0,a.jsx)(ke,{description:n("Add a kv_namespaces binding to wrangler.jsonc \u2014 it appears here automatically, no wiring needed."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"})}),testId:"kv-empty",title:n("No KV namespaces.")}),u!==null&&u.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-namespace-table",children:[(0,a.jsx)(ie,{children:(0,a.jsx)(Q,{children:(0,a.jsx)(X,{children:n("Namespace")})})}),(0,a.jsx)(oe,{children:u.map(c=>(0,a.jsx)(Q,{className:c.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":c.binding,"data-testid":`kv-ns-row-${c.binding}`,onClick:y,children:(0,a.jsx)(Y,{className:"font-mono text-xs",children:c.binding})},c.binding))})]})})}),t!==null&&(0,a.jsx)(Ue,{namespace:t},t)]})},"ut");export{it as KvBrowser};
|
|
1
|
+
import{a as be,b as fe,c as xe,d as Ne,e as Ce}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as ce}from"./chunk-FPI7AMQJ.js";import{a as ue}from"./chunk-7RKB5KS7.js";import{a as q}from"./chunk-37WYCOQ2.js";import{g as me,h as ve,i as pe,j as ye}from"./chunk-WCAUFFIX.js";import"./chunk-XGCIDUJF.js";import"./chunk-ZHLX75F6.js";import"./chunk-CCDX5RYT.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-WJRYEML4.js";import"./chunk-FUYEZFBP.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as $}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as he}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import"./chunk-4ZEL6BYL.js";import"./chunk-W36YKEUZ.js";import{l as G}from"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as ke}from"./chunk-RWVIV3U7.js";import{a as se,b as ie,c as oe,d as Q,e as X,f as Y}from"./chunk-HCTJKP5J.js";import{a as re,e as ne}from"./chunk-2IKDEUCX.js";import{d as R,h as Z,l as ge,p as z,s as de}from"./chunk-HJHSQPHW.js";import{a as i,d as le,e as Oe,f as _e,g as De}from"./chunk-I26MS5PJ.js";var P=le(Oe(),1);var ee=le(_e(),1);var a=le(De(),1);var Be=i(l=>{let e=l.trim();if(e==="")return;let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):void 0},"Be"),Le=i(l=>l===void 0?"\u2014":new Date(l*1e3).toISOString(),"Oe"),Je=i(l=>new TextEncoder().encode(l).length,"Ae"),Fe=i(l=>{if(l.trim()!=="")try{return JSON.stringify(JSON.parse(l),void 0,2)}catch{return}},"ge"),Ke=i(l=>{if(l.trim()==="")return!0;try{return JSON.parse(l),!0}catch{return!1}},"xe"),Ee=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],we=i((l,e)=>{let n=l.trim();if(n==="")return"";let u=Number(n),s=Ee.find(p=>p.key===e)?.seconds??1;return Number.isFinite(u)&&u>0?String(Math.round(u*s)):n},"ue"),Ve=i(l=>{let e=l.trim();if(e==="")return!0;let n=Number(e);return Number.isInteger(n)&&n>=60},"Ce"),Te=i((l,e,n,u)=>{let s=Be(l.ttl);return{expiration:s===void 0?u:void 0,expirationTtl:s,key:e,metadata:l.metadata.trim()===""?void 0:JSON.parse(l.metadata),namespace:n,value:l.value}},"Se"),Me=i(l=>{let e=(0,ee.c)(60),{helper:n,id:u,invalid:s,onChange:p,testId:o}=l,t=R(),[r,y]=(0,P.useState)(""),[c,x]=(0,P.useState)("seconds"),b;e[0]!==p||e[1]!==c?(b=i(f=>{y(f.target.value),p(we(f.target.value,c))},"k"),e[0]=p,e[1]=c,e[2]=b):b=e[2];let _=b,V;e[3]!==r||e[4]!==p?(V=i(f=>{f!==null&&(x(f),p(we(r,f)))},"K"),e[3]=r,e[4]=p,e[5]=V):V=e[5];let T=V,h;e[6]!==t?(h=t("days"),e[6]=t,e[7]=h):h=e[7];let v;e[8]!==t?(v=t("hours"),e[8]=t,e[9]=v):v=e[9];let k;e[10]!==t?(k=t("minutes"),e[10]=t,e[11]=k):k=e[11];let N;e[12]!==t?(N=t("seconds"),e[12]=t,e[13]=N):N=e[13];let C;e[14]!==h||e[15]!==v||e[16]!==k||e[17]!==N?(C={days:h,hours:v,minutes:k,seconds:N},e[14]=h,e[15]=v,e[16]=k,e[17]=N,e[18]=C):C=e[18];let w=C,g;e[19]!==t?(g=t("Expires after"),e[19]=t,e[20]=g):g=e[20];let S;e[21]!==u||e[22]!==g?(S=(0,a.jsx)(q,{className:"text-xs",htmlFor:u,children:g}),e[21]=u,e[22]=g,e[23]=S):S=e[23];let E;e[24]!==t?(E=t("No expiration"),e[24]=t,e[25]=E):E=e[25];let B;e[26]!==r||e[27]!==u||e[28]!==s||e[29]!==_||e[30]!==E||e[31]!==o?(B=(0,a.jsx)(ae,{"aria-invalid":s,className:"flex-1","data-testid":o,id:u,inputMode:"numeric",onChange:_,placeholder:E,value:r}),e[26]=r,e[27]=u,e[28]=s,e[29]=_,e[30]=E,e[31]=o,e[32]=B):B=e[32];let M;e[33]!==t?(M=t("TTL unit"),e[33]=t,e[34]=M):M=e[34];let J=`${o}-unit`,L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(fe,{}),e[35]=L):L=e[35];let I;e[36]!==M||e[37]!==J?(I=(0,a.jsx)(xe,{"aria-label":M,className:"w-[7.5rem]","data-testid":J,children:L}),e[36]=M,e[37]=J,e[38]=I):I=e[38];let d;e[39]!==w?(d=Ee.map(f=>(0,a.jsx)(Ce,{value:f.key,children:w[f.key]},f.key)),e[39]=w,e[40]=d):d=e[40];let m;e[41]!==d?(m=(0,a.jsx)(Ne,{children:d}),e[41]=d,e[42]=m):m=e[42];let F;e[43]!==T||e[44]!==I||e[45]!==m||e[46]!==c?(F=(0,a.jsxs)(be,{onValueChange:T,value:c,children:[I,m]}),e[43]=T,e[44]=I,e[45]=m,e[46]=c,e[47]=F):F=e[47];let O;e[48]!==B||e[49]!==F?(O=(0,a.jsxs)("div",{className:"flex gap-2",children:[B,F]}),e[48]=B,e[49]=F,e[50]=O):O=e[50];let K;e[51]!==n||e[52]!==s||e[53]!==t||e[54]!==o?(K=s?(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":`${o}-invalid`,children:t("TTL must be at least 60 seconds.")}):n!==void 0&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:n}),e[51]=n,e[52]=s,e[53]=t,e[54]=o,e[55]=K):K=e[55];let D;return e[56]!==O||e[57]!==K||e[58]!==S?(D=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[S,O,K]}),e[56]=O,e[57]=K,e[58]=S,e[59]=D):D=e[59],D},"we"),Ie=i(l=>{let e=(0,ee.c)(36),{id:n,invalidTestId:u,onChange:s,testId:p,valid:o,value:t}=l,r=R(),y;e[0]!==t?(y=Fe(t),e[0]=t,e[1]=y):y=e[1];let c=y,x;e[2]!==r?(x=r("Metadata (JSON)"),e[2]=r,e[3]=x):x=e[3];let b;e[4]!==n||e[5]!==x?(b=(0,a.jsx)(q,{className:"text-xs",htmlFor:n,children:x}),e[4]=n,e[5]=x,e[6]=b):b=e[6];let _=`${p}-format`,V=c===void 0,T;e[7]!==c||e[8]!==s?(T=i(()=>{c!==void 0&&s(c)},"V"),e[7]=c,e[8]=s,e[9]=T):T=e[9];let h;e[10]!==r?(h=r("Format JSON"),e[10]=r,e[11]=h):h=e[11];let v;e[12]!==_||e[13]!==V||e[14]!==T||e[15]!==h?(v=(0,a.jsx)($,{"data-testid":_,disabled:V,onClick:T,size:"sm",variant:"outline",children:h}),e[12]=_,e[13]=V,e[14]=T,e[15]=h,e[16]=v):v=e[16];let k;e[17]!==b||e[18]!==v?(k=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[b,v]}),e[17]=b,e[18]=v,e[19]=k):k=e[19];let N=!o,C;e[20]!==s?(C=i(E=>{s(E.target.value)},"N"),e[20]=s,e[21]=C):C=e[21];let w;e[22]!==n||e[23]!==N||e[24]!==C||e[25]!==p||e[26]!==t?(w=(0,a.jsx)(ce,{"aria-invalid":N,className:"min-h-[4rem] font-mono text-xs","data-testid":p,id:n,onChange:C,value:t}),e[22]=n,e[23]=N,e[24]=C,e[25]=p,e[26]=t,e[27]=w):w=e[27];let g;e[28]!==u||e[29]!==r||e[30]!==o?(g=!o&&(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":u,children:r("Metadata must be valid JSON.")}),e[28]=u,e[29]=r,e[30]=o,e[31]=g):g=e[31];let S;return e[32]!==w||e[33]!==g||e[34]!==k?(S=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[k,w,g]}),e[32]=w,e[33]=g,e[34]=k,e[35]=S):S=e[35],S},"Te"),Pe={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},$e=i((l,e)=>{switch(e.type){case"setField":return{...l,[e.field]:e.value};case"submitFailed":return{...l,busy:!1,error:e.error};case"submitStart":return{...l,busy:!0,error:null};default:return l}},"Je"),je=i(l=>{let e=(0,ee.c)(73),{namespace:n,onCancel:u,onCreated:s}=l,p=G(),o=R(),[t,r]=(0,P.useReducer)($e,Pe),y;e[0]!==t.metadata?(y=Ke(t.metadata),e[0]=t.metadata,e[1]=y):y=e[1];let c=y,x;e[2]!==t.ttl?(x=Ve(t.ttl),e[2]=t.ttl,e[3]=x):x=e[3];let b=x,_;e[4]!==c||e[5]!==t.busy||e[6]!==t.name||e[7]!==b?(_=t.name.trim()!==""&&c&&b&&!t.busy,e[4]=c,e[5]=t.busy,e[6]=t.name,e[7]=b,e[8]=_):_=e[8];let V=_,T;e[9]!==V||e[10]!==p||e[11]!==n||e[12]!==s||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(T=i(()=>{V&&(r({type:"submitStart"}),z((async()=>{try{await p.putKvValue(Te({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,n)),s()}catch(A){r({error:Z(A),type:"submitFailed"})}})()))},"V"),e[9]=V,e[10]=p,e[11]=n,e[12]=s,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=T):T=e[17];let h=T,v;e[18]!==o?(v=o("Key name"),e[18]=o,e[19]=v):v=e[19];let k;e[20]!==v?(k=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-name",children:v}),e[20]=v,e[21]=k):k=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=i(A=>{r({field:"name",type:"setField",value:A.target.value})},"x"),e[22]=N):N=e[22];let C;e[23]!==o?(C=o("Key name"),e[23]=o,e[24]=C):C=e[24];let w;e[25]!==t.name||e[26]!==C?(w=(0,a.jsx)(ae,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:N,placeholder:C,value:t.name}),e[25]=t.name,e[26]=C,e[27]=w):w=e[27];let g;e[28]!==k||e[29]!==w?(g=(0,a.jsxs)("div",{className:"grid gap-1",children:[k,w]}),e[28]=k,e[29]=w,e[30]=g):g=e[30];let S;e[31]!==o?(S=o("Value"),e[31]=o,e[32]=S):S=e[32];let E;e[33]!==S?(E=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-value",children:S}),e[33]=S,e[34]=E):E=e[34];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=i(A=>{r({field:"value",type:"setField",value:A.target.value})},"O"),e[35]=B):B=e[35];let M;e[36]!==t.value?(M=(0,a.jsx)(ce,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:B,value:t.value}),e[36]=t.value,e[37]=M):M=e[37];let J;e[38]!==E||e[39]!==M?(J=(0,a.jsxs)("div",{className:"grid gap-1",children:[E,M]}),e[38]=E,e[39]=M,e[40]=J):J=e[40];let L=!b,I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=i(A=>{r({field:"ttl",type:"setField",value:A})},"_"),e[41]=I):I=e[41];let d;e[42]!==L?(d=(0,a.jsx)(Me,{id:"kv-create-ttl",invalid:L,onChange:I,testId:"kv-create-ttl"}),e[42]=L,e[43]=d):d=e[43];let m;e[44]===Symbol.for("react.memo_cache_sentinel")?(m=i(A=>{r({field:"metadata",type:"setField",value:A})},"u"),e[44]=m):m=e[44];let F;e[45]!==c||e[46]!==t.metadata?(F=(0,a.jsx)(Ie,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:m,testId:"kv-create-metadata",valid:c,value:t.metadata}),e[45]=c,e[46]=t.metadata,e[47]=F):F=e[47];let O=!V,K;e[48]!==t.busy||e[49]!==o?(K=t.busy?o("Creating\u2026"):o("Create key"),e[48]=t.busy,e[49]=o,e[50]=K):K=e[50];let D;e[51]!==h||e[52]!==O||e[53]!==K?(D=(0,a.jsx)($,{"data-testid":"kv-create-submit",disabled:O,onClick:h,children:K}),e[51]=h,e[52]=O,e[53]=K,e[54]=D):D=e[54];let f=t.busy,j;e[55]!==o?(j=o("Cancel"),e[55]=o,e[56]=j):j=e[56];let H;e[57]!==u||e[58]!==t.busy||e[59]!==j?(H=(0,a.jsx)($,{"data-testid":"kv-create-cancel",disabled:f,onClick:u,variant:"outline",children:j}),e[57]=u,e[58]=t.busy,e[59]=j,e[60]=H):H=e[60];let U;e[61]!==D||e[62]!==H?(U=(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[D,H]}),e[61]=D,e[62]=H,e[63]=U):U=e[63];let W;e[64]!==t.error?(W=t.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error}),e[64]=t.error,e[65]=W):W=e[65];let te;return e[66]!==g||e[67]!==J||e[68]!==d||e[69]!==F||e[70]!==U||e[71]!==W?(te=(0,a.jsxs)("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[g,J,d,F,U,W]}),e[66]=g,e[67]=J,e[68]=d,e[69]=F,e[70]=U,e[71]=W,e[72]=te):te=e[72],te},"Pe"),Ae={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},ze=i((l,e)=>{switch(e.type){case"deleteStart":return{...l,busy:"deleting",writeError:null};case"editMetadata":return{...l,editedMetadata:e.value};case"editTtl":return{...l,editedTtl:e.value};case"editValue":return{...l,editedValue:e.value};case"loaded":return{...l,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...l,loadError:e.error,loading:!1};case"saveOk":return{...l,busy:"",value:l.editedValue};case"saveStart":return{...l,busy:"saving",writeError:null};case"writeFailed":return{...l,busy:"",writeError:e.error};default:return l}},"je"),He=i(l=>{let e=(0,ee.c)(67),{expiration:n,keyName:u,namespace:s,onDeleted:p}=l,o=G(),t=R(),[r,y]=(0,P.useReducer)(ze,Ae),c,x;e[0]!==o||e[1]!==u||e[2]!==s?(c=i(()=>{let f={cancelled:!1};return z((async()=>{try{let j=await o.getKvValue({key:u,namespace:s});f.cancelled||y({metadata:j.metadata,type:"loaded",value:j.value})}catch(j){let H=j;f.cancelled||y({error:Z(H),type:"loadFailed"})}})()),()=>{f.cancelled=!0}},"o"),x=[o,s,u],e[0]=o,e[1]=u,e[2]=s,e[3]=c,e[4]=x):(c=e[3],x=e[4]),(0,P.useEffect)(c,x);let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=i(f=>{y({type:"editValue",value:f.target.value})},"k"),e[5]=b):b=e[5];let _=b,V;e[6]===Symbol.for("react.memo_cache_sentinel")?(V=i(f=>{y({type:"editMetadata",value:f})},"K"),e[6]=V):V=e[6];let T=V,h;e[7]!==r.editedValue?(h=Fe(r.editedValue),e[7]=r.editedValue,e[8]=h):h=e[8];let v=h,k;e[9]!==r.editedMetadata?(k=Ke(r.editedMetadata),e[9]=r.editedMetadata,e[10]=k):k=e[10];let N=k,C;e[11]!==r.editedTtl?(C=Ve(r.editedTtl),e[11]=r.editedTtl,e[12]=C):C=e[12];let w=C,g;e[13]!==v?(g=i(()=>{v!==void 0&&y({type:"editValue",value:v})},"y"),e[13]=v,e[14]=g):g=e[14];let S=g,E;e[15]!==o||e[16]!==n||e[17]!==u||e[18]!==N||e[19]!==s||e[20]!==r.editedMetadata||e[21]!==r.editedTtl||e[22]!==r.editedValue||e[23]!==t?(E=i(()=>{if(!N){y({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}y({type:"saveStart"}),z((async()=>{try{await o.putKvValue(Te({metadata:r.editedMetadata,ttl:r.editedTtl,value:r.editedValue},u,s,n)),y({type:"saveOk"})}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"F"),e[15]=o,e[16]=n,e[17]=u,e[18]=N,e[19]=s,e[20]=r.editedMetadata,e[21]=r.editedTtl,e[22]=r.editedValue,e[23]=t,e[24]=E):E=e[24];let B=E,M;e[25]!==o||e[26]!==u||e[27]!==s||e[28]!==p?(M=i(()=>{y({type:"deleteStart"}),z((async()=>{try{await o.deleteKvKey({key:u,namespace:s}),p(u)}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"I"),e[25]=o,e[26]=u,e[27]=s,e[28]=p,e[29]=M):M=e[29];let J=M,L;e[30]!==u?(L=i(()=>{de(u)},"A"),e[30]=u,e[31]=L):L=e[31];let I;e[32]!==t?(I=t("Copy key"),e[32]=t,e[33]=I):I=e[33];let d;e[34]!==L||e[35]!==I?(d=(0,a.jsx)("div",{className:"mb-2 flex justify-end",children:(0,a.jsx)($,{"data-testid":"kv-copy-key-btn",onClick:L,size:"sm",variant:"outline",children:I})}),e[34]=L,e[35]=I,e[36]=d):d=e[36];let m;e[37]!==r.loadError?(m=r.loadError!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:r.loadError}),e[37]=r.loadError,e[38]=m):m=e[38];let F;e[39]!==r.loading||e[40]!==t?(F=r.loading&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading\u2026")}),e[39]=r.loading,e[40]=t,e[41]=F):F=e[41];let O;e[42]!==v||e[43]!==N||e[44]!==J||e[45]!==S||e[46]!==B||e[47]!==r.busy||e[48]!==r.editedMetadata||e[49]!==r.editedValue||e[50]!==r.loading||e[51]!==r.value||e[52]!==r.writeError||e[53]!==t||e[54]!==w?(O=!r.loading&&r.value!==null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")}),v!==void 0&&(0,a.jsx)(he,{variant:"secondary",children:t("JSON")}),(0,a.jsx)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:ge(Je(r.editedValue))})]}),(0,a.jsx)("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:_,value:r.editedValue}),(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-format-btn",disabled:v===void 0,onClick:S,size:"sm",variant:"outline",children:t("Format JSON")}),(0,a.jsx)($,{"data-testid":"kv-copy-value-btn",onClick:i(()=>{de(r.editedValue)},"onClick"),size:"sm",variant:"outline",children:t("Copy value")})]}),(0,a.jsx)(Me,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!w,onChange:i(f=>{y({type:"editTtl",value:f})},"onChange"),testId:"kv-ttl-input"}),(0,a.jsx)(Ie,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:T,testId:"kv-metadata-editor",valid:N,value:r.editedMetadata}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-save-btn",disabled:r.busy!==""||!N||!w,onClick:B,children:r.busy==="saving"?t("Saving\u2026"):t("Save")}),(0,a.jsx)($,{"data-testid":"kv-delete-btn",disabled:r.busy!=="",onClick:J,variant:"destructive",children:r.busy==="deleting"?t("Deleting\u2026"):t("Delete")})]}),r.writeError!==null&&(0,a.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:r.writeError})]}),e[42]=v,e[43]=N,e[44]=J,e[45]=S,e[46]=B,e[47]=r.busy,e[48]=r.editedMetadata,e[49]=r.editedValue,e[50]=r.loading,e[51]=r.value,e[52]=r.writeError,e[53]=t,e[54]=w,e[55]=O):O=e[55];let K;e[56]!==r.loadError||e[57]!==r.loading||e[58]!==r.value||e[59]!==t?(K=!r.loading&&r.value===null&&r.loadError===null&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")}),e[56]=r.loadError,e[57]=r.loading,e[58]=r.value,e[59]=t,e[60]=K):K=e[60];let D;return e[61]!==d||e[62]!==m||e[63]!==F||e[64]!==O||e[65]!==K?(D=(0,a.jsxs)("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[d,m,F,O,K]}),e[61]=d,e[62]=m,e[63]=F,e[64]=O,e[65]=K,e[66]=D):D=e[66],D},"He"),Se=100,Ze={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},Re=i((l,e)=>{switch(e.type){case"appendPage":return e.generation!==l.reloadNonce?l:{...l,cursor:e.cursor,keys:[...l.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...l,appliedPrefix:l.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,reloadNonce:l.reloadNonce+1,selectedKey:null};case"bulkDeleted":{let n=new Set(e.deleted);return{...l,bulk:l.bulk.filter(u=>!n.has(u)),bulkBusy:!1,bulkError:e.error,keys:l.keys===null?null:l.keys.filter(u=>!n.has(u.name)),selectedKey:l.selectedKey!==null&&n.has(l.selectedKey)?null:l.selectedKey}}case"bulkDeleteStart":return{...l,bulkBusy:!0,bulkError:null};case"firstPage":return{...l,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...l,bulk:l.bulk.filter(n=>n!==e.name),keys:l.keys===null?null:l.keys.filter(n=>n.name!==e.name),selectedKey:null};case"loadFailed":return e.generation!==void 0&&e.generation!==l.reloadNonce?l:{...l,loadError:e.error,loading:!1};case"loadStart":return{...l,loadError:null,loading:!0};case"prefixInput":return{...l,prefixInput:e.value};case"reload":return{...l,bulk:[],bulkError:null,reloadNonce:l.reloadNonce+1,selectedKey:null};case"selectKey":return{...l,selectedKey:e.name};case"toggleAllBulk":return{...l,bulk:e.names};case"toggleBulk":return{...l,bulk:l.bulk.includes(e.name)?l.bulk.filter(n=>n!==e.name):[...l.bulk,e.name]};default:return l}},"ze"),Ue=i(({namespace:l})=>{let e=G(),n=R(),[u,s]=(0,P.useReducer)(Re,Ze),{appliedPrefix:p,bulk:o,bulkBusy:t,bulkError:r,cursor:y,keys:c,listComplete:x,loadError:b,loading:_,prefixInput:V,reloadNonce:T,selectedKey:h}=u,[v,k]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let d={cancelled:!1};return z((async()=>{s({type:"loadStart"});try{let m=await e.listKvKeys({limit:Se,namespace:l,prefix:p===""?void 0:p});d.cancelled||s({cursor:m.cursor??null,keys:m.keys,listComplete:m.listComplete,type:"firstPage"})}catch(m){d.cancelled||s({error:Z(m),type:"loadFailed"})}})()),()=>{d.cancelled=!0}},[e,l,p,T]);let N=i(d=>{s({type:"prefixInput",value:d.target.value})},"x"),C=i(()=>{s({type:"applyFilter"})},"N"),w=i(d=>{s({name:d.currentTarget.dataset.key??null,type:"selectKey"})},"C"),g=i(()=>{if(y===null)return;s({type:"loadStart"});let d=T;z((async()=>{try{let m=await e.listKvKeys({cursor:y,limit:Se,namespace:l,prefix:p===""?void 0:p});s({cursor:m.cursor??null,generation:d,keys:m.keys,listComplete:m.listComplete,type:"appendPage"})}catch(m){s({error:Z(m),generation:d,type:"loadFailed"})}})())},"y"),S=i(d=>{s({name:d,type:"keyDeleted"})},"S"),E=i(d=>{s({name:d,type:"toggleBulk"})},"F"),B=i(d=>{s({names:d&&c!==null?c.map(m=>m.name):[],type:"toggleAllBulk"})},"O"),M=i(()=>{if(o.length===0)return;let d=[...o];s({type:"bulkDeleteStart"}),z((async()=>{let m=await Promise.allSettled(d.map(K=>e.deleteKvKey({key:K,namespace:l}))),F=d.filter((K,D)=>m[D]?.status==="fulfilled"),O=d.length-F.length;s({deleted:F,error:O>0?n("Failed to delete {count} keys.",{count:O}):null,type:"bulkDeleted"})})())},"I"),J=i(()=>{k(!1),s({type:"reload"})},"D"),L=c!==null&&c.length>0&&o.length===c.length,I=new Set(o);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(ae,{"aria-label":n("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:N,placeholder:n("Filter by prefix\u2026"),value:V}),(0,a.jsx)($,{"data-testid":"kv-filter-btn",disabled:_,onClick:C,children:n("Filter")}),(0,a.jsx)($,{"data-testid":"kv-new-key-btn",onClick:i(()=>{k(d=>!d)},"onClick"),variant:"outline",children:n("New key")}),o.length>0&&(0,a.jsx)($,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:M,variant:"destructive",children:t?n("Deleting\u2026"):n("Delete {count}",{count:o.length})})]}),r!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:r}),b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:b}),c!==null&&c.length===0&&!_&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:n("No keys.")}),c!==null&&c.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-key-table",children:[(0,a.jsx)(ie,{children:(0,a.jsxs)(Q,{children:[(0,a.jsx)(X,{className:"w-10",children:(0,a.jsx)(ue,{"aria-label":n("Select all"),checked:L,"data-testid":"kv-select-all",onCheckedChange:B})}),(0,a.jsx)(X,{children:n("Key")}),(0,a.jsx)(X,{children:n("Expiration")})]})}),(0,a.jsx)(oe,{children:c.map(d=>(0,a.jsxs)(Q,{className:d.name===h?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":d.name,"data-testid":`kv-key-row-${d.name}`,onClick:w,children:[(0,a.jsx)(Y,{onClick:i(m=>{m.stopPropagation()},"onClick"),children:(0,a.jsx)(ue,{"aria-label":n("Select {name}",{name:d.name}),checked:I.has(d.name),"data-testid":`kv-select-${d.name}`,onCheckedChange:i(()=>{E(d.name)},"onCheckedChange")})}),(0,a.jsx)(Y,{className:"font-mono text-xs",children:d.name}),(0,a.jsx)(Y,{className:"tabular-nums text-xs",children:Le(d.expiration)})]},d.name))})]})})}),!x&&y!==null&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)($,{"data-testid":"kv-load-more",disabled:_,onClick:g,variant:"outline",children:n(_?"Loading\u2026":"Load more")})})]}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||k(!1)},"onOpenChange"),open:v,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{children:n("New key")})}),(0,a.jsx)(je,{namespace:l,onCancel:i(()=>{k(!1)},"onCancel"),onCreated:J})]})}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||s({name:null,type:"selectKey"})},"onOpenChange"),open:h!==null,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{className:"truncate font-mono text-xs",children:h})}),h!==null&&(0,a.jsx)(He,{expiration:c?.find(d=>d.name===h)?.expiration,keyName:h,namespace:l,onDeleted:S},`${l}:${h}`)]})})]})},"Ue"),it=i(({loadNamespaces:l}={})=>{let e=G(),n=R(),[u,s]=(0,P.useState)(null),[p,o]=(0,P.useState)(null),[t,r]=(0,P.useState)(null);(0,P.useEffect)(()=>{let c={cancelled:!1};return z((async()=>{try{let x=await(l??(()=>e.listKvNamespaces()))();c.cancelled||(s(x),o(null),r(b=>b??x[0]?.binding??null))}catch(x){c.cancelled||(s(null),o(Z(x)))}})()),()=>{c.cancelled=!0}},[e,l]);let y=i(c=>{r(c.currentTarget.dataset.ns??null)},"f");return(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[p!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:p}),u!==null&&u.length===0&&(0,a.jsx)(ke,{description:n("Add a kv_namespaces binding to wrangler.jsonc \u2014 it appears here automatically, no wiring needed."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"})}),testId:"kv-empty",title:n("No KV namespaces.")}),u!==null&&u.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-namespace-table",children:[(0,a.jsx)(ie,{children:(0,a.jsx)(Q,{children:(0,a.jsx)(X,{children:n("Namespace")})})}),(0,a.jsx)(oe,{children:u.map(c=>(0,a.jsx)(Q,{className:c.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":c.binding,"data-testid":`kv-ns-row-${c.binding}`,onClick:y,children:(0,a.jsx)(Y,{className:"font-mono text-xs",children:c.binding})},c.binding))})]})})}),t!==null&&(0,a.jsx)(Ue,{namespace:t},t)]})},"ut");export{it as KvBrowser};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ct,b as dt}from"./chunk-
|
|
1
|
+
import{a as ct,b as dt}from"./chunk-72K3I5WQ.js";import{c as at}from"./chunk-NDTQTKDX.js";import{a as it}from"./chunk-NNSCCLU4.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import"./chunk-QJLHH3ET.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as lt}from"./chunk-IWZ7GVQO.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-QSF3YY7X.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import"./chunk-XHRKNCCI.js";import{a as rt}from"./chunk-YVR4SEPU.js";import{b as ot}from"./chunk-ZKJS6EBE.js";import{c as nt,d as Ne,e as De,f as Ae,g as Ke}from"./chunk-RGMVGZV4.js";import{i as Qe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as st}from"./chunk-NCPW7WHO.js";import{a as ke}from"./chunk-4ZEL6BYL.js";import"./chunk-W36YKEUZ.js";import{l as _e}from"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import"./chunk-HCTJKP5J.js";import{d as ae,f as Se,g as Ce,h as tt,p as me}from"./chunk-HJHSQPHW.js";import{a,d as Fe,e as Lt,f as Rt,g as _t,i as ue}from"./chunk-I26MS5PJ.js";var Z=Fe(Rt(),1);var B=Fe(Lt(),1);var u=Fe(_t(),1);var qe=class{static{a(this,"Diff")}diff(e,n,t={}){let r;typeof t=="function"?(r=t,t={}):"callback"in t&&(r=t.callback);let o=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(o,t)),c=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,c,t,r)}diffWithOptionsObj(e,n,t,r){var o;let l=a(p=>{if(p=this.postProcess(p,t),r){setTimeout(function(){r(p)},0);return}else return p},"done"),i=n.length,c=e.length,d=1,m=i+c;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let x=(o=t.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+x,v=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(v[0],n,e,0,t);if(v[0].oldPos+1>=c&&f+1>=i)return l(this.buildValues(v[0].lastComponent,n,e));let N=-1/0,b=1/0,w=a(()=>{for(let p=Math.max(N,-d);p<=Math.min(b,d);p+=2){let S,y=v[p-1],g=v[p+1];y&&(v[p-1]=void 0);let C=!1;if(g){let q=g.oldPos-p;C=g&&0<=q&&q<i}let k=y&&y.oldPos+1<c;if(!C&&!k){v[p]=void 0;continue}if(!k||C&&y.oldPos<g.oldPos?S=this.addToPath(g,!0,!1,0,t):S=this.addToPath(y,!1,!0,1,t),f=this.extractCommon(S,n,e,p,t),S.oldPos+1>=c&&f+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;v[p]=S,S.oldPos+1>=c&&(b=Math.min(b,p-1)),f+1>=i&&(N=Math.max(N,p+1))}d++},"execEditLength");if(r)a(function p(){setTimeout(function(){if(d>m||Date.now()>h)return r(void 0);w()||p()},0)},"exec")();else for(;d<=m&&Date.now()<=h;){let p=w();if(p)return p}}addToPath(e,n,t,r,o){let l=e.lastComponent;return l&&!o.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+r,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,r,o){let l=n.length,i=t.length,c=e.oldPos,d=c-r,m=0;for(;d+1<l&&c+1<i&&this.equals(t[c+1],n[d+1],o);)d++,c++,m++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!o.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,d}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let r=[],o;for(;e;)r.push(e),o=e.previousComponent,delete e.previousComponent,e=o;r.reverse();let l=r.length,i=0,c=0,d=0;for(;i<l;i++){let m=r[i];if(m.removed)m.value=this.join(t.slice(d,d+m.count)),d+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(c,c+m.count);x=x.map(function(h,v){let f=t[d+v];return f.length>h.length?f:h}),m.value=this.join(x)}else m.value=this.join(n.slice(c,c+m.count));c+=m.count,m.added||(d+=m.count)}}return r}};var Ue=class extends qe{static{a(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Dt}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
|
|
2
2
|
`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
|
|
3
3
|
`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
|
|
4
4
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-FWNCU5GC.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-6HLARDYO.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-AV7OEKJ6.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,p as ge}from"./chunk-HJHSQPHW.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
1
|
+
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-FWNCU5GC.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-6HLARDYO.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,p as ge}from"./chunk-HJHSQPHW.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as D}from"./chunk-5B2RTXBS.js";import{a as F}from"./chunk-SV764LKQ.js";import{a as V}from"./chunk-R6U22RSY.js";import{a as T}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as L}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as z}from"./chunk-
|
|
1
|
+
import{a as O,b as D}from"./chunk-5B2RTXBS.js";import{a as F}from"./chunk-SV764LKQ.js";import{a as V}from"./chunk-R6U22RSY.js";import{a as T}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as L}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as z}from"./chunk-53NRDRMS.js";import"./chunk-NCPW7WHO.js";import"./chunk-WK5TYZAF.js";import"./chunk-55UGUCQ6.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as M}from"./chunk-W36YKEUZ.js";import"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as K}from"./chunk-RWVIV3U7.js";import{a as A,b as q,c as B,d as p,e as d,f as n}from"./chunk-HCTJKP5J.js";import{a as I,e as E}from"./chunk-2IKDEUCX.js";import{d as b,m as j,t as k}from"./chunk-HJHSQPHW.js";import{a as i,d as y,e as ee,g as te}from"./chunk-I26MS5PJ.js";var s=y(ee(),1);var e=y(te(),1);var re=i(o=>o===void 0?"":JSON.stringify(o,j),"te"),ae=41,J=480,H=5,ie=i((o,t)=>O(o,l=>{t(l.height>0?l:{height:J,width:l.width})}),"ae"),Ne=i(({initialShardKey:o})=>{let t=b(),{queryShardKey:l,setShardKey:P,shardKey:U}=V(o),[h,W]=(0,s.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:G}=M(R.getAuditLog,{},{live:!0,shardKey:l}),c=(0,s.useMemo)(()=>f?.entries??[],[f]),m=(0,s.useMemo)(()=>{let a=h.trim().toLowerCase();return a===""?c:c.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[c,h]),x=(0,s.useRef)(null),v=D({count:m.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),Q=v.getTotalSize(),N=u[0]?.start??0,w=Q-(u.at(-1)?.end??0),X={height:N},Y={height:w},$=i(a=>{W(a.target.value)},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(T,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(F,{message:G,prefix:"au"}),(0,e.jsx)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:$,placeholder:t("filter op, table, id"),value:h})]}),g!==null&&(0,e.jsx)(z,{error:Z,testId:"au-error"}),g===null&&!_&&m.length===0&&(0,e.jsx)(K,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),m.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(q,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(d,{children:t("time")}),(0,e.jsx)(d,{children:t("op")}),(0,e.jsx)(d,{children:t("table")}),(0,e.jsx)(d,{children:t("id")}),(0,e.jsx)(d,{children:t("detail")})]})}),(0,e.jsxs)(B,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})}),u.map(a=>{let r=m[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(n,{className:"text-muted-foreground tabular-nums",children:k(r.ts,"\u2014")}),(0,e.jsx)(n,{children:(0,e.jsx)(C,{variant:"secondary",children:r.op})}),(0,e.jsx)(n,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Y})})]})]})})})]})},"we");export{Ne as AuditPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as se}from"./chunk-FPI7AMQJ.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-M2FQTDR4.js";import{l as V}from"./chunk-AV7OEKJ6.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as j,b as D,c as F,d as x,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as R,e as _}from"./chunk-2IKDEUCX.js";import{d as X,f as Y,g as Z,h as $,m as ee,p as A}from"./chunk-HJHSQPHW.js";import{a as s,d as re,e as oe,g as le}from"./chunk-I26MS5PJ.js";var l=re(oe(),1);var e=re(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],de=["pause","resume","terminate"],ce="WORKFLOWS_NOT_CONFIGURED",ue=s(o=>typeof o=="object"&&o!==null&&o.code===ce,"ce"),me=s(o=>{let a=o.error??o.output;if(a===void 0)return"\u2014";try{return JSON.stringify(a,ee)}catch{return"(unserializable)"}},"ue"),fe=s(({loadDetail:o,loadInstances:a,readOnly:g,runAction:J,workflowName:k})=>{let T=V(),n=X(),[N,v]=(0,l.useState)(null),[C,I]=(0,l.useState)(null),[b,z]=(0,l.useState)(""),[y,p]=(0,l.useState)(null),[L,O]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),f=(0,l.useRef)(0),h=(0,l.useRef)(0),w=(0,l.useRef)(0),q=o??(r=>T.getWorkflowInstance(r)),E=g?void 0:J??(a===void 0?r=>T.setWorkflowInstanceStatus(r):void 0),K=s(async()=>{h.current+=1;let r=h.current;p(null),O(!1);let c=b===""?void 0:b;try{if(a===void 0){let u=await T.listWorkflowInstances({name:k,status:c});if(r!==h.current)return;if(u.configured===!1){v(null),O(!0);return}v(u.instances);return}let t=await a({name:k,status:c});r===h.current&&v(t)}catch(t){if(r!==h.current)return;v(null),ue(t)?O(!0):p($(t))}},"P");(0,l.useEffect)(()=>{f.current+=1,w.current+=1,I(null),A(K())},[k,b]);let M=s(async r=>{w.current+=1;let c=w.current;p(null);try{let t=await q({id:r,name:k});c===w.current&&I(t)}catch(t){c===w.current&&p($(t))}},"J"),H=s(()=>{w.current+=1,I(null)},"B"),Q=s(async(r,c)=>{if(E===void 0)return;let t=f.current;U(r),p(null);try{await E({action:c,id:r,name:k}),t===f.current&&await K()}catch(u){p($(u))}U(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("select",{"aria-label":n("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(r=>{z(r.target.value)},"onChange"),value:b,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),ie.map(r=>(0,e.jsx)("option",{value:r,children:r},r))]})]}),y!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:y}),L&&(0,e.jsx)(B,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(B,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(F,{children:N.map(r=>(0,e.jsxs)(x,{"data-testid":`workflow-instance-${r.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:r.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(W,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:s(()=>{A(M(r.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),E!==void 0&&de.map(c=>(0,e.jsx)(W,{"data-testid":`workflow-instance-${c}-${r.id}`,disabled:P===r.id,onClick:s(()=>{A(Q(r.id,c))},"onClick"),size:"sm",type:"button",variant:"ghost",children:n(c)},c))]})})]},r.id))})]})})}),C!==null&&(0,e.jsx)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",C.id]}),(0,e.jsx)(W,{"data-testid":"workflow-instance-detail-close",onClick:H,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),C.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(j,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(F,{children:C.steps.map((r,c)=>(0,e.jsxs)(x,{"data-testid":`workflow-step-${String(c)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:r.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:r.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:me(r)})]},`${r.name}:${String(c)}`))})]})]})})]})},"me"),he=Y(G.createWorkflowInstance),pe=Y(G.getWorkflowInstanceStatus),we=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,ee)}catch{return"(unserializable)"}},"pe"),xe=s((o,a)=>o.some(g=>g.exportName===a)?a:o[0]?.exportName??"","xe"),$e=s(()=>{let o=V(),a=X(),{data:g,error:J}=ne(G.listWorkflows,{}),[k,T]=(0,l.useState)(""),[n,N]=(0,l.useState)(""),[v,C]=(0,l.useState)(""),[I,b]=(0,l.useState)(!1),[z,y]=(0,l.useState)(null),[p,L]=(0,l.useState)([]),[O,P]=(0,l.useState)(null),U=g!==void 0,f=Array.isArray(g?.workflows)?[...g.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],h=xe(f,k),w=f.find(t=>t.exportName===h),q=s(t=>{L(u=>{let m=u.filter(S=>!(S.exportName===t.exportName&&S.id===t.id));return[t,...m]})},"D"),E=s(async()=>{let t=h;if(t==="")return;let u,m=v.trim();if(m!=="")try{u=JSON.parse(m)}catch{y(a("Params must be valid JSON"));return}b(!0),y(null);try{let S=n.trim(),te=await o.query(he,{exportName:t,id:S===""?void 0:S,params:u},Z(""));q({exportName:t,id:te.id,status:te.status}),N("")}catch(S){y($(S))}b(!1)},"Q"),K=s(()=>{A(E())},"V"),M=s(async(t,u)=>{P(u);try{let m=await o.query(pe,{exportName:t,id:u},Z(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){y($(m))}P(null)},"O"),H=s(t=>{T(t.target.value)},"P"),Q=s(t=>{N(t.target.value)},"J"),r=s(t=>{C(t.target.value)},"B"),c=s(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&A(M(u,m))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:J}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(B,{description:a("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:a("No workflows defined")}):(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Export")}),(0,e.jsx)(i,{children:a("Name")}),(0,e.jsx)(i,{children:a("Class")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":a("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:H,value:h,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":a("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Q,placeholder:a("Instance id (optional)"),value:n}),(0,e.jsx)(W,{"data-testid":"workflows-start-button",disabled:I||h==="",onClick:K,children:a(I?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(se,{"aria-label":a("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:r,placeholder:a("Params (JSON, optional)"),value:v})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Instances")}),(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Workflow")}),(0,e.jsx)(i,{children:a("Instance id")}),(0,e.jsx)(i,{children:a("Status")}),(0,e.jsx)(i,{children:a("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:O===t.id,onClick:c,size:"xs",variant:"outline",children:O===t.id?a("Refreshing\u2026"):a("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),w!==void 0&&(0,e.jsx)(fe,{workflowName:w.name})]})},"We");export{$e as default};
|
|
1
|
+
import{a as se}from"./chunk-FPI7AMQJ.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-W36YKEUZ.js";import{l as V}from"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as j,b as D,c as F,d as x,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as R,e as _}from"./chunk-2IKDEUCX.js";import{d as X,f as Y,g as Z,h as $,m as ee,p as A}from"./chunk-HJHSQPHW.js";import{a as s,d as re,e as oe,g as le}from"./chunk-I26MS5PJ.js";var l=re(oe(),1);var e=re(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],de=["pause","resume","terminate"],ce="WORKFLOWS_NOT_CONFIGURED",ue=s(o=>typeof o=="object"&&o!==null&&o.code===ce,"ce"),me=s(o=>{let a=o.error??o.output;if(a===void 0)return"\u2014";try{return JSON.stringify(a,ee)}catch{return"(unserializable)"}},"ue"),fe=s(({loadDetail:o,loadInstances:a,readOnly:g,runAction:J,workflowName:k})=>{let T=V(),n=X(),[N,v]=(0,l.useState)(null),[C,I]=(0,l.useState)(null),[b,z]=(0,l.useState)(""),[y,p]=(0,l.useState)(null),[L,O]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),f=(0,l.useRef)(0),h=(0,l.useRef)(0),w=(0,l.useRef)(0),q=o??(r=>T.getWorkflowInstance(r)),E=g?void 0:J??(a===void 0?r=>T.setWorkflowInstanceStatus(r):void 0),K=s(async()=>{h.current+=1;let r=h.current;p(null),O(!1);let c=b===""?void 0:b;try{if(a===void 0){let u=await T.listWorkflowInstances({name:k,status:c});if(r!==h.current)return;if(u.configured===!1){v(null),O(!0);return}v(u.instances);return}let t=await a({name:k,status:c});r===h.current&&v(t)}catch(t){if(r!==h.current)return;v(null),ue(t)?O(!0):p($(t))}},"P");(0,l.useEffect)(()=>{f.current+=1,w.current+=1,I(null),A(K())},[k,b]);let M=s(async r=>{w.current+=1;let c=w.current;p(null);try{let t=await q({id:r,name:k});c===w.current&&I(t)}catch(t){c===w.current&&p($(t))}},"J"),H=s(()=>{w.current+=1,I(null)},"B"),Q=s(async(r,c)=>{if(E===void 0)return;let t=f.current;U(r),p(null);try{await E({action:c,id:r,name:k}),t===f.current&&await K()}catch(u){p($(u))}U(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("select",{"aria-label":n("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(r=>{z(r.target.value)},"onChange"),value:b,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),ie.map(r=>(0,e.jsx)("option",{value:r,children:r},r))]})]}),y!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:y}),L&&(0,e.jsx)(B,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(B,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(F,{children:N.map(r=>(0,e.jsxs)(x,{"data-testid":`workflow-instance-${r.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:r.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(W,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:s(()=>{A(M(r.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),E!==void 0&&de.map(c=>(0,e.jsx)(W,{"data-testid":`workflow-instance-${c}-${r.id}`,disabled:P===r.id,onClick:s(()=>{A(Q(r.id,c))},"onClick"),size:"sm",type:"button",variant:"ghost",children:n(c)},c))]})})]},r.id))})]})})}),C!==null&&(0,e.jsx)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",C.id]}),(0,e.jsx)(W,{"data-testid":"workflow-instance-detail-close",onClick:H,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),C.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(j,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(F,{children:C.steps.map((r,c)=>(0,e.jsxs)(x,{"data-testid":`workflow-step-${String(c)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:r.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:r.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:me(r)})]},`${r.name}:${String(c)}`))})]})]})})]})},"me"),he=Y(G.createWorkflowInstance),pe=Y(G.getWorkflowInstanceStatus),we=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,ee)}catch{return"(unserializable)"}},"pe"),xe=s((o,a)=>o.some(g=>g.exportName===a)?a:o[0]?.exportName??"","xe"),$e=s(()=>{let o=V(),a=X(),{data:g,error:J}=ne(G.listWorkflows,{}),[k,T]=(0,l.useState)(""),[n,N]=(0,l.useState)(""),[v,C]=(0,l.useState)(""),[I,b]=(0,l.useState)(!1),[z,y]=(0,l.useState)(null),[p,L]=(0,l.useState)([]),[O,P]=(0,l.useState)(null),U=g!==void 0,f=Array.isArray(g?.workflows)?[...g.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],h=xe(f,k),w=f.find(t=>t.exportName===h),q=s(t=>{L(u=>{let m=u.filter(S=>!(S.exportName===t.exportName&&S.id===t.id));return[t,...m]})},"D"),E=s(async()=>{let t=h;if(t==="")return;let u,m=v.trim();if(m!=="")try{u=JSON.parse(m)}catch{y(a("Params must be valid JSON"));return}b(!0),y(null);try{let S=n.trim(),te=await o.query(he,{exportName:t,id:S===""?void 0:S,params:u},Z(""));q({exportName:t,id:te.id,status:te.status}),N("")}catch(S){y($(S))}b(!1)},"Q"),K=s(()=>{A(E())},"V"),M=s(async(t,u)=>{P(u);try{let m=await o.query(pe,{exportName:t,id:u},Z(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){y($(m))}P(null)},"O"),H=s(t=>{T(t.target.value)},"P"),Q=s(t=>{N(t.target.value)},"J"),r=s(t=>{C(t.target.value)},"B"),c=s(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&A(M(u,m))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:J}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(B,{description:a("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:a("No workflows defined")}):(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Export")}),(0,e.jsx)(i,{children:a("Name")}),(0,e.jsx)(i,{children:a("Class")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":a("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:H,value:h,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":a("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Q,placeholder:a("Instance id (optional)"),value:n}),(0,e.jsx)(W,{"data-testid":"workflows-start-button",disabled:I||h==="",onClick:K,children:a(I?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(se,{"aria-label":a("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:r,placeholder:a("Params (JSON, optional)"),value:v})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Instances")}),(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Workflow")}),(0,e.jsx)(i,{children:a("Instance id")}),(0,e.jsx)(i,{children:a("Status")}),(0,e.jsx)(i,{children:a("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:O===t.id,onClick:c,size:"xs",variant:"outline",children:O===t.id?a("Refreshing\u2026"):a("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),w!==void 0&&(0,e.jsx)(fe,{workflowName:w.name})]})},"We");export{$e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-YC5NRN4O.js";import"./chunk-53NRDRMS.js";import"./chunk-NCPW7WHO.js";import"./chunk-WK5TYZAF.js";import"./chunk-55UGUCQ6.js";import{a as f}from"./chunk-4ZEL6BYL.js";import{c as m}from"./chunk-W36YKEUZ.js";import"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import"./chunk-HCTJKP5J.js";import"./chunk-2IKDEUCX.js";import{d as p}from"./chunk-HJHSQPHW.js";import{a as r,d as h,f as S,g as A}from"./chunk-I26MS5PJ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-253UHWDX.js";import{a as Q}from"./chunk-JQXA2OYK.js";import{a as L}from"./chunk-R6U22RSY.js";import{a as G}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as $}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as W}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-253UHWDX.js";import{a as Q}from"./chunk-JQXA2OYK.js";import{a as L}from"./chunk-R6U22RSY.js";import{a as G}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as $}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as W}from"./chunk-53NRDRMS.js";import"./chunk-NCPW7WHO.js";import"./chunk-WK5TYZAF.js";import"./chunk-55UGUCQ6.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-W36YKEUZ.js";import"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as A}from"./chunk-RWVIV3U7.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-HCTJKP5J.js";import{a as _}from"./chunk-2IKDEUCX.js";import{d as j}from"./chunk-HJHSQPHW.js";import{a as S,d as F,f as J,g as V}from"./chunk-I26MS5PJ.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,refetch:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-SV764LKQ.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-SV764LKQ.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-W36YKEUZ.js";import"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import"./chunk-VGL7ERWQ.js";import{a as I}from"./chunk-RWVIV3U7.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-HCTJKP5J.js";import{a as b,e as S}from"./chunk-2IKDEUCX.js";import{d as w}from"./chunk-HJHSQPHW.js";import{a as f,d as y,f as _,g as j}from"./chunk-I26MS5PJ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as Ie}from"./chunk-FPI7AMQJ.js";import{a as Se}from"./chunk-XHRKNCCI.js";import{a as we}from"./chunk-YVR4SEPU.js";import{b as pe}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as Ne}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{d as ye}from"./chunk-
|
|
1
|
+
import{a as Ie}from"./chunk-FPI7AMQJ.js";import{a as Se}from"./chunk-XHRKNCCI.js";import{a as we}from"./chunk-YVR4SEPU.js";import{b as pe}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as Ne}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{d as ye}from"./chunk-W36YKEUZ.js";import{c as xe,d as be,l as he}from"./chunk-6L2GY26N.js";import"./chunk-QAQDMS6R.js";import{d as se}from"./chunk-VGL7ERWQ.js";import{a as ne,e as ie}from"./chunk-2IKDEUCX.js";import{d as ge,f as ce,g as de,h as ee,p as me}from"./chunk-HJHSQPHW.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-I26MS5PJ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(G.exportShard),Oe=ce(G.importShard),Le=s(x=>x.map(e=>JSON.stringify(xe(e))).join(`
|
|
2
2
|
`),"Ce"),Je=s(x=>{let e=[],te=x.split(`
|
|
3
3
|
`);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=be(JSON.parse(t));if(typeof o!="object"||o===null)throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"Te"),Ge=s(x=>{let e=(0,ve.c)(94),{initialShardKey:te}=x,n=he(),N=ye(),t=ge(),[o,b]=(0,g.useState)(te??""),[a,fe]=(0,g.useState)(""),[d,F]=(0,g.useState)(!1),[H,K]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[y,ue]=(0,g.useState)(null),Q;e[0]!==n||e[1]!==o?(Q=s(async()=>{F(!0),K(null),re(null);try{let c=await n.query(Ae,{},de(o));pe(o),fe(Le(c.rows)),ue(c.rows.length)}catch(c){K(ee(c))}F(!1)},"G"),e[0]=n,e[1]=o,e[2]=Q):Q=e[2];let M=Q,V;e[3]!==n||e[4]!==N||e[5]!==a||e[6]!==o||e[7]!==t?(V=s(async()=>{F(!0),K(null),re(null),ue(null);let c;try{c=Je(a)}catch(l){K(t("Invalid NDJSON: {message}",{message:ee(l)})),F(!1);return}try{let l=await n.query(Oe,{rows:c},de(o));pe(o),re(l),N(G.readTablePage),N(G.listTables)}catch(l){K(ee(l))}F(!1)},"Q"),e[3]=n,e[4]=N,e[5]=a,e[6]=o,e[7]=t,e[8]=V):V=e[8];let z=V,w,S,I,m,v,p,f,j,C,u,T;if(e[9]!==d||e[10]!==y||e[11]!==M||e[12]!==i||e[13]!==z||e[14]!==a||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(_e,0),l;e[28]!==M?(l=s(()=>{me(M())},"o"),e[28]=M,e[29]=l):l=e[29];let oe=l,Y;e[30]!==z?(Y=s(()=>{me(z())},"Y"),e[30]=z,e[31]=Y):Y=e[31];let ae=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=s(h=>{fe(h.target.value)},"Z"),e[32]=Z):Z=e[32];let je=Z;T="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(we,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(Ne,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==y||e[49]!==t?(q=y!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:y})}),e[48]=y,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="gap-0 py-0 rounded-xl border border-border bg-card shadow-xs";let P;e[57]!==t?(P=t("Import"),e[57]=t,e[58]=P):P=e[58],e[59]!==P?(u=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P})}),e[59]=P,e[60]=u):u=e[60],w=ie,v="flex flex-col gap-3 p-4",e[61]!==a?(p=(0,r.jsx)(Ie,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:je,placeholder:'{"table":"messages","doc":{\u2026}}',value:a}),e[61]=a,e[62]=p):p=e[62];let R;e[63]!==t?(R=t("Import (writes rows)?"),e[63]=t,e[64]=R):R=e[64];let U;e[65]!==d||e[66]!==a?(U=d||a.trim()==="",e[65]=d,e[66]=a,e[67]=U):U=e[67];let W;e[68]!==t?(W=t("Import"),e[68]=t,e[69]=W):W=e[69],e[70]!==ae||e[71]!==R||e[72]!==U||e[73]!==W?(f=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(Se,{confirmLabel:R,disabled:U,onConfirm:ae,testId:"ei-import",children:W})}),e[70]=ae,e[71]=R,e[72]=U,e[73]=W,e[74]=f):f=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=y,e[11]=M,e[12]=i,e[13]=z,e[14]=a,e[15]=o,e[16]=t,e[17]=w,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=f,e[24]=j,e[25]=C,e[26]=u,e[27]=T}else w=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],f=e[23],j=e[24],C=e[25],u=e[26],T=e[27];let E;e[75]!==w||e[76]!==v||e[77]!==p||e[78]!==f||e[79]!==j?(E=(0,r.jsxs)(w,{className:v,children:[p,f,j]}),e[75]=w,e[76]=v,e[77]=p,e[78]=f,e[79]=j,e[80]=E):E=e[80];let A;e[81]!==S||e[82]!==E||e[83]!==C||e[84]!==u?(A=(0,r.jsxs)(S,{className:C,children:[u,E]}),e[81]=S,e[82]=E,e[83]=C,e[84]=u,e[85]=A):A=e[85];let O;e[86]!==H?(O=H!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:H}),e[86]=H,e[87]=O):O=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==A||e[91]!==O||e[92]!==T?(X=(0,r.jsxs)("div",{className:T,"data-testid":I,children:[m,A,O]}),e[88]=I,e[89]=m,e[90]=A,e[91]=O,e[92]=T,e[93]=X):X=e[93],X},"Ue");function _e(x,e){return x+e}s(_e,"Ae");export{Ge as ExportImportPanel};
|