@lunora/studio 1.0.0-alpha.296 → 1.0.0-alpha.297
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-MOW4XMIT.js → chunk-23DA2KK5.js} +1 -1
- package/dist/standalone/{chunk-HRFHNV4T.js → chunk-2WCD2IHE.js} +1 -1
- package/dist/standalone/{chunk-BXZADQGW.js → chunk-2XNKJZR7.js} +1 -1
- package/dist/standalone/{chunk-NBBCLHM4.js → chunk-3CTF6VCQ.js} +1 -1
- package/dist/standalone/{chunk-RJ2MB5BX.js → chunk-3T5F2LKG.js} +1 -1
- package/dist/standalone/{chunk-BSA7XEET.js → chunk-47INSVZQ.js} +1 -1
- package/dist/standalone/{chunk-DPIN5VWB.js → chunk-4FFZMCLM.js} +1 -1
- package/dist/standalone/{chunk-NH27P54M.js → chunk-4QO356DN.js} +1 -1
- package/dist/standalone/{chunk-CLF3SQ2D.js → chunk-57L3MFDQ.js} +1 -1
- package/dist/standalone/{chunk-2IKYYXNM.js → chunk-5AORAJFI.js} +1 -1
- package/dist/standalone/{chunk-PDHHQRWE.js → chunk-6EZBEZ7D.js} +1 -1
- package/dist/standalone/{chunk-C7VF7NU5.js → chunk-6F3UVSRY.js} +1 -1
- package/dist/standalone/{chunk-X76GJISU.js → chunk-6K53DCPW.js} +1 -1
- package/dist/standalone/{chunk-YMLND4NJ.js → chunk-6MHPVN2Q.js} +1 -1
- package/dist/standalone/{chunk-SMBKKLRX.js → chunk-76GDLOCA.js} +1 -1
- package/dist/standalone/{chunk-YQDRIIWU.js → chunk-A4GRIXDU.js} +1 -1
- package/dist/standalone/{chunk-BTV4JZDW.js → chunk-APEMVK3W.js} +1 -1
- package/dist/standalone/{chunk-Q5FZ5WKC.js → chunk-AUO3CXYH.js} +1 -1
- package/dist/standalone/{chunk-IRK3B5SD.js → chunk-AXU6L4JV.js} +1 -1
- package/dist/standalone/{chunk-4AZFDWOL.js → chunk-C3TKN336.js} +1 -1
- package/dist/standalone/{chunk-R2SQETIF.js → chunk-C5NU4UZY.js} +1 -1
- package/dist/standalone/{chunk-DNI6LNZ4.js → chunk-CKEE7CZ6.js} +1 -1
- package/dist/standalone/{chunk-7V2HV4G5.js → chunk-CQILUV6T.js} +1 -1
- package/dist/standalone/{chunk-TB6R55NX.js → chunk-DG4MKUNK.js} +1 -1
- package/dist/standalone/{chunk-4OE3Q2HI.js → chunk-E6E3H5HA.js} +1 -1
- package/dist/standalone/{chunk-S5KP3SFO.js → chunk-FJKOBDDS.js} +1 -1
- package/dist/standalone/{chunk-YRQT6KMR.js → chunk-FMJPASTV.js} +1 -1
- package/dist/standalone/{chunk-UCWRZCZR.js → chunk-FXNH2TEH.js} +1 -1
- package/dist/standalone/{chunk-AWI5MNWN.js → chunk-FZIZZO3M.js} +1 -1
- package/dist/standalone/{chunk-G3TVRBKA.js → chunk-G3MCWHRS.js} +1 -1
- package/dist/standalone/{chunk-QIXPKL7H.js → chunk-G6DD6BH4.js} +1 -1
- package/dist/standalone/{chunk-3XJ5LMFU.js → chunk-G7O4XEPM.js} +1 -1
- package/dist/standalone/{chunk-JPGR5DXI.js → chunk-GBS5ACLN.js} +1 -1
- package/dist/standalone/{chunk-VLUSCROM.js → chunk-GUAU5JHQ.js} +1 -1
- package/dist/standalone/{chunk-QCF6JWLN.js → chunk-IALIMFV2.js} +1 -1
- package/dist/standalone/{chunk-3T3I4ANZ.js → chunk-IHPBU2X4.js} +1 -1
- package/dist/standalone/{chunk-2QVH5KC5.js → chunk-IMBXNH5M.js} +1 -1
- package/dist/standalone/{chunk-U6C2EYQE.js → chunk-IT6VW5MM.js} +1 -1
- package/dist/standalone/{chunk-S4KPBXNS.js → chunk-K7NQX3IZ.js} +1 -1
- package/dist/standalone/{chunk-ED6UPEJL.js → chunk-KCNSN6ZF.js} +1 -1
- package/dist/standalone/{chunk-GCG65T2K.js → chunk-KQSQVNVI.js} +1 -1
- package/dist/standalone/{chunk-JCHPR7PH.js → chunk-KUFFHQPR.js} +1 -1
- package/dist/standalone/{chunk-UH7PYZPF.js → chunk-LOKJEEUS.js} +1 -1
- package/dist/standalone/{chunk-GU4XLZTD.js → chunk-M5G5ZAFJ.js} +1 -1
- package/dist/standalone/{chunk-O5IUJQBJ.js → chunk-MK7SA3YV.js} +1 -1
- package/dist/standalone/{chunk-RDLZBY3M.js → chunk-OWD32MWS.js} +1 -1
- package/dist/standalone/{chunk-3CZQMQ7Y.js → chunk-P2I22USO.js} +1 -1
- package/dist/standalone/{chunk-LIEM55GN.js → chunk-P5OQ2T7O.js} +1 -1
- package/dist/standalone/{chunk-EN7DL3D6.js → chunk-PPX63XHJ.js} +1 -1
- package/dist/standalone/{chunk-2LIWQ3VZ.js → chunk-PTPKBYI5.js} +1 -1
- package/dist/standalone/{chunk-NE4ERDVB.js → chunk-Q4UISMBL.js} +1 -1
- package/dist/standalone/{chunk-XMSYNYLP.js → chunk-ROX6INV5.js} +1 -1
- package/dist/standalone/{chunk-5ROUNT7R.js → chunk-RUBMOQH2.js} +1 -1
- package/dist/standalone/{chunk-5QRUAQNY.js → chunk-RZ6QAA2I.js} +1 -1
- package/dist/standalone/{chunk-UBFE7Z5K.js → chunk-UIC7EN6V.js} +1 -1
- package/dist/standalone/{chunk-VJS2NU3M.js → chunk-UVUKVNCP.js} +1 -1
- package/dist/standalone/{chunk-VIWNY3G3.js → chunk-VAITO6LM.js} +2 -2
- package/dist/standalone/{chunk-OM3UFIFS.js → chunk-VAVZCMJZ.js} +1 -1
- package/dist/standalone/{chunk-VGRACTPB.js → chunk-VHLKUGQL.js} +1 -1
- package/dist/standalone/{chunk-VBZWMOHM.js → chunk-VMLLR636.js} +1 -1
- package/dist/standalone/{chunk-U5HRF22B.js → chunk-VZWZIIP6.js} +1 -1
- package/dist/standalone/{chunk-AN4UDYUY.js → chunk-WIASRPIC.js} +1 -1
- package/dist/standalone/{chunk-5FOS25JR.js → chunk-YIDRRLUF.js} +1 -1
- package/dist/standalone/{chunk-VEK3S7MV.js → chunk-YLPATGWK.js} +4 -4
- package/dist/standalone/{chunk-L4Q5WRM6.js → chunk-YSIOHDX6.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ze}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Xe}from"./chunk-FPI7AMQJ.js";import{a as Ye}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{a as Ve}from"./chunk-XHRKNCCI.js";import{i as Pe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as le}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as de}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ke}from"./chunk-NBBCLHM4.js";import{a as He}from"./chunk-NCPW7WHO.js";import"./chunk-U5HRF22B.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-R2SQETIF.js";import{g as ze}from"./chunk-MOW4XMIT.js";import"./chunk-QAQDMS6R.js";import"./chunk-VEK3S7MV.js";import{a as ie}from"./chunk-RWVIV3U7.js";import{a as Te,b as _e,c as Be,d as z,e as C,f as w}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ae}from"./chunk-2IKDEUCX.js";import{d as F,f as ce,g as ue,h as H,m as Ue,p as me,t as Ge}from"./chunk-HJHSQPHW.js";import{a as c,d as Ee,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Ee(ut(),1);var Q=Ee(ct(),1);var t=Ee(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),De="topic:",$e=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Ae"),tt=c(n=>`${De}${n}`,"We"),ht=c((n,e)=>n.startsWith(De)?(e.get(n.slice(De.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ce(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ue(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:H(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ce(W.replayQueueMessage),Nt=ce(W.clearQueueMessages),et=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Ue)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>et?`${n.slice(0,et)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),at=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"Ge"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=$e(d),m;e[4]!==r?(m=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(ie,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Queue")}),(0,t.jsx)(C,{children:r("Mode")}),(0,t.jsx)(C,{children:r("Binding")}),(0,t.jsx)(C,{children:r("Dead-letter")})]})}),(0,t.jsxs)(Be,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(Q.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let P=bt(a.body);o=z,f=`queues-message-${a.id}`;let U=a.exportName??a.queue;e[19]!==U?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:U}),e[19]=U,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let L=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=vt(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let I;e[27]!==a.outcome||e[28]!==L||e[29]!==T?(I=(0,t.jsx)(de,{"data-testid":L,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=L,e[29]=T,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=P,p=qt(P),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let q;e[43]!==a.capturedAt?(q=Ge(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let v=`queues-replay-${a.id}`,E=r!==null,M;e[47]!==a.id||e[48]!==r||e[49]!==s?(M=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=M):M=e[50];let A;e[51]!==a.id||e[52]!==d||e[53]!==v||e[54]!==E||e[55]!==M?(A=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":v,disabled:E,onClick:d,size:"xs",type:"button",variant:"outline",children:M})}),e[51]=a.id,e[52]=d,e[53]=v,e[54]=E,e[55]=M,e[56]=A):A=e[56];let $;return e[57]!==o||e[58]!==b||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?($=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,b,A]}),e[57]=o,e[58]=b,e[59]=A,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=$):$=e[66],$},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ve,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(ie,{description:o("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:o("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsx)(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:o("Export")}),(0,t.jsx)(C,{children:o("Message")}),(0,t.jsx)(C,{children:o("Attempts")}),(0,t.jsx)(C,{children:o("Outcome")}),(0,t.jsx)(C,{children:o("Body")}),(0,t.jsx)(C,{children:o("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:d.map(b=>(0,t.jsx)(Ct,{message:b,onReplay:s,replayingId:l},b.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let q;return e[26]!==N||e[27]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=q):q=e[28],q},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(ie,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),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":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...$e(p).topics].map(b=>{let[v,E]=b;return(0,t.jsx)("option",{value:tt(v),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:E.length,topic:v})},v)})]}),(0,t.jsx)(Pe,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Xe,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let q;return e[17]!==N||e[18]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=q):q=e[19],q},"_t"),Yt=c(n=>{let e=(0,D.c)(57),{limit:a}=n,d=a??gt,r=ze(),s=F(),[l,o]=(0,Q.useState)("declared"),[m,i]=(0,Q.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Le(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:q,refetch:b}=Le(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],E=N?.entries??[],{deadLetteredCount:M,queuesWithoutDlq:A,showReliabilityWarning:$}=pt(v,E),[P,U]=(0,Q.useState)(""),[L,T]=(0,Q.useState)(""),[I,_]=(0,Q.useState)(""),[G,st]=(0,Q.useState)(!1),[pe,ke]=(0,Q.useState)(!1),[he,Oe]=(0,Q.useState)(null),{topics:Re}=$e(v),Je=[...v.map(Tt),...[...Re.keys()].map(_t)],K=Je.includes(P)?P:Je[0]??"",je=l==="messages"?y:x,nt=l==="messages"?q:u,ge=je??m,fe=je===null?m:nt,V;e[3]!==b?(V=c(()=>{b()},"V"),e[3]=b,e[4]=V):V=e[4],Ye(V,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,Fe=L.trim();if(Fe!=="")try{S=JSON.parse(Fe)}catch{i(s("Body must be valid JSON."));return}let Qe,We=I.trim();if(We!==""){let B=Number(We);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Qe=B}if(G&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}ke(!0);let it=ht(g,Re).map(B=>G?{batch:S,delaySeconds:Qe,exportName:B}:{body:S,delaySeconds:Qe,exportName:B});try{i(await xt(r,it,s)),b()}catch(B){i(H(B))}ke(!1)},"Ve"),X;e[5]!==r||e[6]!==b?(X=c(async g=>{i(null),Oe(g);try{await r.query(yt,{id:g},ue("")),b()}catch(S){i(H(S))}Oe(null)},"X"),e[5]=r,e[6]=b,e[7]=X):X=e[7];let xe=X,Y;e[8]!==r||e[9]!==b?(Y=c(async()=>{i(null);try{await r.query(Nt,{},ue("")),b()}catch(g){i(H(g))}},"Y"),e[8]=r,e[9]=b,e[10]=Y):Y=e[10];let ye=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"K"),e[11]=Z):Z=e[11];let ot=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{U(g.currentTarget.value)},"Z"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{T(g.currentTarget.value)},"ee"),e[13]=te):te=e[13];let be=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{_(g.currentTarget.value)},"te"),e[14]=ae):ae=e[14];let qe=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{st(g.currentTarget.checked)},"se"),e[15]=se):se=e[15];let ve=se,Se=c(()=>{me(rt())},"xe"),ne;e[16]!==xe?(ne=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&me(xe(S))},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,re;e[18]!==ye?(re=c(()=>{me(ye())},"re"),e[18]=ye,e[19]=re):re=e[19];let Ce=re,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[20]!==s||e[21]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(le,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[20]=s,e[21]=l,e[22]=k):k=e[22];let O;e[23]!==ge||e[24]!==fe?(O=ge!==null&&(0,t.jsx)(Ke,{error:fe,testId:"queues-error"}),e[23]=ge,e[24]=fe,e[25]=O):O=e[25];let Ie=$&&(0,t.jsx)(He,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[A.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:A.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),M>0&&(0,t.jsx)("p",{className:A.length>0?"text-muted-foreground":"font-medium",children:M===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:M})})]})}),R;e[26]!==v||e[27]!==f||e[28]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[26]=v,e[27]=f,e[28]=l,e[29]=R):R=e[29];let J;e[30]!==E||e[31]!==y||e[32]!==Ce||e[33]!==we||e[34]!==he||e[35]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:E,onClear:Ce,onReplay:we,replayingId:he}),e[30]=E,e[31]=y,e[32]=Ce,e[33]=we,e[34]=he,e[35]=l,e[36]=J):J=e[36];let j;e[37]!==G||e[38]!==L||e[39]!==I||e[40]!==ve||e[41]!==be||e[42]!==qe||e[43]!==Ne||e[44]!==Se||e[45]!==v||e[46]!==K||e[47]!==pe||e[48]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:G,bodyText:L,delayText:I,onBatchModeChange:ve,onBodyChange:be,onDelayChange:qe,onSelectExport:Ne,onSend:Se,queues:v,selectedExportName:K,sending:pe}),e[37]=G,e[38]=L,e[39]=I,e[40]=ve,e[41]=be,e[42]=qe,e[43]=Ne,e[44]=Se,e[45]=v,e[46]=K,e[47]=pe,e[48]=l,e[49]=j):j=e[49];let oe;return e[50]!==k||e[51]!==O||e[52]!==Ie||e[53]!==R||e[54]!==J||e[55]!==j?(oe=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ie,R,J,j]}),e[50]=k,e[51]=O,e[52]=Ie,e[53]=R,e[54]=J,e[55]=j,e[56]=oe):oe=e[56],oe},"es");function Et(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return tt(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
|
|
1
|
+
import{a as Ze}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Xe}from"./chunk-FPI7AMQJ.js";import{a as Ye}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{a as Ve}from"./chunk-XHRKNCCI.js";import{i as Pe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as le}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as de}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ke}from"./chunk-3CTF6VCQ.js";import{a as He}from"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-C5NU4UZY.js";import{g as ze}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as ie}from"./chunk-RWVIV3U7.js";import{a as Te,b as _e,c as Be,d as z,e as C,f as w}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ae}from"./chunk-2IKDEUCX.js";import{d as F,f as ce,g as ue,h as H,m as Ue,p as me,t as Ge}from"./chunk-HJHSQPHW.js";import{a as c,d as Ee,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Ee(ut(),1);var Q=Ee(ct(),1);var t=Ee(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),De="topic:",$e=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Ae"),tt=c(n=>`${De}${n}`,"We"),ht=c((n,e)=>n.startsWith(De)?(e.get(n.slice(De.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ce(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ue(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:H(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ce(W.replayQueueMessage),Nt=ce(W.clearQueueMessages),et=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Ue)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>et?`${n.slice(0,et)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),at=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"Ge"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=$e(d),m;e[4]!==r?(m=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(ie,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Queue")}),(0,t.jsx)(C,{children:r("Mode")}),(0,t.jsx)(C,{children:r("Binding")}),(0,t.jsx)(C,{children:r("Dead-letter")})]})}),(0,t.jsxs)(Be,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(Q.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let P=bt(a.body);o=z,f=`queues-message-${a.id}`;let U=a.exportName??a.queue;e[19]!==U?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:U}),e[19]=U,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let L=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=vt(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let I;e[27]!==a.outcome||e[28]!==L||e[29]!==T?(I=(0,t.jsx)(de,{"data-testid":L,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=L,e[29]=T,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=P,p=qt(P),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let q;e[43]!==a.capturedAt?(q=Ge(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let v=`queues-replay-${a.id}`,E=r!==null,M;e[47]!==a.id||e[48]!==r||e[49]!==s?(M=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=M):M=e[50];let A;e[51]!==a.id||e[52]!==d||e[53]!==v||e[54]!==E||e[55]!==M?(A=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":v,disabled:E,onClick:d,size:"xs",type:"button",variant:"outline",children:M})}),e[51]=a.id,e[52]=d,e[53]=v,e[54]=E,e[55]=M,e[56]=A):A=e[56];let $;return e[57]!==o||e[58]!==b||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?($=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,b,A]}),e[57]=o,e[58]=b,e[59]=A,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=$):$=e[66],$},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ve,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(ie,{description:o("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:o("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsx)(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:o("Export")}),(0,t.jsx)(C,{children:o("Message")}),(0,t.jsx)(C,{children:o("Attempts")}),(0,t.jsx)(C,{children:o("Outcome")}),(0,t.jsx)(C,{children:o("Body")}),(0,t.jsx)(C,{children:o("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:d.map(b=>(0,t.jsx)(Ct,{message:b,onReplay:s,replayingId:l},b.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let q;return e[26]!==N||e[27]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=q):q=e[28],q},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(ie,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),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":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...$e(p).topics].map(b=>{let[v,E]=b;return(0,t.jsx)("option",{value:tt(v),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:E.length,topic:v})},v)})]}),(0,t.jsx)(Pe,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Xe,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let q;return e[17]!==N||e[18]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=q):q=e[19],q},"_t"),Yt=c(n=>{let e=(0,D.c)(57),{limit:a}=n,d=a??gt,r=ze(),s=F(),[l,o]=(0,Q.useState)("declared"),[m,i]=(0,Q.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Le(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:q,refetch:b}=Le(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],E=N?.entries??[],{deadLetteredCount:M,queuesWithoutDlq:A,showReliabilityWarning:$}=pt(v,E),[P,U]=(0,Q.useState)(""),[L,T]=(0,Q.useState)(""),[I,_]=(0,Q.useState)(""),[G,st]=(0,Q.useState)(!1),[pe,ke]=(0,Q.useState)(!1),[he,Oe]=(0,Q.useState)(null),{topics:Re}=$e(v),Je=[...v.map(Tt),...[...Re.keys()].map(_t)],K=Je.includes(P)?P:Je[0]??"",je=l==="messages"?y:x,nt=l==="messages"?q:u,ge=je??m,fe=je===null?m:nt,V;e[3]!==b?(V=c(()=>{b()},"V"),e[3]=b,e[4]=V):V=e[4],Ye(V,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,Fe=L.trim();if(Fe!=="")try{S=JSON.parse(Fe)}catch{i(s("Body must be valid JSON."));return}let Qe,We=I.trim();if(We!==""){let B=Number(We);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Qe=B}if(G&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}ke(!0);let it=ht(g,Re).map(B=>G?{batch:S,delaySeconds:Qe,exportName:B}:{body:S,delaySeconds:Qe,exportName:B});try{i(await xt(r,it,s)),b()}catch(B){i(H(B))}ke(!1)},"Ve"),X;e[5]!==r||e[6]!==b?(X=c(async g=>{i(null),Oe(g);try{await r.query(yt,{id:g},ue("")),b()}catch(S){i(H(S))}Oe(null)},"X"),e[5]=r,e[6]=b,e[7]=X):X=e[7];let xe=X,Y;e[8]!==r||e[9]!==b?(Y=c(async()=>{i(null);try{await r.query(Nt,{},ue("")),b()}catch(g){i(H(g))}},"Y"),e[8]=r,e[9]=b,e[10]=Y):Y=e[10];let ye=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"K"),e[11]=Z):Z=e[11];let ot=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{U(g.currentTarget.value)},"Z"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{T(g.currentTarget.value)},"ee"),e[13]=te):te=e[13];let be=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{_(g.currentTarget.value)},"te"),e[14]=ae):ae=e[14];let qe=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{st(g.currentTarget.checked)},"se"),e[15]=se):se=e[15];let ve=se,Se=c(()=>{me(rt())},"xe"),ne;e[16]!==xe?(ne=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&me(xe(S))},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,re;e[18]!==ye?(re=c(()=>{me(ye())},"re"),e[18]=ye,e[19]=re):re=e[19];let Ce=re,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[20]!==s||e[21]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(le,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[20]=s,e[21]=l,e[22]=k):k=e[22];let O;e[23]!==ge||e[24]!==fe?(O=ge!==null&&(0,t.jsx)(Ke,{error:fe,testId:"queues-error"}),e[23]=ge,e[24]=fe,e[25]=O):O=e[25];let Ie=$&&(0,t.jsx)(He,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[A.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:A.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),M>0&&(0,t.jsx)("p",{className:A.length>0?"text-muted-foreground":"font-medium",children:M===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:M})})]})}),R;e[26]!==v||e[27]!==f||e[28]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[26]=v,e[27]=f,e[28]=l,e[29]=R):R=e[29];let J;e[30]!==E||e[31]!==y||e[32]!==Ce||e[33]!==we||e[34]!==he||e[35]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:E,onClear:Ce,onReplay:we,replayingId:he}),e[30]=E,e[31]=y,e[32]=Ce,e[33]=we,e[34]=he,e[35]=l,e[36]=J):J=e[36];let j;e[37]!==G||e[38]!==L||e[39]!==I||e[40]!==ve||e[41]!==be||e[42]!==qe||e[43]!==Ne||e[44]!==Se||e[45]!==v||e[46]!==K||e[47]!==pe||e[48]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:G,bodyText:L,delayText:I,onBatchModeChange:ve,onBodyChange:be,onDelayChange:qe,onSelectExport:Ne,onSend:Se,queues:v,selectedExportName:K,sending:pe}),e[37]=G,e[38]=L,e[39]=I,e[40]=ve,e[41]=be,e[42]=qe,e[43]=Ne,e[44]=Se,e[45]=v,e[46]=K,e[47]=pe,e[48]=l,e[49]=j):j=e[49];let oe;return e[50]!==k||e[51]!==O||e[52]!==Ie||e[53]!==R||e[54]!==J||e[55]!==j?(oe=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ie,R,J,j]}),e[50]=k,e[51]=O,e[52]=Ie,e[53]=R,e[54]=J,e[55]=j,e[56]=oe):oe=e[56],oe},"es");function Et(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return tt(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as wt}from"./chunk-FPI7AMQJ.js";import{a as Tt}from"./chunk-UBFE7Z5K.js";import{a as se}from"./chunk-OSGXNEFA.js";import{a as $t}from"./chunk-QJLHH3ET.js";import{a as Ot}from"./chunk-37WYCOQ2.js";import{a as zt,b as _t}from"./chunk-4WD4XGC3.js";import"./chunk-Z22BDS6N.js";import{a as kt}from"./chunk-JQXA2OYK.js";import{i as V}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as j}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as ge}from"./chunk-R2SQETIF.js";import{g as oe}from"./chunk-MOW4XMIT.js";import"./chunk-QAQDMS6R.js";import"./chunk-VEK3S7MV.js";import{a as ue}from"./chunk-RWVIV3U7.js";import{a as Ct,b as It,c as xt,d as Ve,e as me,f as de}from"./chunk-HCTJKP5J.js";import{a as vt,e as yt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Nt,o as A,p as At,t as Dt}from"./chunk-HJHSQPHW.js";import{a as c,d as pt,e as Jt,f as Ut,g as Ht}from"./chunk-I26MS5PJ.js";var H=pt(Ut(),1);var F=pt(Jt(),1);var a=pt(Ht(),1);var Lt=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Tt"),Kt=c(t=>{let e=Lt(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Qt"),Pt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"$t"),G=c(t=>{let e=(0,H.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(Ot,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"V"),ce=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:m})=>{let s=Q();return(0,a.jsxs)($t,{label:m,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(j,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,a.jsx)(j,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?s("Saving\u2026"):l})]})]})},"me"),Rt=c(t=>{let e=(0,H.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=oe(),l=Q(),{busy:n,error:m,run:s}=se(),f;e[0]!==i?(f=i?A(i.name):"",e[0]=i,e[1]=f):f=e[1];let[u,b]=(0,F.useState)(f),v;e[2]!==i?(v=i?A(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,p]=(0,F.useState)(v),k;e[4]!==i?(k=i?A(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[y,I]=(0,F.useState)(k),[C,w]=(0,F.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Pt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[z,N]=(0,F.useState)(x),_;e[9]!==o||e[10]!==y||e[11]!==z||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==s||e[19]!==g?(_=c(()=>{s(async()=>{let S=z.trim()===""?void 0:Lt(z);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim()===""?void 0:u.trim(),organizationId:A(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),d()})},"O"),e[9]=o,e[10]=y,e[11]=z,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=s,e[19]=g,e[20]=_):_=e[20];let D=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let $;e[27]!==r||e[28]!==l?($=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=$):$=e[29];let E;e[30]!==l?(E=l("name"),e[30]=l,e[31]=E):E=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=c(S=>{b(S.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,a.jsx)(V,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==E?(K=(0,a.jsx)(G,{htmlFor:"org-form-name",label:E,children:B}),e[35]=B,e[36]=E,e[37]=K):K=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let P;e[40]===Symbol.for("react.memo_cache_sentinel")?(P=c(S=>{p(S.target.value)},"P"),e[40]=P):P=e[40];let U;e[41]!==g?(U=(0,a.jsx)(V,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:P,value:g}),e[41]=g,e[42]=U):U=e[42];let L;e[43]!==J||e[44]!==U?(L=(0,a.jsx)(G,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=L):L=e[45];let Y;e[46]!==l?(Y=l("Logo URL (optional)"),e[46]=l,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=c(S=>{I(S.target.value)},"M"),e[48]=M):M=e[48];let R;e[49]!==y?(R=(0,a.jsx)(V,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=R):R=e[50];let q;e[51]!==Y||e[52]!==R?(q=(0,a.jsx)(G,{htmlFor:"org-form-logo",label:Y,children:R}),e[51]=Y,e[52]=R,e[53]=q):q=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(V,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(S=>{w(S.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=c(S=>{N(S.target.value)},"oe"),e[60]=ae):ae=e[60];let re;e[61]!==z?(re=(0,a.jsx)(wt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:ae,value:z}),e[61]=z,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,a.jsx)(G,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let le;return e[66]!==n||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==K||e[71]!==L||e[72]!==q||e[73]!==W||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==$?(le=(0,a.jsxs)(ce,{busy:n,canSubmit:O,error:m,onClose:d,onSubmit:D,submitLabel:T,testId:"org-form",title:$,children:[K,L,q,W,ee]}),e[66]=n,e[67]=m,e[68]=d,e[69]=D,e[70]=K,e[71]=L,e[72]=q,e[73]=W,e[74]=ee,e[75]=O,e[76]=T,e[77]=$,e[78]=le):le=e[78],le},"yt"),Qt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==m||e[6]!==s?(v=c(()=>{m(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),d(),r()})},"p"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=m,e[6]=s,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-add-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Jt"),Zt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m?(v=c(()=>{m(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-invite-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Ut"),Yt=c(t=>{let e=(0,H.c)(32),{member:r,onClose:d,onDone:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),s;e[0]!==r.role?(s=c(()=>A(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[f,u]=(0,F.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==f||e[7]!==m?(b=c(()=>{m(async()=>{await i.setAuthOrgMemberRole({memberId:A(r.id),role:f.trim()}),h(),d()})},"g"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=f,e[7]=m,e[8]=b):b=e[8];let v=b,g;e[9]!==f?(g=f.trim(),e[9]=f,e[10]=g):g=e[10];let p=g!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let w;e[18]!==f?(w=(0,a.jsx)(V,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:f}),e[18]=f,e[19]=w):w=e[19];let x;e[20]!==I||e[21]!==w?(x=(0,a.jsx)(G,{htmlFor:"org-member-role-value",label:I,children:w}),e[20]=I,e[21]=w,e[22]=x):x=e[22];let z;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==v||e[27]!==x||e[28]!==p||e[29]!==k||e[30]!==y?(z=(0,a.jsx)(ce,{busy:l,canSubmit:p,error:n,onClose:d,onSubmit:v,submitLabel:k,testId:"org-member-role",title:y,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=v,e[27]=x,e[28]=p,e[29]=k,e[30]=y,e[31]=z):z=e[31],z},"Gt"),Mt=c(t=>{let e=(0,H.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==l||e[3]!==r||e[4]!==b||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==f||e[9]!==o?.id?(g=c(()=>{f(async()=>{await(r==="create"?l.createAuthOrgTeam({name:b.trim(),organizationId:i}):l.updateAuthOrgTeam({name:b.trim(),teamId:A(o?.id)})),h(),d()})},"f"),e[2]=l,e[3]=r,e[4]=b,e[5]=d,e[6]=h,e[7]=i,e[8]=f,e[9]=o?.id,e[10]=g):g=e[10];let p=g,k;e[11]!==b?(k=b.trim(),e[11]=b,e[12]=k):k=e[12];let y=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(D=>{v(D.target.value)},"x"),e[21]=x):x=e[21];let z;e[22]!==b?(z=(0,a.jsx)(V,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:b}),e[22]=b,e[23]=z):z=e[23];let N;e[24]!==w||e[25]!==z?(N=(0,a.jsx)(G,{htmlFor:"org-team-form-name",label:w,children:z}),e[24]=w,e[25]=z,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==s||e[29]!==d||e[30]!==p||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==C?(_=(0,a.jsx)(ce,{busy:m,canSubmit:y,error:s,onClose:d,onSubmit:p,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=m,e[28]=s,e[29]=d,e[30]=p,e[31]=N,e[32]=y,e[33]=I,e[34]=C,e[35]=_):_=e[35],_},"Ct"),qt=c(t=>{let e=(0,H.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==m||e[4]!==h||e[5]!==s?(u=c(()=>{m(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=m,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",p;e[9]!==o?(p=o("Add member"),e[9]=o,e[10]=p):p=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(z=>{f(z.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==s?(C=(0,a.jsx)(V,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:s}),e[16]=s,e[17]=C):C=e[17];let w;e[18]!==y||e[19]!==C?(w=(0,a.jsx)(G,{htmlFor:"org-team-add-member-user",label:y,children:C}),e[18]=y,e[19]=C,e[20]=w):w=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==p||e[27]!==k||e[28]!==w?(x=(0,a.jsx)(ce,{busy:l,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:p,testId:"org-team-add-member",title:k,children:w}),e[21]=l,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=p,e[27]=k,e[28]=w,e[29]=x):x=e[29],x},"Ht"),Ft=c(t=>{let e=(0,H.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Pt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[p,k]=(0,F.useState)(g),y;e[5]!==l||e[6]!==r||e[7]!==b||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==p||e[12]!==o?.id||e[13]!==f?(y=c(()=>{f(async()=>{let $=Kt(p);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:$,role:b.trim()}):l.updateAuthOrgRole({permission:$,roleId:A(o?.id)})),h(),d()})},"v"),e[5]=l,e[6]=r,e[7]=b,e[8]=d,e[9]=h,e[10]=i,e[11]=p,e[12]=o?.id,e[13]=f,e[14]=y):y=e[14];let I=y,C;e[15]!==r||e[16]!==b||e[17]!==p?(C=p.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=p,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let z;e[25]!==r||e[26]!==b||e[27]!==n?(z=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(V,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c($=>{v($.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=z):z=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{k($.target.value)},"O"),e[31]=_):_=e[31];let D;e[32]!==p?(D=(0,a.jsx)(wt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:p}),e[32]=p,e[33]=D):D=e[33];let O;e[34]!==D||e[35]!==N?(O=(0,a.jsx)(G,{htmlFor:"org-role-form-permission",label:N,children:D}),e[34]=D,e[35]=N,e[36]=O):O=e[36];let T;return e[37]!==m||e[38]!==s||e[39]!==d||e[40]!==I||e[41]!==O||e[42]!==C||e[43]!==w||e[44]!==x||e[45]!==z?(T=(0,a.jsxs)(ce,{busy:m,canSubmit:C,error:s,onClose:d,onSubmit:I,submitLabel:w,testId:"org-role-form",title:x,children:[z,O]}),e[37]=m,e[38]=s,e[39]=d,e[40]=I,e[41]=O,e[42]=C,e[43]=w,e[44]=x,e[45]=z,e[46]=T):T=e[46],T},"xt"),Bt=c(t=>{let e=(0,H.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==f?(u=c(()=>{f(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=f,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==d?(g=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=g):g=e[8];let p;return e[9]!==m||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==l?(p=(0,a.jsx)(ce,{busy:m,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:l,children:g}),e[9]=m,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=l,e[17]=p):p=e[17],p},"Mt"),Xe=c(t=>{let e=(0,H.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let m;e[7]!==d?(m=(0,a.jsx)(yt,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let s;return e[9]!==n||e[10]!==m||e[11]!==i?(s=(0,a.jsxs)(vt,{className:"overflow-hidden py-0","data-testid":i,children:[n,m]}),e[9]=n,e[10]=m,e[11]=i,e[12]=s):s=e[12],s},"We"),We=c(t=>{let e=(0,H.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=Q(),l;e[0]!==r?(l=r.map(Gt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==n?(m=(0,a.jsx)(me,{"aria-label":n}),e[4]=n,e[5]=m):m=e[5];let s;e[6]!==l||e[7]!==m?(s=(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[l,m]})}),e[6]=l,e[7]=m,e[8]=s):s=e[8];let f;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==d||e[16]!==h?(v=c((g,p)=>{let k=A(g.id),y=k===""?`index-${p.toString()}`:k;return(0,a.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(I=>(0,a.jsx)(de,{className:I.className,children:I.render(g)},I.head)),(0,a.jsx)(de,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(g)})})]},y)},"p"),e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17],f=i.map(v),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=f}else f=e[13];let u;e[18]!==f?(u=(0,a.jsx)(xt,{children:f}),e[18]=f,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,a.jsxs)(Ct,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"Xe");function Gt(t){return(0,a.jsx)(me,{children:t.head},t.head)}c(Gt,"Zt");var Vt=c(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=Q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==l?(m=l("Add member"),e[2]=l,e[3]=m):m=e[3];let s;e[4]!==n||e[5]!==m?(s=(0,a.jsx)(j,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:m}),e[4]=n,e[5]=m,e[6]=s):s=e[6];let f;e[7]!==o?(f=c(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=f):f=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let b;e[11]!==f||e[12]!==u?(b=(0,a.jsx)(j,{"data-testid":"org-open-invite-member",onClick:f,size:"xs",type:"button",variant:"outline",children:u}),e[11]=f,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,a.jsxs)(a.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==l?(g=l("Members"),e[17]=l,e[18]=g):g=e[18];let p;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(p=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(y=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-member-role-${A(y.id)}`,onClick:c(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(j,{"data-testid":`org-remove-member-${A(y.id)}`,disabled:r,onClick:c(()=>{d(A(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=p):p=e[25];let k;return e[26]!==v||e[27]!==g||e[28]!==p?(k=(0,a.jsx)(Xe,{action:v,heading:g,testId:"org-members",children:p}),e[26]=v,e[27]=g,e[28]=p,e[29]=k):k=e[29],k},"qt"),Xt=c(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=Q(),m;e[0]!==d?(m=c(()=>{d({kind:"team-create"})},"m"),e[0]=d,e[1]=m):m=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let f;e[4]!==m||e[5]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[4]=m,e[5]=s,e[6]=f):f=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"aria-pressed":i===A(g.id),"data-testid":`org-team-select-${A(g.id)}`,onClick:c(()=>{h(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(j,{"data-testid":`org-team-rename-${A(g.id)}`,onClick:c(()=>{d({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(j,{"data-testid":`org-team-delete-${A(g.id)}`,onClick:c(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=b):b=e[16];let v;return e[17]!==f||e[18]!==u||e[19]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-teams",children:b}),e[17]=f,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"Kt"),Wt=c(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=Q(),m;e[0]!==h||e[1]!==i?(m=c(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=m):m=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let f;e[5]!==m||e[6]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[5]=m,e[6]=s,e[7]=f):f=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsx)(j,{"data-testid":`org-team-remove-member-${A(g.id)}`,disabled:r,onClick:c(()=>{d(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=b):b=e[15];let v;return e[16]!==f||e[17]!==u||e[18]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-team-members",children:b}),e[16]=f,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"Vt"),er=c(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=Q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"i"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==l||e[5]!==n?(m=(0,a.jsx)(j,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=m):m=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let f;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(f=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(b=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-role-edit-${A(b.id)}`,onClick:c(()=>{d({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(j,{"data-testid":`org-role-delete-${A(b.id)}`,onClick:c(()=>{r(A(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=f):f=e[14];let u;return e[15]!==m||e[16]!==s||e[17]!==f?(u=(0,a.jsx)(Xe,{action:m,heading:s,testId:"org-roles",children:f}),e[15]=m,e[16]=s,e[17]=f,e[18]=u):u=e[18],u},"Wt"),Et=200,tr=c(t=>{let e=(0,H.c)(207),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=oe(),o=Q(),[l,n]=(0,F.useState)(null),[m,s]=(0,F.useState)(null),[f,u]=(0,F.useState)(!1),[b,v]=(0,F.useState)(null),[g,p]=_t(r),k;e[0]!==g||e[1]!==r?(k=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=k):k=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=c(()=>i.listAuthOrgMembers({limit:Et,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let I=ge(k,y),C;e[7]!==r?(C=["lunora-auth-org-invitations",r],e[7]=r,e[8]=C):C=e[8];let w;e[9]!==i||e[10]!==r?(w=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let x=ge(C,w),z;e[12]!==r?(z=["lunora-auth-org-teams",r],e[12]=r,e[13]=z):z=e[13];let N;e[14]!==i||e[15]!==r?(N=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"D"),e[14]=i,e[15]=r,e[16]=N):N=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let D=ge(z,N,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let $;e[24]!==d?($={enabled:d},e[24]=d,e[25]=$):$=e[25];let E=ge(O,T,$),Z;e[26]!==m?(Z=["lunora-auth-org-team-members",m],e[26]=m,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==m?(B=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"B"),e[28]=i,e[29]=m,e[30]=B):B=e[30];let K=m!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let P=ge(Z,B,J),U;e[33]!==I.data?.rows?(U=I.data?.rows??[],e[33]=I.data?.rows,e[34]=U):U=e[34];let L=U,Y;e[35]!==x.data?.rows?(Y=x.data?.rows??[],e[35]=x.data?.rows,e[36]=Y):Y=e[36];let M=Y,R;e[37]!==D.data?.rows?(R=D.data?.rows??[],e[37]=D.data?.rows,e[38]=R):R=e[38];let q=R,W;e[39]!==E.data?.rows?(W=E.data?.rows??[],e[39]=E.data?.rows,e[40]=W):W=e[40];let te=W,ae;e[41]!==m||e[42]!==P?(ae=m===null?[]:P.data?.rows??[],e[41]=m,e[42]=P,e[43]=ae):ae=e[43];let re=ae,ee=I.error??x.error??D.error??E.error??P.error,le;e[44]!==x||e[45]!==I||e[46]!==d||e[47]!==E||e[48]!==m||e[49]!==P||e[50]!==h||e[51]!==D?(le=c(()=>{I.refetch(),x.refetch(),h&&D.refetch(),d&&E.refetch(),m!==null&&P.refetch()},"ie"),e[44]=x,e[45]=I,e[46]=d,e[47]=E,e[48]=m,e[49]=P,e[50]=h,e[51]=D,e[52]=le):le=e[52];let S=le;kt(S,!0);let et;e[53]===Symbol.for("react.memo_cache_sentinel")?(et=c(()=>{n(null)},"Ye"),e[53]=et):et=e[53];let ne=et,tt;e[54]!==S?(tt=c(X=>{At((async()=>{u(!0),v(null);try{await X(),S(),u(!1)}catch(mt){v(Nt(mt)),u(!1)}})())},"et"),e[54]=S,e[55]=tt):tt=e[55];let ie=tt,rt;e[56]!==i||e[57]!==o?(rt=c(X=>{let mt=A(X.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:mt}),s(St=>St===mt?null:St)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"tt"),e[56]=i,e[57]=o,e[58]=rt):rt=e[58];let dt=rt,he;e[59]!==o?(he=o("userId"),e[59]=o,e[60]=he):he=e[60];let be;e[61]!==he?(be={head:he,render:rr},e[61]=he,e[62]=be):be=e[62];let fe;e[63]!==o?(fe=o("role"),e[63]=o,e[64]=fe):fe=e[64];let pe;e[65]!==fe?(pe={head:fe,render:or},e[65]=fe,e[66]=pe):pe=e[66];let ot;e[67]!==be||e[68]!==pe?(ot=[be,pe],e[67]=be,e[68]=pe,e[69]=ot):ot=e[69];let ct=ot,ve;e[70]!==o?(ve=o("email"),e[70]=o,e[71]=ve):ve=e[71];let ye;e[72]!==ve?(ye={head:ve,render:ar},e[72]=ve,e[73]=ye):ye=e[73];let Ce;e[74]!==o?(Ce=o("role"),e[74]=o,e[75]=Ce):Ce=e[75];let Ie;e[76]!==Ce?(Ie={head:Ce,render:lr},e[76]=Ce,e[77]=Ie):Ie=e[77];let xe;e[78]!==o?(xe=o("status"),e[78]=o,e[79]=xe):xe=e[79];let we;e[80]!==xe?(we={head:xe,render:nr},e[80]=xe,e[81]=we):we=e[81];let at;e[82]!==ye||e[83]!==Ie||e[84]!==we?(at=[ye,Ie,we],e[82]=ye,e[83]=Ie,e[84]=we,e[85]=at):at=e[85];let ut=at,ke;e[86]!==o?(ke=o("id"),e[86]=o,e[87]=ke):ke=e[87];let ze;e[88]!==ke?(ze={className:"font-mono text-xs",head:ke,render:ir},e[88]=ke,e[89]=ze):ze=e[89];let Se;e[90]!==o?(Se=o("name"),e[90]=o,e[91]=Se):Se=e[91];let Ne;e[92]!==Se?(Ne={head:Se,render:sr},e[92]=Se,e[93]=Ne):Ne=e[93];let lt;e[94]!==ze||e[95]!==Ne?(lt=[ze,Ne],e[94]=ze,e[95]=Ne,e[96]=lt):lt=e[96];let gt=lt,Ae;e[97]!==o?(Ae=o("userId"),e[97]=o,e[98]=Ae):Ae=e[98];let nt;e[99]!==Ae?(nt=[{head:Ae,render:mr}],e[99]=Ae,e[100]=nt):nt=e[100];let ht=nt,De;e[101]!==o?(De=o("role"),e[101]=o,e[102]=De):De=e[102];let Oe;e[103]!==De?(Oe={head:De,render:dr},e[103]=De,e[104]=Oe):Oe=e[104];let _e;e[105]!==o?(_e=o("Permission"),e[105]=o,e[106]=_e):_e=e[106];let Te;e[107]!==_e?(Te={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:cr},e[107]=_e,e[108]=Te):Te=e[108];let it;e[109]!==Oe||e[110]!==Te?(it=[Oe,Te],e[109]=Oe,e[110]=Te,e[111]=it):it=e[111];let bt=it,$e;e[112]!==ee?($e=ee!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[112]=ee,e[113]=$e):$e=e[113];let Re;e[114]!==b?(Re=b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[114]=b,e[115]=Re):Re=e[115];let Me;e[116]!==i||e[117]!==ie?(Me=c(X=>{ie(()=>i.removeAuthOrgMember({memberId:X}))},"$e"),e[116]=i,e[117]=ie,e[118]=Me):Me=e[118];let Fe;e[119]!==f||e[120]!==ct||e[121]!==L||e[122]!==Me?(Fe=(0,a.jsx)(Vt,{actionBusy:f,memberColumns:ct,members:L,onDialog:n,onRemoveMember:Me}),e[119]=f,e[120]=ct,e[121]=L,e[122]=Me,e[123]=Fe):Fe=e[123];let ft=I.data?.total,Ee;e[124]!==L.length||e[125]!==g||e[126]!==p||e[127]!==ft?(Ee=(0,a.jsx)(zt,{count:L.length,offset:g,onOffsetChange:p,pageSize:Et,prefix:"org-members",total:ft}),e[124]=L.length,e[125]=g,e[126]=p,e[127]=ft,e[128]=Ee):Ee=e[128];let je;e[129]!==f||e[130]!==i||e[131]!==ut||e[132]!==M||e[133]!==ie||e[134]!==o?(je=M.length>0&&(0,a.jsx)(Xe,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(We,{columns:ut,rowActions:c(X=>(0,a.jsx)(j,{"data-testid":`org-cancel-invitation-${A(X.id)}`,disabled:f,onClick:c(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:A(X.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[129]=f,e[130]=i,e[131]=ut,e[132]=M,e[133]=ie,e[134]=o,e[135]=je):je=e[135];let Le;e[136]!==dt||e[137]!==m||e[138]!==gt||e[139]!==q||e[140]!==h?(Le=h&&(0,a.jsx)(Xt,{onConfirmDeleteTeam:dt,onDialog:n,onSelectTeam:s,selectedTeam:m,teamColumns:gt,teams:q}),e[136]=dt,e[137]=m,e[138]=gt,e[139]=q,e[140]=h,e[141]=Le):Le=e[141];let Pe;e[142]!==f||e[143]!==i||e[144]!==ie||e[145]!==m||e[146]!==ht||e[147]!==re||e[148]!==h?(Pe=h&&m!==null&&(0,a.jsx)(Wt,{actionBusy:f,onDialog:n,onRemoveTeamMember:c(X=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:X}))},"onRemoveTeamMember"),selectedTeam:m,teamMemberColumns:ht,teamMembers:re}),e[142]=f,e[143]=i,e[144]=ie,e[145]=m,e[146]=ht,e[147]=re,e[148]=h,e[149]=Pe):Pe=e[149];let Be;e[150]!==i||e[151]!==bt||e[152]!==te||e[153]!==d||e[154]!==o?(Be=d&&(0,a.jsx)(er,{onConfirmDeleteRole:c(X=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:X}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:bt,roles:te}),e[150]=i,e[151]=bt,e[152]=te,e[153]=d,e[154]=o,e[155]=Be):Be=e[155];let Je;e[156]!==l?.kind||e[157]!==r||e[158]!==S?(Je=l?.kind==="add-member"&&(0,a.jsx)(Qt,{onClose:ne,onDone:S,organizationId:r}),e[156]=l?.kind,e[157]=r,e[158]=S,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==S?(Ue=l?.kind==="invite-member"&&(0,a.jsx)(Zt,{onClose:ne,onDone:S,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=S,e[163]=Ue):Ue=e[163];let He;e[164]!==l||e[165]!==S?(He=l?.kind==="member-role"&&(0,a.jsx)(Yt,{member:l.member,onClose:ne,onDone:S}),e[164]=l,e[165]=S,e[166]=He):He=e[166];let Ke;e[167]!==l?.kind||e[168]!==r||e[169]!==S?(Ke=l?.kind==="team-create"&&(0,a.jsx)(Mt,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[167]=l?.kind,e[168]=r,e[169]=S,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l||e[172]!==r||e[173]!==S?(Qe=l?.kind==="team-rename"&&(0,a.jsx)(Mt,{mode:"edit",onClose:ne,onDone:S,organizationId:r,team:l.team}),e[171]=l,e[172]=r,e[173]=S,e[174]=Qe):Qe=e[174];let Ze;e[175]!==l||e[176]!==S?(Ze=l?.kind==="team-add-member"&&(0,a.jsx)(qt,{onClose:ne,onDone:S,teamId:l.teamId}),e[175]=l,e[176]=S,e[177]=Ze):Ze=e[177];let Ye;e[178]!==l?.kind||e[179]!==r||e[180]!==S?(Ye=l?.kind==="role-create"&&(0,a.jsx)(Ft,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[178]=l?.kind,e[179]=r,e[180]=S,e[181]=Ye):Ye=e[181];let qe;e[182]!==l||e[183]!==r||e[184]!==S?(qe=l?.kind==="role-edit"&&(0,a.jsx)(Ft,{mode:"edit",onClose:ne,onDone:S,organizationId:r,role:l.role}),e[182]=l,e[183]=r,e[184]=S,e[185]=qe):qe=e[185];let Ge;e[186]!==l||e[187]!==S?(Ge=l?.kind==="confirm"&&(0,a.jsx)(Bt,{action:l.action,message:l.message,onClose:ne,onDone:S,testId:l.testId,title:l.title}),e[186]=l,e[187]=S,e[188]=Ge):Ge=e[188];let st;return e[189]!==$e||e[190]!==Re||e[191]!==Fe||e[192]!==Ee||e[193]!==je||e[194]!==Le||e[195]!==Pe||e[196]!==Be||e[197]!==Je||e[198]!==Ue||e[199]!==He||e[200]!==Ke||e[201]!==Qe||e[202]!==Ze||e[203]!==Ye||e[204]!==qe||e[205]!==Ge?(st=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Re,Fe,Ee,je,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge]}),e[189]=$e,e[190]=Re,e[191]=Fe,e[192]=Ee,e[193]=je,e[194]=Le,e[195]=Pe,e[196]=Be,e[197]=Je,e[198]=Ue,e[199]=He,e[200]=Ke,e[201]=Qe,e[202]=Ze,e[203]=Ye,e[204]=qe,e[205]=Ge,e[206]=st):st=e[206],st},"Xt");function rr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(rr,"Yt");function or(t){return A(t.role)}c(or,"el");function ar(t){return A(t.email)}c(ar,"tl");function lr(t){return A(t.role)}c(lr,"ll");function nr(t){return A(t.status)}c(nr,"ol");function ir(t){return A(t.id)}c(ir,"il");function sr(t){return A(t.name)}c(sr,"rl");function mr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(mr,"nl");function dr(t){return A(t.role)}c(dr,"sl");function cr(t){return A(t.permission)}c(cr,"al");var jt=100,Ar=c(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:d,ready:h}=Tt(),i=d.capabilities.organization,[o,l]=(0,F.useState)(null),[n,m]=(0,F.useState)(null),[s,f]=(0,F.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=c(()=>e.listAuthOrganizations({limit:jt,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=ge(u,b,v),p=g.data?.rows??null,k;t[7]!==g?(k=c(()=>{g.refetch()},"S"),t[7]=g,t[8]=k):k=t[8],kt(k,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{m(null)},"v"),t[9]=y):y=t[9];let I=y,C;t[10]!==g?(C=c(()=>{g.refetch()},"y"),t[10]=g,t[11]=C):C=t[11];let w=C,x;t[12]===Symbol.for("react.memo_cache_sentinel")?(x=c(M=>{l(M)},"x"),t[12]=x):x=t[12];let z=x;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let R;t[15]!==r?(R=r("Organizations are not enabled."),t[15]=r,t[16]=R):R=t[16];let q;return t[17]!==M||t[18]!==R?(q=(0,a.jsx)(ue,{description:M,testId:"org-disabled",title:R}),t[17]=M,t[18]=R,t[19]=q):q=t[19],q}let N;t[20]!==r?(N=r("Organizations"),t[20]=r,t[21]=N):N=t[21];let _;t[22]!==N?(_=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),t[22]=N,t[23]=_):_=t[23];let D;t[24]===Symbol.for("react.memo_cache_sentinel")?(D=c(()=>{m({kind:"create"})},"A"),t[24]=D):D=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,a.jsx)(j,{"data-testid":"org-new",onClick:D,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let $;t[29]!==T||t[30]!==_?($=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=$):$=t[31];let E;t[32]!==g.error?(E=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=E):E=t[33];let Z;t[34]!==p||t[35]!==r?(Z=p!==null&&p.length===0&&(0,a.jsx)(ue,{testId:"org-empty",title:r("No organizations.")}),t[34]=p,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==p||t[38]!==o||t[39]!==r?(B=p!==null&&p.length>0&&(0,a.jsx)(vt,{className:"overflow-hidden py-0",children:(0,a.jsx)(yt,{className:"px-0",children:(0,a.jsxs)(Ct,{"data-testid":"org-table",children:[(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[(0,a.jsx)(me,{children:r("id")}),(0,a.jsx)(me,{children:r("name")}),(0,a.jsx)(me,{children:r("slug")}),(0,a.jsx)(me,{children:r("created")}),(0,a.jsx)(me,{"aria-label":r("Actions")})]})}),(0,a.jsx)(xt,{children:p.map(M=>{let R=A(M.id);return(0,a.jsxs)(Ve,{"data-testid":`org-row-${R}`,children:[(0,a.jsx)(de,{className:"font-mono text-xs",children:R}),(0,a.jsx)(de,{children:A(M.name)}),(0,a.jsx)(de,{children:A(M.slug)}),(0,a.jsx)(de,{className:"text-muted-foreground tabular-nums",children:Dt(M.createdAt)}),(0,a.jsx)(de,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(j,{"aria-pressed":o===R,"data-testid":`org-select-${R}`,onClick:c(()=>{z(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(j,{"data-testid":`org-edit-${R}`,onClick:c(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(j,{"data-testid":`org-delete-${R}`,onClick:c(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},R)})})]})})}),t[37]=p,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==p||t[43]!==g.data?.total?(K=p!==null&&(0,a.jsx)(zt,{count:p.length,offset:s,onOffsetChange:f,pageSize:jt,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=p,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==d.organization||t[46]!==o?(J=o!==null&&(0,a.jsx)(tr,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=J):J=t[47];let P;t[48]!==n?.kind||t[49]!==w?(P=n?.kind==="create"&&(0,a.jsx)(Rt,{mode:"create",onClose:I,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=P):P=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,a.jsx)(Rt,{mode:"edit",onClose:I,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let L;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(L=n?.kind==="delete"&&(0,a.jsx)(Bt,{action:c(async()=>{let M=A(n.org.id);await e.deleteAuthOrganization({organizationId:M}),l(R=>R===M?null:R)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:I,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=L):L=t[58];let Y;return t[59]!==$||t[60]!==E||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==P||t[66]!==U||t[67]!==L?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[$,E,Z,B,K,J,P,U,L]}),t[59]=$,t[60]=E,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=P,t[66]=U,t[67]=L,t[68]=Y):Y=t[68],Y},"Al");export{Ar as default};
|
|
1
|
+
import{a as wt}from"./chunk-FPI7AMQJ.js";import{a as Tt}from"./chunk-UIC7EN6V.js";import{a as se}from"./chunk-OSGXNEFA.js";import{a as $t}from"./chunk-QJLHH3ET.js";import{a as Ot}from"./chunk-37WYCOQ2.js";import{a as zt,b as _t}from"./chunk-4WD4XGC3.js";import"./chunk-Z22BDS6N.js";import{a as kt}from"./chunk-JQXA2OYK.js";import{i as V}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as j}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as ge}from"./chunk-C5NU4UZY.js";import{g as oe}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as ue}from"./chunk-RWVIV3U7.js";import{a as Ct,b as It,c as xt,d as Ve,e as me,f as de}from"./chunk-HCTJKP5J.js";import{a as vt,e as yt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Nt,o as A,p as At,t as Dt}from"./chunk-HJHSQPHW.js";import{a as c,d as pt,e as Jt,f as Ut,g as Ht}from"./chunk-I26MS5PJ.js";var H=pt(Ut(),1);var F=pt(Jt(),1);var a=pt(Ht(),1);var Lt=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Tt"),Kt=c(t=>{let e=Lt(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Qt"),Pt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"$t"),G=c(t=>{let e=(0,H.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(Ot,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"V"),ce=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:m})=>{let s=Q();return(0,a.jsxs)($t,{label:m,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(j,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,a.jsx)(j,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?s("Saving\u2026"):l})]})]})},"me"),Rt=c(t=>{let e=(0,H.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=oe(),l=Q(),{busy:n,error:m,run:s}=se(),f;e[0]!==i?(f=i?A(i.name):"",e[0]=i,e[1]=f):f=e[1];let[u,b]=(0,F.useState)(f),v;e[2]!==i?(v=i?A(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,p]=(0,F.useState)(v),k;e[4]!==i?(k=i?A(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[y,I]=(0,F.useState)(k),[C,w]=(0,F.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Pt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[z,N]=(0,F.useState)(x),_;e[9]!==o||e[10]!==y||e[11]!==z||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==s||e[19]!==g?(_=c(()=>{s(async()=>{let S=z.trim()===""?void 0:Lt(z);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim()===""?void 0:u.trim(),organizationId:A(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),d()})},"O"),e[9]=o,e[10]=y,e[11]=z,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=s,e[19]=g,e[20]=_):_=e[20];let D=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let $;e[27]!==r||e[28]!==l?($=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=$):$=e[29];let E;e[30]!==l?(E=l("name"),e[30]=l,e[31]=E):E=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=c(S=>{b(S.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,a.jsx)(V,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==E?(K=(0,a.jsx)(G,{htmlFor:"org-form-name",label:E,children:B}),e[35]=B,e[36]=E,e[37]=K):K=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let P;e[40]===Symbol.for("react.memo_cache_sentinel")?(P=c(S=>{p(S.target.value)},"P"),e[40]=P):P=e[40];let U;e[41]!==g?(U=(0,a.jsx)(V,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:P,value:g}),e[41]=g,e[42]=U):U=e[42];let L;e[43]!==J||e[44]!==U?(L=(0,a.jsx)(G,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=L):L=e[45];let Y;e[46]!==l?(Y=l("Logo URL (optional)"),e[46]=l,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=c(S=>{I(S.target.value)},"M"),e[48]=M):M=e[48];let R;e[49]!==y?(R=(0,a.jsx)(V,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=R):R=e[50];let q;e[51]!==Y||e[52]!==R?(q=(0,a.jsx)(G,{htmlFor:"org-form-logo",label:Y,children:R}),e[51]=Y,e[52]=R,e[53]=q):q=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(V,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(S=>{w(S.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=c(S=>{N(S.target.value)},"oe"),e[60]=ae):ae=e[60];let re;e[61]!==z?(re=(0,a.jsx)(wt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:ae,value:z}),e[61]=z,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,a.jsx)(G,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let le;return e[66]!==n||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==K||e[71]!==L||e[72]!==q||e[73]!==W||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==$?(le=(0,a.jsxs)(ce,{busy:n,canSubmit:O,error:m,onClose:d,onSubmit:D,submitLabel:T,testId:"org-form",title:$,children:[K,L,q,W,ee]}),e[66]=n,e[67]=m,e[68]=d,e[69]=D,e[70]=K,e[71]=L,e[72]=q,e[73]=W,e[74]=ee,e[75]=O,e[76]=T,e[77]=$,e[78]=le):le=e[78],le},"yt"),Qt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==m||e[6]!==s?(v=c(()=>{m(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),d(),r()})},"p"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=m,e[6]=s,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-add-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Jt"),Zt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m?(v=c(()=>{m(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-invite-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Ut"),Yt=c(t=>{let e=(0,H.c)(32),{member:r,onClose:d,onDone:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),s;e[0]!==r.role?(s=c(()=>A(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[f,u]=(0,F.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==f||e[7]!==m?(b=c(()=>{m(async()=>{await i.setAuthOrgMemberRole({memberId:A(r.id),role:f.trim()}),h(),d()})},"g"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=f,e[7]=m,e[8]=b):b=e[8];let v=b,g;e[9]!==f?(g=f.trim(),e[9]=f,e[10]=g):g=e[10];let p=g!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let w;e[18]!==f?(w=(0,a.jsx)(V,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:f}),e[18]=f,e[19]=w):w=e[19];let x;e[20]!==I||e[21]!==w?(x=(0,a.jsx)(G,{htmlFor:"org-member-role-value",label:I,children:w}),e[20]=I,e[21]=w,e[22]=x):x=e[22];let z;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==v||e[27]!==x||e[28]!==p||e[29]!==k||e[30]!==y?(z=(0,a.jsx)(ce,{busy:l,canSubmit:p,error:n,onClose:d,onSubmit:v,submitLabel:k,testId:"org-member-role",title:y,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=v,e[27]=x,e[28]=p,e[29]=k,e[30]=y,e[31]=z):z=e[31],z},"Gt"),Mt=c(t=>{let e=(0,H.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==l||e[3]!==r||e[4]!==b||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==f||e[9]!==o?.id?(g=c(()=>{f(async()=>{await(r==="create"?l.createAuthOrgTeam({name:b.trim(),organizationId:i}):l.updateAuthOrgTeam({name:b.trim(),teamId:A(o?.id)})),h(),d()})},"f"),e[2]=l,e[3]=r,e[4]=b,e[5]=d,e[6]=h,e[7]=i,e[8]=f,e[9]=o?.id,e[10]=g):g=e[10];let p=g,k;e[11]!==b?(k=b.trim(),e[11]=b,e[12]=k):k=e[12];let y=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(D=>{v(D.target.value)},"x"),e[21]=x):x=e[21];let z;e[22]!==b?(z=(0,a.jsx)(V,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:b}),e[22]=b,e[23]=z):z=e[23];let N;e[24]!==w||e[25]!==z?(N=(0,a.jsx)(G,{htmlFor:"org-team-form-name",label:w,children:z}),e[24]=w,e[25]=z,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==s||e[29]!==d||e[30]!==p||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==C?(_=(0,a.jsx)(ce,{busy:m,canSubmit:y,error:s,onClose:d,onSubmit:p,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=m,e[28]=s,e[29]=d,e[30]=p,e[31]=N,e[32]=y,e[33]=I,e[34]=C,e[35]=_):_=e[35],_},"Ct"),qt=c(t=>{let e=(0,H.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==m||e[4]!==h||e[5]!==s?(u=c(()=>{m(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=m,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",p;e[9]!==o?(p=o("Add member"),e[9]=o,e[10]=p):p=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(z=>{f(z.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==s?(C=(0,a.jsx)(V,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:s}),e[16]=s,e[17]=C):C=e[17];let w;e[18]!==y||e[19]!==C?(w=(0,a.jsx)(G,{htmlFor:"org-team-add-member-user",label:y,children:C}),e[18]=y,e[19]=C,e[20]=w):w=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==p||e[27]!==k||e[28]!==w?(x=(0,a.jsx)(ce,{busy:l,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:p,testId:"org-team-add-member",title:k,children:w}),e[21]=l,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=p,e[27]=k,e[28]=w,e[29]=x):x=e[29],x},"Ht"),Ft=c(t=>{let e=(0,H.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Pt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[p,k]=(0,F.useState)(g),y;e[5]!==l||e[6]!==r||e[7]!==b||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==p||e[12]!==o?.id||e[13]!==f?(y=c(()=>{f(async()=>{let $=Kt(p);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:$,role:b.trim()}):l.updateAuthOrgRole({permission:$,roleId:A(o?.id)})),h(),d()})},"v"),e[5]=l,e[6]=r,e[7]=b,e[8]=d,e[9]=h,e[10]=i,e[11]=p,e[12]=o?.id,e[13]=f,e[14]=y):y=e[14];let I=y,C;e[15]!==r||e[16]!==b||e[17]!==p?(C=p.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=p,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let z;e[25]!==r||e[26]!==b||e[27]!==n?(z=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(V,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c($=>{v($.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=z):z=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{k($.target.value)},"O"),e[31]=_):_=e[31];let D;e[32]!==p?(D=(0,a.jsx)(wt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:p}),e[32]=p,e[33]=D):D=e[33];let O;e[34]!==D||e[35]!==N?(O=(0,a.jsx)(G,{htmlFor:"org-role-form-permission",label:N,children:D}),e[34]=D,e[35]=N,e[36]=O):O=e[36];let T;return e[37]!==m||e[38]!==s||e[39]!==d||e[40]!==I||e[41]!==O||e[42]!==C||e[43]!==w||e[44]!==x||e[45]!==z?(T=(0,a.jsxs)(ce,{busy:m,canSubmit:C,error:s,onClose:d,onSubmit:I,submitLabel:w,testId:"org-role-form",title:x,children:[z,O]}),e[37]=m,e[38]=s,e[39]=d,e[40]=I,e[41]=O,e[42]=C,e[43]=w,e[44]=x,e[45]=z,e[46]=T):T=e[46],T},"xt"),Bt=c(t=>{let e=(0,H.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==f?(u=c(()=>{f(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=f,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==d?(g=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=g):g=e[8];let p;return e[9]!==m||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==l?(p=(0,a.jsx)(ce,{busy:m,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:l,children:g}),e[9]=m,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=l,e[17]=p):p=e[17],p},"Mt"),Xe=c(t=>{let e=(0,H.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let m;e[7]!==d?(m=(0,a.jsx)(yt,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let s;return e[9]!==n||e[10]!==m||e[11]!==i?(s=(0,a.jsxs)(vt,{className:"overflow-hidden py-0","data-testid":i,children:[n,m]}),e[9]=n,e[10]=m,e[11]=i,e[12]=s):s=e[12],s},"We"),We=c(t=>{let e=(0,H.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=Q(),l;e[0]!==r?(l=r.map(Gt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==n?(m=(0,a.jsx)(me,{"aria-label":n}),e[4]=n,e[5]=m):m=e[5];let s;e[6]!==l||e[7]!==m?(s=(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[l,m]})}),e[6]=l,e[7]=m,e[8]=s):s=e[8];let f;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==d||e[16]!==h?(v=c((g,p)=>{let k=A(g.id),y=k===""?`index-${p.toString()}`:k;return(0,a.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(I=>(0,a.jsx)(de,{className:I.className,children:I.render(g)},I.head)),(0,a.jsx)(de,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(g)})})]},y)},"p"),e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17],f=i.map(v),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=f}else f=e[13];let u;e[18]!==f?(u=(0,a.jsx)(xt,{children:f}),e[18]=f,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,a.jsxs)(Ct,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"Xe");function Gt(t){return(0,a.jsx)(me,{children:t.head},t.head)}c(Gt,"Zt");var Vt=c(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=Q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==l?(m=l("Add member"),e[2]=l,e[3]=m):m=e[3];let s;e[4]!==n||e[5]!==m?(s=(0,a.jsx)(j,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:m}),e[4]=n,e[5]=m,e[6]=s):s=e[6];let f;e[7]!==o?(f=c(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=f):f=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let b;e[11]!==f||e[12]!==u?(b=(0,a.jsx)(j,{"data-testid":"org-open-invite-member",onClick:f,size:"xs",type:"button",variant:"outline",children:u}),e[11]=f,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,a.jsxs)(a.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==l?(g=l("Members"),e[17]=l,e[18]=g):g=e[18];let p;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(p=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(y=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-member-role-${A(y.id)}`,onClick:c(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(j,{"data-testid":`org-remove-member-${A(y.id)}`,disabled:r,onClick:c(()=>{d(A(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=p):p=e[25];let k;return e[26]!==v||e[27]!==g||e[28]!==p?(k=(0,a.jsx)(Xe,{action:v,heading:g,testId:"org-members",children:p}),e[26]=v,e[27]=g,e[28]=p,e[29]=k):k=e[29],k},"qt"),Xt=c(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=Q(),m;e[0]!==d?(m=c(()=>{d({kind:"team-create"})},"m"),e[0]=d,e[1]=m):m=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let f;e[4]!==m||e[5]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[4]=m,e[5]=s,e[6]=f):f=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"aria-pressed":i===A(g.id),"data-testid":`org-team-select-${A(g.id)}`,onClick:c(()=>{h(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(j,{"data-testid":`org-team-rename-${A(g.id)}`,onClick:c(()=>{d({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(j,{"data-testid":`org-team-delete-${A(g.id)}`,onClick:c(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=b):b=e[16];let v;return e[17]!==f||e[18]!==u||e[19]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-teams",children:b}),e[17]=f,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"Kt"),Wt=c(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=Q(),m;e[0]!==h||e[1]!==i?(m=c(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=m):m=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let f;e[5]!==m||e[6]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[5]=m,e[6]=s,e[7]=f):f=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsx)(j,{"data-testid":`org-team-remove-member-${A(g.id)}`,disabled:r,onClick:c(()=>{d(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=b):b=e[15];let v;return e[16]!==f||e[17]!==u||e[18]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-team-members",children:b}),e[16]=f,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"Vt"),er=c(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=Q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"i"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==l||e[5]!==n?(m=(0,a.jsx)(j,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=m):m=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let f;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(f=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(b=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-role-edit-${A(b.id)}`,onClick:c(()=>{d({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(j,{"data-testid":`org-role-delete-${A(b.id)}`,onClick:c(()=>{r(A(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=f):f=e[14];let u;return e[15]!==m||e[16]!==s||e[17]!==f?(u=(0,a.jsx)(Xe,{action:m,heading:s,testId:"org-roles",children:f}),e[15]=m,e[16]=s,e[17]=f,e[18]=u):u=e[18],u},"Wt"),Et=200,tr=c(t=>{let e=(0,H.c)(207),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=oe(),o=Q(),[l,n]=(0,F.useState)(null),[m,s]=(0,F.useState)(null),[f,u]=(0,F.useState)(!1),[b,v]=(0,F.useState)(null),[g,p]=_t(r),k;e[0]!==g||e[1]!==r?(k=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=k):k=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=c(()=>i.listAuthOrgMembers({limit:Et,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let I=ge(k,y),C;e[7]!==r?(C=["lunora-auth-org-invitations",r],e[7]=r,e[8]=C):C=e[8];let w;e[9]!==i||e[10]!==r?(w=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let x=ge(C,w),z;e[12]!==r?(z=["lunora-auth-org-teams",r],e[12]=r,e[13]=z):z=e[13];let N;e[14]!==i||e[15]!==r?(N=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"D"),e[14]=i,e[15]=r,e[16]=N):N=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let D=ge(z,N,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let $;e[24]!==d?($={enabled:d},e[24]=d,e[25]=$):$=e[25];let E=ge(O,T,$),Z;e[26]!==m?(Z=["lunora-auth-org-team-members",m],e[26]=m,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==m?(B=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"B"),e[28]=i,e[29]=m,e[30]=B):B=e[30];let K=m!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let P=ge(Z,B,J),U;e[33]!==I.data?.rows?(U=I.data?.rows??[],e[33]=I.data?.rows,e[34]=U):U=e[34];let L=U,Y;e[35]!==x.data?.rows?(Y=x.data?.rows??[],e[35]=x.data?.rows,e[36]=Y):Y=e[36];let M=Y,R;e[37]!==D.data?.rows?(R=D.data?.rows??[],e[37]=D.data?.rows,e[38]=R):R=e[38];let q=R,W;e[39]!==E.data?.rows?(W=E.data?.rows??[],e[39]=E.data?.rows,e[40]=W):W=e[40];let te=W,ae;e[41]!==m||e[42]!==P?(ae=m===null?[]:P.data?.rows??[],e[41]=m,e[42]=P,e[43]=ae):ae=e[43];let re=ae,ee=I.error??x.error??D.error??E.error??P.error,le;e[44]!==x||e[45]!==I||e[46]!==d||e[47]!==E||e[48]!==m||e[49]!==P||e[50]!==h||e[51]!==D?(le=c(()=>{I.refetch(),x.refetch(),h&&D.refetch(),d&&E.refetch(),m!==null&&P.refetch()},"ie"),e[44]=x,e[45]=I,e[46]=d,e[47]=E,e[48]=m,e[49]=P,e[50]=h,e[51]=D,e[52]=le):le=e[52];let S=le;kt(S,!0);let et;e[53]===Symbol.for("react.memo_cache_sentinel")?(et=c(()=>{n(null)},"Ye"),e[53]=et):et=e[53];let ne=et,tt;e[54]!==S?(tt=c(X=>{At((async()=>{u(!0),v(null);try{await X(),S(),u(!1)}catch(mt){v(Nt(mt)),u(!1)}})())},"et"),e[54]=S,e[55]=tt):tt=e[55];let ie=tt,rt;e[56]!==i||e[57]!==o?(rt=c(X=>{let mt=A(X.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:mt}),s(St=>St===mt?null:St)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"tt"),e[56]=i,e[57]=o,e[58]=rt):rt=e[58];let dt=rt,he;e[59]!==o?(he=o("userId"),e[59]=o,e[60]=he):he=e[60];let be;e[61]!==he?(be={head:he,render:rr},e[61]=he,e[62]=be):be=e[62];let fe;e[63]!==o?(fe=o("role"),e[63]=o,e[64]=fe):fe=e[64];let pe;e[65]!==fe?(pe={head:fe,render:or},e[65]=fe,e[66]=pe):pe=e[66];let ot;e[67]!==be||e[68]!==pe?(ot=[be,pe],e[67]=be,e[68]=pe,e[69]=ot):ot=e[69];let ct=ot,ve;e[70]!==o?(ve=o("email"),e[70]=o,e[71]=ve):ve=e[71];let ye;e[72]!==ve?(ye={head:ve,render:ar},e[72]=ve,e[73]=ye):ye=e[73];let Ce;e[74]!==o?(Ce=o("role"),e[74]=o,e[75]=Ce):Ce=e[75];let Ie;e[76]!==Ce?(Ie={head:Ce,render:lr},e[76]=Ce,e[77]=Ie):Ie=e[77];let xe;e[78]!==o?(xe=o("status"),e[78]=o,e[79]=xe):xe=e[79];let we;e[80]!==xe?(we={head:xe,render:nr},e[80]=xe,e[81]=we):we=e[81];let at;e[82]!==ye||e[83]!==Ie||e[84]!==we?(at=[ye,Ie,we],e[82]=ye,e[83]=Ie,e[84]=we,e[85]=at):at=e[85];let ut=at,ke;e[86]!==o?(ke=o("id"),e[86]=o,e[87]=ke):ke=e[87];let ze;e[88]!==ke?(ze={className:"font-mono text-xs",head:ke,render:ir},e[88]=ke,e[89]=ze):ze=e[89];let Se;e[90]!==o?(Se=o("name"),e[90]=o,e[91]=Se):Se=e[91];let Ne;e[92]!==Se?(Ne={head:Se,render:sr},e[92]=Se,e[93]=Ne):Ne=e[93];let lt;e[94]!==ze||e[95]!==Ne?(lt=[ze,Ne],e[94]=ze,e[95]=Ne,e[96]=lt):lt=e[96];let gt=lt,Ae;e[97]!==o?(Ae=o("userId"),e[97]=o,e[98]=Ae):Ae=e[98];let nt;e[99]!==Ae?(nt=[{head:Ae,render:mr}],e[99]=Ae,e[100]=nt):nt=e[100];let ht=nt,De;e[101]!==o?(De=o("role"),e[101]=o,e[102]=De):De=e[102];let Oe;e[103]!==De?(Oe={head:De,render:dr},e[103]=De,e[104]=Oe):Oe=e[104];let _e;e[105]!==o?(_e=o("Permission"),e[105]=o,e[106]=_e):_e=e[106];let Te;e[107]!==_e?(Te={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:cr},e[107]=_e,e[108]=Te):Te=e[108];let it;e[109]!==Oe||e[110]!==Te?(it=[Oe,Te],e[109]=Oe,e[110]=Te,e[111]=it):it=e[111];let bt=it,$e;e[112]!==ee?($e=ee!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[112]=ee,e[113]=$e):$e=e[113];let Re;e[114]!==b?(Re=b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[114]=b,e[115]=Re):Re=e[115];let Me;e[116]!==i||e[117]!==ie?(Me=c(X=>{ie(()=>i.removeAuthOrgMember({memberId:X}))},"$e"),e[116]=i,e[117]=ie,e[118]=Me):Me=e[118];let Fe;e[119]!==f||e[120]!==ct||e[121]!==L||e[122]!==Me?(Fe=(0,a.jsx)(Vt,{actionBusy:f,memberColumns:ct,members:L,onDialog:n,onRemoveMember:Me}),e[119]=f,e[120]=ct,e[121]=L,e[122]=Me,e[123]=Fe):Fe=e[123];let ft=I.data?.total,Ee;e[124]!==L.length||e[125]!==g||e[126]!==p||e[127]!==ft?(Ee=(0,a.jsx)(zt,{count:L.length,offset:g,onOffsetChange:p,pageSize:Et,prefix:"org-members",total:ft}),e[124]=L.length,e[125]=g,e[126]=p,e[127]=ft,e[128]=Ee):Ee=e[128];let je;e[129]!==f||e[130]!==i||e[131]!==ut||e[132]!==M||e[133]!==ie||e[134]!==o?(je=M.length>0&&(0,a.jsx)(Xe,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(We,{columns:ut,rowActions:c(X=>(0,a.jsx)(j,{"data-testid":`org-cancel-invitation-${A(X.id)}`,disabled:f,onClick:c(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:A(X.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[129]=f,e[130]=i,e[131]=ut,e[132]=M,e[133]=ie,e[134]=o,e[135]=je):je=e[135];let Le;e[136]!==dt||e[137]!==m||e[138]!==gt||e[139]!==q||e[140]!==h?(Le=h&&(0,a.jsx)(Xt,{onConfirmDeleteTeam:dt,onDialog:n,onSelectTeam:s,selectedTeam:m,teamColumns:gt,teams:q}),e[136]=dt,e[137]=m,e[138]=gt,e[139]=q,e[140]=h,e[141]=Le):Le=e[141];let Pe;e[142]!==f||e[143]!==i||e[144]!==ie||e[145]!==m||e[146]!==ht||e[147]!==re||e[148]!==h?(Pe=h&&m!==null&&(0,a.jsx)(Wt,{actionBusy:f,onDialog:n,onRemoveTeamMember:c(X=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:X}))},"onRemoveTeamMember"),selectedTeam:m,teamMemberColumns:ht,teamMembers:re}),e[142]=f,e[143]=i,e[144]=ie,e[145]=m,e[146]=ht,e[147]=re,e[148]=h,e[149]=Pe):Pe=e[149];let Be;e[150]!==i||e[151]!==bt||e[152]!==te||e[153]!==d||e[154]!==o?(Be=d&&(0,a.jsx)(er,{onConfirmDeleteRole:c(X=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:X}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:bt,roles:te}),e[150]=i,e[151]=bt,e[152]=te,e[153]=d,e[154]=o,e[155]=Be):Be=e[155];let Je;e[156]!==l?.kind||e[157]!==r||e[158]!==S?(Je=l?.kind==="add-member"&&(0,a.jsx)(Qt,{onClose:ne,onDone:S,organizationId:r}),e[156]=l?.kind,e[157]=r,e[158]=S,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==S?(Ue=l?.kind==="invite-member"&&(0,a.jsx)(Zt,{onClose:ne,onDone:S,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=S,e[163]=Ue):Ue=e[163];let He;e[164]!==l||e[165]!==S?(He=l?.kind==="member-role"&&(0,a.jsx)(Yt,{member:l.member,onClose:ne,onDone:S}),e[164]=l,e[165]=S,e[166]=He):He=e[166];let Ke;e[167]!==l?.kind||e[168]!==r||e[169]!==S?(Ke=l?.kind==="team-create"&&(0,a.jsx)(Mt,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[167]=l?.kind,e[168]=r,e[169]=S,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l||e[172]!==r||e[173]!==S?(Qe=l?.kind==="team-rename"&&(0,a.jsx)(Mt,{mode:"edit",onClose:ne,onDone:S,organizationId:r,team:l.team}),e[171]=l,e[172]=r,e[173]=S,e[174]=Qe):Qe=e[174];let Ze;e[175]!==l||e[176]!==S?(Ze=l?.kind==="team-add-member"&&(0,a.jsx)(qt,{onClose:ne,onDone:S,teamId:l.teamId}),e[175]=l,e[176]=S,e[177]=Ze):Ze=e[177];let Ye;e[178]!==l?.kind||e[179]!==r||e[180]!==S?(Ye=l?.kind==="role-create"&&(0,a.jsx)(Ft,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[178]=l?.kind,e[179]=r,e[180]=S,e[181]=Ye):Ye=e[181];let qe;e[182]!==l||e[183]!==r||e[184]!==S?(qe=l?.kind==="role-edit"&&(0,a.jsx)(Ft,{mode:"edit",onClose:ne,onDone:S,organizationId:r,role:l.role}),e[182]=l,e[183]=r,e[184]=S,e[185]=qe):qe=e[185];let Ge;e[186]!==l||e[187]!==S?(Ge=l?.kind==="confirm"&&(0,a.jsx)(Bt,{action:l.action,message:l.message,onClose:ne,onDone:S,testId:l.testId,title:l.title}),e[186]=l,e[187]=S,e[188]=Ge):Ge=e[188];let st;return e[189]!==$e||e[190]!==Re||e[191]!==Fe||e[192]!==Ee||e[193]!==je||e[194]!==Le||e[195]!==Pe||e[196]!==Be||e[197]!==Je||e[198]!==Ue||e[199]!==He||e[200]!==Ke||e[201]!==Qe||e[202]!==Ze||e[203]!==Ye||e[204]!==qe||e[205]!==Ge?(st=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Re,Fe,Ee,je,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge]}),e[189]=$e,e[190]=Re,e[191]=Fe,e[192]=Ee,e[193]=je,e[194]=Le,e[195]=Pe,e[196]=Be,e[197]=Je,e[198]=Ue,e[199]=He,e[200]=Ke,e[201]=Qe,e[202]=Ze,e[203]=Ye,e[204]=qe,e[205]=Ge,e[206]=st):st=e[206],st},"Xt");function rr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(rr,"Yt");function or(t){return A(t.role)}c(or,"el");function ar(t){return A(t.email)}c(ar,"tl");function lr(t){return A(t.role)}c(lr,"ll");function nr(t){return A(t.status)}c(nr,"ol");function ir(t){return A(t.id)}c(ir,"il");function sr(t){return A(t.name)}c(sr,"rl");function mr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(mr,"nl");function dr(t){return A(t.role)}c(dr,"sl");function cr(t){return A(t.permission)}c(cr,"al");var jt=100,Ar=c(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:d,ready:h}=Tt(),i=d.capabilities.organization,[o,l]=(0,F.useState)(null),[n,m]=(0,F.useState)(null),[s,f]=(0,F.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=c(()=>e.listAuthOrganizations({limit:jt,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=ge(u,b,v),p=g.data?.rows??null,k;t[7]!==g?(k=c(()=>{g.refetch()},"S"),t[7]=g,t[8]=k):k=t[8],kt(k,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{m(null)},"v"),t[9]=y):y=t[9];let I=y,C;t[10]!==g?(C=c(()=>{g.refetch()},"y"),t[10]=g,t[11]=C):C=t[11];let w=C,x;t[12]===Symbol.for("react.memo_cache_sentinel")?(x=c(M=>{l(M)},"x"),t[12]=x):x=t[12];let z=x;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let R;t[15]!==r?(R=r("Organizations are not enabled."),t[15]=r,t[16]=R):R=t[16];let q;return t[17]!==M||t[18]!==R?(q=(0,a.jsx)(ue,{description:M,testId:"org-disabled",title:R}),t[17]=M,t[18]=R,t[19]=q):q=t[19],q}let N;t[20]!==r?(N=r("Organizations"),t[20]=r,t[21]=N):N=t[21];let _;t[22]!==N?(_=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),t[22]=N,t[23]=_):_=t[23];let D;t[24]===Symbol.for("react.memo_cache_sentinel")?(D=c(()=>{m({kind:"create"})},"A"),t[24]=D):D=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,a.jsx)(j,{"data-testid":"org-new",onClick:D,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let $;t[29]!==T||t[30]!==_?($=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=$):$=t[31];let E;t[32]!==g.error?(E=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=E):E=t[33];let Z;t[34]!==p||t[35]!==r?(Z=p!==null&&p.length===0&&(0,a.jsx)(ue,{testId:"org-empty",title:r("No organizations.")}),t[34]=p,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==p||t[38]!==o||t[39]!==r?(B=p!==null&&p.length>0&&(0,a.jsx)(vt,{className:"overflow-hidden py-0",children:(0,a.jsx)(yt,{className:"px-0",children:(0,a.jsxs)(Ct,{"data-testid":"org-table",children:[(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[(0,a.jsx)(me,{children:r("id")}),(0,a.jsx)(me,{children:r("name")}),(0,a.jsx)(me,{children:r("slug")}),(0,a.jsx)(me,{children:r("created")}),(0,a.jsx)(me,{"aria-label":r("Actions")})]})}),(0,a.jsx)(xt,{children:p.map(M=>{let R=A(M.id);return(0,a.jsxs)(Ve,{"data-testid":`org-row-${R}`,children:[(0,a.jsx)(de,{className:"font-mono text-xs",children:R}),(0,a.jsx)(de,{children:A(M.name)}),(0,a.jsx)(de,{children:A(M.slug)}),(0,a.jsx)(de,{className:"text-muted-foreground tabular-nums",children:Dt(M.createdAt)}),(0,a.jsx)(de,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(j,{"aria-pressed":o===R,"data-testid":`org-select-${R}`,onClick:c(()=>{z(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(j,{"data-testid":`org-edit-${R}`,onClick:c(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(j,{"data-testid":`org-delete-${R}`,onClick:c(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},R)})})]})})}),t[37]=p,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==p||t[43]!==g.data?.total?(K=p!==null&&(0,a.jsx)(zt,{count:p.length,offset:s,onOffsetChange:f,pageSize:jt,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=p,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==d.organization||t[46]!==o?(J=o!==null&&(0,a.jsx)(tr,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=J):J=t[47];let P;t[48]!==n?.kind||t[49]!==w?(P=n?.kind==="create"&&(0,a.jsx)(Rt,{mode:"create",onClose:I,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=P):P=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,a.jsx)(Rt,{mode:"edit",onClose:I,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let L;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(L=n?.kind==="delete"&&(0,a.jsx)(Bt,{action:c(async()=>{let M=A(n.org.id);await e.deleteAuthOrganization({organizationId:M}),l(R=>R===M?null:R)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:I,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=L):L=t[58];let Y;return t[59]!==$||t[60]!==E||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==P||t[66]!==U||t[67]!==L?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[$,E,Z,B,K,J,P,U,L]}),t[59]=$,t[60]=E,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=P,t[66]=U,t[67]=L,t[68]=Y):Y=t[68],Y},"Al");export{Ar as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as E,e as _}from"./chunk-CVXNHIQW.js";import{a as $}from"./chunk-253UHWDX.js";import{a as de}from"./chunk-GCG65T2K.js";import{a as ce}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import"./chunk-AN4UDYUY.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as le}from"./chunk-R6U22RSY.js";import{a as re}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as K}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as ie}from"./chunk-NBBCLHM4.js";import"./chunk-NCPW7WHO.js";import"./chunk-U5HRF22B.js";import"./chunk-55UGUCQ6.js";import{a as J}from"./chunk-4ZEL6BYL.js";import{c as H}from"./chunk-R2SQETIF.js";import"./chunk-MOW4XMIT.js";import"./chunk-QAQDMS6R.js";import"./chunk-VEK3S7MV.js";import{a as ne}from"./chunk-RWVIV3U7.js";import{a as R,b as W,c as Z,d as A,e as M,f as S}from"./chunk-HCTJKP5J.js";import{a as q,b as D,c as U,e as oe}from"./chunk-2IKDEUCX.js";import{d as F,t as ae}from"./chunk-HJHSQPHW.js";import{a as p,d as se,f as be,g as ge}from"./chunk-I26MS5PJ.js";var O=se(be(),1);var o=se(ge(),1);var G="gen_ai.usage.input_tokens",Q="gen_ai.usage.output_tokens",V="gen_ai.usage.cost",fe="gen_ai.request.model",Te="lunora.usage.cost.source",xe=new Set(["ai.embed","ai.generate","ai.stream"]),ue=6e4,Ce=1440,ve="unknown",X=p(()=>({calls:0,estimatedCost:0,inputTokens:0,outputTokens:0,providerCost:0}),"q"),Y=p((n,e)=>{let s=n?.[e];return typeof s=="string"&&s!==""?s:void 0},"J"),z=p((n,e)=>{let s=n?.[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},"L"),ee=p(n=>Y(n,Te)==="provider"?"provider":"estimated","Q"),me=p((n,e)=>n.reduce((s,a)=>s+e(a),0),"Y"),B=p(n=>n.providerCost+n.estimatedCost,"F"),ke=p(n=>n.estimatedCost>0?n.providerCost>0?"mixed":"estimated":n.providerCost>0?"provider":"none","ae"),ye=p((n,e)=>({calls:n.calls+e.calls,estimatedCost:n.estimatedCost+e.estimatedCost,inputTokens:n.inputTokens+e.inputTokens,outputTokens:n.outputTokens+e.outputTokens,providerCost:n.providerCost+e.providerCost}),"ce"),Ie=p(n=>{let e=X(),s=0,a=0,t=0;for(let c of n){let l=me(c.points,i=>i.sum),r=me(c.points,i=>i.count);c.name===G?(e.inputTokens+=l,s+=r):c.name===Q?(e.outputTokens+=l,a+=r):(t+=r,ee(c.attributes)==="provider"?e.providerCost+=l:e.estimatedCost+=l)}return e.calls=Math.max(s,a,t),e},"ge"),Ne=p((n,e)=>B(e)-B(n)||e.inputTokens+e.outputTokens-(n.inputTokens+n.outputTokens)||n.key.localeCompare(e.key),"Ne"),pe=p((n,e)=>{let s=new Map;for(let a of n){let t=e(a);s.set(t,{key:t,...ye(s.get(t)??X(),a)})}return[...s.values()].toSorted(Ne)},"Z"),we=p(n=>(n?.series??[]).filter(e=>e.name===G||e.name===Q||e.name===V),"xe"),Me=p(n=>Y(n.attributes,fe)??ve,"Se"),Se=p(n=>{let e=new Map;for(let s of n){let a=Me(s),t=JSON.stringify([s.functionPath,a]),c=e.get(t)??{functionPath:s.functionPath,model:a,series:[]};c.series.push(s),e.set(t,c)}return[...e.values()].map(({functionPath:s,model:a,series:t})=>({functionPath:s,model:a,...Ie(t)}))},"Ie"),_e=p(n=>{let e=new Map;for(let r of n){if(r.name!==V)continue;let i=ee(r.attributes)==="provider";for(let u of r.points){let m=e.get(u.bucketMs)??{bucketMs:u.bucketMs,estimatedCost:0,providerCost:0};i?m.providerCost+=u.sum:m.estimatedCost+=u.sum,e.set(u.bucketMs,m)}}let s=[...e.keys()].toSorted((r,i)=>r-i),a=s[0],t=s.at(-1);if(a===void 0||t===void 0)return[];let c=Math.max(a,t-(Ce-1)*ue),l=[];for(let r=c;r<=t;r+=ue)l.push(e.get(r)??{bucketMs:r,estimatedCost:0,providerCost:0});return l},"_e"),Pe=p(n=>{let e=[];for(let s of n)for(let a of s.spans){if(!xe.has(a.name))continue;let{attributes:t}=a,c=z(t,V),l=z(t,G),r=z(t,Q);e.push({...c===void 0?{}:{cost:c,costSource:ee(t)},functionPath:s.functionPath,...l===void 0?{}:{inputTokens:l},model:Y(t,fe)??ve,ok:a.ok,...r===void 0?{}:{outputTokens:r},startTs:s.startTs+a.offsetMs,streaming:a.name==="ai.stream",traceId:s.traceId})}return e.toSorted((s,a)=>a.startTs-s.startTs)},"Me"),Fe=p(n=>n.map(e=>{let s=e.cost??0;return{calls:1,estimatedCost:e.costSource==="provider"?0:s,functionPath:e.functionPath,inputTokens:e.inputTokens??0,model:e.model,outputTokens:e.outputTokens??0,providerCost:e.costSource==="provider"?s:0}}),"Oe"),Oe=p((n,e)=>{let s=we(n),a=Pe(e),t=s.length>0,c=t?Se(s):Fe(a),l=X(),r="none";for(let i of c)l=ye(l,i);return t?r="history":a.length>0&&(r="live"),{byFunction:pe(c,i=>i.functionPath),byModel:pe(c,i=>i.model),calls:a,source:r,totals:l,trend:t?_e(s):[]}},"Ae"),Ke=p(n=>Array.isArray(n?.traces)?n.traces:[],"Ee"),Ae=25,te=p(n=>{let e=(0,O.c)(16),{provenance:s,value:a}=n,t=F();if(s==="none"){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let c;e[1]!==s||e[2]!==a?(c=s==="provider"?E(a):`~${E(a)}`,e[1]=s,e[2]=a,e[3]=c):c=e[3];let l;e[4]!==c?(l=(0,o.jsx)("span",{className:"tabular-nums",children:c}),e[4]=c,e[5]=l):l=e[5];let r;e[6]!==s||e[7]!==t?(r=s==="estimated"?(0,o.jsx)(K,{title:t("Derived from a price table, not reported by the provider."),variant:"warning",children:t("Estimated")}):null,e[6]=s,e[7]=t,e[8]=r):r=e[8];let i;e[9]!==s||e[10]!==t?(i=s==="mixed"?(0,o.jsx)(K,{title:t("Includes cost derived from a price table, not reported by the provider."),variant:"warning",children:t("Partly estimated")}):null,e[9]=s,e[10]=t,e[11]=i):i=e[11];let u;return e[12]!==l||e[13]!==r||e[14]!==i?(u=(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[l,r,i]}),e[12]=l,e[13]=r,e[14]=i,e[15]=u):u=e[15],u},"V"),he=p(n=>{let e=(0,O.c)(40),{keyLabel:s,rows:a,testId:t,title:c}=n,l=F(),r;e[0]!==c?(r=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[0]=c,e[1]=r):r=e[1];let i;e[2]!==s?(i=(0,o.jsx)(M,{children:s}),e[2]=s,e[3]=i):i=e[3];let u;e[4]!==l?(u=l("Calls"),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)(M,{className:"text-end",children:u}),e[6]=u,e[7]=m):m=e[7];let k;e[8]!==l?(k=l("Input tokens"),e[8]=l,e[9]=k):k=e[9];let y;e[10]!==k?(y=(0,o.jsx)(M,{className:"text-end",children:k}),e[10]=k,e[11]=y):y=e[11];let b;e[12]!==l?(b=l("Output tokens"),e[12]=l,e[13]=b):b=e[13];let T;e[14]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[14]=b,e[15]=T):T=e[15];let g;e[16]!==l?(g=l("Cost"),e[16]=l,e[17]=g):g=e[17];let d;e[18]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[18]=g,e[19]=d):d=e[19];let x;e[20]!==d||e[21]!==i||e[22]!==m||e[23]!==y||e[24]!==T?(x=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d]})}),e[20]=d,e[21]=i,e[22]=m,e[23]=y,e[24]=T,e[25]=x):x=e[25];let h;if(e[26]!==a||e[27]!==t){let N;e[29]!==t?(N=p(w=>(0,o.jsxs)(A,{"data-testid":`${t}-row`,children:[(0,o.jsx)(S,{className:"max-w-[280px] truncate font-mono",title:w.key,children:w.key}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.calls)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:ke(w),value:B(w)})})]},w.key),"x"),e[29]=t,e[30]=N):N=e[30],h=a.map(N),e[26]=a,e[27]=t,e[28]=h}else h=e[28];let f;e[31]!==h?(f=(0,o.jsx)(Z,{children:h}),e[31]=h,e[32]=f):f=e[32];let v;e[33]!==x||e[34]!==f?(v=(0,o.jsxs)(R,{children:[x,f]}),e[33]=x,e[34]=f,e[35]=v):v=e[35];let C;return e[36]!==r||e[37]!==v||e[38]!==t?(C=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":t,children:[r,v]}),e[36]=r,e[37]=v,e[38]=t,e[39]=C):C=e[39],C},"ee"),$e=p(n=>{let e=(0,O.c)(55),{calls:s,onOpenTrace:a}=n,t=F(),c;e[0]!==t?(c=t("Recent calls"),e[0]=t,e[1]=c):c=e[1];let l;e[2]!==c?(l=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[2]=c,e[3]=l):l=e[3];let r;e[4]!==t?(r=t("When"),e[4]=t,e[5]=r):r=e[5];let i;e[6]!==r?(i=(0,o.jsx)(M,{children:r}),e[6]=r,e[7]=i):i=e[7];let u;e[8]!==t?(u=t("Function"),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u?(m=(0,o.jsx)(M,{children:u}),e[10]=u,e[11]=m):m=e[11];let k;e[12]!==t?(k=t("Model"),e[12]=t,e[13]=k):k=e[13];let y;e[14]!==k?(y=(0,o.jsx)(M,{children:k}),e[14]=k,e[15]=y):y=e[15];let b;e[16]!==t?(b=t("Input tokens"),e[16]=t,e[17]=b):b=e[17];let T;e[18]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[18]=b,e[19]=T):T=e[19];let g;e[20]!==t?(g=t("Output tokens"),e[20]=t,e[21]=g):g=e[21];let d;e[22]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[22]=g,e[23]=d):d=e[23];let x;e[24]!==t?(x=t("Cost"),e[24]=t,e[25]=x):x=e[25];let h;e[26]!==x?(h=(0,o.jsx)(M,{className:"text-end",children:x}),e[26]=x,e[27]=h):h=e[27];let f;e[28]!==t?(f=t("Trace"),e[28]=t,e[29]=f):f=e[29];let v;e[30]!==f?(v=(0,o.jsx)(M,{children:f}),e[30]=f,e[31]=v):v=e[31];let C;e[32]!==T||e[33]!==d||e[34]!==h||e[35]!==v||e[36]!==i||e[37]!==m||e[38]!==y?(C=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d,h,v]})}),e[32]=T,e[33]=d,e[34]=h,e[35]=v,e[36]=i,e[37]=m,e[38]=y,e[39]=C):C=e[39];let N;if(e[40]!==s||e[41]!==a||e[42]!==t){let j;e[44]!==a||e[45]!==t?(j=p(I=>(0,o.jsxs)(A,{"data-testid":"ai-call",children:[(0,o.jsx)(S,{className:"font-mono text-muted-foreground",children:ae(I.startTs)}),(0,o.jsx)(S,{className:"font-mono",children:(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[I.functionPath,I.streaming?(0,o.jsx)(K,{variant:"outline",children:t("stream")}):null,I.ok?null:(0,o.jsx)(K,{variant:"destructive",children:t("failed")})]})}),(0,o.jsx)(S,{className:"max-w-[240px] truncate font-mono",title:I.model,children:I.model}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.inputTokens===void 0?"\u2014":_(I.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.outputTokens===void 0?"\u2014":_(I.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:I.cost===void 0?"none":I.costSource??"estimated",value:I.cost??0})}),(0,o.jsx)(S,{children:(0,o.jsx)("button",{className:"font-mono text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{a(I.traceId)},"onClick"),title:t("Open the trace {trace}",{trace:I.traceId}),type:"button",children:I.traceId.slice(0,8)})})]},`${I.traceId}:${I.startTs.toString()}:${I.model}`),"U"),e[44]=a,e[45]=t,e[46]=j):j=e[46],N=s.slice(0,Ae).map(j),e[40]=s,e[41]=a,e[42]=t,e[43]=N}else N=e[43];let w;e[47]!==N?(w=(0,o.jsx)(Z,{children:N}),e[47]=N,e[48]=w):w=e[48];let P;e[49]!==C||e[50]!==w?(P=(0,o.jsxs)(R,{children:[C,w]}),e[49]=C,e[50]=w,e[51]=P):P=e[51];let L;return e[52]!==l||e[53]!==P?(L=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":"ai-calls",children:[l,P]}),e[52]=l,e[53]=P,e[54]=L):L=e[54],L},"Pe"),Ee=p(n=>{let e=(0,O.c)(48),{totals:s,trend:a}=n,t=F(),c;e[0]!==s?(c=ke(s),e[0]=s,e[1]=c):c=e[1];let l=c,r;e[2]!==t||e[3]!==a?(r=a.length>=2?(0,o.jsx)(de,{ariaLabel:t("Cost per minute"),className:"h-7 w-24",series:a,testId:"ai-trend"}):void 0,e[2]=t,e[3]=a,e[4]=r):r=e[4];let i;e[5]!==l||e[6]!==t||e[7]!==s.estimatedCost||e[8]!==s.providerCost?(i=l==="none"?t("No cost reported"):(0,o.jsx)("span",{"data-testid":"ai-cost-split",children:t("{provider} provider-reported \xB7 {estimated} estimated",{estimated:E(s.estimatedCost),provider:E(s.providerCost)})}),e[5]=l,e[6]=t,e[7]=s.estimatedCost,e[8]=s.providerCost,e[9]=i):i=e[9];let u;e[10]!==t?(u=t("Total cost"),e[10]=t,e[11]=u):u=e[11];let m;e[12]!==s?(m=B(s),e[12]=s,e[13]=m):m=e[13];let k;e[14]!==l||e[15]!==m?(k=(0,o.jsx)(te,{provenance:l,value:m}),e[14]=l,e[15]=m,e[16]=k):k=e[16];let y;e[17]!==r||e[18]!==i||e[19]!==u||e[20]!==k?(y=(0,o.jsx)($,{chart:r,footer:i,label:u,testId:"ai-total-cost",value:k}),e[17]=r,e[18]=i,e[19]=u,e[20]=k,e[21]=y):y=e[21];let b;e[22]!==t?(b=t("Input tokens"),e[22]=t,e[23]=b):b=e[23];let T;e[24]!==s.inputTokens?(T=_(s.inputTokens),e[24]=s.inputTokens,e[25]=T):T=e[25];let g;e[26]!==b||e[27]!==T?(g=(0,o.jsx)($,{label:b,testId:"ai-input-tokens",value:T}),e[26]=b,e[27]=T,e[28]=g):g=e[28];let d;e[29]!==t?(d=t("Output tokens"),e[29]=t,e[30]=d):d=e[30];let x;e[31]!==s.outputTokens?(x=_(s.outputTokens),e[31]=s.outputTokens,e[32]=x):x=e[32];let h;e[33]!==d||e[34]!==x?(h=(0,o.jsx)($,{label:d,testId:"ai-output-tokens",value:x}),e[33]=d,e[34]=x,e[35]=h):h=e[35];let f;e[36]!==t?(f=t("Calls"),e[36]=t,e[37]=f):f=e[37];let v;e[38]!==s.calls?(v=_(s.calls),e[38]=s.calls,e[39]=v):v=e[39];let C;e[40]!==f||e[41]!==v?(C=(0,o.jsx)($,{label:f,testId:"ai-calls-total",value:v}),e[40]=f,e[41]=v,e[42]=C):C=e[42];let N;return e[43]!==g||e[44]!==h||e[45]!==C||e[46]!==y?(N=(0,o.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"ai-totals",children:[y,g,h,C]}),e[43]=g,e[44]=h,e[45]=C,e[46]=y,e[47]=N):N=e[47],N},"Ue"),Ye=p(n=>{let e=(0,O.c)(28),{initialShardKey:s}=n,a=F(),{queryShardKey:t,setShardKey:c,shardKey:l}=le(s),r=ce(t),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let u;e[1]!==t?(u={live:!0,shardKey:t},e[1]=t,e[2]=u):u=e[2];let{data:m,error:k}=H(J.getTraces,i,u),y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={},e[3]=y):y=e[3];let b;e[4]!==t?(b={live:!0,shardKey:t},e[4]=t,e[5]=b):b=e[5];let{data:T}=H(J.getMetricHistory,y,b),g,d;e[6]!==m||e[7]!==T?(d=Oe(T,Ke(m)),g=d.trend.map(Le),e[6]=m,e[7]=T,e[8]=g,e[9]=d):(g=e[8],d=e[9]);let x=g,h;e[10]!==c||e[11]!==l?(h=(0,o.jsx)(re,{onChange:c,testId:"ai-shard-input",value:l}),e[10]=c,e[11]=l,e[12]=h):h=e[12];let f;e[13]!==k?(f=k===null?null:(0,o.jsx)(ie,{error:k,testId:"ai-error"}),e[13]=k,e[14]=f):f=e[14];let v;e[15]!==r||e[16]!==a||e[17]!==x||e[18]!==d.byFunction||e[19]!==d.byModel||e[20]!==d.calls||e[21]!==d.source||e[22]!==d.totals?(v=d.source==="none"?(0,o.jsx)(ne,{description:a("Spend shows up here once an action calls ctx.ai.model(...) \u2014 tokens and cost per function and per model."),testId:"ai-empty",title:a("No AI usage recorded")}):(0,o.jsxs)(o.Fragment,{children:[d.source==="live"?(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-live-only",children:a("No durable history yet \u2014 these totals come from the live trace ring and reset when the shard hibernates.")}):(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-window",children:a("Totals cover the retained metric history (up to the last 24 hours).")}),(0,o.jsx)(Ee,{totals:d.totals,trend:x}),(0,o.jsxs)("div",{className:"grid gap-3 xl:grid-cols-2",children:[(0,o.jsx)(he,{keyLabel:a("Function"),rows:d.byFunction,testId:"ai-by-function",title:a("By function")}),(0,o.jsx)(he,{keyLabel:a("Model"),rows:d.byModel,testId:"ai-by-model",title:a("By model")})]}),d.calls.length===0?(0,o.jsx)(q,{children:(0,o.jsx)(oe,{className:"p-4 text-xs text-muted-foreground","data-testid":"ai-no-calls",children:a("No recent calls in the live trace ring \u2014 it empties when the shard hibernates.")})}):(0,o.jsx)($e,{calls:d.calls,onOpenTrace:r})]}),e[15]=r,e[16]=a,e[17]=x,e[18]=d.byFunction,e[19]=d.byModel,e[20]=d.calls,e[21]=d.source,e[22]=d.totals,e[23]=v):v=e[23];let C;return e[24]!==h||e[25]!==f||e[26]!==v?(C=(0,o.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ai-panel",children:[h,f,v]}),e[24]=h,e[25]=f,e[26]=v,e[27]=C):C=e[27],C},"Ze");function Le(n){return n.providerCost+n.estimatedCost}p(Le,"Ke");export{Ye as default};
|
|
1
|
+
import{d as E,e as _}from"./chunk-CVXNHIQW.js";import{a as $}from"./chunk-253UHWDX.js";import{a as de}from"./chunk-KQSQVNVI.js";import{a as ce}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import"./chunk-WIASRPIC.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as le}from"./chunk-R6U22RSY.js";import{a as re}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as K}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as ie}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as J}from"./chunk-4ZEL6BYL.js";import{c as H}from"./chunk-C5NU4UZY.js";import"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as ne}from"./chunk-RWVIV3U7.js";import{a as R,b as W,c as Z,d as A,e as M,f as S}from"./chunk-HCTJKP5J.js";import{a as q,b as D,c as U,e as oe}from"./chunk-2IKDEUCX.js";import{d as F,t as ae}from"./chunk-HJHSQPHW.js";import{a as p,d as se,f as be,g as ge}from"./chunk-I26MS5PJ.js";var O=se(be(),1);var o=se(ge(),1);var G="gen_ai.usage.input_tokens",Q="gen_ai.usage.output_tokens",V="gen_ai.usage.cost",fe="gen_ai.request.model",Te="lunora.usage.cost.source",xe=new Set(["ai.embed","ai.generate","ai.stream"]),ue=6e4,Ce=1440,ve="unknown",X=p(()=>({calls:0,estimatedCost:0,inputTokens:0,outputTokens:0,providerCost:0}),"q"),Y=p((n,e)=>{let s=n?.[e];return typeof s=="string"&&s!==""?s:void 0},"J"),z=p((n,e)=>{let s=n?.[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},"L"),ee=p(n=>Y(n,Te)==="provider"?"provider":"estimated","Q"),me=p((n,e)=>n.reduce((s,a)=>s+e(a),0),"Y"),B=p(n=>n.providerCost+n.estimatedCost,"F"),ke=p(n=>n.estimatedCost>0?n.providerCost>0?"mixed":"estimated":n.providerCost>0?"provider":"none","ae"),ye=p((n,e)=>({calls:n.calls+e.calls,estimatedCost:n.estimatedCost+e.estimatedCost,inputTokens:n.inputTokens+e.inputTokens,outputTokens:n.outputTokens+e.outputTokens,providerCost:n.providerCost+e.providerCost}),"ce"),Ie=p(n=>{let e=X(),s=0,a=0,t=0;for(let c of n){let l=me(c.points,i=>i.sum),r=me(c.points,i=>i.count);c.name===G?(e.inputTokens+=l,s+=r):c.name===Q?(e.outputTokens+=l,a+=r):(t+=r,ee(c.attributes)==="provider"?e.providerCost+=l:e.estimatedCost+=l)}return e.calls=Math.max(s,a,t),e},"ge"),Ne=p((n,e)=>B(e)-B(n)||e.inputTokens+e.outputTokens-(n.inputTokens+n.outputTokens)||n.key.localeCompare(e.key),"Ne"),pe=p((n,e)=>{let s=new Map;for(let a of n){let t=e(a);s.set(t,{key:t,...ye(s.get(t)??X(),a)})}return[...s.values()].toSorted(Ne)},"Z"),we=p(n=>(n?.series??[]).filter(e=>e.name===G||e.name===Q||e.name===V),"xe"),Me=p(n=>Y(n.attributes,fe)??ve,"Se"),Se=p(n=>{let e=new Map;for(let s of n){let a=Me(s),t=JSON.stringify([s.functionPath,a]),c=e.get(t)??{functionPath:s.functionPath,model:a,series:[]};c.series.push(s),e.set(t,c)}return[...e.values()].map(({functionPath:s,model:a,series:t})=>({functionPath:s,model:a,...Ie(t)}))},"Ie"),_e=p(n=>{let e=new Map;for(let r of n){if(r.name!==V)continue;let i=ee(r.attributes)==="provider";for(let u of r.points){let m=e.get(u.bucketMs)??{bucketMs:u.bucketMs,estimatedCost:0,providerCost:0};i?m.providerCost+=u.sum:m.estimatedCost+=u.sum,e.set(u.bucketMs,m)}}let s=[...e.keys()].toSorted((r,i)=>r-i),a=s[0],t=s.at(-1);if(a===void 0||t===void 0)return[];let c=Math.max(a,t-(Ce-1)*ue),l=[];for(let r=c;r<=t;r+=ue)l.push(e.get(r)??{bucketMs:r,estimatedCost:0,providerCost:0});return l},"_e"),Pe=p(n=>{let e=[];for(let s of n)for(let a of s.spans){if(!xe.has(a.name))continue;let{attributes:t}=a,c=z(t,V),l=z(t,G),r=z(t,Q);e.push({...c===void 0?{}:{cost:c,costSource:ee(t)},functionPath:s.functionPath,...l===void 0?{}:{inputTokens:l},model:Y(t,fe)??ve,ok:a.ok,...r===void 0?{}:{outputTokens:r},startTs:s.startTs+a.offsetMs,streaming:a.name==="ai.stream",traceId:s.traceId})}return e.toSorted((s,a)=>a.startTs-s.startTs)},"Me"),Fe=p(n=>n.map(e=>{let s=e.cost??0;return{calls:1,estimatedCost:e.costSource==="provider"?0:s,functionPath:e.functionPath,inputTokens:e.inputTokens??0,model:e.model,outputTokens:e.outputTokens??0,providerCost:e.costSource==="provider"?s:0}}),"Oe"),Oe=p((n,e)=>{let s=we(n),a=Pe(e),t=s.length>0,c=t?Se(s):Fe(a),l=X(),r="none";for(let i of c)l=ye(l,i);return t?r="history":a.length>0&&(r="live"),{byFunction:pe(c,i=>i.functionPath),byModel:pe(c,i=>i.model),calls:a,source:r,totals:l,trend:t?_e(s):[]}},"Ae"),Ke=p(n=>Array.isArray(n?.traces)?n.traces:[],"Ee"),Ae=25,te=p(n=>{let e=(0,O.c)(16),{provenance:s,value:a}=n,t=F();if(s==="none"){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let c;e[1]!==s||e[2]!==a?(c=s==="provider"?E(a):`~${E(a)}`,e[1]=s,e[2]=a,e[3]=c):c=e[3];let l;e[4]!==c?(l=(0,o.jsx)("span",{className:"tabular-nums",children:c}),e[4]=c,e[5]=l):l=e[5];let r;e[6]!==s||e[7]!==t?(r=s==="estimated"?(0,o.jsx)(K,{title:t("Derived from a price table, not reported by the provider."),variant:"warning",children:t("Estimated")}):null,e[6]=s,e[7]=t,e[8]=r):r=e[8];let i;e[9]!==s||e[10]!==t?(i=s==="mixed"?(0,o.jsx)(K,{title:t("Includes cost derived from a price table, not reported by the provider."),variant:"warning",children:t("Partly estimated")}):null,e[9]=s,e[10]=t,e[11]=i):i=e[11];let u;return e[12]!==l||e[13]!==r||e[14]!==i?(u=(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[l,r,i]}),e[12]=l,e[13]=r,e[14]=i,e[15]=u):u=e[15],u},"V"),he=p(n=>{let e=(0,O.c)(40),{keyLabel:s,rows:a,testId:t,title:c}=n,l=F(),r;e[0]!==c?(r=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[0]=c,e[1]=r):r=e[1];let i;e[2]!==s?(i=(0,o.jsx)(M,{children:s}),e[2]=s,e[3]=i):i=e[3];let u;e[4]!==l?(u=l("Calls"),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)(M,{className:"text-end",children:u}),e[6]=u,e[7]=m):m=e[7];let k;e[8]!==l?(k=l("Input tokens"),e[8]=l,e[9]=k):k=e[9];let y;e[10]!==k?(y=(0,o.jsx)(M,{className:"text-end",children:k}),e[10]=k,e[11]=y):y=e[11];let b;e[12]!==l?(b=l("Output tokens"),e[12]=l,e[13]=b):b=e[13];let T;e[14]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[14]=b,e[15]=T):T=e[15];let g;e[16]!==l?(g=l("Cost"),e[16]=l,e[17]=g):g=e[17];let d;e[18]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[18]=g,e[19]=d):d=e[19];let x;e[20]!==d||e[21]!==i||e[22]!==m||e[23]!==y||e[24]!==T?(x=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d]})}),e[20]=d,e[21]=i,e[22]=m,e[23]=y,e[24]=T,e[25]=x):x=e[25];let h;if(e[26]!==a||e[27]!==t){let N;e[29]!==t?(N=p(w=>(0,o.jsxs)(A,{"data-testid":`${t}-row`,children:[(0,o.jsx)(S,{className:"max-w-[280px] truncate font-mono",title:w.key,children:w.key}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.calls)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:ke(w),value:B(w)})})]},w.key),"x"),e[29]=t,e[30]=N):N=e[30],h=a.map(N),e[26]=a,e[27]=t,e[28]=h}else h=e[28];let f;e[31]!==h?(f=(0,o.jsx)(Z,{children:h}),e[31]=h,e[32]=f):f=e[32];let v;e[33]!==x||e[34]!==f?(v=(0,o.jsxs)(R,{children:[x,f]}),e[33]=x,e[34]=f,e[35]=v):v=e[35];let C;return e[36]!==r||e[37]!==v||e[38]!==t?(C=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":t,children:[r,v]}),e[36]=r,e[37]=v,e[38]=t,e[39]=C):C=e[39],C},"ee"),$e=p(n=>{let e=(0,O.c)(55),{calls:s,onOpenTrace:a}=n,t=F(),c;e[0]!==t?(c=t("Recent calls"),e[0]=t,e[1]=c):c=e[1];let l;e[2]!==c?(l=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[2]=c,e[3]=l):l=e[3];let r;e[4]!==t?(r=t("When"),e[4]=t,e[5]=r):r=e[5];let i;e[6]!==r?(i=(0,o.jsx)(M,{children:r}),e[6]=r,e[7]=i):i=e[7];let u;e[8]!==t?(u=t("Function"),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u?(m=(0,o.jsx)(M,{children:u}),e[10]=u,e[11]=m):m=e[11];let k;e[12]!==t?(k=t("Model"),e[12]=t,e[13]=k):k=e[13];let y;e[14]!==k?(y=(0,o.jsx)(M,{children:k}),e[14]=k,e[15]=y):y=e[15];let b;e[16]!==t?(b=t("Input tokens"),e[16]=t,e[17]=b):b=e[17];let T;e[18]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[18]=b,e[19]=T):T=e[19];let g;e[20]!==t?(g=t("Output tokens"),e[20]=t,e[21]=g):g=e[21];let d;e[22]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[22]=g,e[23]=d):d=e[23];let x;e[24]!==t?(x=t("Cost"),e[24]=t,e[25]=x):x=e[25];let h;e[26]!==x?(h=(0,o.jsx)(M,{className:"text-end",children:x}),e[26]=x,e[27]=h):h=e[27];let f;e[28]!==t?(f=t("Trace"),e[28]=t,e[29]=f):f=e[29];let v;e[30]!==f?(v=(0,o.jsx)(M,{children:f}),e[30]=f,e[31]=v):v=e[31];let C;e[32]!==T||e[33]!==d||e[34]!==h||e[35]!==v||e[36]!==i||e[37]!==m||e[38]!==y?(C=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d,h,v]})}),e[32]=T,e[33]=d,e[34]=h,e[35]=v,e[36]=i,e[37]=m,e[38]=y,e[39]=C):C=e[39];let N;if(e[40]!==s||e[41]!==a||e[42]!==t){let j;e[44]!==a||e[45]!==t?(j=p(I=>(0,o.jsxs)(A,{"data-testid":"ai-call",children:[(0,o.jsx)(S,{className:"font-mono text-muted-foreground",children:ae(I.startTs)}),(0,o.jsx)(S,{className:"font-mono",children:(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[I.functionPath,I.streaming?(0,o.jsx)(K,{variant:"outline",children:t("stream")}):null,I.ok?null:(0,o.jsx)(K,{variant:"destructive",children:t("failed")})]})}),(0,o.jsx)(S,{className:"max-w-[240px] truncate font-mono",title:I.model,children:I.model}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.inputTokens===void 0?"\u2014":_(I.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.outputTokens===void 0?"\u2014":_(I.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:I.cost===void 0?"none":I.costSource??"estimated",value:I.cost??0})}),(0,o.jsx)(S,{children:(0,o.jsx)("button",{className:"font-mono text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{a(I.traceId)},"onClick"),title:t("Open the trace {trace}",{trace:I.traceId}),type:"button",children:I.traceId.slice(0,8)})})]},`${I.traceId}:${I.startTs.toString()}:${I.model}`),"U"),e[44]=a,e[45]=t,e[46]=j):j=e[46],N=s.slice(0,Ae).map(j),e[40]=s,e[41]=a,e[42]=t,e[43]=N}else N=e[43];let w;e[47]!==N?(w=(0,o.jsx)(Z,{children:N}),e[47]=N,e[48]=w):w=e[48];let P;e[49]!==C||e[50]!==w?(P=(0,o.jsxs)(R,{children:[C,w]}),e[49]=C,e[50]=w,e[51]=P):P=e[51];let L;return e[52]!==l||e[53]!==P?(L=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":"ai-calls",children:[l,P]}),e[52]=l,e[53]=P,e[54]=L):L=e[54],L},"Pe"),Ee=p(n=>{let e=(0,O.c)(48),{totals:s,trend:a}=n,t=F(),c;e[0]!==s?(c=ke(s),e[0]=s,e[1]=c):c=e[1];let l=c,r;e[2]!==t||e[3]!==a?(r=a.length>=2?(0,o.jsx)(de,{ariaLabel:t("Cost per minute"),className:"h-7 w-24",series:a,testId:"ai-trend"}):void 0,e[2]=t,e[3]=a,e[4]=r):r=e[4];let i;e[5]!==l||e[6]!==t||e[7]!==s.estimatedCost||e[8]!==s.providerCost?(i=l==="none"?t("No cost reported"):(0,o.jsx)("span",{"data-testid":"ai-cost-split",children:t("{provider} provider-reported \xB7 {estimated} estimated",{estimated:E(s.estimatedCost),provider:E(s.providerCost)})}),e[5]=l,e[6]=t,e[7]=s.estimatedCost,e[8]=s.providerCost,e[9]=i):i=e[9];let u;e[10]!==t?(u=t("Total cost"),e[10]=t,e[11]=u):u=e[11];let m;e[12]!==s?(m=B(s),e[12]=s,e[13]=m):m=e[13];let k;e[14]!==l||e[15]!==m?(k=(0,o.jsx)(te,{provenance:l,value:m}),e[14]=l,e[15]=m,e[16]=k):k=e[16];let y;e[17]!==r||e[18]!==i||e[19]!==u||e[20]!==k?(y=(0,o.jsx)($,{chart:r,footer:i,label:u,testId:"ai-total-cost",value:k}),e[17]=r,e[18]=i,e[19]=u,e[20]=k,e[21]=y):y=e[21];let b;e[22]!==t?(b=t("Input tokens"),e[22]=t,e[23]=b):b=e[23];let T;e[24]!==s.inputTokens?(T=_(s.inputTokens),e[24]=s.inputTokens,e[25]=T):T=e[25];let g;e[26]!==b||e[27]!==T?(g=(0,o.jsx)($,{label:b,testId:"ai-input-tokens",value:T}),e[26]=b,e[27]=T,e[28]=g):g=e[28];let d;e[29]!==t?(d=t("Output tokens"),e[29]=t,e[30]=d):d=e[30];let x;e[31]!==s.outputTokens?(x=_(s.outputTokens),e[31]=s.outputTokens,e[32]=x):x=e[32];let h;e[33]!==d||e[34]!==x?(h=(0,o.jsx)($,{label:d,testId:"ai-output-tokens",value:x}),e[33]=d,e[34]=x,e[35]=h):h=e[35];let f;e[36]!==t?(f=t("Calls"),e[36]=t,e[37]=f):f=e[37];let v;e[38]!==s.calls?(v=_(s.calls),e[38]=s.calls,e[39]=v):v=e[39];let C;e[40]!==f||e[41]!==v?(C=(0,o.jsx)($,{label:f,testId:"ai-calls-total",value:v}),e[40]=f,e[41]=v,e[42]=C):C=e[42];let N;return e[43]!==g||e[44]!==h||e[45]!==C||e[46]!==y?(N=(0,o.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"ai-totals",children:[y,g,h,C]}),e[43]=g,e[44]=h,e[45]=C,e[46]=y,e[47]=N):N=e[47],N},"Ue"),Ye=p(n=>{let e=(0,O.c)(28),{initialShardKey:s}=n,a=F(),{queryShardKey:t,setShardKey:c,shardKey:l}=le(s),r=ce(t),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let u;e[1]!==t?(u={live:!0,shardKey:t},e[1]=t,e[2]=u):u=e[2];let{data:m,error:k}=H(J.getTraces,i,u),y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={},e[3]=y):y=e[3];let b;e[4]!==t?(b={live:!0,shardKey:t},e[4]=t,e[5]=b):b=e[5];let{data:T}=H(J.getMetricHistory,y,b),g,d;e[6]!==m||e[7]!==T?(d=Oe(T,Ke(m)),g=d.trend.map(Le),e[6]=m,e[7]=T,e[8]=g,e[9]=d):(g=e[8],d=e[9]);let x=g,h;e[10]!==c||e[11]!==l?(h=(0,o.jsx)(re,{onChange:c,testId:"ai-shard-input",value:l}),e[10]=c,e[11]=l,e[12]=h):h=e[12];let f;e[13]!==k?(f=k===null?null:(0,o.jsx)(ie,{error:k,testId:"ai-error"}),e[13]=k,e[14]=f):f=e[14];let v;e[15]!==r||e[16]!==a||e[17]!==x||e[18]!==d.byFunction||e[19]!==d.byModel||e[20]!==d.calls||e[21]!==d.source||e[22]!==d.totals?(v=d.source==="none"?(0,o.jsx)(ne,{description:a("Spend shows up here once an action calls ctx.ai.model(...) \u2014 tokens and cost per function and per model."),testId:"ai-empty",title:a("No AI usage recorded")}):(0,o.jsxs)(o.Fragment,{children:[d.source==="live"?(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-live-only",children:a("No durable history yet \u2014 these totals come from the live trace ring and reset when the shard hibernates.")}):(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-window",children:a("Totals cover the retained metric history (up to the last 24 hours).")}),(0,o.jsx)(Ee,{totals:d.totals,trend:x}),(0,o.jsxs)("div",{className:"grid gap-3 xl:grid-cols-2",children:[(0,o.jsx)(he,{keyLabel:a("Function"),rows:d.byFunction,testId:"ai-by-function",title:a("By function")}),(0,o.jsx)(he,{keyLabel:a("Model"),rows:d.byModel,testId:"ai-by-model",title:a("By model")})]}),d.calls.length===0?(0,o.jsx)(q,{children:(0,o.jsx)(oe,{className:"p-4 text-xs text-muted-foreground","data-testid":"ai-no-calls",children:a("No recent calls in the live trace ring \u2014 it empties when the shard hibernates.")})}):(0,o.jsx)($e,{calls:d.calls,onOpenTrace:r})]}),e[15]=r,e[16]=a,e[17]=x,e[18]=d.byFunction,e[19]=d.byModel,e[20]=d.calls,e[21]=d.source,e[22]=d.totals,e[23]=v):v=e[23];let C;return e[24]!==h||e[25]!==f||e[26]!==v?(C=(0,o.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ai-panel",children:[h,f,v]}),e[24]=h,e[25]=f,e[26]=v,e[27]=C):C=e[27],C},"Ze");function Le(n){return n.providerCost+n.estimatedCost}p(Le,"Ke");export{Ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Pe,b as Re}from"./chunk-2VA5S3IA.js";import{a as ce}from"./chunk-VCFEO3RI.js";import{a as Te}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import{a as Se}from"./chunk-S4Z7K55A.js";import{b as ke}from"./chunk-5B2RTXBS.js";import{a as de}from"./chunk-UYEZR3BI.js";import{a as Le}from"./chunk-SV764LKQ.js";import{a as ie}from"./chunk-IWZ7GVQO.js";import{a as xe}from"./chunk-R6U22RSY.js";import{a as be}from"./chunk-YVR4SEPU.js";import{b as ve}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import{i as D}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as pe}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as re}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as ye}from"./chunk-NBBCLHM4.js";import"./chunk-NCPW7WHO.js";import"./chunk-U5HRF22B.js";import"./chunk-55UGUCQ6.js";import{a as ne}from"./chunk-4ZEL6BYL.js";import{c as oe}from"./chunk-R2SQETIF.js";import{g as ge}from"./chunk-MOW4XMIT.js";import"./chunk-QAQDMS6R.js";import"./chunk-VEK3S7MV.js";import{a as J}from"./chunk-RWVIV3U7.js";import{a as we,b as Ne,c as Ce,d as se,e as B,f as W}from"./chunk-HCTJKP5J.js";import{d as z,h as ae,i as fe,p as le}from"./chunk-HJHSQPHW.js";import{a as v,d as te,e as _e,f as Ae,g as Ue,i as j}from"./chunk-I26MS5PJ.js";var K=te(Ae(),1);var I=te(_e(),1);var r=te(Ue(),1);var me=["trace","debug","log","info","warn","error","fatal"],$e="LOG_ARCHIVE_NOT_CONFIGURED",ze={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},De=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"De"),Be=v(i=>{let e=(0,K.c)(33),{row:t}=i,n;e[0]!==t.fields?(n=ce(t.fields),e[0]=t.fields,e[1]=n):n=e[1];let s=n,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let f;e[4]!==c?(f=(0,r.jsx)(W,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=f):f=e[5];let m=Pe[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(W,{children:(0,r.jsx)(re,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(W,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==s?(l=s!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s,children:s}),e[13]=s,e[14]=l):l=e[14];let u;e[15]!==h||e[16]!==l?(u=(0,r.jsxs)(W,{className:"max-w-md",children:[h,l]}),e[15]=h,e[16]=l,e[17]=u):u=e[17];let g=t.traceId??"\u2014",b;e[18]!==g?(b=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=b):b=e[19];let x=t.shardKey??"\u2014",w;e[20]!==x?(w=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[20]=x,e[21]=w):w=e[21];let N=t.userId??"\u2014",y;e[22]!==N?(y=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:N}),e[22]=N,e[23]=y):y=e[23];let T;return e[24]!==u||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==o||e[29]!==f||e[30]!==d||e[31]!==a?(T=(0,r.jsxs)(se,{"data-testid":o,children:[f,d,a,u,b,w,y]}),e[24]=u,e[25]=b,e[26]=w,e[27]=y,e[28]=o,e[29]=f,e[30]=d,e[31]=a,e[32]=T):T=e[32],T},"Qe"),We=v(({shardKey:i})=>{let e=ge(),t=z(),[n,s]=(0,I.useState)(""),[o,c]=(0,I.useState)(""),[f,m]=(0,I.useState)(""),[{cursor:d,error:a,loading:h,notConfigured:l,rows:u},g]=(0,I.useReducer)(De,ze),b=ie(n.trim(),400),x=ie(o.trim(),400),w={...b===""?{}:{functionPathPrefix:b},...f===""?{}:{minLevel:f},...i===""?{}:{shardKey:i},...x===""?{}:{userId:x}},N=JSON.stringify(w),y=(0,I.useRef)(N);(0,I.useEffect)(()=>{let p={cancelled:!1};return y.current=N,le((async()=>{g({type:"loading"});try{let C=await e.queryLogArchive(w);p.cancelled||g({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){p.cancelled||g(fe(C)===$e?{type:"notConfigured"}:{message:ae(C),type:"failed"})}})()),()=>{p.cancelled=!0}},[e,N]);let T=v(async()=>{if(d===void 0)return;let p=N;g({type:"loading"});try{let C=await e.queryLogArchive({...w,cursor:d});y.current===p&&g({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===p&&g({message:ae(C),type:"pageFailed"})}},"T"),R=v(p=>{s(p.target.value)},"R"),k=v(p=>{c(p.target.value)},"N"),L=v(p=>{m(p.target.value)},"L"),S=v(()=>{le(T())},"S");return l?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:n}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:k,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:L,value:f,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),me.map(p=>(0,r.jsx)("option",{value:p,children:p},p))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),h&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(we,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(Ne,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(B,{children:t("Time")}),(0,r.jsx)(B,{children:t("Level")}),(0,r.jsx)(B,{children:t("Function")}),(0,r.jsx)(B,{children:t("Message")}),(0,r.jsx)(B,{children:t("Trace")}),(0,r.jsx)(B,{children:t("Shard")}),(0,r.jsx)(B,{children:t("User")})]})}),(0,r.jsx)(Ce,{children:u.map((p,C)=>(0,r.jsx)(Be,{row:p},`${String(p.ts)}-${String(C)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:h,onClick:S,size:"sm",variant:"outline",children:t(h?"Loading\u2026":"Load more")})})]})},"ze"),je=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:n,selected:s}=i,o;e[0]!==t||e[1]!==n?(o=v(()=>{n(t)},"o"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let c=o,f=s?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==f?(m=j("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==s||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":s,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=s,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"Ge"),Ve=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:n,onSearchChange:s,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:f,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),u;e[0]!==l?(u=l("Search messages"),e[0]=l,e[1]=u):u=e[1];let g;e[2]!==l?(g=l("search message"),e[2]=l,e[3]=g):g=e[3];let b;e[4]!==s||e[5]!==d||e[6]!==u||e[7]!==g?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-48","data-testid":"lg-search",onChange:s,placeholder:g,value:d}),e[4]=s,e[5]=d,e[6]=u,e[7]=g,e[8]=b):b=e[8];let x;e[9]!==l?(x=l("Function path"),e[9]=l,e[10]=x):x=e[10];let w;e[11]!==l?(w=l("filter path"),e[11]=l,e[12]=w):w=e[12];let N;e[13]!==n||e[14]!==m||e[15]!==x||e[16]!==w?(N=(0,r.jsx)(D,{"aria-label":x,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:n,placeholder:w,value:m}),e[13]=n,e[14]=m,e[15]=x,e[16]=w,e[17]=N):N=e[17];let y;e[18]!==l?(y=l("Level filter"),e[18]=l,e[19]=y):y=e[19];let T;e[20]!==t||e[21]!==c?(T=me.map(Q=>(0,r.jsx)(je,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=T):T=e[22];let R;e[23]!==y||e[24]!==T?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:T}),e[23]=y,e[24]=T,e[25]=R):R=e[25];let k;e[26]!==l?(k=l("Time range"),e[26]=l,e[27]=k):k=e[27];let L;e[28]!==l?(L=l("All time"),e[28]=l,e[29]=L):L=e[29];let S;e[30]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[30]=L,e[31]=S):S=e[31];let p;e[32]!==l?(p=l("Last 5m"),e[32]=l,e[33]=p):p=e[33];let C;e[34]!==p?(C=(0,r.jsx)("option",{value:"5m",children:p}),e[34]=p,e[35]=C):C=e[35];let q;e[36]!==l?(q=l("Last 15m"),e[36]=l,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let O;e[40]!==l?(O=l("Last hour"),e[40]=l,e[41]=O):O=e[41];let E;e[42]!==O?(E=(0,r.jsx)("option",{value:"1h",children:O}),e[42]=O,e[43]=E):E=e[43];let M;e[44]!==o||e[45]!==k||e[46]!==S||e[47]!==C||e[48]!==F||e[49]!==E||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[S,C,F,E]}),e[44]=o,e[45]=k,e[46]=S,e[47]=C,e[48]=F,e[49]=E,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=j("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==f||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:f,type:"button",children:U}),e[57]=f,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==b||e[65]!==N||e[66]!==R?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[b,N,R,M,A]}),e[62]=M,e[63]=A,e[64]=b,e[65]=N,e[66]=R,e[67]=$):$=e[67],$},"He"),Qe=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:n,onTableChange:s,onUserChange:o,outcomeFilter:c,pathPrefix:f,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let u;e[4]!==n||e[5]!==f||e[6]!==h||e[7]!==l?(u=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:n,placeholder:l,value:f}),e[4]=n,e[5]=f,e[6]=h,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==a?(g=a("User id"),e[9]=a,e[10]=g):g=e[10];let b;e[11]!==a?(b=a("userId"),e[11]=a,e[12]=b):b=e[12];let x;e[13]!==o||e[14]!==g||e[15]!==b||e[16]!==d?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:b,value:d}),e[13]=o,e[14]=g,e[15]=b,e[16]=d,e[17]=x):x=e[17];let w;e[18]!==a?(w=a("Table touched"),e[18]=a,e[19]=w):w=e[19];let N;e[20]!==a?(N=a("table"),e[20]=a,e[21]=N):N=e[21];let y;e[22]!==s||e[23]!==w||e[24]!==N||e[25]!==m?(y=(0,r.jsx)(D,{"aria-label":w,className:"h-8 w-32","data-testid":"lg-req-table",onChange:s,placeholder:N,value:m}),e[22]=s,e[23]=w,e[24]=N,e[25]=m,e[26]=y):y=e[26];let T;e[27]!==a?(T=a("Outcome filter"),e[27]=a,e[28]=T):T=e[28];let R;e[29]!==a?(R=a("all"),e[29]=a,e[30]=R):R=e[30];let k;e[31]!==R?(k=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=k):k=e[32];let L;e[33]!==a?(L=a("ok"),e[33]=a,e[34]=L):L=e[34];let S;e[35]!==L?(S=(0,r.jsx)("option",{value:"ok",children:L}),e[35]=L,e[36]=S):S=e[36];let p;e[37]!==a?(p=a("error"),e[37]=a,e[38]=p):p=e[38];let C;e[39]!==p?(C=(0,r.jsx)("option",{value:"error",children:p}),e[39]=p,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==c||e[43]!==T||e[44]!==k||e[45]!==S||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":T,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[k,S,C]}),e[41]=t,e[42]=c,e[43]=T,e[44]=k,e[45]=S,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==u||e[50]!==x||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,y,q]}),e[48]=q,e[49]=u,e[50]=x,e[51]=y,e[52]=F):F=e[52],F},"We"),Fe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,n;e[0]!==t.key?(n=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=n):n=e[1];let s;e[2]!==t.count?(s=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"ve"),Ye=v(i=>{let e=(0,K.c)(31),{summary:t}=i,n=z(),s;e[0]!==t.total||e[1]!==n?(s=n("{count} entries",{count:t.total}),e[0]=t.total,e[1]=n,e[2]=s):s=e[2];let o;e[3]!==s?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:s}),e[3]=s,e[4]=o):o=e[4];let c;e[5]!==n?(c=n("By level"),e[5]=n,e[6]=c):c=e[6];let f;e[7]!==c?(f=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=f):f=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Ge),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==f||e[14]!==d?(a=(0,r.jsxs)("div",{children:[f,d]}),e[13]=f,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==n?(h=n("By function"),e[16]=n,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let u;e[20]!==t.byPath?(u=t.byPath.map(He),e[20]=t.byPath,e[21]=u):u=e[21];let g;e[22]!==u?(g=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:u}),e[22]=u,e[23]=g):g=e[23];let b;e[24]!==g||e[25]!==l?(b=(0,r.jsxs)("div",{children:[l,g]}),e[24]=g,e[25]=l,e[26]=b):b=e[26];let x;return e[27]!==b||e[28]!==o||e[29]!==a?(x=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,b]}),e[27]=b,e[28]=o,e[29]=a,e[30]=x):x=e[30],x},"Ye");function Ge(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(Ge,"je");function He(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(He,"Je");var Je=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:n,onShowArchive:s,onShowErrors:o,onShowRequests:c,shardKey:f,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=j("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]!==d?(u=d("Requests"),e[2]=d,e[3]=u):u=e[3];let g;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==u?(g=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:u}),e[4]=c,e[5]=a,e[6]=l,e[7]=u,e[8]=g):g=e[8];let b=m==="errors",x=m==="errors"?"bg-muted font-medium":"text-muted-foreground",w;e[9]!==x?(w=j("px-3 py-1 text-sm",x),e[9]=x,e[10]=w):w=e[10];let N;e[11]!==d?(N=d("Errors"),e[11]=d,e[12]=N):N=e[12];let y;e[13]!==o||e[14]!==b||e[15]!==w||e[16]!==N?(y=(0,r.jsx)("button",{"aria-selected":b,className:w,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:N}),e[13]=o,e[14]=b,e[15]=w,e[16]=N,e[17]=y):y=e[17];let T=m==="archive",R=m==="archive"?"bg-muted font-medium":"text-muted-foreground",k;e[18]!==R?(k=j("px-3 py-1 text-sm",R),e[18]=R,e[19]=k):k=e[19];let L;e[20]!==d?(L=d("Archive"),e[20]=d,e[21]=L):L=e[21];let S;e[22]!==s||e[23]!==T||e[24]!==k||e[25]!==L?(S=(0,r.jsx)("button",{"aria-selected":T,className:k,"data-testid":"lg-view-archive",onClick:s,role:"tab",type:"button",children:L}),e[22]=s,e[23]=T,e[24]=k,e[25]=L,e[26]=S):S=e[26];let p;e[27]!==y||e[28]!==S||e[29]!==g?(p=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[g,y,S]}),e[27]=y,e[28]=S,e[29]=g,e[30]=p):p=e[30];let C;e[31]!==n||e[32]!==f?(C=(0,r.jsx)(be,{onChange:n,testId:"lg-shard-input",value:f}),e[31]=n,e[32]=f,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==m?(q=m!=="archive"&&(0,r.jsx)(Le,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=q):q=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let O;e[39]!==F?(O=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=O):O=e[40];let E;return e[41]!==p||e[42]!==C||e[43]!==q||e[44]!==O?(E=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,C,q,O]}),e[41]=p,e[42]=C,e[43]=q,e[44]=O,e[45]=E):E=e[45],E},"Xe"),ue=400,Xe=36,Ze={height:ue,overflow:"auto"},Oe={left:0,position:"absolute",top:0,width:"100%"},et={error:"destructive",ok:"secondary"},Ee=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:n}=i,s=z(),o;e[0]!==t||e[1]!==s||e[2]!==n?(o=n===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(n)},"onClick"),type:"button",children:s("Trace")}),e[0]=t,e[1]=s,e[2]=n,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"xe"),tt=v(i=>{let e=(0,K.c)(13),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(Re,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-row",ref:s,role:"row",style:d,children:[a,h]}),e[7]=n,e[8]=s,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"rt"),Ie=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),rt=v(i=>{let e=(0,K.c)(41),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=et[t.outcome],u;e[6]!==t.outcome||e[7]!==l?(u=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(re,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==t.functionPath?(g=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=g):g=e[10];let b=t.shardKey??"\u2014",x;e[11]!==b?(x=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[11]=b,e[12]=x):x=e[12];let w=t.userId??"\u2014",N;e[13]!==w?(N=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:w}),e[13]=w,e[14]=N):N=e[14];let y;e[15]!==t.durationMs?(y=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=y):y=e[16];let T=`${String(y)}ms`,R;e[17]!==T?(R=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:T}),e[17]=T,e[18]=R):R=e[18];let k;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(k=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Ie(t.tablesRead)} \xB7 w:${Ie(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=k):k=e[23];let L;e[24]!==k?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k}),e[24]=k,e[25]=L):L=e[25];let S;e[26]!==t.traceId||e[27]!==o?(S=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=S):S=e[28];let p;return e[29]!==n||e[30]!==s||e[31]!==d||e[32]!==N||e[33]!==R||e[34]!==L||e[35]!==S||e[36]!==h||e[37]!==u||e[38]!==g||e[39]!==x?(p=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-req-row",ref:s,role:"row",style:d,children:[h,u,g,x,N,R,L,S]}),e[29]=n,e[30]=s,e[31]=d,e[32]=N,e[33]=R,e[34]=L,e[35]=S,e[36]=h,e[37]=u,e[38]=g,e[39]=x,e[40]=p):p=e[40],p},"st"),qe=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),at=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"lt"),lt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},ot=v((i,e)=>{let t=e.search.trim().toLowerCase(),n=e.path.trim().toLowerCase(),s=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-lt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<s||n!==""&&!(o.functionPath??"").toLowerCase().includes(n)?!1:t===""||o.message.toLowerCase().includes(t)||ce(o.fields).toLowerCase().includes(t))},"at"),nt="\u2014",st=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??nt;t.set(c,(t.get(c)??0)+1)}let n=me.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),s=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:n,byPath:s,total:i.length}},"it"),qt=v(({initialShardKey:i})=>{let e=z(),[t,n]=(0,I.useState)("requests"),{queryShardKey:s,setShardKey:o,shardKey:c}=xe(i),[f,m]=(0,I.useState)(""),[d,a]=(0,I.useState)(()=>new Set),[h,l]=(0,I.useState)(""),[u,g]=(0,I.useState)("all"),[b,x]=(0,I.useState)(!1),[w,N]=(0,I.useState)(""),[y,T]=(0,I.useState)(""),[R,k]=(0,I.useState)(""),[L,S]=(0,I.useState)("all"),p=at({functionPathPrefix:w,outcome:L,tableTouched:R,userId:y}),C=oe(ne.getRequestLog,p,{enabled:t==="requests",live:!0,shardKey:s}),q=oe(ne.getLogs,{},{enabled:t==="errors",live:!0,shardKey:s}),F=t==="requests"?C:q,{error:O,errorSource:E,isLoading:M,liveError:V}=F,_=Te(s),U=qe(q.data),A=qe(C.data);(0,I.useEffect)(()=>{F.data!==void 0&&ve(s)},[F.data,s]);let $=ot(U,{levels:d,now:Date.now(),path:h,range:u,search:f}),Q=st($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&b,Y=(0,I.useMemo)(()=>O!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,O,Z]),he=(0,I.useRef)(null),G=ke({count:X,estimateSize:v(()=>Xe,"estimateSize"),getScrollElement:v(()=>he.current,"getScrollElement"),initialRect:{height:ue,width:800},observeElementRect:v((P,ee)=>Se(P,ee,ue),"observeElementRect"),overscan:8}),Ke=G.getVirtualItems(),Me={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Je,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{n("archive"),x(!1)},"onShowArchive"),onShowErrors:v(()=>{n("errors"),x(!1)},"onShowErrors"),onShowRequests:v(()=>{n("requests"),x(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ve,{levelFilter:d,onLogPathChange:v(P=>{l(P.target.value)},"onLogPathChange"),onSearchChange:v(P=>{m(P.target.value)},"onSearchChange"),onTimeRangeChange:v(P=>{g(P.target.value)},"onTimeRangeChange"),onToggleLevel:v(P=>{a(ee=>{let H=new Set(ee);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:v(()=>{x(P=>!P)},"onToggleSummary"),pathFilter:h,search:f,showSummary:b,timeRange:u}),t==="requests"&&(0,r.jsx)(Qe,{onOutcomeChange:v(P=>{S(P.target.value)},"onOutcomeChange"),onPathChange:v(P=>{N(P.target.value)},"onPathChange"),onTableChange:v(P=>{k(P.target.value)},"onTableChange"),onUserChange:v(P=>{T(P.target.value)},"onUserChange"),outcomeFilter:L,pathPrefix:w,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(We,{shardKey:s}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(ye,{error:E,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(Ye,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:he,style:Ze,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Ke.map(P=>t==="requests"?(0,r.jsx)(rt,{entry:A[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key):(0,r.jsx)(tt,{entry:$[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key))})})]})]})},"Wt");export{qt as LogsPanel,ot as filterLogs,st as summarizeLogs};
|
|
1
|
+
import{a as Pe,b as Re}from"./chunk-2VA5S3IA.js";import{a as ce}from"./chunk-VCFEO3RI.js";import{a as Te}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import{a as Se}from"./chunk-S4Z7K55A.js";import{b as ke}from"./chunk-5B2RTXBS.js";import{a as de}from"./chunk-UYEZR3BI.js";import{a as Le}from"./chunk-SV764LKQ.js";import{a as ie}from"./chunk-IWZ7GVQO.js";import{a as xe}from"./chunk-R6U22RSY.js";import{a as be}from"./chunk-YVR4SEPU.js";import{b as ve}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import{i as D}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as pe}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as re}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as ye}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as ne}from"./chunk-4ZEL6BYL.js";import{c as oe}from"./chunk-C5NU4UZY.js";import{g as ge}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as J}from"./chunk-RWVIV3U7.js";import{a as we,b as Ne,c as Ce,d as se,e as B,f as W}from"./chunk-HCTJKP5J.js";import{d as z,h as ae,i as fe,p as le}from"./chunk-HJHSQPHW.js";import{a as v,d as te,e as _e,f as Ae,g as Ue,i as j}from"./chunk-I26MS5PJ.js";var K=te(Ae(),1);var I=te(_e(),1);var r=te(Ue(),1);var me=["trace","debug","log","info","warn","error","fatal"],$e="LOG_ARCHIVE_NOT_CONFIGURED",ze={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},De=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"De"),Be=v(i=>{let e=(0,K.c)(33),{row:t}=i,n;e[0]!==t.fields?(n=ce(t.fields),e[0]=t.fields,e[1]=n):n=e[1];let s=n,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let f;e[4]!==c?(f=(0,r.jsx)(W,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=f):f=e[5];let m=Pe[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(W,{children:(0,r.jsx)(re,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(W,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==s?(l=s!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s,children:s}),e[13]=s,e[14]=l):l=e[14];let u;e[15]!==h||e[16]!==l?(u=(0,r.jsxs)(W,{className:"max-w-md",children:[h,l]}),e[15]=h,e[16]=l,e[17]=u):u=e[17];let g=t.traceId??"\u2014",b;e[18]!==g?(b=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=b):b=e[19];let x=t.shardKey??"\u2014",w;e[20]!==x?(w=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[20]=x,e[21]=w):w=e[21];let N=t.userId??"\u2014",y;e[22]!==N?(y=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:N}),e[22]=N,e[23]=y):y=e[23];let T;return e[24]!==u||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==o||e[29]!==f||e[30]!==d||e[31]!==a?(T=(0,r.jsxs)(se,{"data-testid":o,children:[f,d,a,u,b,w,y]}),e[24]=u,e[25]=b,e[26]=w,e[27]=y,e[28]=o,e[29]=f,e[30]=d,e[31]=a,e[32]=T):T=e[32],T},"Qe"),We=v(({shardKey:i})=>{let e=ge(),t=z(),[n,s]=(0,I.useState)(""),[o,c]=(0,I.useState)(""),[f,m]=(0,I.useState)(""),[{cursor:d,error:a,loading:h,notConfigured:l,rows:u},g]=(0,I.useReducer)(De,ze),b=ie(n.trim(),400),x=ie(o.trim(),400),w={...b===""?{}:{functionPathPrefix:b},...f===""?{}:{minLevel:f},...i===""?{}:{shardKey:i},...x===""?{}:{userId:x}},N=JSON.stringify(w),y=(0,I.useRef)(N);(0,I.useEffect)(()=>{let p={cancelled:!1};return y.current=N,le((async()=>{g({type:"loading"});try{let C=await e.queryLogArchive(w);p.cancelled||g({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){p.cancelled||g(fe(C)===$e?{type:"notConfigured"}:{message:ae(C),type:"failed"})}})()),()=>{p.cancelled=!0}},[e,N]);let T=v(async()=>{if(d===void 0)return;let p=N;g({type:"loading"});try{let C=await e.queryLogArchive({...w,cursor:d});y.current===p&&g({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===p&&g({message:ae(C),type:"pageFailed"})}},"T"),R=v(p=>{s(p.target.value)},"R"),k=v(p=>{c(p.target.value)},"N"),L=v(p=>{m(p.target.value)},"L"),S=v(()=>{le(T())},"S");return l?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:n}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:k,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:L,value:f,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),me.map(p=>(0,r.jsx)("option",{value:p,children:p},p))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),h&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(we,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(Ne,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(B,{children:t("Time")}),(0,r.jsx)(B,{children:t("Level")}),(0,r.jsx)(B,{children:t("Function")}),(0,r.jsx)(B,{children:t("Message")}),(0,r.jsx)(B,{children:t("Trace")}),(0,r.jsx)(B,{children:t("Shard")}),(0,r.jsx)(B,{children:t("User")})]})}),(0,r.jsx)(Ce,{children:u.map((p,C)=>(0,r.jsx)(Be,{row:p},`${String(p.ts)}-${String(C)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:h,onClick:S,size:"sm",variant:"outline",children:t(h?"Loading\u2026":"Load more")})})]})},"ze"),je=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:n,selected:s}=i,o;e[0]!==t||e[1]!==n?(o=v(()=>{n(t)},"o"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let c=o,f=s?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==f?(m=j("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==s||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":s,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=s,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"Ge"),Ve=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:n,onSearchChange:s,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:f,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),u;e[0]!==l?(u=l("Search messages"),e[0]=l,e[1]=u):u=e[1];let g;e[2]!==l?(g=l("search message"),e[2]=l,e[3]=g):g=e[3];let b;e[4]!==s||e[5]!==d||e[6]!==u||e[7]!==g?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-48","data-testid":"lg-search",onChange:s,placeholder:g,value:d}),e[4]=s,e[5]=d,e[6]=u,e[7]=g,e[8]=b):b=e[8];let x;e[9]!==l?(x=l("Function path"),e[9]=l,e[10]=x):x=e[10];let w;e[11]!==l?(w=l("filter path"),e[11]=l,e[12]=w):w=e[12];let N;e[13]!==n||e[14]!==m||e[15]!==x||e[16]!==w?(N=(0,r.jsx)(D,{"aria-label":x,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:n,placeholder:w,value:m}),e[13]=n,e[14]=m,e[15]=x,e[16]=w,e[17]=N):N=e[17];let y;e[18]!==l?(y=l("Level filter"),e[18]=l,e[19]=y):y=e[19];let T;e[20]!==t||e[21]!==c?(T=me.map(Q=>(0,r.jsx)(je,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=T):T=e[22];let R;e[23]!==y||e[24]!==T?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:T}),e[23]=y,e[24]=T,e[25]=R):R=e[25];let k;e[26]!==l?(k=l("Time range"),e[26]=l,e[27]=k):k=e[27];let L;e[28]!==l?(L=l("All time"),e[28]=l,e[29]=L):L=e[29];let S;e[30]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[30]=L,e[31]=S):S=e[31];let p;e[32]!==l?(p=l("Last 5m"),e[32]=l,e[33]=p):p=e[33];let C;e[34]!==p?(C=(0,r.jsx)("option",{value:"5m",children:p}),e[34]=p,e[35]=C):C=e[35];let q;e[36]!==l?(q=l("Last 15m"),e[36]=l,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let O;e[40]!==l?(O=l("Last hour"),e[40]=l,e[41]=O):O=e[41];let E;e[42]!==O?(E=(0,r.jsx)("option",{value:"1h",children:O}),e[42]=O,e[43]=E):E=e[43];let M;e[44]!==o||e[45]!==k||e[46]!==S||e[47]!==C||e[48]!==F||e[49]!==E||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[S,C,F,E]}),e[44]=o,e[45]=k,e[46]=S,e[47]=C,e[48]=F,e[49]=E,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=j("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==f||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:f,type:"button",children:U}),e[57]=f,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==b||e[65]!==N||e[66]!==R?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[b,N,R,M,A]}),e[62]=M,e[63]=A,e[64]=b,e[65]=N,e[66]=R,e[67]=$):$=e[67],$},"He"),Qe=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:n,onTableChange:s,onUserChange:o,outcomeFilter:c,pathPrefix:f,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let u;e[4]!==n||e[5]!==f||e[6]!==h||e[7]!==l?(u=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:n,placeholder:l,value:f}),e[4]=n,e[5]=f,e[6]=h,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==a?(g=a("User id"),e[9]=a,e[10]=g):g=e[10];let b;e[11]!==a?(b=a("userId"),e[11]=a,e[12]=b):b=e[12];let x;e[13]!==o||e[14]!==g||e[15]!==b||e[16]!==d?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:b,value:d}),e[13]=o,e[14]=g,e[15]=b,e[16]=d,e[17]=x):x=e[17];let w;e[18]!==a?(w=a("Table touched"),e[18]=a,e[19]=w):w=e[19];let N;e[20]!==a?(N=a("table"),e[20]=a,e[21]=N):N=e[21];let y;e[22]!==s||e[23]!==w||e[24]!==N||e[25]!==m?(y=(0,r.jsx)(D,{"aria-label":w,className:"h-8 w-32","data-testid":"lg-req-table",onChange:s,placeholder:N,value:m}),e[22]=s,e[23]=w,e[24]=N,e[25]=m,e[26]=y):y=e[26];let T;e[27]!==a?(T=a("Outcome filter"),e[27]=a,e[28]=T):T=e[28];let R;e[29]!==a?(R=a("all"),e[29]=a,e[30]=R):R=e[30];let k;e[31]!==R?(k=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=k):k=e[32];let L;e[33]!==a?(L=a("ok"),e[33]=a,e[34]=L):L=e[34];let S;e[35]!==L?(S=(0,r.jsx)("option",{value:"ok",children:L}),e[35]=L,e[36]=S):S=e[36];let p;e[37]!==a?(p=a("error"),e[37]=a,e[38]=p):p=e[38];let C;e[39]!==p?(C=(0,r.jsx)("option",{value:"error",children:p}),e[39]=p,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==c||e[43]!==T||e[44]!==k||e[45]!==S||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":T,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[k,S,C]}),e[41]=t,e[42]=c,e[43]=T,e[44]=k,e[45]=S,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==u||e[50]!==x||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,y,q]}),e[48]=q,e[49]=u,e[50]=x,e[51]=y,e[52]=F):F=e[52],F},"We"),Fe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,n;e[0]!==t.key?(n=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=n):n=e[1];let s;e[2]!==t.count?(s=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"ve"),Ye=v(i=>{let e=(0,K.c)(31),{summary:t}=i,n=z(),s;e[0]!==t.total||e[1]!==n?(s=n("{count} entries",{count:t.total}),e[0]=t.total,e[1]=n,e[2]=s):s=e[2];let o;e[3]!==s?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:s}),e[3]=s,e[4]=o):o=e[4];let c;e[5]!==n?(c=n("By level"),e[5]=n,e[6]=c):c=e[6];let f;e[7]!==c?(f=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=f):f=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Ge),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==f||e[14]!==d?(a=(0,r.jsxs)("div",{children:[f,d]}),e[13]=f,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==n?(h=n("By function"),e[16]=n,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let u;e[20]!==t.byPath?(u=t.byPath.map(He),e[20]=t.byPath,e[21]=u):u=e[21];let g;e[22]!==u?(g=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:u}),e[22]=u,e[23]=g):g=e[23];let b;e[24]!==g||e[25]!==l?(b=(0,r.jsxs)("div",{children:[l,g]}),e[24]=g,e[25]=l,e[26]=b):b=e[26];let x;return e[27]!==b||e[28]!==o||e[29]!==a?(x=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,b]}),e[27]=b,e[28]=o,e[29]=a,e[30]=x):x=e[30],x},"Ye");function Ge(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(Ge,"je");function He(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(He,"Je");var Je=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:n,onShowArchive:s,onShowErrors:o,onShowRequests:c,shardKey:f,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=j("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]!==d?(u=d("Requests"),e[2]=d,e[3]=u):u=e[3];let g;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==u?(g=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:u}),e[4]=c,e[5]=a,e[6]=l,e[7]=u,e[8]=g):g=e[8];let b=m==="errors",x=m==="errors"?"bg-muted font-medium":"text-muted-foreground",w;e[9]!==x?(w=j("px-3 py-1 text-sm",x),e[9]=x,e[10]=w):w=e[10];let N;e[11]!==d?(N=d("Errors"),e[11]=d,e[12]=N):N=e[12];let y;e[13]!==o||e[14]!==b||e[15]!==w||e[16]!==N?(y=(0,r.jsx)("button",{"aria-selected":b,className:w,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:N}),e[13]=o,e[14]=b,e[15]=w,e[16]=N,e[17]=y):y=e[17];let T=m==="archive",R=m==="archive"?"bg-muted font-medium":"text-muted-foreground",k;e[18]!==R?(k=j("px-3 py-1 text-sm",R),e[18]=R,e[19]=k):k=e[19];let L;e[20]!==d?(L=d("Archive"),e[20]=d,e[21]=L):L=e[21];let S;e[22]!==s||e[23]!==T||e[24]!==k||e[25]!==L?(S=(0,r.jsx)("button",{"aria-selected":T,className:k,"data-testid":"lg-view-archive",onClick:s,role:"tab",type:"button",children:L}),e[22]=s,e[23]=T,e[24]=k,e[25]=L,e[26]=S):S=e[26];let p;e[27]!==y||e[28]!==S||e[29]!==g?(p=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[g,y,S]}),e[27]=y,e[28]=S,e[29]=g,e[30]=p):p=e[30];let C;e[31]!==n||e[32]!==f?(C=(0,r.jsx)(be,{onChange:n,testId:"lg-shard-input",value:f}),e[31]=n,e[32]=f,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==m?(q=m!=="archive"&&(0,r.jsx)(Le,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=q):q=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let O;e[39]!==F?(O=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=O):O=e[40];let E;return e[41]!==p||e[42]!==C||e[43]!==q||e[44]!==O?(E=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,C,q,O]}),e[41]=p,e[42]=C,e[43]=q,e[44]=O,e[45]=E):E=e[45],E},"Xe"),ue=400,Xe=36,Ze={height:ue,overflow:"auto"},Oe={left:0,position:"absolute",top:0,width:"100%"},et={error:"destructive",ok:"secondary"},Ee=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:n}=i,s=z(),o;e[0]!==t||e[1]!==s||e[2]!==n?(o=n===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(n)},"onClick"),type:"button",children:s("Trace")}),e[0]=t,e[1]=s,e[2]=n,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"xe"),tt=v(i=>{let e=(0,K.c)(13),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(Re,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-row",ref:s,role:"row",style:d,children:[a,h]}),e[7]=n,e[8]=s,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"rt"),Ie=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),rt=v(i=>{let e=(0,K.c)(41),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=et[t.outcome],u;e[6]!==t.outcome||e[7]!==l?(u=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(re,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==t.functionPath?(g=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=g):g=e[10];let b=t.shardKey??"\u2014",x;e[11]!==b?(x=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[11]=b,e[12]=x):x=e[12];let w=t.userId??"\u2014",N;e[13]!==w?(N=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:w}),e[13]=w,e[14]=N):N=e[14];let y;e[15]!==t.durationMs?(y=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=y):y=e[16];let T=`${String(y)}ms`,R;e[17]!==T?(R=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:T}),e[17]=T,e[18]=R):R=e[18];let k;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(k=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Ie(t.tablesRead)} \xB7 w:${Ie(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=k):k=e[23];let L;e[24]!==k?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k}),e[24]=k,e[25]=L):L=e[25];let S;e[26]!==t.traceId||e[27]!==o?(S=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=S):S=e[28];let p;return e[29]!==n||e[30]!==s||e[31]!==d||e[32]!==N||e[33]!==R||e[34]!==L||e[35]!==S||e[36]!==h||e[37]!==u||e[38]!==g||e[39]!==x?(p=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-req-row",ref:s,role:"row",style:d,children:[h,u,g,x,N,R,L,S]}),e[29]=n,e[30]=s,e[31]=d,e[32]=N,e[33]=R,e[34]=L,e[35]=S,e[36]=h,e[37]=u,e[38]=g,e[39]=x,e[40]=p):p=e[40],p},"st"),qe=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),at=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"lt"),lt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},ot=v((i,e)=>{let t=e.search.trim().toLowerCase(),n=e.path.trim().toLowerCase(),s=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-lt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<s||n!==""&&!(o.functionPath??"").toLowerCase().includes(n)?!1:t===""||o.message.toLowerCase().includes(t)||ce(o.fields).toLowerCase().includes(t))},"at"),nt="\u2014",st=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??nt;t.set(c,(t.get(c)??0)+1)}let n=me.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),s=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:n,byPath:s,total:i.length}},"it"),qt=v(({initialShardKey:i})=>{let e=z(),[t,n]=(0,I.useState)("requests"),{queryShardKey:s,setShardKey:o,shardKey:c}=xe(i),[f,m]=(0,I.useState)(""),[d,a]=(0,I.useState)(()=>new Set),[h,l]=(0,I.useState)(""),[u,g]=(0,I.useState)("all"),[b,x]=(0,I.useState)(!1),[w,N]=(0,I.useState)(""),[y,T]=(0,I.useState)(""),[R,k]=(0,I.useState)(""),[L,S]=(0,I.useState)("all"),p=at({functionPathPrefix:w,outcome:L,tableTouched:R,userId:y}),C=oe(ne.getRequestLog,p,{enabled:t==="requests",live:!0,shardKey:s}),q=oe(ne.getLogs,{},{enabled:t==="errors",live:!0,shardKey:s}),F=t==="requests"?C:q,{error:O,errorSource:E,isLoading:M,liveError:V}=F,_=Te(s),U=qe(q.data),A=qe(C.data);(0,I.useEffect)(()=>{F.data!==void 0&&ve(s)},[F.data,s]);let $=ot(U,{levels:d,now:Date.now(),path:h,range:u,search:f}),Q=st($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&b,Y=(0,I.useMemo)(()=>O!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,O,Z]),he=(0,I.useRef)(null),G=ke({count:X,estimateSize:v(()=>Xe,"estimateSize"),getScrollElement:v(()=>he.current,"getScrollElement"),initialRect:{height:ue,width:800},observeElementRect:v((P,ee)=>Se(P,ee,ue),"observeElementRect"),overscan:8}),Ke=G.getVirtualItems(),Me={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Je,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{n("archive"),x(!1)},"onShowArchive"),onShowErrors:v(()=>{n("errors"),x(!1)},"onShowErrors"),onShowRequests:v(()=>{n("requests"),x(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ve,{levelFilter:d,onLogPathChange:v(P=>{l(P.target.value)},"onLogPathChange"),onSearchChange:v(P=>{m(P.target.value)},"onSearchChange"),onTimeRangeChange:v(P=>{g(P.target.value)},"onTimeRangeChange"),onToggleLevel:v(P=>{a(ee=>{let H=new Set(ee);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:v(()=>{x(P=>!P)},"onToggleSummary"),pathFilter:h,search:f,showSummary:b,timeRange:u}),t==="requests"&&(0,r.jsx)(Qe,{onOutcomeChange:v(P=>{S(P.target.value)},"onOutcomeChange"),onPathChange:v(P=>{N(P.target.value)},"onPathChange"),onTableChange:v(P=>{k(P.target.value)},"onTableChange"),onUserChange:v(P=>{T(P.target.value)},"onUserChange"),outcomeFilter:L,pathPrefix:w,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(We,{shardKey:s}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(ye,{error:E,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(Ye,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:he,style:Ze,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Ke.map(P=>t==="requests"?(0,r.jsx)(rt,{entry:A[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key):(0,r.jsx)(tt,{entry:$[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key))})})]})]})},"Wt");export{qt as LogsPanel,ot as filterLogs,st as summarizeLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-C5NU4UZY.js";import{g as k}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-HJHSQPHW.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
|