@lunora/studio 1.0.0-alpha.57 → 1.0.0-alpha.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +61 -4
- package/dist/index.js +8 -6
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.js +664 -0
- package/dist/packem_chunks/ExportImportPanel.js +1 -1
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MailPanel.js +1 -1
- package/dist/packem_chunks/MetricsPanel.js +473 -242
- package/dist/packem_chunks/MigrationsPanel.js +1 -1
- package/dist/packem_chunks/NotificationsPanel.js +306 -0
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +1 -1
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +1 -1
- package/dist/packem_chunks/auth-audit-panel.js +247 -0
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/flags-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/payments-panel.js +28 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/queues-panel.js +1 -1
- package/dist/packem_chunks/rls-panel.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +125 -112
- package/dist/packem_chunks/workflows-panel.js +1 -1
- package/dist/packem_shared/{ADMIN_FUNCTIONS-C1LXrovV.js → ADMIN_FUNCTIONS-P2UzJscH.js} +3 -0
- package/dist/packem_shared/{ApiDocsPanel-BBvinlRD.js → ApiDocsPanel-DNDpeR5O.js} +1 -1
- package/dist/packem_shared/{DataBrowser-BoinTGxr.js → DataBrowser-obTn4sKX.js} +1 -1
- package/dist/packem_shared/{HomePanel-BpdGcW4L.js → HomePanel-DCRj3hGB.js} +2 -2
- package/dist/packem_shared/{Studio-BpnYw3lc.js → Studio-DnlPCbID.js} +2 -2
- package/dist/packem_shared/{StudioApp-DRGVBnFx.js → StudioApp-CzqlB4zO.js} +1 -1
- package/dist/packem_shared/{app.d-C-kxb-1T.d.ts → app.d-bRPJhby-.d.ts} +1 -1
- package/dist/packem_shared/{home-panel-Dmg4sNiv.js → home-panel-BRAA2UlM.js} +1 -1
- package/dist/packem_shared/{studio-LL4iP8fZ.js → studio-8QSXbZ98.js} +682 -607
- package/dist/packem_shared/trace-handoff-CGolF3KS.js +38 -0
- package/dist/standalone/{chunk-C7UZEQZ7.js → chunk-3LJEGSMK.js} +2 -2
- package/dist/standalone/{chunk-SAQU44MF.js → chunk-56XQYNUJ.js} +1 -1
- package/dist/standalone/chunk-5QT5JRXD.js +3 -0
- package/dist/standalone/{chunk-JM3ZISDM.js → chunk-6RLPR7PL.js} +1 -1
- package/dist/standalone/{chunk-T3R6VHAT.js → chunk-6V74EUPK.js} +1 -1
- package/dist/standalone/{chunk-27JTW53L.js → chunk-7EE33WLB.js} +1 -1
- package/dist/standalone/{chunk-R4ALMCZA.js → chunk-AXNGWSBM.js} +1 -1
- package/dist/standalone/{chunk-OHCGUIOG.js → chunk-AXZILWRM.js} +1 -1
- package/dist/standalone/{chunk-J2DQ63SR.js → chunk-C7RHEBOH.js} +1 -1
- package/dist/standalone/chunk-CSWIYOB3.js +1 -0
- package/dist/standalone/{chunk-NV5LO5I6.js → chunk-D3VAON25.js} +1 -1
- package/dist/standalone/{chunk-HQ2CPGA4.js → chunk-DDLQN67F.js} +1 -1
- package/dist/standalone/chunk-DGHW5JG5.js +1 -0
- package/dist/standalone/{chunk-EFYZYQUA.js → chunk-DMCSOTAE.js} +1 -1
- package/dist/standalone/{chunk-MBG7XWNH.js → chunk-E3BKETAS.js} +1 -1
- package/dist/standalone/{chunk-IMVAYDPK.js → chunk-E3OXNN6O.js} +1 -1
- package/dist/standalone/chunk-E6BOGDIS.js +1 -0
- package/dist/standalone/{chunk-2ICZ6HXQ.js → chunk-F7GE4X2U.js} +1 -1
- package/dist/standalone/{chunk-CENYZ5GF.js → chunk-FAVUOGJR.js} +1 -1
- package/dist/standalone/{chunk-NIC6UYAQ.js → chunk-FXP6256Q.js} +1 -1
- package/dist/standalone/{chunk-X34PHGZF.js → chunk-G6CTAYHJ.js} +1 -1
- package/dist/standalone/chunk-H42W62SE.js +1 -0
- package/dist/standalone/{chunk-LABWKVKR.js → chunk-HTF5ZX4I.js} +1 -1
- package/dist/standalone/{chunk-AYHAJL3Z.js → chunk-I2PS4L74.js} +1 -1
- package/dist/standalone/{chunk-MJ4HATA2.js → chunk-J7OGP4NN.js} +1 -1
- package/dist/standalone/{chunk-2XUT4Z4W.js → chunk-L2LN3MK4.js} +1 -1
- package/dist/standalone/{chunk-2BSDITP4.js → chunk-LT3FH6MW.js} +1 -1
- package/dist/standalone/{chunk-ZXLEXF4X.js → chunk-LXULVPEM.js} +3 -3
- package/dist/standalone/{chunk-RIZDNIW7.js → chunk-LZUWZBPE.js} +1 -1
- package/dist/standalone/{chunk-W3EYW2EA.js → chunk-M4JM3TOY.js} +1 -1
- package/dist/standalone/{chunk-P7MZQ6VJ.js → chunk-MLA5ZAEB.js} +1 -1
- package/dist/standalone/{chunk-67YMILPJ.js → chunk-MRBI5HNQ.js} +1 -1
- package/dist/standalone/{chunk-53J4JZ2D.js → chunk-NKFXMDOD.js} +1 -1
- package/dist/standalone/{chunk-WAX3RSAI.js → chunk-NPSNKFHE.js} +1 -1
- package/dist/standalone/{chunk-ZVQMTQYX.js → chunk-O7FVPUCO.js} +1 -1
- package/dist/standalone/{chunk-227DORM6.js → chunk-OKQXTLFX.js} +1 -1
- package/dist/standalone/{chunk-OPSAI5PZ.js → chunk-QAIM6KWT.js} +1 -1
- package/dist/standalone/{chunk-7YGTGBP7.js → chunk-QCPMTB6W.js} +1 -1
- package/dist/standalone/{chunk-XAGYDGI6.js → chunk-QQ2LOSZL.js} +1 -1
- package/dist/standalone/{chunk-Y26ZIWUZ.js → chunk-R2GMHLJY.js} +1 -1
- package/dist/standalone/{chunk-2YUYNNHQ.js → chunk-RD5UG2YL.js} +1 -1
- package/dist/standalone/chunk-RJTIP3WF.js +1 -0
- package/dist/standalone/{chunk-BIA2DLBR.js → chunk-SOC5CY3F.js} +1 -1
- package/dist/standalone/{chunk-GF6GF6CF.js → chunk-SS7JLF2I.js} +1 -1
- package/dist/standalone/{chunk-PYPWIYI2.js → chunk-SWWYUGPL.js} +1 -1
- package/dist/standalone/chunk-TEWVD66F.js +1 -0
- package/dist/standalone/{chunk-QAW6AWOE.js → chunk-TTXRHJUP.js} +1 -1
- package/dist/standalone/{chunk-4Q66FL5S.js → chunk-UKDHGVOC.js} +1 -1
- package/dist/standalone/{chunk-5IGHDPEP.js → chunk-UPNTMJFF.js} +1 -1
- package/dist/standalone/{chunk-PRHAIUWS.js → chunk-XN6QYJQ6.js} +1 -1
- package/dist/standalone/chunk-Y4U6CC22.js +1 -0
- package/dist/standalone/{chunk-SWMBBYJU.js → chunk-Y7PD5KP4.js} +1 -1
- package/dist/standalone/chunk-YFIPHCEC.js +1 -0
- package/dist/standalone/chunk-YJXOWLFJ.js +1 -0
- package/dist/standalone/{chunk-CURAOCQJ.js → chunk-YNN6NFRZ.js} +1 -1
- package/dist/standalone/{chunk-LFORIMS7.js → chunk-YUGHRVPD.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -6
- package/dist/standalone/chunk-EXNK5XAW.js +0 -1
- package/dist/standalone/chunk-LT2HPR6R.js +0 -3
- package/dist/standalone/chunk-MHGJUKCZ.js +0 -1
- package/dist/standalone/chunk-N2E4TKRD.js +0 -1
- package/dist/standalone/chunk-S6PTK7Y2.js +0 -1
- package/dist/standalone/chunk-X3VAERRH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as S,e as k}from"./chunk-Y572GMZE.js";import{R as $}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-
|
|
1
|
+
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as S,e as k}from"./chunk-Y572GMZE.js";import{R as $}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-3LJEGSMK.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as H}from"./chunk-TAD43CG5.js";import{d as Q,h as E,l as K,m as I}from"./chunk-HBGS4SEX.js";import"./chunk-LXULVPEM.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"./chunk-
|
|
1
|
+
import{a as y}from"./chunk-RD5UG2YL.js";import{f as m}from"./chunk-3LJEGSMK.js";import{h as d,m as g}from"./chunk-HBGS4SEX.js";import{a as o,e as f,f as A,g as b}from"./chunk-RRCPZMC2.js";var p=f(b(),1);var c=f(A(),1);var h={capabilities:{accounts:!0,admin:!0,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},L=o(()=>{let e=(0,p.c)(6),t=m(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],e[0]=a):a=e[0];let s;e[1]!==t?(s=o(()=>t.getAuthConfig(),"t1"),e[1]=t,e[2]=s):s=e[2];let{data:u,isLoading:i}=y(a,s),r=u??h,l=!i,n;return e[3]!==r||e[4]!==l?(n={config:r,ready:l},e[3]=r,e[4]=l,e[5]=n):n=e[5],n},"useAuthConfig"),w=o(()=>{let[e,t]=(0,c.useState)(!1),[a,s]=(0,c.useState)(null);return{busy:e,error:a,run:o(i=>{g((async()=>{t(!0),s(null);try{await i()}catch(r){s(d(r))}finally{t(!1)}})())},"run")}},"useAsyncSubmit");export{L as a,w as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Mt,b as ae}from"./chunk-227DORM6.js";import{a as Ft}from"./chunk-AHILM3ZP.js";import{a as Dt}from"./chunk-J6J54MBP.js";import{a as fe}from"./chunk-2YUYNNHQ.js";import{a as St,b as Nt,c as At,d as tt,e as ne,f as de}from"./chunk-GTM65MVX.js";import{a as kt,e as wt}from"./chunk-Y572GMZE.js";import{a as zt}from"./chunk-VLXV72QE.js";import{a as Tt}from"./chunk-JSEXCW5Q.js";import{R as W}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as j}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as le}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ce}from"./chunk-TAD43CG5.js";import{d as K,h as Ot,l as A,m as _t,q as $t}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as n,e as It,f as Jt,g as Bt,h as Ut}from"./chunk-RRCPZMC2.js";var G=It(Bt(),1);var P=It(Jt(),1);var o=It(Ut(),1);var jt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),Ht=n(t=>{let e=jt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Pt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),q=n(t=>{let e=(0,G.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(Tt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),me=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=K();return(0,o.jsxDEV)(Ft,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(j,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Rt=n(t=>{let e=(0,G.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=le(),s=K(),{busy:a,error:m,run:c}=ae(),p;e[0]!==r?(p=r?A(r.name):"",e[0]=r,e[1]=p):p=e[1];let[u,g]=(0,P.useState)(p),k;e[2]!==r?(k=r?A(r.slug):"",e[2]=r,e[3]=k):k=e[3];let[h,y]=(0,P.useState)(k),w;e[4]!==r?(w=r?A(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[b,I]=(0,P.useState)(w),[v,S]=(0,P.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Pt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,P.useState)(C),_;e[9]!==i||e[10]!==b||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let E=x.trim()===""?void 0:jt(x);l==="create"?await i.createAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim()===""?void 0:u.trim(),organizationId:A(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=b,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let D=_,z;e[21]!==l||e[22]!==u?(z=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=z):z=e[23];let $;e[24]!==l||e[25]!==s?($=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=$):$=e[26];let T;e[27]!==l||e[28]!==s?(T=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=T):T=e[29];let Q;e[30]!==s?(Q=s("name"),e[30]=s,e[31]=Q):Q=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=n(E=>{g(E.target.value)},"t10"),e[32]=H):H=e[32];let J;e[33]!==u?(J=(0,o.jsxDEV)(W,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:u},void 0,!1),e[33]=u,e[34]=J):J=e[34];let L;e[35]!==J||e[36]!==Q?(L=(0,o.jsxDEV)(q,{htmlFor:"org-form-name",label:Q,children:J},void 0,!1),e[35]=J,e[36]=Q,e[37]=L):L=e[37];let B;e[38]!==s?(B=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=B):B=e[39];let V;e[40]===Symbol.for("react.memo_cache_sentinel")?(V=n(E=>{y(E.target.value)},"t14"),e[40]=V):V=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(W,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:V,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==B||e[44]!==M?(F=(0,o.jsxDEV)(q,{htmlFor:"org-form-slug",label:B,children:M},void 0,!1),e[43]=B,e[44]=M,e[45]=F):F=e[45];let U;e[46]!==s?(U=s("Logo URL (optional)"),e[46]=s,e[47]=U):U=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=n(E=>{I(E.target.value)},"t18"),e[48]=ie):ie=e[48];let X;e[49]!==b?(X=(0,o.jsxDEV)(W,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:b},void 0,!1),e[49]=b,e[50]=X):X=e[50];let Y;e[51]!==U||e[52]!==X?(Y=(0,o.jsxDEV)(q,{htmlFor:"org-form-logo",label:U,children:X},void 0,!1),e[51]=U,e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==l||e[55]!==v||e[56]!==s?(Z=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(W,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(E=>{S(E.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==s?(ee=s("Metadata (JSON, optional)"),e[58]=s,e[59]=ee):ee=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=n(E=>{N(E.target.value)},"t23"),e[60]=oe):oe=e[60];let te;e[61]!==x?(te=(0,o.jsxDEV)(zt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:x},void 0,!1),e[61]=x,e[62]=te):te=e[62];let O;e[63]!==ee||e[64]!==te?(O=(0,o.jsxDEV)(q,{htmlFor:"org-form-metadata",label:ee,children:te},void 0,!1),e[63]=ee,e[64]=te,e[65]=O):O=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==L||e[71]!==F||e[72]!==Y||e[73]!==Z||e[74]!==O||e[75]!==z||e[76]!==$||e[77]!==T?(se=(0,o.jsxDEV)(me,{busy:a,canSubmit:z,error:m,onClose:d,onSubmit:D,submitLabel:$,testId:"org-form",title:T,children:[L,F,Y,Z,O]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=D,e[70]=L,e[71]=F,e[72]=Y,e[73]=Z,e[74]=O,e[75]=z,e[76]=$,e[77]=T,e[78]=se):se=e[78],se},"OrgFormDialog"),Vt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(k=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Add member"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-add-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberAddDialog"),qt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(k=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Send invitation"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-invite-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberInviteDialog"),Gt=n(t=>{let e=(0,G.c)(32),{member:l,onClose:d,onDone:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),c;e[0]!==l.role?(c=A(l.role),e[0]=l.role,e[1]=c):c=e[1];let[p,u]=(0,P.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==p||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:A(l.id),role:p.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=p,e[7]=m,e[8]=g):g=e[8];let k=g,h;e[9]!==p?(h=p.trim(),e[9]=p,e[10]=h):h=e[10];let y=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("Change member role"),e[13]=i,e[14]=b):b=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==p?(S=(0,o.jsxDEV)(W,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:p},void 0,!1),e[18]=p,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(q,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==k||e[27]!==C||e[28]!==y||e[29]!==w||e[30]!==b?(x=(0,o.jsxDEV)(me,{busy:s,canSubmit:y,error:a,onClose:d,onSubmit:k,submitLabel:w,testId:"org-member-role",title:b,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=k,e[27]=C,e[28]=y,e[29]=w,e[30]=b,e[31]=x):x=e[31],x},"MemberRoleDialog"),Et=n(t=>{let e=(0,G.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==p||e[9]!==i?.id?(h=n(()=>{p(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:A(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=p,e[9]=i?.id,e[10]=h):h=e[10];let y=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let b=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(D=>{k(D.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(W,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(q,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==b||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(me,{busy:m,canSubmit:b,error:c,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=y,e[31]=N,e[32]=b,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Kt=n(t=>{let e=(0,G.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,k;e[7]!==c?(k=c.trim(),e[7]=c,e[8]=k):k=e[8];let h=k!=="",y;e[9]!==i?(y=i("Add member"),e[9]=i,e[10]=y):y=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("User id"),e[13]=i,e[14]=b):b=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{p(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(W,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==b||e[19]!==v?(S=(0,o.jsxDEV)(q,{htmlFor:"org-team-add-member-user",label:b,children:v},void 0,!1),e[18]=b,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==y||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(me,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=y,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),Lt=n(t=>{let e=(0,G.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Pt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[y,w]=(0,P.useState)(h),b;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==y||e[12]!==i?.id||e[13]!==p?(b=n(()=>{p(async()=>{let T=Ht(y);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:T,role:g.trim()}):s.updateAuthOrgRole({permission:T,roleId:A(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=y,e[12]=i?.id,e[13]=p,e[14]=b):b=e[14];let I=b,v;e[15]!==l||e[16]!==g||e[17]!==y?(v=y.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=y,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(W,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n(T=>{k(T.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{w(T.target.value)},"t9"),e[31]=_):_=e[31];let D;e[32]!==y?(D=(0,o.jsxDEV)(zt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:y},void 0,!1),e[32]=y,e[33]=D):D=e[33];let z;e[34]!==D||e[35]!==N?(z=(0,o.jsxDEV)(q,{htmlFor:"org-role-form-permission",label:N,children:D},void 0,!1),e[34]=D,e[35]=N,e[36]=z):z=e[36];let $;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==z||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?($=(0,o.jsxDEV)(me,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,z]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=z,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=$):$=e[46],$},"RoleFormDialog"),Qt=n(t=>{let e=(0,G.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==p?(u=n(()=>{p(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=p,e[4]=u):u=e[4];let g=u,k;e[5]!==a?(k=a("Delete"),e[5]=a,e[6]=k):k=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let y;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==k||e[14]!==h||e[15]!==i||e[16]!==s?(y=(0,o.jsxDEV)(me,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:k,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=k,e[14]=h,e[15]=i,e[16]=s,e[17]=y):y=e[17],y},"ConfirmDialog"),lt=n(t=>{let e=(0,G.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(wt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),it=n(t=>{let e=(0,G.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=K(),s;e[0]!==l?(s=l.map(Xt),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ne,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let p;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let k;e[14]!==l||e[15]!==d||e[16]!==f?(k=n(h=>{let y=A(h.id);return(0,o.jsxDEV)(tt,{"data-testid":`${f}-${y}`,children:[l.map(w=>(0,o.jsxDEV)(de,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},y,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=k):k=e[17],p=r.map(k),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,o.jsxDEV)(At,{children:p},void 0,!1),e[18]=p,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(St,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Wt=n(t=>{let e=(0,G.c)(219),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=le(),i=K(),[s,a]=(0,P.useState)(null),[m,c]=(0,P.useState)(null),[p,u]=(0,P.useState)(!1),[g,k]=(0,P.useState)(null),h;e[0]!==l?(h=["lunora-auth-org-members",l],e[0]=l,e[1]=h):h=e[1];let y;e[2]!==r||e[3]!==l?(y=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=y):y=e[4];let w=fe(h,y),b;e[5]!==l?(b=["lunora-auth-org-invitations",l],e[5]=l,e[6]=b):b=e[6];let I;e[7]!==r||e[8]!==l?(I=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=I):I=e[9];let v=fe(b,I),S;e[10]!==l?(S=["lunora-auth-org-teams",l],e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=C):C=e[14];let x;e[15]!==f?(x={enabled:f},e[15]=f,e[16]=x):x=e[16];let N=fe(S,C,x),_;e[17]!==l?(_=["lunora-auth-org-roles",l],e[17]=l,e[18]=_):_=e[18];let D;e[19]!==r||e[20]!==l?(D=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=D):D=e[21];let z;e[22]!==d?(z={enabled:d},e[22]=d,e[23]=z):z=e[23];let $=fe(_,D,z),T;e[24]!==m?(T=["lunora-auth-org-team-members",m],e[24]=m,e[25]=T):T=e[25];let Q;e[26]!==r||e[27]!==m?(Q=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=Q):Q=e[28];let H=m!==null,J;e[29]!==H?(J={enabled:H},e[29]=H,e[30]=J):J=e[30];let L=fe(T,Q,J),B;e[31]!==w.data?.rows?(B=w.data?.rows??[],e[31]=w.data?.rows,e[32]=B):B=e[32];let V=B,M;e[33]!==v.data?.rows?(M=v.data?.rows??[],e[33]=v.data?.rows,e[34]=M):M=e[34];let F=M,U;e[35]!==N.data?.rows?(U=N.data?.rows??[],e[35]=N.data?.rows,e[36]=U):U=e[36];let ie=U,X;e[37]!==$.data?.rows?(X=$.data?.rows??[],e[37]=$.data?.rows,e[38]=X):X=e[38];let Y=X,Z;e[39]!==m||e[40]!==L?(Z=m===null?[]:L.data?.rows??[],e[39]=m,e[40]=L,e[41]=Z):Z=e[41];let ee=Z,oe=w.error??v.error??N.error??$.error??L.error,te;e[42]!==v||e[43]!==w||e[44]!==d||e[45]!==$||e[46]!==m||e[47]!==L||e[48]!==f||e[49]!==N?(te=n(()=>{w.refetch(),v.refetch(),f&&N.refetch(),d&&$.refetch(),m!==null&&L.refetch()},"t20"),e[42]=v,e[43]=w,e[44]=d,e[45]=$,e[46]=m,e[47]=L,e[48]=f,e[49]=N,e[50]=te):te=e[50];let O=te;Dt(O,!0);let se;e[51]===Symbol.for("react.memo_cache_sentinel")?(se=n(()=>{a(null)},"t21"),e[51]=se):se=e[51];let E=se,ot;e[52]!==O?(ot=n(R=>{_t((async()=>{u(!0),k(null);try{await R(),O(),u(!1)}catch(gt){k(Ot(gt)),u(!1)}})())},"t22"),e[52]=O,e[53]=ot):ot=e[53];let re=ot,st;e[54]!==r||e[55]!==i?(st=n(R=>{let gt=A(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:gt}),c(xt=>xt===gt?null:xt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=st):st=e[56];let vt=st,ue;e[57]!==i?(ue=i("userId"),e[57]=i,e[58]=ue):ue=e[58];let ge;e[59]!==ue?(ge={head:ue,render:Yt},e[59]=ue,e[60]=ge):ge=e[60];let ve;e[61]!==i?(ve=i("role"),e[61]=i,e[62]=ve):ve=e[62];let he;e[63]!==ve?(he={head:ve,render:Zt},e[63]=ve,e[64]=he):he=e[64];let rt;e[65]!==ge||e[66]!==he?(rt=[ge,he],e[65]=ge,e[66]=he,e[67]=rt):rt=e[67];let ht=rt,be;e[68]!==i?(be=i("email"),e[68]=i,e[69]=be):be=e[69];let pe;e[70]!==be?(pe={head:be,render:el},e[70]=be,e[71]=pe):pe=e[71];let ye;e[72]!==i?(ye=i("role"),e[72]=i,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:tl},e[74]=ye,e[75]=Ce):Ce=e[75];let xe;e[76]!==i?(xe=i("status"),e[76]=i,e[77]=xe):xe=e[77];let Ie;e[78]!==xe?(Ie={head:xe,render:ll},e[78]=xe,e[79]=Ie):Ie=e[79];let at;e[80]!==pe||e[81]!==Ce||e[82]!==Ie?(at=[pe,Ce,Ie],e[80]=pe,e[81]=Ce,e[82]=Ie,e[83]=at):at=e[83];let bt=at,ke;e[84]!==i?(ke=i("id"),e[84]=i,e[85]=ke):ke=e[85];let we;e[86]!==ke?(we={className:"font-mono text-xs",head:ke,render:il},e[86]=ke,e[87]=we):we=e[87];let Se;e[88]!==i?(Se=i("name"),e[88]=i,e[89]=Se):Se=e[89];let Ne;e[90]!==Se?(Ne={head:Se,render:ol},e[90]=Se,e[91]=Ne):Ne=e[91];let nt;e[92]!==we||e[93]!==Ne?(nt=[we,Ne],e[92]=we,e[93]=Ne,e[94]=nt):nt=e[94];let pt=nt,Ae;e[95]!==i?(Ae=i("userId"),e[95]=i,e[96]=Ae):Ae=e[96];let dt;e[97]!==Ae?(dt=[{head:Ae,render:sl}],e[97]=Ae,e[98]=dt):dt=e[98];let yt=dt,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let De;e[101]!==ze?(De={head:ze,render:rl},e[101]=ze,e[102]=De):De=e[102];let Oe;e[103]!==i?(Oe=i("Permission"),e[103]=i,e[104]=Oe):Oe=e[104];let _e;e[105]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:al},e[105]=Oe,e[106]=_e):_e=e[106];let mt;e[107]!==De||e[108]!==_e?(mt=[De,_e],e[107]=De,e[108]=_e,e[109]=mt):mt=e[109];let Ct=mt,$e;e[110]!==oe?($e=oe!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe},void 0,!1),e[110]=oe,e[111]=$e):$e=e[111];let Te;e[112]!==g?(Te=g!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g},void 0,!1),e[112]=g,e[113]=Te):Te=e[113];let ct;e[114]===Symbol.for("react.memo_cache_sentinel")?(ct=n(()=>{a({kind:"add-member"})},"t50"),e[114]=ct):ct=e[114];let Me;e[115]!==i?(Me=i("Add member"),e[115]=i,e[116]=Me):Me=e[116];let Fe;e[117]!==Me?(Fe=(0,o.jsxDEV)(j,{"data-testid":"org-open-add-member",onClick:ct,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[117]=Me,e[118]=Fe):Fe=e[118];let ft;e[119]===Symbol.for("react.memo_cache_sentinel")?(ft=n(()=>{a({kind:"invite-member"})},"t53"),e[119]=ft):ft=e[119];let Re;e[120]!==i?(Re=i("Invite member"),e[120]=i,e[121]=Re):Re=e[121];let Ee;e[122]!==Re?(Ee=(0,o.jsxDEV)(j,{"data-testid":"org-open-invite-member",onClick:ft,size:"xs",type:"button",variant:"outline",children:Re},void 0,!1),e[122]=Re,e[123]=Ee):Ee=e[123];let Le;e[124]!==Fe||e[125]!==Ee?(Le=(0,o.jsxDEV)(o.Fragment,{children:[Fe,Ee]},void 0,!0),e[124]=Fe,e[125]=Ee,e[126]=Le):Le=e[126];let je;e[127]!==i?(je=i("Members"),e[127]=i,e[128]=je):je=e[128];let Pe;e[129]!==p||e[130]!==r||e[131]!==ht||e[132]!==V||e[133]!==re||e[134]!==i?(Pe=V.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:ht,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-member-role-${A(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgMember({memberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:V},void 0,!1),e[129]=p,e[130]=r,e[131]=ht,e[132]=V,e[133]=re,e[134]=i,e[135]=Pe):Pe=e[135];let Qe;e[136]!==Le||e[137]!==je||e[138]!==Pe?(Qe=(0,o.jsxDEV)(lt,{action:Le,heading:je,testId:"org-members",children:Pe},void 0,!1),e[136]=Le,e[137]=je,e[138]=Pe,e[139]=Qe):Qe=e[139];let Je;e[140]!==p||e[141]!==r||e[142]!==bt||e[143]!==F||e[144]!==re||e[145]!==i?(Je=F.length>0&&(0,o.jsxDEV)(lt,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(it,{columns:bt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-cancel-invitation-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.cancelAuthOrgInvitation({invitationId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:F},void 0,!1)},void 0,!1),e[140]=p,e[141]=r,e[142]=bt,e[143]=F,e[144]=re,e[145]=i,e[146]=Je):Je=e[146];let Be;e[147]!==vt||e[148]!==m||e[149]!==i||e[150]!==pt||e[151]!==ie||e[152]!==f?(Be=f&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:ie.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:pt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"aria-pressed":m===A(R.id),"data-testid":`org-team-select-${A(R.id)}`,onClick:n(()=>{c(A(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-rename-${A(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-delete-${A(R.id)}`,onClick:n(()=>{vt(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:ie},void 0,!1)},void 0,!1),e[147]=vt,e[148]=m,e[149]=i,e[150]=pt,e[151]=ie,e[152]=f,e[153]=Be):Be=e[153];let Ue;e[154]!==p||e[155]!==r||e[156]!==re||e[157]!==m||e[158]!==i||e[159]!==yt||e[160]!==ee||e[161]!==f?(Ue=f&&m!==null&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:ee.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:yt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-team-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgTeamMember({teamMemberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:ee},void 0,!1)},void 0,!1),e[154]=p,e[155]=r,e[156]=re,e[157]=m,e[158]=i,e[159]=yt,e[160]=ee,e[161]=f,e[162]=Ue):Ue=e[162];let He;e[163]!==r||e[164]!==Ct||e[165]!==Y||e[166]!==d||e[167]!==i?(He=d&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:Y.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:Ct,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-role-edit-${A(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-role-delete-${A(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:A(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:Y},void 0,!1)},void 0,!1),e[163]=r,e[164]=Ct,e[165]=Y,e[166]=d,e[167]=i,e[168]=He):He=e[168];let Ve;e[169]!==s?.kind||e[170]!==l||e[171]!==O?(Ve=s?.kind==="add-member"&&(0,o.jsxDEV)(Vt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[169]=s?.kind,e[170]=l,e[171]=O,e[172]=Ve):Ve=e[172];let qe;e[173]!==s?.kind||e[174]!==l||e[175]!==O?(qe=s?.kind==="invite-member"&&(0,o.jsxDEV)(qt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[173]=s?.kind,e[174]=l,e[175]=O,e[176]=qe):qe=e[176];let Ge;e[177]!==s||e[178]!==O?(Ge=s?.kind==="member-role"&&(0,o.jsxDEV)(Gt,{member:s.member,onClose:E,onDone:O},void 0,!1),e[177]=s,e[178]=O,e[179]=Ge):Ge=e[179];let Ke;e[180]!==s?.kind||e[181]!==l||e[182]!==O?(Ke=s?.kind==="team-create"&&(0,o.jsxDEV)(Et,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[180]=s?.kind,e[181]=l,e[182]=O,e[183]=Ke):Ke=e[183];let We;e[184]!==s||e[185]!==l||e[186]!==O?(We=s?.kind==="team-rename"&&(0,o.jsxDEV)(Et,{mode:"edit",onClose:E,onDone:O,organizationId:l,team:s.team},void 0,!1),e[184]=s,e[185]=l,e[186]=O,e[187]=We):We=e[187];let Xe;e[188]!==s||e[189]!==O?(Xe=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Kt,{onClose:E,onDone:O,teamId:s.teamId},void 0,!1),e[188]=s,e[189]=O,e[190]=Xe):Xe=e[190];let Ye;e[191]!==s?.kind||e[192]!==l||e[193]!==O?(Ye=s?.kind==="role-create"&&(0,o.jsxDEV)(Lt,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[191]=s?.kind,e[192]=l,e[193]=O,e[194]=Ye):Ye=e[194];let Ze;e[195]!==s||e[196]!==l||e[197]!==O?(Ze=s?.kind==="role-edit"&&(0,o.jsxDEV)(Lt,{mode:"edit",onClose:E,onDone:O,organizationId:l,role:s.role},void 0,!1),e[195]=s,e[196]=l,e[197]=O,e[198]=Ze):Ze=e[198];let et;e[199]!==s||e[200]!==O?(et=s?.kind==="confirm"&&(0,o.jsxDEV)(Qt,{action:s.action,message:s.message,onClose:E,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[199]=s,e[200]=O,e[201]=et):et=e[201];let ut;return e[202]!==$e||e[203]!==Te||e[204]!==Qe||e[205]!==Je||e[206]!==Be||e[207]!==Ue||e[208]!==He||e[209]!==Ve||e[210]!==qe||e[211]!==Ge||e[212]!==Ke||e[213]!==We||e[214]!==Xe||e[215]!==Ye||e[216]!==Ze||e[217]!==et?(ut=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Te,Qe,Je,Be,Ue,He,Ve,qe,Ge,Ke,We,Xe,Ye,Ze,et]},void 0,!0),e[202]=$e,e[203]=Te,e[204]=Qe,e[205]=Je,e[206]=Be,e[207]=Ue,e[208]=He,e[209]=Ve,e[210]=qe,e[211]=Ge,e[212]=Ke,e[213]=We,e[214]=Xe,e[215]=Ye,e[216]=Ze,e[217]=et,e[218]=ut):ut=e[218],ut},"OrganizationDetail");function Xt(t){return(0,o.jsxDEV)(ne,{children:t.head},t.head,!1)}n(Xt,"_temp");function Yt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(Yt,"_temp2");function Zt(t){return A(t.role)}n(Zt,"_temp3");function el(t){return A(t.email)}n(el,"_temp4");function tl(t){return A(t.role)}n(tl,"_temp5");function ll(t){return A(t.status)}n(ll,"_temp6");function il(t){return A(t.id)}n(il,"_temp7");function ol(t){return A(t.name)}n(ol,"_temp8");function sl(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(sl,"_temp9");function rl(t){return A(t.role)}n(rl,"_temp0");function al(t){return A(t.permission)}n(al,"_temp1");var Il=n(()=>{let t=(0,G.c)(62),e=le(),l=K(),{config:d,ready:f}=Mt(),r=d.capabilities.organization,[i,s]=(0,P.useState)(null),[a,m]=(0,P.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let p;t[1]!==e?(p=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=p):p=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=fe(c,p,u),k=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],Dt(h,r);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=n(()=>{m(null)},"t4"),t[7]=y):y=t[7];let w=y,b;t[8]!==g?(b=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=b):b=t[9];let I=b,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let U;return t[15]!==M||t[16]!==F?(U=(0,o.jsxDEV)(ce,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=U):U=t[17],U}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let D;t[25]!==_?(D=(0,o.jsxDEV)(j,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=D):D=t[26];let z;t[27]!==D||t[28]!==x?(z=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,D]},void 0,!0),t[27]=D,t[28]=x,t[29]=z):z=t[29];let $;t[30]!==g.error?($=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=$):$=t[31];let T;t[32]!==k||t[33]!==l?(T=k!==null&&k.length===0&&(0,o.jsxDEV)(ce,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=k,t[33]=l,t[34]=T):T=t[34];let Q;t[35]!==k||t[36]!==i||t[37]!==l?(Q=k!==null&&k.length>0&&(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(wt,{className:"px-0",children:(0,o.jsxDEV)(St,{"data-testid":"org-table",children:[(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[(0,o.jsxDEV)(ne,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ne,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(At,{children:k.map(M=>{let F=A(M.id);return(0,o.jsxDEV)(tt,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(de,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.name)},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.slug)},void 0,!1),(0,o.jsxDEV)(de,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)},void 0,!1),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(j,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=k,t[36]=i,t[37]=l,t[38]=Q):Q=t[38];let H;t[39]!==d.organization||t[40]!==i?(H=i!==null&&(0,o.jsxDEV)(Wt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=H):H=t[41];let J;t[42]!==a?.kind||t[43]!==I?(J=a?.kind==="create"&&(0,o.jsxDEV)(Rt,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=J):J=t[44];let L;t[45]!==a||t[46]!==I?(L=a?.kind==="edit"&&(0,o.jsxDEV)(Rt,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=L):L=t[47];let B;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(B=a?.kind==="delete"&&(0,o.jsxDEV)(Qt,{action:n(async()=>{let M=A(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=B):B=t[52];let V;return t[53]!==z||t[54]!==$||t[55]!==T||t[56]!==Q||t[57]!==H||t[58]!==J||t[59]!==L||t[60]!==B?(V=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[z,$,T,Q,H,J,L,B]},void 0,!0),t[53]=z,t[54]=$,t[55]=T,t[56]=Q,t[57]=H,t[58]=J,t[59]=L,t[60]=B,t[61]=V):V=t[61],V},"OrganizationsPanel");export{Il as OrganizationsPanel};
|
|
1
|
+
import{a as Mt,b as ae}from"./chunk-OKQXTLFX.js";import{a as Ft}from"./chunk-AHILM3ZP.js";import{a as Dt}from"./chunk-J6J54MBP.js";import{a as fe}from"./chunk-RD5UG2YL.js";import{a as St,b as Nt,c as At,d as tt,e as ne,f as de}from"./chunk-GTM65MVX.js";import{a as kt,e as wt}from"./chunk-Y572GMZE.js";import{a as zt}from"./chunk-VLXV72QE.js";import{a as Tt}from"./chunk-JSEXCW5Q.js";import{R as W}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as j}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as le}from"./chunk-3LJEGSMK.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ce}from"./chunk-TAD43CG5.js";import{d as K,h as Ot,l as A,m as _t,q as $t}from"./chunk-HBGS4SEX.js";import"./chunk-LXULVPEM.js";import{a as n,e as It,f as Jt,g as Bt,h as Ut}from"./chunk-RRCPZMC2.js";var G=It(Bt(),1);var P=It(Jt(),1);var o=It(Ut(),1);var jt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),Ht=n(t=>{let e=jt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Pt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),q=n(t=>{let e=(0,G.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(Tt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),me=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=K();return(0,o.jsxDEV)(Ft,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(j,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Rt=n(t=>{let e=(0,G.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=le(),s=K(),{busy:a,error:m,run:c}=ae(),p;e[0]!==r?(p=r?A(r.name):"",e[0]=r,e[1]=p):p=e[1];let[u,g]=(0,P.useState)(p),k;e[2]!==r?(k=r?A(r.slug):"",e[2]=r,e[3]=k):k=e[3];let[h,y]=(0,P.useState)(k),w;e[4]!==r?(w=r?A(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[b,I]=(0,P.useState)(w),[v,S]=(0,P.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Pt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,P.useState)(C),_;e[9]!==i||e[10]!==b||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let E=x.trim()===""?void 0:jt(x);l==="create"?await i.createAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:b.trim()===""?void 0:b.trim(),metadata:E,name:u.trim()===""?void 0:u.trim(),organizationId:A(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=b,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let D=_,z;e[21]!==l||e[22]!==u?(z=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=z):z=e[23];let $;e[24]!==l||e[25]!==s?($=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=$):$=e[26];let T;e[27]!==l||e[28]!==s?(T=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=T):T=e[29];let Q;e[30]!==s?(Q=s("name"),e[30]=s,e[31]=Q):Q=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=n(E=>{g(E.target.value)},"t10"),e[32]=H):H=e[32];let J;e[33]!==u?(J=(0,o.jsxDEV)(W,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:u},void 0,!1),e[33]=u,e[34]=J):J=e[34];let L;e[35]!==J||e[36]!==Q?(L=(0,o.jsxDEV)(q,{htmlFor:"org-form-name",label:Q,children:J},void 0,!1),e[35]=J,e[36]=Q,e[37]=L):L=e[37];let B;e[38]!==s?(B=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=B):B=e[39];let V;e[40]===Symbol.for("react.memo_cache_sentinel")?(V=n(E=>{y(E.target.value)},"t14"),e[40]=V):V=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(W,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:V,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==B||e[44]!==M?(F=(0,o.jsxDEV)(q,{htmlFor:"org-form-slug",label:B,children:M},void 0,!1),e[43]=B,e[44]=M,e[45]=F):F=e[45];let U;e[46]!==s?(U=s("Logo URL (optional)"),e[46]=s,e[47]=U):U=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=n(E=>{I(E.target.value)},"t18"),e[48]=ie):ie=e[48];let X;e[49]!==b?(X=(0,o.jsxDEV)(W,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:b},void 0,!1),e[49]=b,e[50]=X):X=e[50];let Y;e[51]!==U||e[52]!==X?(Y=(0,o.jsxDEV)(q,{htmlFor:"org-form-logo",label:U,children:X},void 0,!1),e[51]=U,e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==l||e[55]!==v||e[56]!==s?(Z=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(W,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(E=>{S(E.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==s?(ee=s("Metadata (JSON, optional)"),e[58]=s,e[59]=ee):ee=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=n(E=>{N(E.target.value)},"t23"),e[60]=oe):oe=e[60];let te;e[61]!==x?(te=(0,o.jsxDEV)(zt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:x},void 0,!1),e[61]=x,e[62]=te):te=e[62];let O;e[63]!==ee||e[64]!==te?(O=(0,o.jsxDEV)(q,{htmlFor:"org-form-metadata",label:ee,children:te},void 0,!1),e[63]=ee,e[64]=te,e[65]=O):O=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==L||e[71]!==F||e[72]!==Y||e[73]!==Z||e[74]!==O||e[75]!==z||e[76]!==$||e[77]!==T?(se=(0,o.jsxDEV)(me,{busy:a,canSubmit:z,error:m,onClose:d,onSubmit:D,submitLabel:$,testId:"org-form",title:T,children:[L,F,Y,Z,O]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=D,e[70]=L,e[71]=F,e[72]=Y,e[73]=Z,e[74]=O,e[75]=z,e[76]=$,e[77]=T,e[78]=se):se=e[78],se},"OrgFormDialog"),Vt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(k=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Add member"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-add-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-add-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberAddDialog"),qt=n(t=>{let e=(0,G.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),[u,g]=(0,P.useState)(""),k;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(k=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=k):k=e[7];let h=k,y;e[8]!==c?(y=c.trim(),e[8]=c,e[9]=y):y=e[9];let w=y!=="",b;e[10]!==i?(b=i("Send invitation"),e[10]=i,e[11]=b):b=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n(T=>{p(T.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{g(T.target.value)},"t11"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,o.jsxDEV)(W,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=D):D=e[26];let z;e[27]!==N||e[28]!==D?(z=(0,o.jsxDEV)(q,{htmlFor:"org-invite-member-role",label:N,children:D},void 0,!1),e[27]=N,e[28]=D,e[29]=z):z=e[29];let $;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==z||e[35]!==w||e[36]!==b||e[37]!==I||e[38]!==x?($=(0,o.jsxDEV)(me,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:b,testId:"org-invite-member",title:I,children:[x,z]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=z,e[35]=w,e[36]=b,e[37]=I,e[38]=x,e[39]=$):$=e[39],$},"MemberInviteDialog"),Gt=n(t=>{let e=(0,G.c)(32),{member:l,onClose:d,onDone:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),c;e[0]!==l.role?(c=A(l.role),e[0]=l.role,e[1]=c):c=e[1];let[p,u]=(0,P.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==p||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:A(l.id),role:p.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=p,e[7]=m,e[8]=g):g=e[8];let k=g,h;e[9]!==p?(h=p.trim(),e[9]=p,e[10]=h):h=e[10];let y=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("Change member role"),e[13]=i,e[14]=b):b=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==p?(S=(0,o.jsxDEV)(W,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:p},void 0,!1),e[18]=p,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(q,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==k||e[27]!==C||e[28]!==y||e[29]!==w||e[30]!==b?(x=(0,o.jsxDEV)(me,{busy:s,canSubmit:y,error:a,onClose:d,onSubmit:k,submitLabel:w,testId:"org-member-role",title:b,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=k,e[27]=C,e[28]=y,e[29]=w,e[30]=b,e[31]=x):x=e[31],x},"MemberRoleDialog"),Et=n(t=>{let e=(0,G.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==p||e[9]!==i?.id?(h=n(()=>{p(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:A(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=p,e[9]=i?.id,e[10]=h):h=e[10];let y=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let b=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(D=>{k(D.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(W,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(q,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==b||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(me,{busy:m,canSubmit:b,error:c,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=y,e[31]=N,e[32]=b,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Kt=n(t=>{let e=(0,G.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=le(),i=K(),{busy:s,error:a,run:m}=ae(),[c,p]=(0,P.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,k;e[7]!==c?(k=c.trim(),e[7]=c,e[8]=k):k=e[8];let h=k!=="",y;e[9]!==i?(y=i("Add member"),e[9]=i,e[10]=y):y=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let b;e[13]!==i?(b=i("User id"),e[13]=i,e[14]=b):b=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{p(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(W,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==b||e[19]!==v?(S=(0,o.jsxDEV)(q,{htmlFor:"org-team-add-member-user",label:b,children:v},void 0,!1),e[18]=b,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==y||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(me,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=y,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),Lt=n(t=>{let e=(0,G.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=le(),a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==i?(u=i?A(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,k]=(0,P.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Pt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[y,w]=(0,P.useState)(h),b;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==y||e[12]!==i?.id||e[13]!==p?(b=n(()=>{p(async()=>{let T=Ht(y);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:T,role:g.trim()}):s.updateAuthOrgRole({permission:T,roleId:A(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=y,e[12]=i?.id,e[13]=p,e[14]=b):b=e[14];let I=b,v;e[15]!==l||e[16]!==g||e[17]!==y?(v=y.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=y,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(q,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(W,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n(T=>{k(T.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n(T=>{w(T.target.value)},"t9"),e[31]=_):_=e[31];let D;e[32]!==y?(D=(0,o.jsxDEV)(zt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:y},void 0,!1),e[32]=y,e[33]=D):D=e[33];let z;e[34]!==D||e[35]!==N?(z=(0,o.jsxDEV)(q,{htmlFor:"org-role-form-permission",label:N,children:D},void 0,!1),e[34]=D,e[35]=N,e[36]=z):z=e[36];let $;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==z||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?($=(0,o.jsxDEV)(me,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,z]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=z,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=$):$=e[46],$},"RoleFormDialog"),Qt=n(t=>{let e=(0,G.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=K(),{busy:m,error:c,run:p}=ae(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==p?(u=n(()=>{p(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=p,e[4]=u):u=e[4];let g=u,k;e[5]!==a?(k=a("Delete"),e[5]=a,e[6]=k):k=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let y;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==k||e[14]!==h||e[15]!==i||e[16]!==s?(y=(0,o.jsxDEV)(me,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:k,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=k,e[14]=h,e[15]=i,e[16]=s,e[17]=y):y=e[17],y},"ConfirmDialog"),lt=n(t=>{let e=(0,G.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(wt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),it=n(t=>{let e=(0,G.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=K(),s;e[0]!==l?(s=l.map(Xt),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ne,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let p;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let k;e[14]!==l||e[15]!==d||e[16]!==f?(k=n(h=>{let y=A(h.id);return(0,o.jsxDEV)(tt,{"data-testid":`${f}-${y}`,children:[l.map(w=>(0,o.jsxDEV)(de,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},y,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=k):k=e[17],p=r.map(k),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,o.jsxDEV)(At,{children:p},void 0,!1),e[18]=p,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(St,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Wt=n(t=>{let e=(0,G.c)(219),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=le(),i=K(),[s,a]=(0,P.useState)(null),[m,c]=(0,P.useState)(null),[p,u]=(0,P.useState)(!1),[g,k]=(0,P.useState)(null),h;e[0]!==l?(h=["lunora-auth-org-members",l],e[0]=l,e[1]=h):h=e[1];let y;e[2]!==r||e[3]!==l?(y=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=y):y=e[4];let w=fe(h,y),b;e[5]!==l?(b=["lunora-auth-org-invitations",l],e[5]=l,e[6]=b):b=e[6];let I;e[7]!==r||e[8]!==l?(I=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=I):I=e[9];let v=fe(b,I),S;e[10]!==l?(S=["lunora-auth-org-teams",l],e[10]=l,e[11]=S):S=e[11];let C;e[12]!==r||e[13]!==l?(C=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=C):C=e[14];let x;e[15]!==f?(x={enabled:f},e[15]=f,e[16]=x):x=e[16];let N=fe(S,C,x),_;e[17]!==l?(_=["lunora-auth-org-roles",l],e[17]=l,e[18]=_):_=e[18];let D;e[19]!==r||e[20]!==l?(D=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=D):D=e[21];let z;e[22]!==d?(z={enabled:d},e[22]=d,e[23]=z):z=e[23];let $=fe(_,D,z),T;e[24]!==m?(T=["lunora-auth-org-team-members",m],e[24]=m,e[25]=T):T=e[25];let Q;e[26]!==r||e[27]!==m?(Q=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=Q):Q=e[28];let H=m!==null,J;e[29]!==H?(J={enabled:H},e[29]=H,e[30]=J):J=e[30];let L=fe(T,Q,J),B;e[31]!==w.data?.rows?(B=w.data?.rows??[],e[31]=w.data?.rows,e[32]=B):B=e[32];let V=B,M;e[33]!==v.data?.rows?(M=v.data?.rows??[],e[33]=v.data?.rows,e[34]=M):M=e[34];let F=M,U;e[35]!==N.data?.rows?(U=N.data?.rows??[],e[35]=N.data?.rows,e[36]=U):U=e[36];let ie=U,X;e[37]!==$.data?.rows?(X=$.data?.rows??[],e[37]=$.data?.rows,e[38]=X):X=e[38];let Y=X,Z;e[39]!==m||e[40]!==L?(Z=m===null?[]:L.data?.rows??[],e[39]=m,e[40]=L,e[41]=Z):Z=e[41];let ee=Z,oe=w.error??v.error??N.error??$.error??L.error,te;e[42]!==v||e[43]!==w||e[44]!==d||e[45]!==$||e[46]!==m||e[47]!==L||e[48]!==f||e[49]!==N?(te=n(()=>{w.refetch(),v.refetch(),f&&N.refetch(),d&&$.refetch(),m!==null&&L.refetch()},"t20"),e[42]=v,e[43]=w,e[44]=d,e[45]=$,e[46]=m,e[47]=L,e[48]=f,e[49]=N,e[50]=te):te=e[50];let O=te;Dt(O,!0);let se;e[51]===Symbol.for("react.memo_cache_sentinel")?(se=n(()=>{a(null)},"t21"),e[51]=se):se=e[51];let E=se,ot;e[52]!==O?(ot=n(R=>{_t((async()=>{u(!0),k(null);try{await R(),O(),u(!1)}catch(gt){k(Ot(gt)),u(!1)}})())},"t22"),e[52]=O,e[53]=ot):ot=e[53];let re=ot,st;e[54]!==r||e[55]!==i?(st=n(R=>{let gt=A(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:gt}),c(xt=>xt===gt?null:xt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=st):st=e[56];let vt=st,ue;e[57]!==i?(ue=i("userId"),e[57]=i,e[58]=ue):ue=e[58];let ge;e[59]!==ue?(ge={head:ue,render:Yt},e[59]=ue,e[60]=ge):ge=e[60];let ve;e[61]!==i?(ve=i("role"),e[61]=i,e[62]=ve):ve=e[62];let he;e[63]!==ve?(he={head:ve,render:Zt},e[63]=ve,e[64]=he):he=e[64];let rt;e[65]!==ge||e[66]!==he?(rt=[ge,he],e[65]=ge,e[66]=he,e[67]=rt):rt=e[67];let ht=rt,be;e[68]!==i?(be=i("email"),e[68]=i,e[69]=be):be=e[69];let pe;e[70]!==be?(pe={head:be,render:el},e[70]=be,e[71]=pe):pe=e[71];let ye;e[72]!==i?(ye=i("role"),e[72]=i,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:tl},e[74]=ye,e[75]=Ce):Ce=e[75];let xe;e[76]!==i?(xe=i("status"),e[76]=i,e[77]=xe):xe=e[77];let Ie;e[78]!==xe?(Ie={head:xe,render:ll},e[78]=xe,e[79]=Ie):Ie=e[79];let at;e[80]!==pe||e[81]!==Ce||e[82]!==Ie?(at=[pe,Ce,Ie],e[80]=pe,e[81]=Ce,e[82]=Ie,e[83]=at):at=e[83];let bt=at,ke;e[84]!==i?(ke=i("id"),e[84]=i,e[85]=ke):ke=e[85];let we;e[86]!==ke?(we={className:"font-mono text-xs",head:ke,render:il},e[86]=ke,e[87]=we):we=e[87];let Se;e[88]!==i?(Se=i("name"),e[88]=i,e[89]=Se):Se=e[89];let Ne;e[90]!==Se?(Ne={head:Se,render:ol},e[90]=Se,e[91]=Ne):Ne=e[91];let nt;e[92]!==we||e[93]!==Ne?(nt=[we,Ne],e[92]=we,e[93]=Ne,e[94]=nt):nt=e[94];let pt=nt,Ae;e[95]!==i?(Ae=i("userId"),e[95]=i,e[96]=Ae):Ae=e[96];let dt;e[97]!==Ae?(dt=[{head:Ae,render:sl}],e[97]=Ae,e[98]=dt):dt=e[98];let yt=dt,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let De;e[101]!==ze?(De={head:ze,render:rl},e[101]=ze,e[102]=De):De=e[102];let Oe;e[103]!==i?(Oe=i("Permission"),e[103]=i,e[104]=Oe):Oe=e[104];let _e;e[105]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:al},e[105]=Oe,e[106]=_e):_e=e[106];let mt;e[107]!==De||e[108]!==_e?(mt=[De,_e],e[107]=De,e[108]=_e,e[109]=mt):mt=e[109];let Ct=mt,$e;e[110]!==oe?($e=oe!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe},void 0,!1),e[110]=oe,e[111]=$e):$e=e[111];let Te;e[112]!==g?(Te=g!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g},void 0,!1),e[112]=g,e[113]=Te):Te=e[113];let ct;e[114]===Symbol.for("react.memo_cache_sentinel")?(ct=n(()=>{a({kind:"add-member"})},"t50"),e[114]=ct):ct=e[114];let Me;e[115]!==i?(Me=i("Add member"),e[115]=i,e[116]=Me):Me=e[116];let Fe;e[117]!==Me?(Fe=(0,o.jsxDEV)(j,{"data-testid":"org-open-add-member",onClick:ct,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[117]=Me,e[118]=Fe):Fe=e[118];let ft;e[119]===Symbol.for("react.memo_cache_sentinel")?(ft=n(()=>{a({kind:"invite-member"})},"t53"),e[119]=ft):ft=e[119];let Re;e[120]!==i?(Re=i("Invite member"),e[120]=i,e[121]=Re):Re=e[121];let Ee;e[122]!==Re?(Ee=(0,o.jsxDEV)(j,{"data-testid":"org-open-invite-member",onClick:ft,size:"xs",type:"button",variant:"outline",children:Re},void 0,!1),e[122]=Re,e[123]=Ee):Ee=e[123];let Le;e[124]!==Fe||e[125]!==Ee?(Le=(0,o.jsxDEV)(o.Fragment,{children:[Fe,Ee]},void 0,!0),e[124]=Fe,e[125]=Ee,e[126]=Le):Le=e[126];let je;e[127]!==i?(je=i("Members"),e[127]=i,e[128]=je):je=e[128];let Pe;e[129]!==p||e[130]!==r||e[131]!==ht||e[132]!==V||e[133]!==re||e[134]!==i?(Pe=V.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:ht,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-member-role-${A(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgMember({memberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:V},void 0,!1),e[129]=p,e[130]=r,e[131]=ht,e[132]=V,e[133]=re,e[134]=i,e[135]=Pe):Pe=e[135];let Qe;e[136]!==Le||e[137]!==je||e[138]!==Pe?(Qe=(0,o.jsxDEV)(lt,{action:Le,heading:je,testId:"org-members",children:Pe},void 0,!1),e[136]=Le,e[137]=je,e[138]=Pe,e[139]=Qe):Qe=e[139];let Je;e[140]!==p||e[141]!==r||e[142]!==bt||e[143]!==F||e[144]!==re||e[145]!==i?(Je=F.length>0&&(0,o.jsxDEV)(lt,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(it,{columns:bt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-cancel-invitation-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.cancelAuthOrgInvitation({invitationId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:F},void 0,!1)},void 0,!1),e[140]=p,e[141]=r,e[142]=bt,e[143]=F,e[144]=re,e[145]=i,e[146]=Je):Je=e[146];let Be;e[147]!==vt||e[148]!==m||e[149]!==i||e[150]!==pt||e[151]!==ie||e[152]!==f?(Be=f&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:ie.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:pt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"aria-pressed":m===A(R.id),"data-testid":`org-team-select-${A(R.id)}`,onClick:n(()=>{c(A(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-rename-${A(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-team-delete-${A(R.id)}`,onClick:n(()=>{vt(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:ie},void 0,!1)},void 0,!1),e[147]=vt,e[148]=m,e[149]=i,e[150]=pt,e[151]=ie,e[152]=f,e[153]=Be):Be=e[153];let Ue;e[154]!==p||e[155]!==r||e[156]!==re||e[157]!==m||e[158]!==i||e[159]!==yt||e[160]!==ee||e[161]!==f?(Ue=f&&m!==null&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:ee.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:yt,rowActions:n(R=>(0,o.jsxDEV)(j,{"data-testid":`org-team-remove-member-${A(R.id)}`,disabled:p,onClick:n(()=>{re(()=>r.removeAuthOrgTeamMember({teamMemberId:A(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:ee},void 0,!1)},void 0,!1),e[154]=p,e[155]=r,e[156]=re,e[157]=m,e[158]=i,e[159]=yt,e[160]=ee,e[161]=f,e[162]=Ue):Ue=e[162];let He;e[163]!==r||e[164]!==Ct||e[165]!==Y||e[166]!==d||e[167]!==i?(He=d&&(0,o.jsxDEV)(lt,{action:(0,o.jsxDEV)(j,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:Y.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(ce,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(it,{columns:Ct,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(j,{"data-testid":`org-role-edit-${A(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-role-delete-${A(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:A(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:Y},void 0,!1)},void 0,!1),e[163]=r,e[164]=Ct,e[165]=Y,e[166]=d,e[167]=i,e[168]=He):He=e[168];let Ve;e[169]!==s?.kind||e[170]!==l||e[171]!==O?(Ve=s?.kind==="add-member"&&(0,o.jsxDEV)(Vt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[169]=s?.kind,e[170]=l,e[171]=O,e[172]=Ve):Ve=e[172];let qe;e[173]!==s?.kind||e[174]!==l||e[175]!==O?(qe=s?.kind==="invite-member"&&(0,o.jsxDEV)(qt,{onClose:E,onDone:O,organizationId:l},void 0,!1),e[173]=s?.kind,e[174]=l,e[175]=O,e[176]=qe):qe=e[176];let Ge;e[177]!==s||e[178]!==O?(Ge=s?.kind==="member-role"&&(0,o.jsxDEV)(Gt,{member:s.member,onClose:E,onDone:O},void 0,!1),e[177]=s,e[178]=O,e[179]=Ge):Ge=e[179];let Ke;e[180]!==s?.kind||e[181]!==l||e[182]!==O?(Ke=s?.kind==="team-create"&&(0,o.jsxDEV)(Et,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[180]=s?.kind,e[181]=l,e[182]=O,e[183]=Ke):Ke=e[183];let We;e[184]!==s||e[185]!==l||e[186]!==O?(We=s?.kind==="team-rename"&&(0,o.jsxDEV)(Et,{mode:"edit",onClose:E,onDone:O,organizationId:l,team:s.team},void 0,!1),e[184]=s,e[185]=l,e[186]=O,e[187]=We):We=e[187];let Xe;e[188]!==s||e[189]!==O?(Xe=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Kt,{onClose:E,onDone:O,teamId:s.teamId},void 0,!1),e[188]=s,e[189]=O,e[190]=Xe):Xe=e[190];let Ye;e[191]!==s?.kind||e[192]!==l||e[193]!==O?(Ye=s?.kind==="role-create"&&(0,o.jsxDEV)(Lt,{mode:"create",onClose:E,onDone:O,organizationId:l},void 0,!1),e[191]=s?.kind,e[192]=l,e[193]=O,e[194]=Ye):Ye=e[194];let Ze;e[195]!==s||e[196]!==l||e[197]!==O?(Ze=s?.kind==="role-edit"&&(0,o.jsxDEV)(Lt,{mode:"edit",onClose:E,onDone:O,organizationId:l,role:s.role},void 0,!1),e[195]=s,e[196]=l,e[197]=O,e[198]=Ze):Ze=e[198];let et;e[199]!==s||e[200]!==O?(et=s?.kind==="confirm"&&(0,o.jsxDEV)(Qt,{action:s.action,message:s.message,onClose:E,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[199]=s,e[200]=O,e[201]=et):et=e[201];let ut;return e[202]!==$e||e[203]!==Te||e[204]!==Qe||e[205]!==Je||e[206]!==Be||e[207]!==Ue||e[208]!==He||e[209]!==Ve||e[210]!==qe||e[211]!==Ge||e[212]!==Ke||e[213]!==We||e[214]!==Xe||e[215]!==Ye||e[216]!==Ze||e[217]!==et?(ut=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Te,Qe,Je,Be,Ue,He,Ve,qe,Ge,Ke,We,Xe,Ye,Ze,et]},void 0,!0),e[202]=$e,e[203]=Te,e[204]=Qe,e[205]=Je,e[206]=Be,e[207]=Ue,e[208]=He,e[209]=Ve,e[210]=qe,e[211]=Ge,e[212]=Ke,e[213]=We,e[214]=Xe,e[215]=Ye,e[216]=Ze,e[217]=et,e[218]=ut):ut=e[218],ut},"OrganizationDetail");function Xt(t){return(0,o.jsxDEV)(ne,{children:t.head},t.head,!1)}n(Xt,"_temp");function Yt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(Yt,"_temp2");function Zt(t){return A(t.role)}n(Zt,"_temp3");function el(t){return A(t.email)}n(el,"_temp4");function tl(t){return A(t.role)}n(tl,"_temp5");function ll(t){return A(t.status)}n(ll,"_temp6");function il(t){return A(t.id)}n(il,"_temp7");function ol(t){return A(t.name)}n(ol,"_temp8");function sl(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:A(t.userId)},void 0,!1)}n(sl,"_temp9");function rl(t){return A(t.role)}n(rl,"_temp0");function al(t){return A(t.permission)}n(al,"_temp1");var Il=n(()=>{let t=(0,G.c)(62),e=le(),l=K(),{config:d,ready:f}=Mt(),r=d.capabilities.organization,[i,s]=(0,P.useState)(null),[a,m]=(0,P.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let p;t[1]!==e?(p=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=p):p=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=fe(c,p,u),k=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],Dt(h,r);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=n(()=>{m(null)},"t4"),t[7]=y):y=t[7];let w=y,b;t[8]!==g?(b=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=b):b=t[9];let I=b,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let U;return t[15]!==M||t[16]!==F?(U=(0,o.jsxDEV)(ce,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=U):U=t[17],U}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let D;t[25]!==_?(D=(0,o.jsxDEV)(j,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=D):D=t[26];let z;t[27]!==D||t[28]!==x?(z=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,D]},void 0,!0),t[27]=D,t[28]=x,t[29]=z):z=t[29];let $;t[30]!==g.error?($=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=$):$=t[31];let T;t[32]!==k||t[33]!==l?(T=k!==null&&k.length===0&&(0,o.jsxDEV)(ce,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=k,t[33]=l,t[34]=T):T=t[34];let Q;t[35]!==k||t[36]!==i||t[37]!==l?(Q=k!==null&&k.length>0&&(0,o.jsxDEV)(kt,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(wt,{className:"px-0",children:(0,o.jsxDEV)(St,{"data-testid":"org-table",children:[(0,o.jsxDEV)(Nt,{children:(0,o.jsxDEV)(tt,{children:[(0,o.jsxDEV)(ne,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ne,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ne,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(At,{children:k.map(M=>{let F=A(M.id);return(0,o.jsxDEV)(tt,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(de,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.name)},void 0,!1),(0,o.jsxDEV)(de,{children:A(M.slug)},void 0,!1),(0,o.jsxDEV)(de,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)},void 0,!1),(0,o.jsxDEV)(de,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(j,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(j,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=k,t[36]=i,t[37]=l,t[38]=Q):Q=t[38];let H;t[39]!==d.organization||t[40]!==i?(H=i!==null&&(0,o.jsxDEV)(Wt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=H):H=t[41];let J;t[42]!==a?.kind||t[43]!==I?(J=a?.kind==="create"&&(0,o.jsxDEV)(Rt,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=J):J=t[44];let L;t[45]!==a||t[46]!==I?(L=a?.kind==="edit"&&(0,o.jsxDEV)(Rt,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=L):L=t[47];let B;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(B=a?.kind==="delete"&&(0,o.jsxDEV)(Qt,{action:n(async()=>{let M=A(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=B):B=t[52];let V;return t[53]!==z||t[54]!==$||t[55]!==T||t[56]!==Q||t[57]!==H||t[58]!==J||t[59]!==L||t[60]!==B?(V=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[z,$,T,Q,H,J,L,B]},void 0,!0),t[53]=z,t[54]=$,t[55]=T,t[56]=Q,t[57]=H,t[58]=J,t[59]=L,t[60]=B,t[61]=V):V=t[61],V},"OrganizationsPanel");export{Il as OrganizationsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as S}from"./chunk-
|
|
1
|
+
import{a as g,b as S}from"./chunk-Y7PD5KP4.js";import{a as i,e as m,g as v,h as C,j as d}from"./chunk-RRCPZMC2.js";var w=i(e=>{let t=0,n=0,o=0,r=0,s=0,l=0,c=0;for(let{metrics:a}of e){if(a===null){s+=1;continue}r+=1,t+=a.requests,n+=a.errors,o+=a.databaseSize??0,a.cache!==null&&(l+=a.cache.hits,c+=a.cache.hits+a.cache.misses)}return{failed:s,hitRate:c===0?null:l/c,reachable:r,totalDatabaseSize:o,totalErrors:n,totalRequests:t}},"aggregateMetrics"),E=i((e,t)=>{let n=new Set,o=[];for(let r of["",e.trim(),...t])n.has(r)||(n.add(r),o.push(r));return o},"shardsToAggregate"),x=i((e,t)=>{if(e.length===0)return 0;if(e.sort((o,r)=>o-r),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let n=Math.ceil(t/100*e.length)-1;return e[n]??0},"percentile"),N=i(e=>{let n=e.functions;if(!n||n.length===0)return{p90:0,p95:0};let o=1e3,r=[];for(let s of n){if(s.calls<=0)continue;let l=s.totalDurationMs/s.calls,c=Math.min(s.calls,o);for(let a=0;a<c;a+=1)r.push(l)}return r.length===0?{p90:0,p95:0}:{p90:x([...r],90),p95:x([...r],95)}},"computeLatencyPercentiles");var _=i(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"enrichQueryStats");var b=m(v(),1);var p=m(C(),1);var D={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},P=i(e=>{let t=(0,b.c)(12),{ariaLabel:n,className:o,series:r,testId:s}=e;if(r.length<2)return null;let l;t[0]!==r?(l=r.slice(-40).map(M),t[0]=r,t[1]=l):l=t[1];let c=l,a;t[2]!==o?(a=d("h-6 w-[120px]",o),t[2]=o,t[3]=a):a=t[3];let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,p.jsxDEV)(S,{dataKey:"value"},void 0,!1),t[4]=u):u=t[4];let f;t[5]!==c?(f=(0,p.jsxDEV)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:D,data:c,children:u},void 0,!1),t[5]=c,t[6]=f):f=t[6];let h;return t[7]!==n||t[8]!==a||t[9]!==f||t[10]!==s?(h=(0,p.jsxDEV)("div",{"aria-label":n,className:a,"data-testid":s,role:"img",children:f},void 0,!1),t[7]=n,t[8]=a,t[9]=f,t[10]=s,t[11]=h):h=t[11],h},"Sparkline");function M(e,t){return{index:t,value:e}}i(M,"_temp");export{w as a,E as b,N as c,_ as d,P as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-WMDH2CIZ.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-
|
|
1
|
+
import{a as le}from"./chunk-WMDH2CIZ.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-F7GE4X2U.js";import"./chunk-XNJNSCLM.js";import{b as G}from"./chunk-RD5UG2YL.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as z,e as Q}from"./chunk-Y572GMZE.js";import{a as X}from"./chunk-F2YMCQ6B.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-TEWVD66F.js";import"./chunk-3LJEGSMK.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as U}from"./chunk-TAD43CG5.js";import{d as H,q as W}from"./chunk-HBGS4SEX.js";import"./chunk-LXULVPEM.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as He}from"./chunk-2TJVFKD2.js";import"./chunk-3HGNPZBN.js";import{a as je}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Pe}from"./chunk-2ICZ6HXQ.js";import{a as Ge}from"./chunk-XNJNSCLM.js";import{b as De}from"./chunk-2YUYNNHQ.js";import{a as Be,b as Re,c as $e,d as j,e as E,f as _}from"./chunk-GTM65MVX.js";import{a as Le,e as Me}from"./chunk-Y572GMZE.js";import{a as Ve}from"./chunk-VLXV72QE.js";import{R as We}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as de}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-MHGJUKCZ.js";import{f as Fe}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ie}from"./chunk-TAD43CG5.js";import{d as U,f as ce,g as ue,h as me,m as fe,q as ze}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as f,e as Ie,f as at,g as ot,h as rt}from"./chunk-RRCPZMC2.js";var F=Ie(ot(),1);var w=Ie(at(),1);var t=Ie(rt(),1);var lt=f((o,e)=>{let s=new Set(o.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=o.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!s.has(a.name)),n=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:n,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||n>0}},"computeQueueReliability"),nt=200,dt=ce(J.sendQueueMessage),it=ce(J.replayQueueMessage),ct=ce(J.clearQueueMessages),Ye=96,ut=f(o=>{if(o===void 0)return"\u2014";try{return JSON.stringify(o)}catch{return"[unserializable]"}},"formatBody"),mt=f(o=>o.length>Ye?`${o.slice(0,Ye)}\u2026`:o,"truncate"),ft=f(o=>o==="error"?"destructive":o==="retry"?"outline":"secondary","outcomeVariant"),ht=f((o,e)=>e(o==="messages"?"Messages":o==="send"?"Send":"Declared"),"tabLabel"),pt=f(o=>{let e=(0,F.c)(11),{loaded:s,queues:i}=o,n=U(),a;e[0]!==n?(a=n("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[0]=n,e[1]=a):a=e[1];let l;e[2]!==a?(l=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=l):l=e[3];let r;e[4]!==s||e[5]!==i||e[6]!==n?(r=s&&i.length===0?(0,t.jsxDEV)(ie,{description:n("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:n("No queues defined")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:n("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Queue")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Mode")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Binding")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(yt)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=i,e[6]=n,e[7]=r):r=e[7];let h;return e[8]!==l||e[9]!==r?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[l,r]},void 0,!0),e[8]=l,e[9]=r,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),gt=f(o=>{let e=(0,F.c)(67),{message:s,onReplay:i,replayingId:n}=o,a=U(),l,r,h,u,y,p,x,d,m,g;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==a){let W=ut(s.body);r=j,p=`queues-message-${s.id}`;let z=s.exportName??s.queue;e[19]!==z?(x=(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:z},void 0,!1),e[19]=z,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(m=(0,t.jsxDEV)(_,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=m):m=e[24];let I=`queues-outcome-${s.id}`,L;e[25]!==s.outcome?(L=ft(s.outcome),e[25]=s.outcome,e[26]=L):L=e[26];let T;e[27]!==s.outcome||e[28]!==I||e[29]!==L?(T=(0,t.jsxDEV)(de,{"data-testid":I,variant:L,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=I,e[29]=L,e[30]=T):T=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==a?(M=s.deadLettered&&(0,t.jsxDEV)(de,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:a("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=a,e[34]=M):M=e[34],e[35]!==T||e[36]!==M?(g=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[T,M]},void 0,!0)},void 0,!1),e[35]=T,e[36]=M,e[37]=g):g=e[37],l=_,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,y=mt(W),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=a,e[9]=l,e[10]=r,e[11]=h,e[12]=u,e[13]=y,e[14]=p,e[15]=x,e[16]=d,e[17]=m,e[18]=g}else l=e[9],r=e[10],h=e[11],u=e[12],y=e[13],p=e[14],x=e[15],d=e[16],m=e[17],g=e[18];let v;e[38]!==l||e[39]!==h||e[40]!==u||e[41]!==y?(v=(0,t.jsxDEV)(l,{className:h,title:u,children:y},void 0,!1),e[38]=l,e[39]=h,e[40]=u,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(_,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let S=`queues-replay-${s.id}`,A=n!==null,C;e[47]!==s.id||e[48]!==n||e[49]!==a?(C=n===s.id?a("Replaying\u2026"):a("Replay"),e[47]=s.id,e[48]=n,e[49]=a,e[50]=C):C=e[50];let Q;e[51]!==s.id||e[52]!==i||e[53]!==S||e[54]!==A||e[55]!==C?(Q=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(V,{"data-id":s.id,"data-testid":S,disabled:A,onClick:i,size:"xs",type:"button",variant:"outline",children:C},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=i,e[53]=S,e[54]=A,e[55]=C,e[56]=Q):Q=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==Q||e[60]!==p||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==g||e[65]!==v?(D=(0,t.jsxDEV)(r,{"data-testid":p,children:[x,d,m,g,v,b,Q]},void 0,!0),e[57]=r,e[58]=b,e[59]=Q,e[60]=p,e[61]=x,e[62]=d,e[63]=m,e[64]=g,e[65]=v,e[66]=D):D=e[66],D},"QueueLogRow"),vt=f(o=>{let e=(0,F.c)(26),{hasError:s,messages:i,onClear:n,onReplay:a,replayingId:l}=o,r=U(),h;e[0]!==r?(h=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=h):h=e[1];let u;e[2]!==h?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=u):u=e[3];let y=i.length===0,p;e[4]!==r?(p=r("Clear log"),e[4]=r,e[5]=p):p=e[5];let x;e[6]!==n||e[7]!==y||e[8]!==p?(x=(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:n,size:"sm",type:"button",variant:"outline",children:p},void 0,!1),e[6]=n,e[7]=y,e[8]=p,e[9]=x):x=e[9];let d;e[10]!==i.length||e[11]!==r?(d=i.length>0&&(0,t.jsxDEV)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})},void 0,!1),e[10]=i.length,e[11]=r,e[12]=d):d=e[12];let m;e[13]!==u||e[14]!==x||e[15]!==d?(m=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,d]},void 0,!0),e[13]=u,e[14]=x,e[15]=d,e[16]=m):m=e[16];let g;e[17]!==s||e[18]!==i||e[19]!==a||e[20]!==l||e[21]!==r?(g=!s&&i.length===0?(0,t.jsxDEV)(ie,{description:r("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:r("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:r("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Message")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Attempts")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Outcome")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Body")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Captured")},void 0,!1),(0,t.jsxDEV)(E,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(N=>(0,t.jsxDEV)(gt,{message:N,onReplay:a,replayingId:l},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=i,e[19]=a,e[20]=l,e[21]=r,e[22]=g):g=e[22];let v;return e[23]!==m||e[24]!==g?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]},void 0,!0),e[23]=m,e[24]=g,e[25]=v):v=e[25],v},"QueuesMessagesTab"),xt=f(o=>{let e=(0,F.c)(20),{batchMode:s,bodyText:i,delayText:n,onBatchModeChange:a,onBodyChange:l,onDelayChange:r,onSelectExport:h,onSend:u,queues:y,selectedExportName:p,sending:x}=o,d=U(),m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let g;e[2]!==m?(g=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=g):g=e[3];let v;e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==h||e[11]!==u||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ie,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("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:h,value:p,children:y.map(bt)},void 0,!1),(0,t.jsxDEV)(We,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:n},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:u,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Ve,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i},void 0,!1)]},void 0,!0),e[4]=s,e[5]=i,e[6]=n,e[7]=a,e[8]=l,e[9]=r,e[10]=h,e[11]=u,e[12]=y,e[13]=p,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==g||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,v]},void 0,!0),e[17]=g,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),Ut=f(o=>{let e=(0,F.c)(59),{limit:s}=o,i=s??nt,n=Fe(),a=U(),[l,r]=(0,w.useState)("declared"),[h,u]=(0,w.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:p,error:x,errorSource:d}=De(J.listQueues,y),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:g,error:v,errorSource:N,refetch:b}=De(J.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(Nt):[],A=g?.entries??[],{deadLetteredCount:C,queuesWithoutDlq:Q,showReliabilityWarning:D}=lt(S,A),[W,z]=(0,w.useState)(""),[I,L]=(0,w.useState)(""),[T,M]=(0,w.useState)(""),[G,Xe]=(0,w.useState)(!1),[he,Oe]=(0,w.useState)(!1),[pe,ke]=(0,w.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Ue=l==="messages"?v:x,Ke=l==="messages"?N:d,ge=Ue??h,ve=Ue===null?h:Ke,Y;e[3]!==b?(Y=f(()=>{b()},"t3"),e[3]=b,e[4]=Y):Y=e[4],je(Y,l==="messages");let xe=f(async()=>{u(null);let c=H;if(c==="")return;let q=null,we=I.trim();if(we!=="")try{q=JSON.parse(we)}catch{u(a("Body must be valid JSON."));return}let Ae,Je=T.trim();if(Je!==""){let P=Number(Je);if(!Number.isFinite(P)||P<0){u(a("Delay must be a non-negative number of seconds."));return}Ae=P}if(G&&!Array.isArray(q)){u(a("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=G?{batch:q,delaySeconds:Ae,exportName:c}:{body:q,delaySeconds:Ae,exportName:c};try{await n.query(dt,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"send"),X;e[5]!==n||e[6]!==b?(X=f(async c=>{u(null),ke(c);try{await n.query(it,{id:c},ue("")),b()}catch(q){u(me(q))}ke(null)},"t5"),e[5]=n,e[6]=b,e[7]=X):X=e[7];let ye=X,K;e[8]!==n||e[9]!==b?(K=f(async()=>{u(null);try{await n.query(ct,{},ue("")),b()}catch(c){u(me(c))}},"t6"),e[8]=n,e[9]=b,e[10]=K):K=e[10];let be=K,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f(c=>{let q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&r(q)},"t7"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f(c=>{z(c.currentTarget.value)},"t8"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f(c=>{L(c.currentTarget.value)},"t9"),e[13]=te):te=e[13];let qe=te,se;e[14]===Symbol.for("react.memo_cache_sentinel")?(se=f(c=>{M(c.currentTarget.value)},"t10"),e[14]=se):se=e[14];let Se=se,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=f(c=>{Xe(c.currentTarget.checked)},"t11"),e[15]=ae):ae=e[15];let Ee=ae,oe;e[16]!==xe?(oe=f(()=>{fe(xe())},"t12"),e[16]=xe,e[17]=oe):oe=e[17];let _e=oe,re;e[18]!==ye?(re=f(c=>{let{id:q}=c.currentTarget.dataset;q!==void 0&&fe(ye(q))},"t13"),e[18]=ye,e[19]=re):re=e[19];let Te=re,le;e[20]!==be?(le=f(()=>{fe(be())},"t14"),e[20]=be,e[21]=le):le=e[21];let Ce=le,et="flex flex-col gap-6",tt="lunora-queues-panel",B;e[22]!==a||e[23]!==l?(B=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsxDEV)(V,{"aria-selected":l===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:l===c?"secondary":"ghost",children:ht(c,a)},c,!1))},void 0,!1),e[22]=a,e[23]=l,e[24]=B):B=e[24];let R;e[25]!==ge||e[26]!==ve?(R=ge!==null&&(0,t.jsxDEV)(Pe,{error:ve,testId:"queues-error"},void 0,!1),e[25]=ge,e[26]=ve,e[27]=R):R=e[27];let Qe=D&&(0,t.jsxDEV)(Ge,{icon:(0,t.jsxDEV)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"},void 0,!1),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[Q.length>0&&(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:Q.map(qt).join(", ")})},void 0,!1),(0,t.jsxDEV)("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")},void 0,!1)]},void 0,!0),C>0&&(0,t.jsxDEV)("p",{className:Q.length>0?"text-muted-foreground":"font-medium",children:C===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:C})},void 0,!1)]},void 0,!0)},void 0,!1),$;e[28]!==S||e[29]!==p||e[30]!==l?($=l==="declared"&&(0,t.jsxDEV)(pt,{loaded:p!==void 0,queues:S},void 0,!1),e[28]=S,e[29]=p,e[30]=l,e[31]=$):$=e[31];let O;e[32]!==A||e[33]!==v||e[34]!==Ce||e[35]!==Te||e[36]!==pe||e[37]!==l?(O=l==="messages"&&(0,t.jsxDEV)(vt,{hasError:v!==null,messages:A,onClear:Ce,onReplay:Te,replayingId:pe},void 0,!1),e[32]=A,e[33]=v,e[34]=Ce,e[35]=Te,e[36]=pe,e[37]=l,e[38]=O):O=e[38];let k;e[39]!==G||e[40]!==I||e[41]!==T||e[42]!==Ee||e[43]!==qe||e[44]!==Se||e[45]!==Ne||e[46]!==_e||e[47]!==S||e[48]!==H||e[49]!==he||e[50]!==l?(k=l==="send"&&(0,t.jsxDEV)(xt,{batchMode:G,bodyText:I,delayText:T,onBatchModeChange:Ee,onBodyChange:qe,onDelayChange:Se,onSelectExport:Ne,onSend:_e,queues:S,selectedExportName:H,sending:he},void 0,!1),e[39]=G,e[40]=I,e[41]=T,e[42]=Ee,e[43]=qe,e[44]=Se,e[45]=Ne,e[46]=_e,e[47]=S,e[48]=H,e[49]=he,e[50]=l,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=(0,t.jsxDEV)("div",{className:et,"data-testid":tt,children:[B,R,Qe,$,O,k]},void 0,!0),e[52]=B,e[53]=R,e[54]=Qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne},"QueuesPanel");function yt(o){return(0,t.jsxDEV)(j,{"data-testid":`queues-row-${o.exportName}`,children:[(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:o.exportName},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.name},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.mode},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.binding},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.deadLetterQueue??"\u2014"},void 0,!1)]},o.exportName,!0)}f(yt,"_temp");function bt(o){return(0,t.jsxDEV)("option",{value:o.exportName,children:o.exportName},o.exportName,!1)}f(bt,"_temp2");function Nt(o,e){return o.exportName.localeCompare(e.exportName)}f(Nt,"_temp3");function qt(o){return o.name}f(qt,"_temp4");export{Ut as default};
|
|
1
|
+
import{a as He}from"./chunk-2TJVFKD2.js";import"./chunk-3HGNPZBN.js";import{a as je}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Pe}from"./chunk-F7GE4X2U.js";import{a as Ge}from"./chunk-XNJNSCLM.js";import{b as De}from"./chunk-RD5UG2YL.js";import{a as Be,b as Re,c as $e,d as j,e as E,f as _}from"./chunk-GTM65MVX.js";import{a as Le,e as Me}from"./chunk-Y572GMZE.js";import{a as Ve}from"./chunk-VLXV72QE.js";import{R as We}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as de}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-TEWVD66F.js";import{f as Fe}from"./chunk-3LJEGSMK.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ie}from"./chunk-TAD43CG5.js";import{d as U,f as ce,g as ue,h as me,m as fe,q as ze}from"./chunk-HBGS4SEX.js";import"./chunk-LXULVPEM.js";import{a as f,e as Ie,f as at,g as ot,h as rt}from"./chunk-RRCPZMC2.js";var F=Ie(ot(),1);var w=Ie(at(),1);var t=Ie(rt(),1);var lt=f((o,e)=>{let s=new Set(o.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=o.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!s.has(a.name)),n=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:n,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||n>0}},"computeQueueReliability"),nt=200,dt=ce(J.sendQueueMessage),it=ce(J.replayQueueMessage),ct=ce(J.clearQueueMessages),Ye=96,ut=f(o=>{if(o===void 0)return"\u2014";try{return JSON.stringify(o)}catch{return"[unserializable]"}},"formatBody"),mt=f(o=>o.length>Ye?`${o.slice(0,Ye)}\u2026`:o,"truncate"),ft=f(o=>o==="error"?"destructive":o==="retry"?"outline":"secondary","outcomeVariant"),ht=f((o,e)=>e(o==="messages"?"Messages":o==="send"?"Send":"Declared"),"tabLabel"),pt=f(o=>{let e=(0,F.c)(11),{loaded:s,queues:i}=o,n=U(),a;e[0]!==n?(a=n("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[0]=n,e[1]=a):a=e[1];let l;e[2]!==a?(l=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=l):l=e[3];let r;e[4]!==s||e[5]!==i||e[6]!==n?(r=s&&i.length===0?(0,t.jsxDEV)(ie,{description:n("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:n("No queues defined")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:n("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Queue")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Mode")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Binding")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(yt)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=i,e[6]=n,e[7]=r):r=e[7];let h;return e[8]!==l||e[9]!==r?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[l,r]},void 0,!0),e[8]=l,e[9]=r,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),gt=f(o=>{let e=(0,F.c)(67),{message:s,onReplay:i,replayingId:n}=o,a=U(),l,r,h,u,y,p,x,d,m,g;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==a){let W=ut(s.body);r=j,p=`queues-message-${s.id}`;let z=s.exportName??s.queue;e[19]!==z?(x=(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:z},void 0,!1),e[19]=z,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(m=(0,t.jsxDEV)(_,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=m):m=e[24];let I=`queues-outcome-${s.id}`,L;e[25]!==s.outcome?(L=ft(s.outcome),e[25]=s.outcome,e[26]=L):L=e[26];let T;e[27]!==s.outcome||e[28]!==I||e[29]!==L?(T=(0,t.jsxDEV)(de,{"data-testid":I,variant:L,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=I,e[29]=L,e[30]=T):T=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==a?(M=s.deadLettered&&(0,t.jsxDEV)(de,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:a("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=a,e[34]=M):M=e[34],e[35]!==T||e[36]!==M?(g=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[T,M]},void 0,!0)},void 0,!1),e[35]=T,e[36]=M,e[37]=g):g=e[37],l=_,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,y=mt(W),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=a,e[9]=l,e[10]=r,e[11]=h,e[12]=u,e[13]=y,e[14]=p,e[15]=x,e[16]=d,e[17]=m,e[18]=g}else l=e[9],r=e[10],h=e[11],u=e[12],y=e[13],p=e[14],x=e[15],d=e[16],m=e[17],g=e[18];let v;e[38]!==l||e[39]!==h||e[40]!==u||e[41]!==y?(v=(0,t.jsxDEV)(l,{className:h,title:u,children:y},void 0,!1),e[38]=l,e[39]=h,e[40]=u,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(_,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let S=`queues-replay-${s.id}`,A=n!==null,C;e[47]!==s.id||e[48]!==n||e[49]!==a?(C=n===s.id?a("Replaying\u2026"):a("Replay"),e[47]=s.id,e[48]=n,e[49]=a,e[50]=C):C=e[50];let Q;e[51]!==s.id||e[52]!==i||e[53]!==S||e[54]!==A||e[55]!==C?(Q=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(V,{"data-id":s.id,"data-testid":S,disabled:A,onClick:i,size:"xs",type:"button",variant:"outline",children:C},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=i,e[53]=S,e[54]=A,e[55]=C,e[56]=Q):Q=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==Q||e[60]!==p||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==g||e[65]!==v?(D=(0,t.jsxDEV)(r,{"data-testid":p,children:[x,d,m,g,v,b,Q]},void 0,!0),e[57]=r,e[58]=b,e[59]=Q,e[60]=p,e[61]=x,e[62]=d,e[63]=m,e[64]=g,e[65]=v,e[66]=D):D=e[66],D},"QueueLogRow"),vt=f(o=>{let e=(0,F.c)(26),{hasError:s,messages:i,onClear:n,onReplay:a,replayingId:l}=o,r=U(),h;e[0]!==r?(h=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=h):h=e[1];let u;e[2]!==h?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=u):u=e[3];let y=i.length===0,p;e[4]!==r?(p=r("Clear log"),e[4]=r,e[5]=p):p=e[5];let x;e[6]!==n||e[7]!==y||e[8]!==p?(x=(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:n,size:"sm",type:"button",variant:"outline",children:p},void 0,!1),e[6]=n,e[7]=y,e[8]=p,e[9]=x):x=e[9];let d;e[10]!==i.length||e[11]!==r?(d=i.length>0&&(0,t.jsxDEV)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})},void 0,!1),e[10]=i.length,e[11]=r,e[12]=d):d=e[12];let m;e[13]!==u||e[14]!==x||e[15]!==d?(m=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,d]},void 0,!0),e[13]=u,e[14]=x,e[15]=d,e[16]=m):m=e[16];let g;e[17]!==s||e[18]!==i||e[19]!==a||e[20]!==l||e[21]!==r?(g=!s&&i.length===0?(0,t.jsxDEV)(ie,{description:r("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:r("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:r("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Message")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Attempts")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Outcome")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Body")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Captured")},void 0,!1),(0,t.jsxDEV)(E,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(N=>(0,t.jsxDEV)(gt,{message:N,onReplay:a,replayingId:l},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=i,e[19]=a,e[20]=l,e[21]=r,e[22]=g):g=e[22];let v;return e[23]!==m||e[24]!==g?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]},void 0,!0),e[23]=m,e[24]=g,e[25]=v):v=e[25],v},"QueuesMessagesTab"),xt=f(o=>{let e=(0,F.c)(20),{batchMode:s,bodyText:i,delayText:n,onBatchModeChange:a,onBodyChange:l,onDelayChange:r,onSelectExport:h,onSend:u,queues:y,selectedExportName:p,sending:x}=o,d=U(),m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let g;e[2]!==m?(g=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=g):g=e[3];let v;e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==h||e[11]!==u||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ie,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("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:h,value:p,children:y.map(bt)},void 0,!1),(0,t.jsxDEV)(We,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:n},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:u,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Ve,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i},void 0,!1)]},void 0,!0),e[4]=s,e[5]=i,e[6]=n,e[7]=a,e[8]=l,e[9]=r,e[10]=h,e[11]=u,e[12]=y,e[13]=p,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==g||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,v]},void 0,!0),e[17]=g,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),Ut=f(o=>{let e=(0,F.c)(59),{limit:s}=o,i=s??nt,n=Fe(),a=U(),[l,r]=(0,w.useState)("declared"),[h,u]=(0,w.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:p,error:x,errorSource:d}=De(J.listQueues,y),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:g,error:v,errorSource:N,refetch:b}=De(J.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(Nt):[],A=g?.entries??[],{deadLetteredCount:C,queuesWithoutDlq:Q,showReliabilityWarning:D}=lt(S,A),[W,z]=(0,w.useState)(""),[I,L]=(0,w.useState)(""),[T,M]=(0,w.useState)(""),[G,Xe]=(0,w.useState)(!1),[he,Oe]=(0,w.useState)(!1),[pe,ke]=(0,w.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Ue=l==="messages"?v:x,Ke=l==="messages"?N:d,ge=Ue??h,ve=Ue===null?h:Ke,Y;e[3]!==b?(Y=f(()=>{b()},"t3"),e[3]=b,e[4]=Y):Y=e[4],je(Y,l==="messages");let xe=f(async()=>{u(null);let c=H;if(c==="")return;let q=null,we=I.trim();if(we!=="")try{q=JSON.parse(we)}catch{u(a("Body must be valid JSON."));return}let Ae,Je=T.trim();if(Je!==""){let P=Number(Je);if(!Number.isFinite(P)||P<0){u(a("Delay must be a non-negative number of seconds."));return}Ae=P}if(G&&!Array.isArray(q)){u(a("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=G?{batch:q,delaySeconds:Ae,exportName:c}:{body:q,delaySeconds:Ae,exportName:c};try{await n.query(dt,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"send"),X;e[5]!==n||e[6]!==b?(X=f(async c=>{u(null),ke(c);try{await n.query(it,{id:c},ue("")),b()}catch(q){u(me(q))}ke(null)},"t5"),e[5]=n,e[6]=b,e[7]=X):X=e[7];let ye=X,K;e[8]!==n||e[9]!==b?(K=f(async()=>{u(null);try{await n.query(ct,{},ue("")),b()}catch(c){u(me(c))}},"t6"),e[8]=n,e[9]=b,e[10]=K):K=e[10];let be=K,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f(c=>{let q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&r(q)},"t7"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f(c=>{z(c.currentTarget.value)},"t8"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f(c=>{L(c.currentTarget.value)},"t9"),e[13]=te):te=e[13];let qe=te,se;e[14]===Symbol.for("react.memo_cache_sentinel")?(se=f(c=>{M(c.currentTarget.value)},"t10"),e[14]=se):se=e[14];let Se=se,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=f(c=>{Xe(c.currentTarget.checked)},"t11"),e[15]=ae):ae=e[15];let Ee=ae,oe;e[16]!==xe?(oe=f(()=>{fe(xe())},"t12"),e[16]=xe,e[17]=oe):oe=e[17];let _e=oe,re;e[18]!==ye?(re=f(c=>{let{id:q}=c.currentTarget.dataset;q!==void 0&&fe(ye(q))},"t13"),e[18]=ye,e[19]=re):re=e[19];let Te=re,le;e[20]!==be?(le=f(()=>{fe(be())},"t14"),e[20]=be,e[21]=le):le=e[21];let Ce=le,et="flex flex-col gap-6",tt="lunora-queues-panel",B;e[22]!==a||e[23]!==l?(B=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsxDEV)(V,{"aria-selected":l===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:l===c?"secondary":"ghost",children:ht(c,a)},c,!1))},void 0,!1),e[22]=a,e[23]=l,e[24]=B):B=e[24];let R;e[25]!==ge||e[26]!==ve?(R=ge!==null&&(0,t.jsxDEV)(Pe,{error:ve,testId:"queues-error"},void 0,!1),e[25]=ge,e[26]=ve,e[27]=R):R=e[27];let Qe=D&&(0,t.jsxDEV)(Ge,{icon:(0,t.jsxDEV)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"},void 0,!1),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[Q.length>0&&(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:Q.map(qt).join(", ")})},void 0,!1),(0,t.jsxDEV)("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")},void 0,!1)]},void 0,!0),C>0&&(0,t.jsxDEV)("p",{className:Q.length>0?"text-muted-foreground":"font-medium",children:C===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:C})},void 0,!1)]},void 0,!0)},void 0,!1),$;e[28]!==S||e[29]!==p||e[30]!==l?($=l==="declared"&&(0,t.jsxDEV)(pt,{loaded:p!==void 0,queues:S},void 0,!1),e[28]=S,e[29]=p,e[30]=l,e[31]=$):$=e[31];let O;e[32]!==A||e[33]!==v||e[34]!==Ce||e[35]!==Te||e[36]!==pe||e[37]!==l?(O=l==="messages"&&(0,t.jsxDEV)(vt,{hasError:v!==null,messages:A,onClear:Ce,onReplay:Te,replayingId:pe},void 0,!1),e[32]=A,e[33]=v,e[34]=Ce,e[35]=Te,e[36]=pe,e[37]=l,e[38]=O):O=e[38];let k;e[39]!==G||e[40]!==I||e[41]!==T||e[42]!==Ee||e[43]!==qe||e[44]!==Se||e[45]!==Ne||e[46]!==_e||e[47]!==S||e[48]!==H||e[49]!==he||e[50]!==l?(k=l==="send"&&(0,t.jsxDEV)(xt,{batchMode:G,bodyText:I,delayText:T,onBatchModeChange:Ee,onBodyChange:qe,onDelayChange:Se,onSelectExport:Ne,onSend:_e,queues:S,selectedExportName:H,sending:he},void 0,!1),e[39]=G,e[40]=I,e[41]=T,e[42]=Ee,e[43]=qe,e[44]=Se,e[45]=Ne,e[46]=_e,e[47]=S,e[48]=H,e[49]=he,e[50]=l,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=(0,t.jsxDEV)("div",{className:et,"data-testid":tt,children:[B,R,Qe,$,O,k]},void 0,!0),e[52]=B,e[53]=R,e[54]=Qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne},"QueuesPanel");function yt(o){return(0,t.jsxDEV)(j,{"data-testid":`queues-row-${o.exportName}`,children:[(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:o.exportName},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.name},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.mode},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.binding},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.deadLetterQueue??"\u2014"},void 0,!1)]},o.exportName,!0)}f(yt,"_temp");function bt(o){return(0,t.jsxDEV)("option",{value:o.exportName,children:o.exportName},o.exportName,!1)}f(bt,"_temp2");function Nt(o,e){return o.exportName.localeCompare(e.exportName)}f(Nt,"_temp3");function qt(o){return o.name}f(qt,"_temp4");export{Ut as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,c as v,d as g,f as D}from"./chunk-
|
|
1
|
+
import{b,c as v,d as g,f as D}from"./chunk-3LJEGSMK.js";import{f as y,g as p,h as P,m as O}from"./chunk-HBGS4SEX.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,c as o}from"./chunk-2MLA6WFH.js";import{a as t}from"./chunk-RRCPZMC2.js";var n="lunora:traces:pending-filter",c=t(e=>{o(n,e,"session")},"writePendingTraceFilter"),d=t(()=>{let e=s("session");if(e!==void 0)try{let a=e.getItem(n);if(a===null)return;let r=JSON.parse(a);return typeof r.traceId!="string"?void 0:{traceId:r.traceId,...typeof r.shardKey=="string"?{shardKey:r.shardKey}:{}}}catch{return}},"peekPendingTraceFilter"),g=t(()=>{try{s("session")?.removeItem(n)}catch{}},"clearPendingTraceFilter");export{c as a,d as b,g as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-N7SVJOHN.js";import{a as ye}from"./chunk-QVIPA6UJ.js";import{b as xe}from"./chunk-VXM5H542.js";import{a as re}from"./chunk-IYHPYY4A.js";import{a as be}from"./chunk-WMDH2CIZ.js";import{a as B}from"./chunk-2K47A3P6.js";import{a as he}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as Z}from"./chunk-2YUYNNHQ.js";import{a as ge,b as ve,c as pe,d as te,e as P,f as _}from"./chunk-GTM65MVX.js";import{a as me}from"./chunk-F2YMCQ6B.js";import{b as fe}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as E}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as ce}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as V}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as ee}from"./chunk-MHGJUKCZ.js";import{f as de}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as $}from"./chunk-TAD43CG5.js";import{d as j,h as J,i as ue,m as X}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as n,e as Y,f as Qe,g as ze,h as He,j as q}from"./chunk-RRCPZMC2.js";var A=Y(ze(),1);var b=Y(Qe(),1);var r=Y(He(),1);var Ce=["trace","debug","log","info","warn","error","fatal"],We="LOG_ARCHIVE_NOT_CONFIGURED",Se={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},Ye={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},je=n((s,e)=>{switch(e.type){case"append":return{...s,cursor:e.cursor,error:null,loading:!1,rows:[...s.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{...s,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...s,error:e.message,loading:!1};default:return s}},"archiveReducer"),Je=n(s=>{let e=(0,A.c)(33),{row:t}=s,l;e[0]!==t.fields?(l=D(t.fields),e[0]=t.fields,e[1]=l):l=e[1];let i=l,o=`lg-archive-row-${String(t.ts)}`,d;e[2]!==t.ts?(d=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=d):d=e[3];let f;e[4]!==d?(f=(0,r.jsxDEV)(_,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:d},void 0,!1),e[4]=d,e[5]=f):f=e[5];let x=Se[t.level],u;e[6]!==t.level||e[7]!==x?(u=(0,r.jsxDEV)(_,{children:(0,r.jsxDEV)(V,{variant:x,children:t.level},void 0,!1)},void 0,!1),e[6]=t.level,e[7]=x,e[8]=u):u=e[8];let c;e[9]!==t.functionPath?(c=(0,r.jsxDEV)(_,{className:"font-mono text-xs",children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=c):c=e[10];let y;e[11]!==t.message?(y=(0,r.jsxDEV)("div",{className:"truncate",title:t.message,children:t.message},void 0,!1),e[11]=t.message,e[12]=y):y=e[12];let v;e[13]!==i?(v=i!==""&&(0,r.jsxDEV)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i},void 0,!1),e[13]=i,e[14]=v):v=e[14];let m;e[15]!==y||e[16]!==v?(m=(0,r.jsxDEV)(_,{className:"max-w-md",children:[y,v]},void 0,!0),e[15]=y,e[16]=v,e[17]=m):m=e[17];let h=t.traceId??"\u2014",p;e[18]!==h?(p=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:h},void 0,!1),e[18]=h,e[19]=p):p=e[19];let C=t.shardKey??"\u2014",g;e[20]!==C?(g=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:C},void 0,!1),e[20]=C,e[21]=g):g=e[21];let w=t.userId??"\u2014",N;e[22]!==w?(N=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:w},void 0,!1),e[22]=w,e[23]=N):N=e[23];let S;return e[24]!==m||e[25]!==p||e[26]!==g||e[27]!==N||e[28]!==o||e[29]!==f||e[30]!==u||e[31]!==c?(S=(0,r.jsxDEV)(te,{"data-testid":o,children:[f,u,c,m,p,g,N]},void 0,!0),e[24]=m,e[25]=p,e[26]=g,e[27]=N,e[28]=o,e[29]=f,e[30]=u,e[31]=c,e[32]=S):S=e[32],S},"ArchiveRow"),Xe=n(({shardKey:s})=>{let e=de(),t=j(),[l,i]=(0,b.useState)(""),[o,d]=(0,b.useState)(""),[f,x]=(0,b.useState)(""),[{cursor:u,error:c,loading:y,notConfigured:v,rows:m},h]=(0,b.useReducer)(je,Ye),p=B(l.trim(),400),C=B(o.trim(),400),g={...p===""?{}:{functionPathPrefix:p},...f===""?{}:{minLevel:f},...s===""?{}:{shardKey:s},...C===""?{}:{userId:C}},w=JSON.stringify(g),N=(0,b.useRef)(w);(0,b.useEffect)(()=>{let L={cancelled:!1};return N.current=w,X((async()=>{h({type:"loading"});try{let T=await e.queryLogArchive(g);L.cancelled||h({cursor:T.nextCursor,rows:T.rows,type:"loaded"})}catch(T){L.cancelled||h(ue(T)===We?{type:"notConfigured"}:{message:J(T),type:"failed"})}})()),()=>{L.cancelled=!0}},[e,w]);let S=n(async()=>{if(u===void 0)return;let L=w;h({type:"loading"});try{let T=await e.queryLogArchive({...g,cursor:u});N.current===L&&h({cursor:T.nextCursor,rows:T.rows,type:"append"})}catch(T){N.current===L&&h({message:J(T),type:"pageFailed"})}},"loadMore"),k=n(L=>{i(L.target.value)},"onPathPrefixChange"),I=n(L=>{d(L.target.value)},"onUserIdChange"),R=n(L=>{x(L.target.value)},"onMinLevelChange"),O=n(()=>{X(S())},"onLoadMore");return v?(0,r.jsxDEV)($,{action:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:re,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1),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")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:k,placeholder:t("function path\u2026"),value:l},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:I,placeholder:t("user id\u2026"),value:o},void 0,!1),(0,r.jsxDEV)("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:R,value:f,children:[(0,r.jsxDEV)("option",{value:"",children:t("min level")},void 0,!1),Ce.map(L=>(0,r.jsxDEV)("option",{value:L,children:L},L,!1))]},void 0,!0)]},void 0,!0),c!==null&&(0,r.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:c},void 0,!1),y&&m===null&&c===null&&(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")},void 0,!1),m!==null&&m.length===0&&(0,r.jsxDEV)($,{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.")},void 0,!1),m!==null&&m.length>0&&(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxDEV)(ge,{"data-testid":"lg-archive-table",children:[(0,r.jsxDEV)(ve,{children:(0,r.jsxDEV)(te,{children:[(0,r.jsxDEV)(P,{children:t("Time")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Level")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Function")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Message")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Trace")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Shard")},void 0,!1),(0,r.jsxDEV)(P,{children:t("User")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(pe,{children:m.map((L,T)=>(0,r.jsxDEV)(Je,{row:L},`${String(L.ts)}-${String(T)}`,!1))},void 0,!1)]},void 0,!0)},void 0,!1),u!==void 0&&(0,r.jsxDEV)("div",{children:(0,r.jsxDEV)(ce,{"data-testid":"lg-archive-more",disabled:y,onClick:O,size:"sm",variant:"outline",children:t(y?"Loading\u2026":"Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"ArchiveFeed"),oe=400,Ze=36,et={height:oe,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},tt={error:"destructive",ok:"secondary"},rt=n(s=>{let e=(0,A.c)(26),{entry:t,index:l,measureRef:i,start:o}=s,d=`translateY(${String(o)}px)`,f;e[0]!==d?(f={...Te,transform:d},e[0]=d,e[1]=f):f=e[1];let x=f,u;e[2]!==t.fields?(u=D(t.fields),e[2]=t.fields,e[3]=u):u=e[3];let c=u,y;e[4]!==t.timestamp?(y=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=y):y=e[5];let v;e[6]!==y?(v=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y},void 0,!1),e[6]=y,e[7]=v):v=e[7];let m=Se[t.level],h;e[8]!==t.level||e[9]!==m?(h=(0,r.jsxDEV)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(V,{variant:m,children:t.level},void 0,!1)},void 0,!1),e[8]=t.level,e[9]=m,e[10]=h):h=e[10];let p=t.functionPath??"\u2014",C;e[11]!==p?(C=(0,r.jsxDEV)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p},void 0,!1),e[11]=p,e[12]=C):C=e[12];let g;e[13]!==c?(g=c===""?null:(0,r.jsxDEV)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c},void 0,!1),e[13]=c,e[14]=g):g=e[14];let w;e[15]!==t.message||e[16]!==g?(w=(0,r.jsxDEV)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]},void 0,!0),e[15]=t.message,e[16]=g,e[17]=w):w=e[17];let N;return e[18]!==l||e[19]!==i||e[20]!==x||e[21]!==w||e[22]!==v||e[23]!==h||e[24]!==C?(N=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-row",ref:i,role:"row",style:x,children:[v,h,C,w]},void 0,!0),e[18]=l,e[19]=i,e[20]=x,e[21]=w,e[22]=v,e[23]=h,e[24]=C,e[25]=N):N=e[25],N},"LogRow"),we=n(s=>s.length===0?"\u2014":s.join(", "),"tablesLabel"),ot=n(s=>{let e=(0,A.c)(37),{entry:t,index:l,measureRef:i,start:o}=s,d=`translateY(${String(o)}px)`,f;e[0]!==d?(f={...Te,transform:d},e[0]=d,e[1]=f):f=e[1];let x=f,u;e[2]!==t.ts?(u=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,r.jsxDEV)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u},void 0,!1),e[4]=u,e[5]=c):c=e[5];let y=tt[t.outcome],v;e[6]!==t.outcome||e[7]!==y?(v=(0,r.jsxDEV)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(V,{variant:y,children:t.outcome},void 0,!1)},void 0,!1),e[6]=t.outcome,e[7]=y,e[8]=v):v=e[8];let m;e[9]!==t.functionPath?(m=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=m):m=e[10];let h=t.shardKey??"\u2014",p;e[11]!==h?(p=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h},void 0,!1),e[11]=h,e[12]=p):p=e[12];let C=t.userId??"\u2014",g;e[13]!==C?(g=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C},void 0,!1),e[13]=C,e[14]=g):g=e[14];let w;e[15]!==t.durationMs?(w=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=w):w=e[16];let N=`${String(w)}ms`,S;e[17]!==N?(S=(0,r.jsxDEV)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:N},void 0,!1),e[17]=N,e[18]=S):S=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:${we(t.tablesRead)} \xB7 w:${we(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 I;e[24]!==k?(I=(0,r.jsxDEV)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k},void 0,!1),e[24]=k,e[25]=I):I=e[25];let R;return e[26]!==l||e[27]!==i||e[28]!==x||e[29]!==g||e[30]!==S||e[31]!==I||e[32]!==c||e[33]!==v||e[34]!==m||e[35]!==p?(R=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-req-row",ref:i,role:"row",style:x,children:[c,v,m,p,g,S,I]},void 0,!0),e[26]=l,e[27]=i,e[28]=x,e[29]=g,e[30]=S,e[31]=I,e[32]=c,e[33]=v,e[34]=m,e[35]=p,e[36]=R):R=e[36],R},"RequestRow"),Ne=n(s=>{let{entries:e}=s??{};return Array.isArray(e)?e:[]},"entriesOf"),st=n(s=>{let e={};return s.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=s.functionPathPrefix.trim()),s.userId.trim()!==""&&(e.userId=s.userId.trim()),s.tableTouched.trim()!==""&&(e.tableTouched=s.tableTouched.trim()),(s.outcome==="ok"||s.outcome==="error")&&(e.outcome=s.outcome),e},"buildRequestQuery"),Ie=Ce,at={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},lt=n((s,e)=>{let t=e.search.trim().toLowerCase(),l=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-at[e.range];return s.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||l!==""&&!(o.functionPath??"").toLowerCase().includes(l)?!1:t===""||o.message.toLowerCase().includes(t)||D(o.fields).toLowerCase().includes(t))},"filterLogs"),nt="\u2014",it=n(s=>{let e=new Map,t=new Map;for(let o of s){e.set(o.level,(e.get(o.level)??0)+1);let d=o.functionPath??nt;t.set(d,(t.get(d)??0)+1)}let l=Ie.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,d])=>({count:d,key:o})).toSorted((o,d)=>d.count===o.count?o.key.localeCompare(d.key):d.count-o.count);return{byLevel:l,byPath:i,total:s.length}},"summarizeLogs"),dt=n(s=>{let e=(0,A.c)(11),{level:t,onToggle:l,selected:i}=s,o;e[0]!==t||e[1]!==l?(o=n(()=>{l(t)},"t1"),e[0]=t,e[1]=l,e[2]=o):o=e[2];let d=o,f=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",x;e[3]!==f?(x=q("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=x):x=e[4];let u=`logs-level-${t}`,c;return e[5]!==t||e[6]!==d||e[7]!==i||e[8]!==x||e[9]!==u?(c=(0,r.jsxDEV)("button",{"aria-pressed":i,className:x,"data-testid":u,onClick:d,type:"button",children:t},void 0,!1),e[5]=t,e[6]=d,e[7]=i,e[8]=x,e[9]=u,e[10]=c):c=e[10],c},"LevelToggle"),Le=n(s=>{let e=(0,A.c)(7),{bucket:t}=s,l;e[0]!==t.key?(l=(0,r.jsxDEV)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key},void 0,!1),e[0]=t.key,e[1]=l):l=e[1];let i;e[2]!==t.count?(i=(0,r.jsxDEV)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count},void 0,!1),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==l||e[5]!==i?(o=(0,r.jsxDEV)("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:[l,i]},void 0,!0),e[4]=l,e[5]=i,e[6]=o):o=e[6],o},"SummaryBucketRow"),Pt=n(({initialShardKey:s})=>{let e=j(),[t,l]=(0,b.useState)("requests"),[i,o]=(0,b.useState)(s??""),[d,f]=(0,b.useState)(""),[x,u]=(0,b.useState)(()=>new Set),[c,y]=(0,b.useState)(""),[v,m]=(0,b.useState)("all"),[h,p]=(0,b.useState)(!1),[C,g]=(0,b.useState)(""),[w,N]=(0,b.useState)(""),[S,k]=(0,b.useState)(""),[I,R]=(0,b.useState)("all"),O=B(i.trim(),400),L=st({functionPathPrefix:C,outcome:I,tableTouched:S,userId:w}),T=Z(ee.getRequestLog,L,{enabled:t==="requests",live:!0,shardKey:O}),se=Z(ee.getLogs,{},{enabled:t==="errors",live:!0,shardKey:O}),G=t==="requests"?T:se,{error:ae,errorSource:ke,isLoading:le,liveError:Re}=G,Ee=Ne(se.data),ne=Ne(T.data);(0,b.useEffect)(()=>{G.data!==void 0&&fe(O)},[G.data,O]);let K=lt(Ee,{levels:x,now:Date.now(),path:c,range:v,search:d}),Q=it(K),z=t==="requests"?ne.length:K.length,H=t==="errors"&&h,F=(0,b.useMemo)(()=>ae!==null?"error":z===0?le?H?"summary":"list":"empty":H?"summary":"list",[z,le,ae,H]),ie=(0,b.useRef)(null),M=xe({count:z,estimateSize:n(()=>Ze,"estimateSize"),getScrollElement:n(()=>ie.current,"getScrollElement"),initialRect:{height:oe,width:800},observeElementRect:n((a,W)=>ye(a,W,oe),"observeElementRect"),overscan:8}),Pe=M.getVirtualItems(),_e={height:M.getTotalSize(),position:"relative",width:"100%"},Oe=n(a=>{f(a.target.value)},"onSearchChange"),qe=n(a=>{u(W=>{let U=new Set(W);return U.has(a)?U.delete(a):U.add(a),U})},"toggleLevel"),Ae=n(a=>{y(a.target.value)},"onLogPathChange"),Fe=n(a=>{m(a.target.value)},"onTimeRangeChange"),Me=n(()=>{p(a=>!a)},"toggleSummary"),Ue=n(a=>{g(a.target.value)},"onPathChange"),Ve=n(a=>{N(a.target.value)},"onUserChange"),$e=n(a=>{k(a.target.value)},"onTableChange"),Be=n(a=>{R(a.target.value)},"onOutcomeChange"),De=n(()=>{l("requests"),p(!1)},"showRequests"),Ge=n(()=>{l("errors"),p(!1)},"showErrors"),Ke=n(()=>{l("archive"),p(!1)},"showArchive");return(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,r.jsxDEV)("button",{"aria-selected":t==="requests",className:q("px-3 py-1 text-sm",t==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:De,role:"tab",type:"button",children:e("Requests")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="errors",className:q("px-3 py-1 text-sm",t==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:Ge,role:"tab",type:"button",children:e("Errors")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="archive",className:q("px-3 py-1 text-sm",t==="archive"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-archive",onClick:Ke,role:"tab",type:"button",children:e("Archive")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(me,{onChange:o,testId:"lg-shard-input",value:i},void 0,!1),t!=="archive"&&(0,r.jsxDEV)(be,{message:Re,prefix:"lg"},void 0,!1),(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:re,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")},void 0,!1)]},void 0,!0),t==="errors"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:Oe,placeholder:e("search message"),value:d},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Ae,placeholder:e("filter path"),value:c},void 0,!1),(0,r.jsxDEV)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:Ie.map(a=>(0,r.jsxDEV)(dt,{level:a,onToggle:qe,selected:x.has(a)},a,!1))},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Time range"),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:Fe,value:v,children:[(0,r.jsxDEV)("option",{value:"all",children:e("All time")},void 0,!1),(0,r.jsxDEV)("option",{value:"5m",children:e("Last 5m")},void 0,!1),(0,r.jsxDEV)("option",{value:"15m",children:e("Last 15m")},void 0,!1),(0,r.jsxDEV)("option",{value:"1h",children:e("Last hour")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("button",{"aria-pressed":h,className:q("h-8 rounded-md border px-3 text-sm",h?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:Me,type:"button",children:e(h?"List":"Summary")},void 0,!1)]},void 0,!0),t==="requests"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Ue,placeholder:e("file:function"),value:C},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:Ve,placeholder:e("userId"),value:w},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:$e,placeholder:e("table"),value:S},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Outcome filter"),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:Be,value:I,children:[(0,r.jsxDEV)("option",{value:"all",children:e("all")},void 0,!1),(0,r.jsxDEV)("option",{value:"ok",children:e("ok")},void 0,!1),(0,r.jsxDEV)("option",{value:"error",children:e("error")},void 0,!1)]},void 0,!0)]},void 0,!0),t==="archive"?(0,r.jsxDEV)(Xe,{shardKey:O},void 0,!1):(0,r.jsxDEV)(r.Fragment,{children:[F==="error"&&(0,r.jsxDEV)(he,{error:ke,testId:"lg-error"},void 0,!1),F==="empty"&&(0,r.jsxDEV)($,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M4 5h16M4 12h16M4 19h10"},void 0,!1)},void 0,!1),testId:"lg-empty",title:e("No logs.")},void 0,!1),F==="summary"&&(0,r.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,r.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:Q.total})},void 0,!1),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:Q.byLevel.map(a=>(0,r.jsxDEV)(Le,{bucket:a},a.key,!1))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:Q.byPath.map(a=>(0,r.jsxDEV)(Le,{bucket:a},a.key,!1))},void 0,!1)]},void 0,!0)]},void 0,!0),F==="list"&&(0,r.jsxDEV)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:ie,style:et,children:(0,r.jsxDEV)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:_e,children:Pe.map(a=>t==="requests"?(0,r.jsxDEV)(ot,{entry:ne[a.index],index:a.index,measureRef:M.measureElement,start:a.start},a.key,!1):(0,r.jsxDEV)(rt,{entry:K[a.index],index:a.index,measureRef:M.measureElement,start:a.start},a.key,!1))},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"LogsPanel");export{Pt as LogsPanel,lt as filterLogs,it as summarizeLogs};
|
|
1
|
+
import{a as D}from"./chunk-N7SVJOHN.js";import{a as be}from"./chunk-WMDH2CIZ.js";import{a as ye}from"./chunk-QVIPA6UJ.js";import{a as re}from"./chunk-IYHPYY4A.js";import{b as xe}from"./chunk-VXM5H542.js";import{a as B}from"./chunk-2K47A3P6.js";import{a as he}from"./chunk-F7GE4X2U.js";import"./chunk-XNJNSCLM.js";import{b as Z}from"./chunk-RD5UG2YL.js";import{a as ge,b as ve,c as pe,d as te,e as P,f as _}from"./chunk-GTM65MVX.js";import{a as me}from"./chunk-F2YMCQ6B.js";import{b as fe}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as E}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as ce}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as V}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as ee}from"./chunk-TEWVD66F.js";import{f as de}from"./chunk-3LJEGSMK.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as $}from"./chunk-TAD43CG5.js";import{d as j,h as J,i as ue,m as X}from"./chunk-HBGS4SEX.js";import"./chunk-LXULVPEM.js";import{a as n,e as Y,f as Qe,g as ze,h as He,j as q}from"./chunk-RRCPZMC2.js";var A=Y(ze(),1);var b=Y(Qe(),1);var r=Y(He(),1);var Ce=["trace","debug","log","info","warn","error","fatal"],We="LOG_ARCHIVE_NOT_CONFIGURED",Se={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},Ye={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},je=n((s,e)=>{switch(e.type){case"append":return{...s,cursor:e.cursor,error:null,loading:!1,rows:[...s.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{...s,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...s,error:e.message,loading:!1};default:return s}},"archiveReducer"),Je=n(s=>{let e=(0,A.c)(33),{row:t}=s,l;e[0]!==t.fields?(l=D(t.fields),e[0]=t.fields,e[1]=l):l=e[1];let i=l,o=`lg-archive-row-${String(t.ts)}`,d;e[2]!==t.ts?(d=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=d):d=e[3];let f;e[4]!==d?(f=(0,r.jsxDEV)(_,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:d},void 0,!1),e[4]=d,e[5]=f):f=e[5];let x=Se[t.level],u;e[6]!==t.level||e[7]!==x?(u=(0,r.jsxDEV)(_,{children:(0,r.jsxDEV)(V,{variant:x,children:t.level},void 0,!1)},void 0,!1),e[6]=t.level,e[7]=x,e[8]=u):u=e[8];let c;e[9]!==t.functionPath?(c=(0,r.jsxDEV)(_,{className:"font-mono text-xs",children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=c):c=e[10];let y;e[11]!==t.message?(y=(0,r.jsxDEV)("div",{className:"truncate",title:t.message,children:t.message},void 0,!1),e[11]=t.message,e[12]=y):y=e[12];let v;e[13]!==i?(v=i!==""&&(0,r.jsxDEV)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i},void 0,!1),e[13]=i,e[14]=v):v=e[14];let m;e[15]!==y||e[16]!==v?(m=(0,r.jsxDEV)(_,{className:"max-w-md",children:[y,v]},void 0,!0),e[15]=y,e[16]=v,e[17]=m):m=e[17];let h=t.traceId??"\u2014",p;e[18]!==h?(p=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:h},void 0,!1),e[18]=h,e[19]=p):p=e[19];let C=t.shardKey??"\u2014",g;e[20]!==C?(g=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:C},void 0,!1),e[20]=C,e[21]=g):g=e[21];let w=t.userId??"\u2014",N;e[22]!==w?(N=(0,r.jsxDEV)(_,{className:"font-mono text-[11px] text-muted-foreground",children:w},void 0,!1),e[22]=w,e[23]=N):N=e[23];let S;return e[24]!==m||e[25]!==p||e[26]!==g||e[27]!==N||e[28]!==o||e[29]!==f||e[30]!==u||e[31]!==c?(S=(0,r.jsxDEV)(te,{"data-testid":o,children:[f,u,c,m,p,g,N]},void 0,!0),e[24]=m,e[25]=p,e[26]=g,e[27]=N,e[28]=o,e[29]=f,e[30]=u,e[31]=c,e[32]=S):S=e[32],S},"ArchiveRow"),Xe=n(({shardKey:s})=>{let e=de(),t=j(),[l,i]=(0,b.useState)(""),[o,d]=(0,b.useState)(""),[f,x]=(0,b.useState)(""),[{cursor:u,error:c,loading:y,notConfigured:v,rows:m},h]=(0,b.useReducer)(je,Ye),p=B(l.trim(),400),C=B(o.trim(),400),g={...p===""?{}:{functionPathPrefix:p},...f===""?{}:{minLevel:f},...s===""?{}:{shardKey:s},...C===""?{}:{userId:C}},w=JSON.stringify(g),N=(0,b.useRef)(w);(0,b.useEffect)(()=>{let L={cancelled:!1};return N.current=w,X((async()=>{h({type:"loading"});try{let T=await e.queryLogArchive(g);L.cancelled||h({cursor:T.nextCursor,rows:T.rows,type:"loaded"})}catch(T){L.cancelled||h(ue(T)===We?{type:"notConfigured"}:{message:J(T),type:"failed"})}})()),()=>{L.cancelled=!0}},[e,w]);let S=n(async()=>{if(u===void 0)return;let L=w;h({type:"loading"});try{let T=await e.queryLogArchive({...g,cursor:u});N.current===L&&h({cursor:T.nextCursor,rows:T.rows,type:"append"})}catch(T){N.current===L&&h({message:J(T),type:"pageFailed"})}},"loadMore"),k=n(L=>{i(L.target.value)},"onPathPrefixChange"),I=n(L=>{d(L.target.value)},"onUserIdChange"),R=n(L=>{x(L.target.value)},"onMinLevelChange"),O=n(()=>{X(S())},"onLoadMore");return v?(0,r.jsxDEV)($,{action:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:re,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1),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")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:k,placeholder:t("function path\u2026"),value:l},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:I,placeholder:t("user id\u2026"),value:o},void 0,!1),(0,r.jsxDEV)("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:R,value:f,children:[(0,r.jsxDEV)("option",{value:"",children:t("min level")},void 0,!1),Ce.map(L=>(0,r.jsxDEV)("option",{value:L,children:L},L,!1))]},void 0,!0)]},void 0,!0),c!==null&&(0,r.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:c},void 0,!1),y&&m===null&&c===null&&(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")},void 0,!1),m!==null&&m.length===0&&(0,r.jsxDEV)($,{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.")},void 0,!1),m!==null&&m.length>0&&(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxDEV)(ge,{"data-testid":"lg-archive-table",children:[(0,r.jsxDEV)(ve,{children:(0,r.jsxDEV)(te,{children:[(0,r.jsxDEV)(P,{children:t("Time")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Level")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Function")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Message")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Trace")},void 0,!1),(0,r.jsxDEV)(P,{children:t("Shard")},void 0,!1),(0,r.jsxDEV)(P,{children:t("User")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(pe,{children:m.map((L,T)=>(0,r.jsxDEV)(Je,{row:L},`${String(L.ts)}-${String(T)}`,!1))},void 0,!1)]},void 0,!0)},void 0,!1),u!==void 0&&(0,r.jsxDEV)("div",{children:(0,r.jsxDEV)(ce,{"data-testid":"lg-archive-more",disabled:y,onClick:O,size:"sm",variant:"outline",children:t(y?"Loading\u2026":"Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"ArchiveFeed"),oe=400,Ze=36,et={height:oe,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},tt={error:"destructive",ok:"secondary"},rt=n(s=>{let e=(0,A.c)(26),{entry:t,index:l,measureRef:i,start:o}=s,d=`translateY(${String(o)}px)`,f;e[0]!==d?(f={...Te,transform:d},e[0]=d,e[1]=f):f=e[1];let x=f,u;e[2]!==t.fields?(u=D(t.fields),e[2]=t.fields,e[3]=u):u=e[3];let c=u,y;e[4]!==t.timestamp?(y=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=y):y=e[5];let v;e[6]!==y?(v=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y},void 0,!1),e[6]=y,e[7]=v):v=e[7];let m=Se[t.level],h;e[8]!==t.level||e[9]!==m?(h=(0,r.jsxDEV)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(V,{variant:m,children:t.level},void 0,!1)},void 0,!1),e[8]=t.level,e[9]=m,e[10]=h):h=e[10];let p=t.functionPath??"\u2014",C;e[11]!==p?(C=(0,r.jsxDEV)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p},void 0,!1),e[11]=p,e[12]=C):C=e[12];let g;e[13]!==c?(g=c===""?null:(0,r.jsxDEV)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c},void 0,!1),e[13]=c,e[14]=g):g=e[14];let w;e[15]!==t.message||e[16]!==g?(w=(0,r.jsxDEV)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]},void 0,!0),e[15]=t.message,e[16]=g,e[17]=w):w=e[17];let N;return e[18]!==l||e[19]!==i||e[20]!==x||e[21]!==w||e[22]!==v||e[23]!==h||e[24]!==C?(N=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-row",ref:i,role:"row",style:x,children:[v,h,C,w]},void 0,!0),e[18]=l,e[19]=i,e[20]=x,e[21]=w,e[22]=v,e[23]=h,e[24]=C,e[25]=N):N=e[25],N},"LogRow"),we=n(s=>s.length===0?"\u2014":s.join(", "),"tablesLabel"),ot=n(s=>{let e=(0,A.c)(37),{entry:t,index:l,measureRef:i,start:o}=s,d=`translateY(${String(o)}px)`,f;e[0]!==d?(f={...Te,transform:d},e[0]=d,e[1]=f):f=e[1];let x=f,u;e[2]!==t.ts?(u=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,r.jsxDEV)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u},void 0,!1),e[4]=u,e[5]=c):c=e[5];let y=tt[t.outcome],v;e[6]!==t.outcome||e[7]!==y?(v=(0,r.jsxDEV)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(V,{variant:y,children:t.outcome},void 0,!1)},void 0,!1),e[6]=t.outcome,e[7]=y,e[8]=v):v=e[8];let m;e[9]!==t.functionPath?(m=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=m):m=e[10];let h=t.shardKey??"\u2014",p;e[11]!==h?(p=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h},void 0,!1),e[11]=h,e[12]=p):p=e[12];let C=t.userId??"\u2014",g;e[13]!==C?(g=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C},void 0,!1),e[13]=C,e[14]=g):g=e[14];let w;e[15]!==t.durationMs?(w=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=w):w=e[16];let N=`${String(w)}ms`,S;e[17]!==N?(S=(0,r.jsxDEV)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:N},void 0,!1),e[17]=N,e[18]=S):S=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:${we(t.tablesRead)} \xB7 w:${we(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 I;e[24]!==k?(I=(0,r.jsxDEV)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k},void 0,!1),e[24]=k,e[25]=I):I=e[25];let R;return e[26]!==l||e[27]!==i||e[28]!==x||e[29]!==g||e[30]!==S||e[31]!==I||e[32]!==c||e[33]!==v||e[34]!==m||e[35]!==p?(R=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-req-row",ref:i,role:"row",style:x,children:[c,v,m,p,g,S,I]},void 0,!0),e[26]=l,e[27]=i,e[28]=x,e[29]=g,e[30]=S,e[31]=I,e[32]=c,e[33]=v,e[34]=m,e[35]=p,e[36]=R):R=e[36],R},"RequestRow"),Ne=n(s=>{let{entries:e}=s??{};return Array.isArray(e)?e:[]},"entriesOf"),st=n(s=>{let e={};return s.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=s.functionPathPrefix.trim()),s.userId.trim()!==""&&(e.userId=s.userId.trim()),s.tableTouched.trim()!==""&&(e.tableTouched=s.tableTouched.trim()),(s.outcome==="ok"||s.outcome==="error")&&(e.outcome=s.outcome),e},"buildRequestQuery"),Ie=Ce,at={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},lt=n((s,e)=>{let t=e.search.trim().toLowerCase(),l=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-at[e.range];return s.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||l!==""&&!(o.functionPath??"").toLowerCase().includes(l)?!1:t===""||o.message.toLowerCase().includes(t)||D(o.fields).toLowerCase().includes(t))},"filterLogs"),nt="\u2014",it=n(s=>{let e=new Map,t=new Map;for(let o of s){e.set(o.level,(e.get(o.level)??0)+1);let d=o.functionPath??nt;t.set(d,(t.get(d)??0)+1)}let l=Ie.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,d])=>({count:d,key:o})).toSorted((o,d)=>d.count===o.count?o.key.localeCompare(d.key):d.count-o.count);return{byLevel:l,byPath:i,total:s.length}},"summarizeLogs"),dt=n(s=>{let e=(0,A.c)(11),{level:t,onToggle:l,selected:i}=s,o;e[0]!==t||e[1]!==l?(o=n(()=>{l(t)},"t1"),e[0]=t,e[1]=l,e[2]=o):o=e[2];let d=o,f=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",x;e[3]!==f?(x=q("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=x):x=e[4];let u=`logs-level-${t}`,c;return e[5]!==t||e[6]!==d||e[7]!==i||e[8]!==x||e[9]!==u?(c=(0,r.jsxDEV)("button",{"aria-pressed":i,className:x,"data-testid":u,onClick:d,type:"button",children:t},void 0,!1),e[5]=t,e[6]=d,e[7]=i,e[8]=x,e[9]=u,e[10]=c):c=e[10],c},"LevelToggle"),Le=n(s=>{let e=(0,A.c)(7),{bucket:t}=s,l;e[0]!==t.key?(l=(0,r.jsxDEV)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key},void 0,!1),e[0]=t.key,e[1]=l):l=e[1];let i;e[2]!==t.count?(i=(0,r.jsxDEV)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count},void 0,!1),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==l||e[5]!==i?(o=(0,r.jsxDEV)("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:[l,i]},void 0,!0),e[4]=l,e[5]=i,e[6]=o):o=e[6],o},"SummaryBucketRow"),Pt=n(({initialShardKey:s})=>{let e=j(),[t,l]=(0,b.useState)("requests"),[i,o]=(0,b.useState)(s??""),[d,f]=(0,b.useState)(""),[x,u]=(0,b.useState)(()=>new Set),[c,y]=(0,b.useState)(""),[v,m]=(0,b.useState)("all"),[h,p]=(0,b.useState)(!1),[C,g]=(0,b.useState)(""),[w,N]=(0,b.useState)(""),[S,k]=(0,b.useState)(""),[I,R]=(0,b.useState)("all"),O=B(i.trim(),400),L=st({functionPathPrefix:C,outcome:I,tableTouched:S,userId:w}),T=Z(ee.getRequestLog,L,{enabled:t==="requests",live:!0,shardKey:O}),se=Z(ee.getLogs,{},{enabled:t==="errors",live:!0,shardKey:O}),G=t==="requests"?T:se,{error:ae,errorSource:ke,isLoading:le,liveError:Re}=G,Ee=Ne(se.data),ne=Ne(T.data);(0,b.useEffect)(()=>{G.data!==void 0&&fe(O)},[G.data,O]);let K=lt(Ee,{levels:x,now:Date.now(),path:c,range:v,search:d}),Q=it(K),z=t==="requests"?ne.length:K.length,H=t==="errors"&&h,F=(0,b.useMemo)(()=>ae!==null?"error":z===0?le?H?"summary":"list":"empty":H?"summary":"list",[z,le,ae,H]),ie=(0,b.useRef)(null),M=xe({count:z,estimateSize:n(()=>Ze,"estimateSize"),getScrollElement:n(()=>ie.current,"getScrollElement"),initialRect:{height:oe,width:800},observeElementRect:n((a,W)=>ye(a,W,oe),"observeElementRect"),overscan:8}),Pe=M.getVirtualItems(),_e={height:M.getTotalSize(),position:"relative",width:"100%"},Oe=n(a=>{f(a.target.value)},"onSearchChange"),qe=n(a=>{u(W=>{let U=new Set(W);return U.has(a)?U.delete(a):U.add(a),U})},"toggleLevel"),Ae=n(a=>{y(a.target.value)},"onLogPathChange"),Fe=n(a=>{m(a.target.value)},"onTimeRangeChange"),Me=n(()=>{p(a=>!a)},"toggleSummary"),Ue=n(a=>{g(a.target.value)},"onPathChange"),Ve=n(a=>{N(a.target.value)},"onUserChange"),$e=n(a=>{k(a.target.value)},"onTableChange"),Be=n(a=>{R(a.target.value)},"onOutcomeChange"),De=n(()=>{l("requests"),p(!1)},"showRequests"),Ge=n(()=>{l("errors"),p(!1)},"showErrors"),Ke=n(()=>{l("archive"),p(!1)},"showArchive");return(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,r.jsxDEV)("button",{"aria-selected":t==="requests",className:q("px-3 py-1 text-sm",t==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:De,role:"tab",type:"button",children:e("Requests")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="errors",className:q("px-3 py-1 text-sm",t==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:Ge,role:"tab",type:"button",children:e("Errors")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="archive",className:q("px-3 py-1 text-sm",t==="archive"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-archive",onClick:Ke,role:"tab",type:"button",children:e("Archive")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(me,{onChange:o,testId:"lg-shard-input",value:i},void 0,!1),t!=="archive"&&(0,r.jsxDEV)(be,{message:Re,prefix:"lg"},void 0,!1),(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:re,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")},void 0,!1)]},void 0,!0),t==="errors"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:Oe,placeholder:e("search message"),value:d},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Ae,placeholder:e("filter path"),value:c},void 0,!1),(0,r.jsxDEV)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:Ie.map(a=>(0,r.jsxDEV)(dt,{level:a,onToggle:qe,selected:x.has(a)},a,!1))},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Time range"),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:Fe,value:v,children:[(0,r.jsxDEV)("option",{value:"all",children:e("All time")},void 0,!1),(0,r.jsxDEV)("option",{value:"5m",children:e("Last 5m")},void 0,!1),(0,r.jsxDEV)("option",{value:"15m",children:e("Last 15m")},void 0,!1),(0,r.jsxDEV)("option",{value:"1h",children:e("Last hour")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("button",{"aria-pressed":h,className:q("h-8 rounded-md border px-3 text-sm",h?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:Me,type:"button",children:e(h?"List":"Summary")},void 0,!1)]},void 0,!0),t==="requests"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Ue,placeholder:e("file:function"),value:C},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:Ve,placeholder:e("userId"),value:w},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:$e,placeholder:e("table"),value:S},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Outcome filter"),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:Be,value:I,children:[(0,r.jsxDEV)("option",{value:"all",children:e("all")},void 0,!1),(0,r.jsxDEV)("option",{value:"ok",children:e("ok")},void 0,!1),(0,r.jsxDEV)("option",{value:"error",children:e("error")},void 0,!1)]},void 0,!0)]},void 0,!0),t==="archive"?(0,r.jsxDEV)(Xe,{shardKey:O},void 0,!1):(0,r.jsxDEV)(r.Fragment,{children:[F==="error"&&(0,r.jsxDEV)(he,{error:ke,testId:"lg-error"},void 0,!1),F==="empty"&&(0,r.jsxDEV)($,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M4 5h16M4 12h16M4 19h10"},void 0,!1)},void 0,!1),testId:"lg-empty",title:e("No logs.")},void 0,!1),F==="summary"&&(0,r.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,r.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:Q.total})},void 0,!1),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:Q.byLevel.map(a=>(0,r.jsxDEV)(Le,{bucket:a},a.key,!1))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:Q.byPath.map(a=>(0,r.jsxDEV)(Le,{bucket:a},a.key,!1))},void 0,!1)]},void 0,!0)]},void 0,!0),F==="list"&&(0,r.jsxDEV)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:ie,style:et,children:(0,r.jsxDEV)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:_e,children:Pe.map(a=>t==="requests"?(0,r.jsxDEV)(ot,{entry:ne[a.index],index:a.index,measureRef:M.measureElement,start:a.start},a.key,!1):(0,r.jsxDEV)(rt,{entry:K[a.index],index:a.index,measureRef:M.measureElement,start:a.start},a.key,!1))},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"LogsPanel");export{Pt as LogsPanel,lt as filterLogs,it as summarizeLogs};
|