@lunora/studio 1.0.0-alpha.345 → 1.0.0-alpha.347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/{chunk-DNIDQC3K.js → chunk-2PMCHTCC.js} +1 -1
- package/dist/standalone/{chunk-YNJEO3WB.js → chunk-34OJ2OXP.js} +1 -1
- package/dist/standalone/{chunk-3F3742NV.js → chunk-3FWAGIOT.js} +1 -1
- package/dist/standalone/chunk-3I25WO3P.js +15 -0
- package/dist/standalone/{chunk-5QTTNVDW.js → chunk-4GHCKQLY.js} +1 -1
- package/dist/standalone/{chunk-SQ4ZU5YB.js → chunk-4HYPC5NN.js} +1 -1
- package/dist/standalone/{chunk-EYTZURBK.js → chunk-4TYCTORB.js} +1 -1
- package/dist/standalone/{chunk-4RLRI34N.js → chunk-5TQHZVNN.js} +1 -1
- package/dist/standalone/{chunk-AD7FLIUQ.js → chunk-5YLFS5NU.js} +1 -1
- package/dist/standalone/{chunk-TFLKMZK5.js → chunk-6BELLPMP.js} +1 -1
- package/dist/standalone/{chunk-EJSTZM7A.js → chunk-6FZLAL4W.js} +1 -1
- package/dist/standalone/{chunk-GXRBCKNP.js → chunk-6I2QO7SE.js} +1 -1
- package/dist/standalone/{chunk-CUIPEXIW.js → chunk-6TJHYXQW.js} +1 -1
- package/dist/standalone/{chunk-SRNH27XV.js → chunk-6XPDVZVB.js} +1 -1
- package/dist/standalone/{chunk-A4WUN5R3.js → chunk-ATVMUIBN.js} +1 -1
- package/dist/standalone/{chunk-RGDSRUIX.js → chunk-AVSMQPR3.js} +3 -3
- package/dist/standalone/{chunk-JAPCIIQC.js → chunk-B57UZJ6W.js} +1 -1
- package/dist/standalone/{chunk-DD7J6RMR.js → chunk-BOMFGCKX.js} +1 -1
- package/dist/standalone/{chunk-EUTV2OGD.js → chunk-C7SAXSO3.js} +1 -1
- package/dist/standalone/{chunk-WXMYNIXK.js → chunk-CCTWURT3.js} +1 -1
- package/dist/standalone/{chunk-PBQ5ZONR.js → chunk-DJ3BKVAZ.js} +1 -1
- package/dist/standalone/{chunk-5X7LJ6UT.js → chunk-E4Y6TF6C.js} +1 -1
- package/dist/standalone/{chunk-ZUB5DMJT.js → chunk-EFGDGZHN.js} +1 -1
- package/dist/standalone/{chunk-66MXYZBW.js → chunk-EGYPW6UY.js} +1 -1
- package/dist/standalone/{chunk-3BF2QRJM.js → chunk-EPI4SHLN.js} +1 -1
- package/dist/standalone/{chunk-FMSWGAHK.js → chunk-FTN4XJOQ.js} +1 -1
- package/dist/standalone/{chunk-YYEQLN53.js → chunk-GDP3S4GQ.js} +1 -1
- package/dist/standalone/{chunk-3XYWAO26.js → chunk-H6FW2TMO.js} +1 -1
- package/dist/standalone/{chunk-N36IWCKG.js → chunk-IIU4TZRG.js} +1 -1
- package/dist/standalone/{chunk-QMJTL4SW.js → chunk-IQ3SMVFW.js} +1 -1
- package/dist/standalone/{chunk-G5P5DUVD.js → chunk-JD6SCY7V.js} +1 -1
- package/dist/standalone/{chunk-NJ3YQOVN.js → chunk-JGUKFZ3R.js} +1 -1
- package/dist/standalone/{chunk-S7XJPD6Z.js → chunk-JLQPIE3Z.js} +2 -2
- package/dist/standalone/{chunk-KLQVRXER.js → chunk-KEHDC5BQ.js} +1 -1
- package/dist/standalone/{chunk-D6CNULEI.js → chunk-KNUGID7F.js} +1 -1
- package/dist/standalone/{chunk-L7OWZOME.js → chunk-L4BDA4VZ.js} +1 -1
- package/dist/standalone/{chunk-IDX6KQRG.js → chunk-LI2GRPOB.js} +1 -1
- package/dist/standalone/{chunk-RGCYH5VO.js → chunk-M7HCYBJJ.js} +1 -1
- package/dist/standalone/{chunk-GTEER76O.js → chunk-MFZF7GEM.js} +1 -1
- package/dist/standalone/{chunk-ATVJ7XYZ.js → chunk-MT4E42PB.js} +1 -1
- package/dist/standalone/{chunk-5DKOUMFY.js → chunk-N45O7D5G.js} +1 -1
- package/dist/standalone/{chunk-XUS6E3C7.js → chunk-NARRSYMQ.js} +1 -1
- package/dist/standalone/{chunk-NQZMPZNU.js → chunk-PQ6DUCKC.js} +1 -1
- package/dist/standalone/{chunk-WZ2CXW4B.js → chunk-PTIKIQY6.js} +1 -1
- package/dist/standalone/{chunk-Y5PZGFRZ.js → chunk-QDHFLZ3N.js} +1 -1
- package/dist/standalone/{chunk-DQAXICZV.js → chunk-R37RA67H.js} +1 -1
- package/dist/standalone/{chunk-E57JT34T.js → chunk-R457VG7L.js} +1 -1
- package/dist/standalone/{chunk-SMZHXNCR.js → chunk-R75AFV7G.js} +1 -1
- package/dist/standalone/{chunk-42DNLDTQ.js → chunk-RLVR5BRF.js} +1 -1
- package/dist/standalone/{chunk-HXC2I6YI.js → chunk-RTWSDGPV.js} +1 -1
- package/dist/standalone/{chunk-EITTEB6M.js → chunk-SJYQFABZ.js} +1 -1
- package/dist/standalone/{chunk-VVHORMP3.js → chunk-SQYX2Z5H.js} +1 -1
- package/dist/standalone/{chunk-DFVQBXUZ.js → chunk-T2JHVL34.js} +1 -1
- package/dist/standalone/{chunk-3BCMZMOX.js → chunk-TET2ESOI.js} +1 -1
- package/dist/standalone/{chunk-5CW7W7LQ.js → chunk-TNPF3XGI.js} +1 -1
- package/dist/standalone/{chunk-IC2NNXPZ.js → chunk-TVSU6RYZ.js} +1 -1
- package/dist/standalone/{chunk-YR5YXUZT.js → chunk-U7KUGVBB.js} +1 -1
- package/dist/standalone/{chunk-SMN2PVWA.js → chunk-V7IFSDTT.js} +1 -1
- package/dist/standalone/{chunk-SPLVBIFP.js → chunk-WQW4IPHB.js} +1 -1
- package/dist/standalone/{chunk-GWCMBJ2U.js → chunk-WW7D5RFR.js} +1 -1
- package/dist/standalone/{chunk-6ZRYMZEX.js → chunk-XCVO3IAH.js} +1 -1
- package/dist/standalone/{chunk-QNAKWBFW.js → chunk-XCWVO6DI.js} +1 -1
- package/dist/standalone/{chunk-NRJJBPJY.js → chunk-XEGAP64U.js} +1 -1
- package/dist/standalone/{chunk-UMPQDFU6.js → chunk-XJPJSZ4W.js} +1 -1
- package/dist/standalone/{chunk-SFMWHWJG.js → chunk-XR2JH2A7.js} +1 -1
- package/dist/standalone/{chunk-PAYY63FN.js → chunk-XWGORWQU.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/standalone/chunk-35Q6XYRL.js +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-FPI7AMQJ.js";import{a as se}from"./chunk-LXCVA5SP.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as A}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-DFVQBXUZ.js";import{l as Y}from"./chunk-RGDSRUIX.js";import"./chunk-QAQDMS6R.js";import"./chunk-35Q6XYRL.js";import{a as G}from"./chunk-RWVIV3U7.js";import{a as L,b as _,c as J,d as y,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as E,e as F}from"./chunk-2IKDEUCX.js";import{d as K,f as Z,g as ee,h as T,n as te,q as R}from"./chunk-74IYYDDI.js";import{a as s,d as X,e as ie,f as de,g as ce}from"./chunk-I26MS5PJ.js";var l=X(ie(),1);var le=X(de(),1);var e=X(ce(),1);var me=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],fe=s(o=>{let r=(0,le.c)(7),{busy:w,id:k,onAct:h}=o,x=K(),n;r[0]!==w||r[1]!==k||r[2]!==h||r[3]!==x?(n=ue.map(c=>c==="restart"?(0,e.jsx)(se,{confirmLabel:x("Restart?"),disabled:w,onConfirm:s(()=>{h(c)},"onConfirm"),testId:`workflow-instance-${c}-${k}`,children:x(c)},c):(0,e.jsx)(A,{"data-testid":`workflow-instance-${c}-${k}`,disabled:w,onClick:s(()=>{h(c)},"onClick"),size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=w,r[1]=k,r[2]=h,r[3]=x,r[4]=n):n=r[4];let p;return r[5]!==n?(p=(0,e.jsx)(e.Fragment,{children:n}),r[5]=n,r[6]=p):p=r[6],p},"me"),he="WORKFLOWS_NOT_CONFIGURED",pe=s(o=>typeof o=="object"&&o!==null&&o.code===he,"he"),we=s(o=>{let r=o.error??o.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},"pe"),xe=s(({loadDetail:o,loadInstances:r,readOnly:w,runAction:k,workflowName:h})=>{let x=Y(),n=K(),[p,c]=(0,l.useState)(null),[O,$]=(0,l.useState)(null),[S,j]=(0,l.useState)(""),[C,v]=(0,l.useState)(null),[z,W]=(0,l.useState)(!1),[U,B]=(0,l.useState)(null),N=(0,l.useRef)(0),g=(0,l.useRef)(0),b=(0,l.useRef)(0),P=o??(a=>x.getWorkflowInstance(a)),D=w?void 0:k??(r===void 0?a=>x.setWorkflowInstanceStatus(a):void 0),q=s(async()=>{g.current+=1;let a=g.current;v(null),W(!1);let u=S===""?void 0:S;try{if(r===void 0){let m=await x.listWorkflowInstances({name:h,status:u});if(a!==g.current)return;if(m.configured===!1){c(null),W(!0);return}c(m.instances);return}let t=await r({name:h,status:u});a===g.current&&c(t)}catch(t){if(a!==g.current)return;c(null),pe(t)?W(!0):v(T(t))}},"L");(0,l.useEffect)(()=>{N.current+=1,b.current+=1,$(null),R(q())},[h,S]);let H=s(async a=>{b.current+=1;let u=b.current;v(null);try{let t=await P({id:a,name:h});u===b.current&&$(t)}catch(t){u===b.current&&v(T(t))}},"B"),Q=s(()=>{b.current+=1,$(null)},"J"),V=s(async(a,u)=>{if(D===void 0)return;let t=N.current;B(a),v(null);try{await D({action:u,id:a,name:h}),t===N.current&&await q()}catch(m){v(T(m))}B(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("select",{"aria-label":n("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(a=>{j(a.target.value)},"onChange"),value:S,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),me.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),C!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),z&&(0,e.jsx)(G,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!z&&p!==null&&p.length===0&&(0,e.jsx)(G,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(J,{children:p.map(a=>(0,e.jsxs)(y,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(A,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:s(()=>{R(H(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),D!==void 0&&(0,e.jsx)(fe,{busy:U===a.id,id:a.id,onAct:s(u=>{R(V(a.id,u))},"onAct")},h)]})})]},a.id))})]})})}),O!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(F,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",O.id]}),(0,e.jsx)(A,{"data-testid":"workflow-instance-detail-close",onClick:Q,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),O.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(L,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(J,{children:O.steps.map((a,u)=>(0,e.jsxs)(y,{"data-testid":`workflow-step-${String(u)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(a)})]},`${a.name}:${String(u)}`))})]})]})})]})},"xe"),Ne=Z(M.createWorkflowInstance),ge=Z(M.getWorkflowInstanceStatus),ke=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,te)}catch{return"(unserializable)"}},"ge"),ve=s((o,r)=>o.some(w=>w.exportName===r)?r:o[0]?.exportName??"","be"),Ee=s(()=>{let o=Y(),r=K(),{data:w,error:k}=ne(M.listWorkflows,{}),[h,x]=(0,l.useState)(""),[n,p]=(0,l.useState)(""),[c,O]=(0,l.useState)(""),[$,S]=(0,l.useState)(!1),[j,C]=(0,l.useState)(null),[v,z]=(0,l.useState)([]),[W,U]=(0,l.useState)(null),B=w!==void 0,N=Array.isArray(w?.workflows)?[...w.workflows].toSorted((t,m)=>t.exportName.localeCompare(m.exportName)):[],g=ve(N,h),b=N.find(t=>t.exportName===g),P=s(t=>{z(m=>{let f=m.filter(I=>!(I.exportName===t.exportName&&I.id===t.id));return[t,...f]})},"D"),D=s(async()=>{let t=g;if(t==="")return;let m,f=c.trim();if(f!=="")try{m=JSON.parse(f)}catch{C(r("Params must be valid JSON"));return}S(!0),C(null);try{let I=n.trim(),re=await o.query(Ne,{exportName:t,id:I===""?void 0:I,params:m},ee(""));P({exportName:t,id:re.id,status:re.status}),p("")}catch(I){C(T(I))}S(!1)},"V"),q=s(()=>{R(D())},"X"),H=s(async(t,m)=>{U(m);try{let f=await o.query(ge,{exportName:t,id:m},ee(""));P({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){C(T(f))}U(null)},"T"),Q=s(t=>{x(t.target.value)},"L"),V=s(t=>{p(t.target.value)},"B"),a=s(t=>{O(t.target.value)},"J"),u=s(t=>{let{export:m,id:f}=t.currentTarget.dataset;m!==void 0&&f!==void 0&&R(H(m,f))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:k}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),B&&N.length===0?(0,e.jsx)(G,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflows-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Export")}),(0,e.jsx)(i,{children:r("Name")}),(0,e.jsx)(i,{children:r("Class")})]})}),(0,e.jsx)(J,{children:N.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),N.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:Q,value:g,children:N.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:V,placeholder:r("Instance id (optional)"),value:n}),(0,e.jsx)(A,{"data-testid":"workflows-start-button",disabled:$||g==="",onClick:q,children:r($?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(oe,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:a,placeholder:r("Params (JSON, optional)"),value:c})]}),v.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Workflow")}),(0,e.jsx)(i,{children:r("Instance id")}),(0,e.jsx)(i,{children:r("Status")}),(0,e.jsx)(i,{children:r("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(J,{children:v.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:ke(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(A,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:W===t.id,onClick:u,size:"xs",variant:"outline",children:W===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),b!==void 0&&(0,e.jsx)(xe,{workflowName:b.name})]})},"De");export{Ee as default};
|
|
1
|
+
import{a as oe}from"./chunk-FPI7AMQJ.js";import{a as se}from"./chunk-LXCVA5SP.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as A}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-T2JHVL34.js";import{l as Y}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as G}from"./chunk-RWVIV3U7.js";import{a as L,b as _,c as J,d as y,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as E,e as F}from"./chunk-2IKDEUCX.js";import{d as K,f as Z,g as ee,h as T,n as te,q as R}from"./chunk-74IYYDDI.js";import{a as s,d as X,e as ie,f as de,g as ce}from"./chunk-I26MS5PJ.js";var l=X(ie(),1);var le=X(de(),1);var e=X(ce(),1);var me=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],fe=s(o=>{let r=(0,le.c)(7),{busy:w,id:k,onAct:h}=o,x=K(),n;r[0]!==w||r[1]!==k||r[2]!==h||r[3]!==x?(n=ue.map(c=>c==="restart"?(0,e.jsx)(se,{confirmLabel:x("Restart?"),disabled:w,onConfirm:s(()=>{h(c)},"onConfirm"),testId:`workflow-instance-${c}-${k}`,children:x(c)},c):(0,e.jsx)(A,{"data-testid":`workflow-instance-${c}-${k}`,disabled:w,onClick:s(()=>{h(c)},"onClick"),size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=w,r[1]=k,r[2]=h,r[3]=x,r[4]=n):n=r[4];let p;return r[5]!==n?(p=(0,e.jsx)(e.Fragment,{children:n}),r[5]=n,r[6]=p):p=r[6],p},"me"),he="WORKFLOWS_NOT_CONFIGURED",pe=s(o=>typeof o=="object"&&o!==null&&o.code===he,"he"),we=s(o=>{let r=o.error??o.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},"pe"),xe=s(({loadDetail:o,loadInstances:r,readOnly:w,runAction:k,workflowName:h})=>{let x=Y(),n=K(),[p,c]=(0,l.useState)(null),[O,$]=(0,l.useState)(null),[S,j]=(0,l.useState)(""),[C,v]=(0,l.useState)(null),[z,W]=(0,l.useState)(!1),[U,B]=(0,l.useState)(null),N=(0,l.useRef)(0),g=(0,l.useRef)(0),b=(0,l.useRef)(0),P=o??(a=>x.getWorkflowInstance(a)),D=w?void 0:k??(r===void 0?a=>x.setWorkflowInstanceStatus(a):void 0),q=s(async()=>{g.current+=1;let a=g.current;v(null),W(!1);let u=S===""?void 0:S;try{if(r===void 0){let m=await x.listWorkflowInstances({name:h,status:u});if(a!==g.current)return;if(m.configured===!1){c(null),W(!0);return}c(m.instances);return}let t=await r({name:h,status:u});a===g.current&&c(t)}catch(t){if(a!==g.current)return;c(null),pe(t)?W(!0):v(T(t))}},"L");(0,l.useEffect)(()=>{N.current+=1,b.current+=1,$(null),R(q())},[h,S]);let H=s(async a=>{b.current+=1;let u=b.current;v(null);try{let t=await P({id:a,name:h});u===b.current&&$(t)}catch(t){u===b.current&&v(T(t))}},"B"),Q=s(()=>{b.current+=1,$(null)},"J"),V=s(async(a,u)=>{if(D===void 0)return;let t=N.current;B(a),v(null);try{await D({action:u,id:a,name:h}),t===N.current&&await q()}catch(m){v(T(m))}B(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("select",{"aria-label":n("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(a=>{j(a.target.value)},"onChange"),value:S,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),me.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),C!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),z&&(0,e.jsx)(G,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!z&&p!==null&&p.length===0&&(0,e.jsx)(G,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(J,{children:p.map(a=>(0,e.jsxs)(y,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(A,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:s(()=>{R(H(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),D!==void 0&&(0,e.jsx)(fe,{busy:U===a.id,id:a.id,onAct:s(u=>{R(V(a.id,u))},"onAct")},h)]})})]},a.id))})]})})}),O!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(F,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",O.id]}),(0,e.jsx)(A,{"data-testid":"workflow-instance-detail-close",onClick:Q,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),O.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(L,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(J,{children:O.steps.map((a,u)=>(0,e.jsxs)(y,{"data-testid":`workflow-step-${String(u)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(a)})]},`${a.name}:${String(u)}`))})]})]})})]})},"xe"),Ne=Z(M.createWorkflowInstance),ge=Z(M.getWorkflowInstanceStatus),ke=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,te)}catch{return"(unserializable)"}},"ge"),ve=s((o,r)=>o.some(w=>w.exportName===r)?r:o[0]?.exportName??"","be"),Ee=s(()=>{let o=Y(),r=K(),{data:w,error:k}=ne(M.listWorkflows,{}),[h,x]=(0,l.useState)(""),[n,p]=(0,l.useState)(""),[c,O]=(0,l.useState)(""),[$,S]=(0,l.useState)(!1),[j,C]=(0,l.useState)(null),[v,z]=(0,l.useState)([]),[W,U]=(0,l.useState)(null),B=w!==void 0,N=Array.isArray(w?.workflows)?[...w.workflows].toSorted((t,m)=>t.exportName.localeCompare(m.exportName)):[],g=ve(N,h),b=N.find(t=>t.exportName===g),P=s(t=>{z(m=>{let f=m.filter(I=>!(I.exportName===t.exportName&&I.id===t.id));return[t,...f]})},"D"),D=s(async()=>{let t=g;if(t==="")return;let m,f=c.trim();if(f!=="")try{m=JSON.parse(f)}catch{C(r("Params must be valid JSON"));return}S(!0),C(null);try{let I=n.trim(),re=await o.query(Ne,{exportName:t,id:I===""?void 0:I,params:m},ee(""));P({exportName:t,id:re.id,status:re.status}),p("")}catch(I){C(T(I))}S(!1)},"V"),q=s(()=>{R(D())},"X"),H=s(async(t,m)=>{U(m);try{let f=await o.query(ge,{exportName:t,id:m},ee(""));P({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){C(T(f))}U(null)},"T"),Q=s(t=>{x(t.target.value)},"L"),V=s(t=>{p(t.target.value)},"B"),a=s(t=>{O(t.target.value)},"J"),u=s(t=>{let{export:m,id:f}=t.currentTarget.dataset;m!==void 0&&f!==void 0&&R(H(m,f))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:k}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),B&&N.length===0?(0,e.jsx)(G,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflows-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Export")}),(0,e.jsx)(i,{children:r("Name")}),(0,e.jsx)(i,{children:r("Class")})]})}),(0,e.jsx)(J,{children:N.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),N.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:Q,value:g,children:N.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:V,placeholder:r("Instance id (optional)"),value:n}),(0,e.jsx)(A,{"data-testid":"workflows-start-button",disabled:$||g==="",onClick:q,children:r($?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(oe,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:a,placeholder:r("Params (JSON, optional)"),value:c})]}),v.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Workflow")}),(0,e.jsx)(i,{children:r("Instance id")}),(0,e.jsx)(i,{children:r("Status")}),(0,e.jsx)(i,{children:r("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(J,{children:v.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:ke(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(A,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:W===t.id,onClick:u,size:"xs",variant:"outline",children:W===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),b!==void 0&&(0,e.jsx)(xe,{workflowName:b.name})]})},"De");export{Ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as k}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as q}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as j}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as U}from"./chunk-
|
|
1
|
+
import{i as k}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as q}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as j}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as U}from"./chunk-R75AFV7G.js";import"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-T2JHVL34.js";import"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as M}from"./chunk-RWVIV3U7.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HCTJKP5J.js";import{a as z,e as D}from"./chunk-2IKDEUCX.js";import{d as F,u as O}from"./chunk-74IYYDDI.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-I26MS5PJ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-SA2OGF3F.js";import{b as Z}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{i as se,l as X}from"./chunk-
|
|
1
|
+
import{a as ee}from"./chunk-SA2OGF3F.js";import{b as Z}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{i as se,l as X}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as O}from"./chunk-2IKDEUCX.js";import{d as le,u as ne}from"./chunk-74IYYDDI.js";import{a as k,d as ae,f as ce,g as me,i as Y}from"./chunk-I26MS5PJ.js";var te=ae(ce(),1);var a=ae(me(),1);var pe="/_lunora/health",he="/_lunora/health/ready",ue=k((r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,"me"),fe=k(()=>{let r=X();return async e=>{let w=e==="ready"?he:pe,t=r.getAuthToken(),y=ue(r.url,w);try{let i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),p=null;try{p=await i.json()}catch{p=null}return{body:p,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},"pe"),ge={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ye=k(r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok","fe"),ie=k(r=>{let e=(0,te.c)(13),{label:w,level:t,testId:y,value:i}=r,p=ge[t],d;e[0]!==p?(d=Y("size-1.5 shrink-0 rounded-full",p),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==d?(o=(0,a.jsx)("span",{"aria-hidden":"true",className:d}),e[2]=d,e[3]=o):o=e[3];let c;e[4]!==w||e[5]!==o?(c=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[o,w]}),e[4]=w,e[5]=o,e[6]=c):c=e[6];let h;e[7]!==y||e[8]!==i?(h=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=h):h=e[9];let C;return e[10]!==c||e[11]!==h?(C=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[c,h]})}),e[10]=c,e[11]=h,e[12]=C):C=e[12],C},"Z"),Pe=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=le(),y=X(),i=fe(),p=w??i,d;e[0]!==p?(d=k(async()=>{let[s,n]=await Promise.all([p("live"),p("ready")]);return{live:s,ready:n}},"o"),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==y?(o=y.clientIdentifier(),e[2]=y,e[3]=o):o=e[3];let c;e[4]!==o?(c=["deployment-health",o],e[4]=o,e[5]=c):c=e[5];let h;e[6]!==d||e[7]!==c?(h={queryFn:d,queryKey:c},e[6]=d,e[7]=c,e[8]=h):h=e[8];let{data:C,isPending:de}=se(h),Q=C?.live??null,oe=C?.ready??null;if(de){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(ee,{className:"h-16 w-full"}),(0,a.jsx)(ee,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}let l=Q?.body??null;if(l===null){let s=Q?.status===403,n;e[10]!==s||e[11]!==Q?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:Q?.error??t("no response")}),e[10]=s,e[11]=Q?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let f;return e[16]!==n||e[17]!==m?(f=(0,a.jsx)(re,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=f):f=e[18],f}let J;e[19]!==l.status?(J=ye(l.status),e[19]=l.status,e[20]=J):J=e[20];let W=J,u;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],u=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],u=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],u=s}let j=oe?.ok??!1,G=j?"ok":"crit",H,I,P,x,N,v,S,V,b,_;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==W||e[32]!==G||e[33]!==j||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);I="flex flex-col gap-6",P="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(x=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=x):x=e[49];let m;e[50]!==u?(m=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:u}),e[50]=u,e[51]=m):m=e[51];let f;e[52]!==l.appName||e[53]!==l.appVersion?(f=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," \xB7 ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=f):f=e[54];let D;e[55]!==m||e[56]!==f?(D=(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"grid leading-tight",children:[m,f]})}),e[55]=m,e[56]=f,e[57]=D):D=e[57];let L;e[58]!==t?(L=t("Checked"),e[58]=t,e[59]=L):L=e[59];let T;e[60]!==L?(T=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:L}),e[60]=L,e[61]=T):T=e[61];let $;e[62]!==l.timestamp?($=ne(l.timestamp),e[62]=l.timestamp,e[63]=$):$=e[63];let q;e[64]!==$?(q=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:$}),e[64]=$,e[65]=q):q=e[65];let B;e[66]!==T||e[67]!==q?(B=(0,a.jsxs)("div",{className:"text-end",children:[T,q]}),e[66]=T,e[67]=q,e[68]=B):B=e[68],e[69]!==D||e[70]!==B?(N=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[D,B]})}),e[69]=D,e[70]=B,e[71]=N):N=e[71];let E;e[72]!==t?(E=t("Liveness"),e[72]=t,e[73]=E):E=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==E?(R=(0,a.jsx)(ie,{label:E,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=E,e[77]=R):R=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let A;e[80]!==j||e[81]!==t?(A=t(j?"Ready":"Not ready"),e[80]=j,e[81]=t,e[82]=A):A=e[82];let F;e[83]!==G||e[84]!==U||e[85]!==A?(F=(0,a.jsx)(ie,{label:U,level:G,testId:"dh-readiness",value:A}),e[83]=G,e[84]=U,e[85]=A,e[86]=F):F=e[86],e[87]!==R||e[88]!==F?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[R,F]}),e[87]=R,e[88]=F,e[89]=v):v=e[89],H=O,S="gap-0 py-0",V="dh-checks";let K;e[90]!==t?(K=t("Subsystem checks"),e[90]=t,e[91]=K):K=e[91],e[92]!==K?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K})}),e[92]=K,e[93]=b):b=e[93],_=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(g=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${g.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Y("size-1.5 shrink-0 rounded-full",g.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:g.name}),g.critical&&(0,a.jsx)(Z,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[g.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:g.message}),(0,a.jsx)(Z,{"data-testid":`dh-check-status-${g.name}`,variant:g.status==="up"?"secondary":"destructive",children:g.status==="up"?t("Up"):t("Down")})]})]},g.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=W,e[32]=G,e[33]=j,e[34]=u,e[35]=t,e[36]=H,e[37]=I,e[38]=P,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=_}else H=e[36],I=e[37],P=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],_=e[45];let z;e[94]!==H||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==_?(z=(0,a.jsxs)(H,{className:S,"data-testid":V,children:[b,_]}),e[94]=H,e[95]=S,e[96]=V,e[97]=b,e[98]=_,e[99]=z):z=e[99];let M;return e[100]!==I||e[101]!==P||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:I,"data-testid":P,children:[x,N,v,z]}),e[100]=I,e[101]=P,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"Pe");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Pe as DeploymentHealthPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-WW7D5RFR.js";import{a as k}from"./chunk-K2EHRNYW.js";import"./chunk-VESGIGMQ.js";import"./chunk-TET2ESOI.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as A}from"./chunk-R6U22RSY.js";import{a as $}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as K}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as F}from"./chunk-R75AFV7G.js";import"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-T2JHVL34.js";import"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as O}from"./chunk-RWVIV3U7.js";import{a as j,e as w}from"./chunk-2IKDEUCX.js";import{d as I,u as E}from"./chunk-74IYYDDI.js";import{a as p,d as C,f as D,g as H}from"./chunk-I26MS5PJ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P}from"./chunk-
|
|
1
|
+
import{b as P}from"./chunk-XCWVO6DI.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-TET2ESOI.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HCTJKP5J.js";import{d as C,p as j}from"./chunk-74IYYDDI.js";import{a as f,d as T,f as U,g as V}from"./chunk-I26MS5PJ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as J}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as J}from"./chunk-R75AFV7G.js";import"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as z}from"./chunk-T2JHVL34.js";import"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as E}from"./chunk-RWVIV3U7.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-HCTJKP5J.js";import{a as D,e as _}from"./chunk-2IKDEUCX.js";import{d as q}from"./chunk-74IYYDDI.js";import{a as S,d as O,f as Q,g as V}from"./chunk-I26MS5PJ.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-D6CNULEI.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-VDC6JP4A.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-RGDSRUIX.js";import"./chunk-QAQDMS6R.js";import"./chunk-35Q6XYRL.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,q as ge}from"./chunk-74IYYDDI.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
1
|
+
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-KNUGID7F.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-VDC6JP4A.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,q as ge}from"./chunk-74IYYDDI.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-E4Y6TF6C.js";import"./chunk-R75AFV7G.js";import"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as f}from"./chunk-4ZEL6BYL.js";import{c as m}from"./chunk-T2JHVL34.js";import"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import"./chunk-HCTJKP5J.js";import"./chunk-2IKDEUCX.js";import{d as p}from"./chunk-74IYYDDI.js";import{a as r,d as h,f as S,g as A}from"./chunk-I26MS5PJ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ot}from"./chunk-FPI7AMQJ.js";import{a as Et}from"./chunk-SFMWHWJG.js";import{a as me}from"./chunk-WVWCUB4S.js";import{a as Lt}from"./chunk-QJLHH3ET.js";import{a as Mt}from"./chunk-37WYCOQ2.js";import{a as _t,b as jt}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as be,b as Ft}from"./chunk-EYTZURBK.js";import{i as X}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as L}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as he}from"./chunk-DFVQBXUZ.js";import{l as oe}from"./chunk-RGDSRUIX.js";import"./chunk-QAQDMS6R.js";import"./chunk-35Q6XYRL.js";import{a as ge}from"./chunk-RWVIV3U7.js";import{a as Nt,b as At,c as Dt,d as Ve,e as de,f as ce}from"./chunk-HCTJKP5J.js";import{a as zt,e as kt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Rt,p as D,q as St,u as $t}from"./chunk-74IYYDDI.js";import{a as m,d as wt,e as Yt,f as qt,g as Gt}from"./chunk-I26MS5PJ.js";var H=wt(qt(),1);var E=wt(Yt(),1);var l=wt(Gt(),1);var Kt=m(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Pt"),Wt=m(t=>{let e=Kt(t),r={};for(let[c,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${c}" must map to an array of action strings`);r[c]=h}return r},"qt"),Qt=m(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jt"),W=m(t=>{let e=(0,H.c)(6),{children:r,htmlFor:c,label:h}=t,i;e[0]!==c||e[1]!==h?(i=(0,l.jsx)(Mt,{htmlFor:c,children:h}),e[0]=c,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"W"),ue=m(({busy:t,canSubmit:e,children:r,destructive:c=!1,error:h,onClose:i,onSubmit:o,submitLabel:a,testId:n,title:d})=>{let s=Q();return(0,l.jsxs)(Lt,{label:d,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d}),r,h!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,l.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,l.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:c?"destructive":"default",children:t?s("Saving\u2026"):a})]})]})},"de"),Pt=m(t=>{let e=(0,H.c)(79),{mode:r,onClose:c,onDone:h,org:i}=t,o=oe(),a=Q(),{busy:n,error:d,run:s}=me(),p;e[0]!==i?(p=i?D(i.name):"",e[0]=i,e[1]=p):p=e[1];let[u,b]=(0,E.useState)(p),v;e[2]!==i?(v=i?D(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,f]=(0,E.useState)(v),z;e[4]!==i?(z=i?D(i.logo):"",e[4]=i,e[5]=z):z=e[5];let[y,C]=(0,E.useState)(z),[x,w]=(0,E.useState)(""),I;e[6]!==r||e[7]!==i?.metadata?(I=r==="edit"?Qt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=I):I=e[8];let[k,S]=(0,E.useState)(I),_;e[9]!==o||e[10]!==y||e[11]!==k||e[12]!==r||e[13]!==u||e[14]!==c||e[15]!==h||e[16]!==i?.id||e[17]!==x||e[18]!==s||e[19]!==g?(_=m(()=>{s(async()=>{let N=k.trim()===""?void 0:Kt(k);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim()===""?void 0:u.trim(),organizationId:D(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),c()})},"O"),e[9]=o,e[10]=y,e[11]=k,e[12]=r,e[13]=u,e[14]=c,e[15]=h,e[16]=i?.id,e[17]=x,e[18]=s,e[19]=g,e[20]=_):_=e[20];let A=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==a?(T=a(r==="create"?"Create":"Save"),e[24]=r,e[25]=a,e[26]=T):T=e[26];let R;e[27]!==r||e[28]!==a?(R=a(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=a,e[29]=R):R=e[29];let F;e[30]!==a?(F=a("name"),e[30]=a,e[31]=F):F=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=m(N=>{b(N.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,l.jsx)(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==F?(K=(0,l.jsx)(W,{htmlFor:"org-form-name",label:F,children:B}),e[35]=B,e[36]=F,e[37]=K):K=e[37];let J;e[38]!==a?(J=a("Slug (optional \u2014 derived from name)"),e[38]=a,e[39]=J):J=e[39];let j;e[40]===Symbol.for("react.memo_cache_sentinel")?(j=m(N=>{f(N.target.value)},"F"),e[40]=j):j=e[40];let U;e[41]!==g?(U=(0,l.jsx)(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:j,value:g}),e[41]=g,e[42]=U):U=e[42];let P;e[43]!==J||e[44]!==U?(P=(0,l.jsx)(W,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=P):P=e[45];let Y;e[46]!==a?(Y=a("Logo URL (optional)"),e[46]=a,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=m(N=>{C(N.target.value)},"M"),e[48]=M):M=e[48];let $;e[49]!==y?($=(0,l.jsx)(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=$):$=e[50];let q;e[51]!==Y||e[52]!==$?(q=(0,l.jsx)(W,{htmlFor:"org-form-logo",label:Y,children:$}),e[51]=Y,e[52]=$,e[53]=q):q=e[53];let V;e[54]!==r||e[55]!==x||e[56]!==a?(V=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-form-owner",label:a("Owner user id (optional)"),children:(0,l.jsx)(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:m(N=>{w(N.target.value)},"onChange"),value:x})}),e[54]=r,e[55]=x,e[56]=a,e[57]=V):V=e[57];let te;e[58]!==a?(te=a("Metadata (JSON, optional)"),e[58]=a,e[59]=te):te=e[59];let le;e[60]===Symbol.for("react.memo_cache_sentinel")?(le=m(N=>{S(N.target.value)},"oe"),e[60]=le):le=e[60];let re;e[61]!==k?(re=(0,l.jsx)(Ot,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:le,value:k}),e[61]=k,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,l.jsx)(W,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let ae;return e[66]!==n||e[67]!==d||e[68]!==c||e[69]!==A||e[70]!==K||e[71]!==P||e[72]!==q||e[73]!==V||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==R?(ae=(0,l.jsxs)(ue,{busy:n,canSubmit:O,error:d,onClose:c,onSubmit:A,submitLabel:T,testId:"org-form",title:R,children:[K,P,q,V,ee]}),e[66]=n,e[67]=d,e[68]=c,e[69]=A,e[70]=K,e[71]=P,e[72]=q,e[73]=V,e[74]=ee,e[75]=O,e[76]=T,e[77]=R,e[78]=ae):ae=e[78],ae},"Dt"),Xt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==h||e[4]!==u||e[5]!==d||e[6]!==s?(v=m(()=>{d(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),c(),r()})},"p"),e[0]=i,e[1]=r,e[2]=c,e[3]=h,e[4]=u,e[5]=d,e[6]=s,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Add member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-add-member-user",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-add-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Kt"),Vt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==c||e[4]!==h||e[5]!==u||e[6]!==d?(v=m(()=>{d(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),c(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=c,e[4]=h,e[5]=u,e[6]=d,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Invite member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-invite-member-email",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-invite-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Vt"),er=m(t=>{let e=(0,H.c)(32),{member:r,onClose:c,onDone:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),s;e[0]!==r.role?(s=m(()=>D(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[p,u]=(0,E.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==c||e[5]!==h||e[6]!==p||e[7]!==d?(b=m(()=>{d(async()=>{await i.setAuthOrgMemberRole({memberId:D(r.id),role:p.trim()}),h(),c()})},"g"),e[2]=i,e[3]=r.id,e[4]=c,e[5]=h,e[6]=p,e[7]=d,e[8]=b):b=e[8];let v=b,g;e[9]!==p?(g=p.trim(),e[9]=p,e[10]=g):g=e[10];let f=g!=="",z;e[11]!==o?(z=o("Save"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let C;e[15]!==o?(C=o("Role"),e[15]=o,e[16]=C):C=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=m(S=>{u(S.target.value)},"x"),e[17]=x):x=e[17];let w;e[18]!==p?(w=(0,l.jsx)(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:p}),e[18]=p,e[19]=w):w=e[19];let I;e[20]!==C||e[21]!==w?(I=(0,l.jsx)(W,{htmlFor:"org-member-role-value",label:C,children:w}),e[20]=C,e[21]=w,e[22]=I):I=e[22];let k;return e[23]!==a||e[24]!==n||e[25]!==c||e[26]!==v||e[27]!==I||e[28]!==f||e[29]!==z||e[30]!==y?(k=(0,l.jsx)(ue,{busy:a,canSubmit:f,error:n,onClose:c,onSubmit:v,submitLabel:z,testId:"org-member-role",title:y,children:I}),e[23]=a,e[24]=n,e[25]=c,e[26]=v,e[27]=I,e[28]=f,e[29]=z,e[30]=y,e[31]=k):k=e[31],k},"Wt"),Bt=m(t=>{let e=(0,H.c)(36),{mode:r,onClose:c,onDone:h,organizationId:i,team:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==a||e[3]!==r||e[4]!==b||e[5]!==c||e[6]!==h||e[7]!==i||e[8]!==p||e[9]!==o?.id?(g=m(()=>{p(async()=>{await(r==="create"?a.createAuthOrgTeam({name:b.trim(),organizationId:i}):a.updateAuthOrgTeam({name:b.trim(),teamId:D(o?.id)})),h(),c()})},"f"),e[2]=a,e[3]=r,e[4]=b,e[5]=c,e[6]=h,e[7]=i,e[8]=p,e[9]=o?.id,e[10]=g):g=e[10];let f=g,z;e[11]!==b?(z=b.trim(),e[11]=b,e[12]=z):z=e[12];let y=z!=="",C;e[13]!==r||e[14]!==n?(C=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=C):C=e[15];let x;e[16]!==r||e[17]!==n?(x=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=x):x=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=m(A=>{v(A.target.value)},"C"),e[21]=I):I=e[21];let k;e[22]!==b?(k=(0,l.jsx)(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:I,value:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==w||e[25]!==k?(S=(0,l.jsx)(W,{htmlFor:"org-team-form-name",label:w,children:k}),e[24]=w,e[25]=k,e[26]=S):S=e[26];let _;return e[27]!==d||e[28]!==s||e[29]!==c||e[30]!==f||e[31]!==S||e[32]!==y||e[33]!==C||e[34]!==x?(_=(0,l.jsx)(ue,{busy:d,canSubmit:y,error:s,onClose:c,onSubmit:f,submitLabel:C,testId:"org-team-form",title:x,children:S}),e[27]=d,e[28]=s,e[29]=c,e[30]=f,e[31]=S,e[32]=y,e[33]=C,e[34]=x,e[35]=_):_=e[35],_},"zt"),tr=m(t=>{let e=(0,H.c)(30),{onClose:r,onDone:c,teamId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==s?(u=m(()=>{d(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),c(),r()})},"c"),e[0]=i,e[1]=r,e[2]=c,e[3]=d,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",f;e[9]!==o?(f=o("Add member"),e[9]=o,e[10]=f):f=e[10];let z;e[11]!==o?(z=o("Add team member"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=m(k=>{p(k.target.value)},"y"),e[15]=C):C=e[15];let x;e[16]!==s?(x=(0,l.jsx)(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:C,value:s}),e[16]=s,e[17]=x):x=e[17];let w;e[18]!==y||e[19]!==x?(w=(0,l.jsx)(W,{htmlFor:"org-team-add-member-user",label:y,children:x}),e[18]=y,e[19]=x,e[20]=w):w=e[20];let I;return e[21]!==a||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==f||e[27]!==z||e[28]!==w?(I=(0,l.jsx)(ue,{busy:a,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:f,testId:"org-team-add-member",title:z,children:w}),e[21]=a,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=f,e[27]=z,e[28]=w,e[29]=I):I=e[29],I},"Xt"),Jt=m(t=>{let e=(0,H.c)(47),{mode:r,onClose:c,onDone:h,organizationId:i,role:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Qt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[f,z]=(0,E.useState)(g),y;e[5]!==a||e[6]!==r||e[7]!==b||e[8]!==c||e[9]!==h||e[10]!==i||e[11]!==f||e[12]!==o?.id||e[13]!==p?(y=m(()=>{p(async()=>{let R=Wt(f);await(r==="create"?a.createAuthOrgRole({organizationId:i,permission:R,role:b.trim()}):a.updateAuthOrgRole({permission:R,roleId:D(o?.id)})),h(),c()})},"v"),e[5]=a,e[6]=r,e[7]=b,e[8]=c,e[9]=h,e[10]=i,e[11]=f,e[12]=o?.id,e[13]=p,e[14]=y):y=e[14];let C=y,x;e[15]!==r||e[16]!==b||e[17]!==f?(x=f.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=f,e[18]=x):x=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let I;e[22]!==r||e[23]!==n?(I=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=I):I=e[24];let k;e[25]!==r||e[26]!==b||e[27]!==n?(k=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,l.jsx)(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:m(R=>{v(R.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=k):k=e[28];let S;e[29]!==n?(S=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=S):S=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{z(R.target.value)},"O"),e[31]=_):_=e[31];let A;e[32]!==f?(A=(0,l.jsx)(Ot,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:f}),e[32]=f,e[33]=A):A=e[33];let O;e[34]!==A||e[35]!==S?(O=(0,l.jsx)(W,{htmlFor:"org-role-form-permission",label:S,children:A}),e[34]=A,e[35]=S,e[36]=O):O=e[36];let T;return e[37]!==d||e[38]!==s||e[39]!==c||e[40]!==C||e[41]!==O||e[42]!==x||e[43]!==w||e[44]!==I||e[45]!==k?(T=(0,l.jsxs)(ue,{busy:d,canSubmit:x,error:s,onClose:c,onSubmit:C,submitLabel:w,testId:"org-role-form",title:I,children:[k,O]}),e[37]=d,e[38]=s,e[39]=c,e[40]=C,e[41]=O,e[42]=x,e[43]=w,e[44]=I,e[45]=k,e[46]=T):T=e[46],T},"At"),Zt=m(t=>{let e=(0,H.c)(18),{action:r,message:c,onClose:h,onDone:i,testId:o,title:a}=t,n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==p?(u=m(()=>{p(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=p,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==c?(g=(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:c}),e[7]=c,e[8]=g):g=e[8];let f;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==a?(f=(0,l.jsx)(ue,{busy:d,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:a,children:g}),e[9]=d,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=a,e[17]=f):f=e[17],f},"Lt"),et=m(t=>{let e=(0,H.c)(13),{action:r,children:c,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let a;e[2]!==r?(a=r!==void 0&&(0,l.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=a):a=e[3];let n;e[4]!==o||e[5]!==a?(n=(0,l.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,a]}),e[4]=o,e[5]=a,e[6]=n):n=e[6];let d;e[7]!==c?(d=(0,l.jsx)(kt,{className:"px-0",children:c}),e[7]=c,e[8]=d):d=e[8];let s;return e[9]!==n||e[10]!==d||e[11]!==i?(s=(0,l.jsxs)(zt,{className:"overflow-hidden py-0","data-testid":i,children:[n,d]}),e[9]=n,e[10]=d,e[11]=i,e[12]=s):s=e[12],s},"Ye"),tt=m(t=>{let e=(0,H.c)(23),{columns:r,rowActions:c,rowPrefix:h,rows:i}=t,o=Q(),a;e[0]!==r?(a=r.map(rr),e[0]=r,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==n?(d=(0,l.jsx)(de,{"aria-label":n}),e[4]=n,e[5]=d):d=e[5];let s;e[6]!==a||e[7]!==d?(s=(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[a,d]})}),e[6]=a,e[7]=d,e[8]=s):s=e[8];let p;if(e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==c||e[16]!==h?(v=m((g,f)=>{let z=D(g.id),y=z===""?`index-${f.toString()}`:z;return(0,l.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(C=>(0,l.jsx)(ce,{className:C.className,children:C.render(g)},C.head)),(0,l.jsx)(ce,{children:(0,l.jsx)("div",{className:"flex justify-end gap-1",children:c(g)})})]},y)},"p"),e[14]=r,e[15]=c,e[16]=h,e[17]=v):v=e[17],p=i.map(v),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,l.jsx)(Dt,{children:p}),e[18]=p,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,l.jsxs)(Nt,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"et");function rr(t){return(0,l.jsx)(de,{children:t.head},t.head)}m(rr,"Yt");var or=m(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:c,memberColumns:h,members:i,onDialog:o}=t,a=Q(),n;e[0]!==o?(n=m(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let d;e[2]!==a?(d=a("Add member"),e[2]=a,e[3]=d):d=e[3];let s;e[4]!==n||e[5]!==d?(s=(0,l.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:d}),e[4]=n,e[5]=d,e[6]=s):s=e[6];let p;e[7]!==o?(p=m(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=p):p=e[8];let u;e[9]!==a?(u=a("Invite member"),e[9]=a,e[10]=u):u=e[10];let b;e[11]!==p||e[12]!==u?(b=(0,l.jsx)(L,{"data-testid":"org-open-invite-member",onClick:p,size:"xs",type:"button",variant:"outline",children:u}),e[11]=p,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,l.jsxs)(l.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==a?(g=a("Members"),e[17]=a,e[18]=g):g=e[18];let f;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==c||e[24]!==a?(f=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-members-empty",title:a("No members.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(y=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-member-role-${D(y.id)}`,onClick:m(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Change role")}),(0,l.jsx)(L,{"data-testid":`org-remove-member-${D(y.id)}`,disabled:r,onClick:m(()=>{c(D(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=c,e[24]=a,e[25]=f):f=e[25];let z;return e[26]!==v||e[27]!==g||e[28]!==f?(z=(0,l.jsx)(et,{action:v,heading:g,testId:"org-members",children:f}),e[26]=v,e[27]=g,e[28]=f,e[29]=z):z=e[29],z},"el"),lr=m(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:c,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:a}=t,n=Q(),d;e[0]!==c?(d=m(()=>{c({kind:"team-create"})},"m"),e[0]=c,e[1]=d):d=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let p;e[4]!==d||e[5]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-create-team",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[4]=d,e[5]=s,e[6]=p):p=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-teams-empty",title:n("No teams.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"aria-pressed":i===D(g.id),"data-testid":`org-team-select-${D(g.id)}`,onClick:m(()=>{h(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,l.jsx)(L,{"data-testid":`org-team-rename-${D(g.id)}`,onClick:m(()=>{c({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,l.jsx)(L,{"data-testid":`org-team-delete-${D(g.id)}`,onClick:m(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:a}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=a,e[16]=b):b=e[16];let v;return e[17]!==p||e[18]!==u||e[19]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-teams",children:b}),e[17]=p,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"tl"),ar=m(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:c,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:a}=t,n=Q(),d;e[0]!==h||e[1]!==i?(d=m(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=d):d=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let p;e[5]!==d||e[6]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[5]=d,e[6]=s,e[7]=p):p=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsx)(L,{"data-testid":`org-team-remove-member-${D(g.id)}`,disabled:r,onClick:m(()=>{c(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:a}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let v;return e[16]!==p||e[17]!==u||e[18]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-team-members",children:b}),e[16]=p,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"ll"),nr=m(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:c,roleColumns:h,roles:i}=t,o=Q(),a;e[0]!==c?(a=m(()=>{c({kind:"role-create"})},"i"),e[0]=c,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==a||e[5]!==n?(d=(0,l.jsx)(L,{"data-testid":"org-open-create-role",onClick:a,size:"xs",type:"button",variant:"outline",children:n}),e[4]=a,e[5]=n,e[6]=d):d=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let p;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==o?(p=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(b=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-role-edit-${D(b.id)}`,onClick:m(()=>{c({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,l.jsx)(L,{"data-testid":`org-role-delete-${D(b.id)}`,onClick:m(()=>{r(D(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=o,e[14]=p):p=e[14];let u;return e[15]!==d||e[16]!==s||e[17]!==p?(u=(0,l.jsx)(et,{action:d,heading:s,testId:"org-roles",children:p}),e[15]=d,e[16]=s,e[17]=p,e[18]=u):u=e[18],u},"ol"),Ut=200,ir=m(t=>{let e=(0,H.c)(217),{organizationId:r,rolesEnabled:c,teamsEnabled:h}=t,i=oe(),o=Q(),[a,n]=(0,E.useState)(null),[d,s]=(0,E.useState)(null),[p,u]=(0,E.useState)(!1),[b,v]=(0,E.useState)(null),[g,f]=jt(r),z;e[0]!==g||e[1]!==r?(z=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=z):z=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=m(()=>i.listAuthOrgMembers({limit:Ut,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let C=he(z,y),x;e[7]!==r?(x=["lunora-auth-org-invitations",r],e[7]=r,e[8]=x):x=e[8];let w;e[9]!==i||e[10]!==r?(w=m(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let I=he(x,w),k;e[12]!==r?(k=["lunora-auth-org-teams",r],e[12]=r,e[13]=k):k=e[13];let S;e[14]!==i||e[15]!==r?(S=m(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"k"),e[14]=i,e[15]=r,e[16]=S):S=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let A=he(k,S,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=m(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let R;e[24]!==c?(R={enabled:c},e[24]=c,e[25]=R):R=e[25];let F=he(O,T,R),Z;e[26]!==d?(Z=["lunora-auth-org-team-members",d],e[26]=d,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==d?(B=m(()=>i.listAuthOrgTeamMembers({limit:200,teamId:d??""}),"B"),e[28]=i,e[29]=d,e[30]=B):B=e[30];let K=d!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let j=he(Z,B,J),U;e[33]!==C.data?.rows?(U=C.data?.rows??[],e[33]=C.data?.rows,e[34]=U):U=e[34];let P=U,Y;e[35]!==I.data?.rows?(Y=I.data?.rows??[],e[35]=I.data?.rows,e[36]=Y):Y=e[36];let M=Y,$;e[37]!==A.data?.rows?($=A.data?.rows??[],e[37]=A.data?.rows,e[38]=$):$=e[38];let q=$,V;e[39]!==F.data?.rows?(V=F.data?.rows??[],e[39]=F.data?.rows,e[40]=V):V=e[40];let te=V,le;e[41]!==d||e[42]!==j.data?.rows?(le=d===null?[]:j.data?.rows??[],e[41]=d,e[42]=j.data?.rows,e[43]=le):le=e[43];let re=le,ee=C.error??I.error??A.error??F.error??j.error,ae;if(e[44]!==I||e[45]!==C||e[46]!==c||e[47]!==F||e[48]!==d||e[49]!==j||e[50]!==h||e[51]!==A){let G=m(()=>{let se=[C.poll(),I.poll()];return h&&se.push(A.poll()),c&&se.push(F.poll()),d!==null&&se.push(j.poll()),Ft(se)},"V");ae=m(()=>{St(G())},"ie"),e[44]=I,e[45]=C,e[46]=c,e[47]=F,e[48]=d,e[49]=j,e[50]=h,e[51]=A,e[52]=ae}else ae=e[52];let N=ae,rt;e[53]!==C?(rt=m(()=>C.poll(),"tt"),e[53]=C,e[54]=rt):rt=e[54],be(rt,!0);let ot;e[55]!==I?(ot=m(()=>I.poll(),"lt"),e[55]=I,e[56]=ot):ot=e[56],be(ot,!0);let lt;e[57]!==A?(lt=m(()=>A.poll(),"ot"),e[57]=A,e[58]=lt):lt=e[58],be(lt,h);let at;e[59]!==F?(at=m(()=>F.poll(),"it"),e[59]=F,e[60]=at):at=e[60],be(at,c);let nt;e[61]!==j?(nt=m(()=>j.poll(),"rt"),e[61]=j,e[62]=nt):nt=e[62],be(nt,d!==null);let it;e[63]===Symbol.for("react.memo_cache_sentinel")?(it=m(()=>{n(null)},"st"),e[63]=it):it=e[63];let ne=it,st;e[64]!==N?(st=m(G=>{St((async()=>{u(!0),v(null);try{await G(),N(),u(!1)}catch(se){v(Rt(se)),u(!1)}})())},"nt"),e[64]=N,e[65]=st):st=e[65];let ie=st,mt;e[66]!==i||e[67]!==o?(mt=m(G=>{let se=D(G.id);n({action:m(async()=>{await i.removeAuthOrgTeam({teamId:se}),s(Tt=>Tt===se?null:Tt)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"at"),e[66]=i,e[67]=o,e[68]=mt):mt=e[68];let pt=mt,pe;e[69]!==o?(pe=o("userId"),e[69]=o,e[70]=pe):pe=e[70];let fe;e[71]!==pe?(fe={head:pe,render:sr},e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o?(ve=o("role"),e[73]=o,e[74]=ve):ve=e[74];let ye;e[75]!==ve?(ye={head:ve,render:mr},e[75]=ve,e[76]=ye):ye=e[76];let dt;e[77]!==fe||e[78]!==ye?(dt=[fe,ye],e[77]=fe,e[78]=ye,e[79]=dt):dt=e[79];let ft=dt,Ce;e[80]!==o?(Ce=o("email"),e[80]=o,e[81]=Ce):Ce=e[81];let Ie;e[82]!==Ce?(Ie={head:Ce,render:dr},e[82]=Ce,e[83]=Ie):Ie=e[83];let xe;e[84]!==o?(xe=o("role"),e[84]=o,e[85]=xe):xe=e[85];let we;e[86]!==xe?(we={head:xe,render:cr},e[86]=xe,e[87]=we):we=e[87];let ze;e[88]!==o?(ze=o("status"),e[88]=o,e[89]=ze):ze=e[89];let ke;e[90]!==ze?(ke={head:ze,render:ur},e[90]=ze,e[91]=ke):ke=e[91];let ct;e[92]!==Ie||e[93]!==we||e[94]!==ke?(ct=[Ie,we,ke],e[92]=Ie,e[93]=we,e[94]=ke,e[95]=ct):ct=e[95];let vt=ct,Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let Ne;e[98]!==Se?(Ne={className:"font-mono text-xs",head:Se,render:gr},e[98]=Se,e[99]=Ne):Ne=e[99];let Ae;e[100]!==o?(Ae=o("name"),e[100]=o,e[101]=Ae):Ae=e[101];let De;e[102]!==Ae?(De={head:Ae,render:hr},e[102]=Ae,e[103]=De):De=e[103];let ut;e[104]!==Ne||e[105]!==De?(ut=[Ne,De],e[104]=Ne,e[105]=De,e[106]=ut):ut=e[106];let yt=ut,Oe;e[107]!==o?(Oe=o("userId"),e[107]=o,e[108]=Oe):Oe=e[108];let gt;e[109]!==Oe?(gt=[{head:Oe,render:br}],e[109]=Oe,e[110]=gt):gt=e[110];let Ct=gt,_e;e[111]!==o?(_e=o("role"),e[111]=o,e[112]=_e):_e=e[112];let Te;e[113]!==_e?(Te={head:_e,render:pr},e[113]=_e,e[114]=Te):Te=e[114];let Re;e[115]!==o?(Re=o("Permission"),e[115]=o,e[116]=Re):Re=e[116];let $e;e[117]!==Re?($e={className:"font-mono text-xs whitespace-pre-wrap",head:Re,render:fr},e[117]=Re,e[118]=$e):$e=e[118];let ht;e[119]!==Te||e[120]!==$e?(ht=[Te,$e],e[119]=Te,e[120]=$e,e[121]=ht):ht=e[121];let It=ht,Me;e[122]!==ee?(Me=ee!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Me):Me=e[123];let Fe;e[124]!==b?(Fe=b!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[124]=b,e[125]=Fe):Fe=e[125];let je;e[126]!==i||e[127]!==ie?(je=m(G=>{ie(()=>i.removeAuthOrgMember({memberId:G}))},"Me"),e[126]=i,e[127]=ie,e[128]=je):je=e[128];let Ee;e[129]!==p||e[130]!==ft||e[131]!==P||e[132]!==je?(Ee=(0,l.jsx)(or,{actionBusy:p,memberColumns:ft,members:P,onDialog:n,onRemoveMember:je}),e[129]=p,e[130]=ft,e[131]=P,e[132]=je,e[133]=Ee):Ee=e[133];let xt=C.data?.total,Le;e[134]!==P.length||e[135]!==g||e[136]!==f||e[137]!==xt?(Le=(0,l.jsx)(_t,{count:P.length,offset:g,onOffsetChange:f,pageSize:Ut,prefix:"org-members",total:xt}),e[134]=P.length,e[135]=g,e[136]=f,e[137]=xt,e[138]=Le):Le=e[138];let Pe;e[139]!==p||e[140]!==i||e[141]!==vt||e[142]!==M||e[143]!==ie||e[144]!==o?(Pe=M.length>0&&(0,l.jsx)(et,{heading:o("Invitations"),testId:"org-invitations",children:(0,l.jsx)(tt,{columns:vt,rowActions:m(G=>(0,l.jsx)(L,{"data-testid":`org-cancel-invitation-${D(G.id)}`,disabled:p,onClick:m(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:D(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[139]=p,e[140]=i,e[141]=vt,e[142]=M,e[143]=ie,e[144]=o,e[145]=Pe):Pe=e[145];let Be;e[146]!==pt||e[147]!==d||e[148]!==yt||e[149]!==q||e[150]!==h?(Be=h&&(0,l.jsx)(lr,{onConfirmDeleteTeam:pt,onDialog:n,onSelectTeam:s,selectedTeam:d,teamColumns:yt,teams:q}),e[146]=pt,e[147]=d,e[148]=yt,e[149]=q,e[150]=h,e[151]=Be):Be=e[151];let Je;e[152]!==p||e[153]!==i||e[154]!==ie||e[155]!==d||e[156]!==Ct||e[157]!==re||e[158]!==h?(Je=h&&d!==null&&(0,l.jsx)(ar,{actionBusy:p,onDialog:n,onRemoveTeamMember:m(G=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:d,teamMemberColumns:Ct,teamMembers:re}),e[152]=p,e[153]=i,e[154]=ie,e[155]=d,e[156]=Ct,e[157]=re,e[158]=h,e[159]=Je):Je=e[159];let Ue;e[160]!==i||e[161]!==It||e[162]!==te||e[163]!==c||e[164]!==o?(Ue=c&&(0,l.jsx)(nr,{onConfirmDeleteRole:m(G=>{n({action:m(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:It,roles:te}),e[160]=i,e[161]=It,e[162]=te,e[163]=c,e[164]=o,e[165]=Ue):Ue=e[165];let He;e[166]!==a?.kind||e[167]!==r||e[168]!==N?(He=a?.kind==="add-member"&&(0,l.jsx)(Xt,{onClose:ne,onDone:N,organizationId:r}),e[166]=a?.kind,e[167]=r,e[168]=N,e[169]=He):He=e[169];let Ke;e[170]!==a?.kind||e[171]!==r||e[172]!==N?(Ke=a?.kind==="invite-member"&&(0,l.jsx)(Vt,{onClose:ne,onDone:N,organizationId:r}),e[170]=a?.kind,e[171]=r,e[172]=N,e[173]=Ke):Ke=e[173];let Qe;e[174]!==a||e[175]!==N?(Qe=a?.kind==="member-role"&&(0,l.jsx)(er,{member:a.member,onClose:ne,onDone:N}),e[174]=a,e[175]=N,e[176]=Qe):Qe=e[176];let Ze;e[177]!==a?.kind||e[178]!==r||e[179]!==N?(Ze=a?.kind==="team-create"&&(0,l.jsx)(Bt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[177]=a?.kind,e[178]=r,e[179]=N,e[180]=Ze):Ze=e[180];let Ye;e[181]!==a||e[182]!==r||e[183]!==N?(Ye=a?.kind==="team-rename"&&(0,l.jsx)(Bt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,team:a.team}),e[181]=a,e[182]=r,e[183]=N,e[184]=Ye):Ye=e[184];let qe;e[185]!==a||e[186]!==N?(qe=a?.kind==="team-add-member"&&(0,l.jsx)(tr,{onClose:ne,onDone:N,teamId:a.teamId}),e[185]=a,e[186]=N,e[187]=qe):qe=e[187];let Ge;e[188]!==a?.kind||e[189]!==r||e[190]!==N?(Ge=a?.kind==="role-create"&&(0,l.jsx)(Jt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[188]=a?.kind,e[189]=r,e[190]=N,e[191]=Ge):Ge=e[191];let We;e[192]!==a||e[193]!==r||e[194]!==N?(We=a?.kind==="role-edit"&&(0,l.jsx)(Jt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,role:a.role}),e[192]=a,e[193]=r,e[194]=N,e[195]=We):We=e[195];let Xe;e[196]!==a||e[197]!==N?(Xe=a?.kind==="confirm"&&(0,l.jsx)(Zt,{action:a.action,message:a.message,onClose:ne,onDone:N,testId:a.testId,title:a.title}),e[196]=a,e[197]=N,e[198]=Xe):Xe=e[198];let bt;return e[199]!==Me||e[200]!==Fe||e[201]!==Ee||e[202]!==Le||e[203]!==Pe||e[204]!==Be||e[205]!==Je||e[206]!==Ue||e[207]!==He||e[208]!==Ke||e[209]!==Qe||e[210]!==Ze||e[211]!==Ye||e[212]!==qe||e[213]!==Ge||e[214]!==We||e[215]!==Xe?(bt=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Me,Fe,Ee,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge,We,Xe]}),e[199]=Me,e[200]=Fe,e[201]=Ee,e[202]=Le,e[203]=Pe,e[204]=Be,e[205]=Je,e[206]=Ue,e[207]=He,e[208]=Ke,e[209]=Qe,e[210]=Ze,e[211]=Ye,e[212]=qe,e[213]=Ge,e[214]=We,e[215]=Xe,e[216]=bt):bt=e[216],bt},"il");function sr(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(sr,"rl");function mr(t){return D(t.role)}m(mr,"sl");function dr(t){return D(t.email)}m(dr,"nl");function cr(t){return D(t.role)}m(cr,"al");function ur(t){return D(t.status)}m(ur,"ml");function gr(t){return D(t.id)}m(gr,"dl");function hr(t){return D(t.name)}m(hr,"cl");function br(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(br,"fl");function pr(t){return D(t.role)}m(pr,"ul");function fr(t){return D(t.permission)}m(fr,"gl");var Ht=100,$r=m(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:c,ready:h}=Et(),i=c.capabilities.organization,[o,a]=(0,E.useState)(null),[n,d]=(0,E.useState)(null),[s,p]=(0,E.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=m(()=>e.listAuthOrganizations({limit:Ht,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=he(u,b,v),f=g.data?.rows??null,z;t[7]!==g?(z=m(()=>g.poll(),"S"),t[7]=g,t[8]=z):z=t[8],be(z,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=m(()=>{d(null)},"v"),t[9]=y):y=t[9];let C=y,x;t[10]!==g?(x=m(()=>{g.refetch()},"x"),t[10]=g,t[11]=x):x=t[11];let w=x,I;t[12]===Symbol.for("react.memo_cache_sentinel")?(I=m(M=>{a(M)},"C"),t[12]=I):I=t[12];let k=I;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let $;t[15]!==r?($=r("Organizations are not enabled."),t[15]=r,t[16]=$):$=t[16];let q;return t[17]!==M||t[18]!==$?(q=(0,l.jsx)(ge,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=q):q=t[19],q}let S;t[20]!==r?(S=r("Organizations"),t[20]=r,t[21]=S):S=t[21];let _;t[22]!==S?(_=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),t[22]=S,t[23]=_):_=t[23];let A;t[24]===Symbol.for("react.memo_cache_sentinel")?(A=m(()=>{d({kind:"create"})},"z"),t[24]=A):A=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,l.jsx)(L,{"data-testid":"org-new",onClick:A,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let R;t[29]!==T||t[30]!==_?(R=(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=R):R=t[31];let F;t[32]!==g.error?(F=g.error!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=F):F=t[33];let Z;t[34]!==f||t[35]!==r?(Z=f!==null&&f.length===0&&(0,l.jsx)(ge,{testId:"org-empty",title:r("No organizations.")}),t[34]=f,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==f||t[38]!==o||t[39]!==r?(B=f!==null&&f.length>0&&(0,l.jsx)(zt,{className:"overflow-hidden py-0",children:(0,l.jsx)(kt,{className:"px-0",children:(0,l.jsxs)(Nt,{"data-testid":"org-table",children:[(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[(0,l.jsx)(de,{children:r("id")}),(0,l.jsx)(de,{children:r("name")}),(0,l.jsx)(de,{children:r("slug")}),(0,l.jsx)(de,{children:r("created")}),(0,l.jsx)(de,{"aria-label":r("Actions")})]})}),(0,l.jsx)(Dt,{children:f.map(M=>{let $=D(M.id);return(0,l.jsxs)(Ve,{"data-testid":`org-row-${$}`,children:[(0,l.jsx)(ce,{className:"font-mono text-xs",children:$}),(0,l.jsx)(ce,{children:D(M.name)}),(0,l.jsx)(ce,{children:D(M.slug)}),(0,l.jsx)(ce,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)}),(0,l.jsx)(ce,{children:(0,l.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,l.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:m(()=>{k($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,l.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:m(()=>{d({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,l.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:m(()=>{d({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[37]=f,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==f||t[43]!==g.data?.total?(K=f!==null&&(0,l.jsx)(_t,{count:f.length,offset:s,onOffsetChange:p,pageSize:Ht,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=f,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==c.organization||t[46]!==o?(J=o!==null&&(0,l.jsx)(ir,{organizationId:o,rolesEnabled:c.organization.roles,teamsEnabled:c.organization.teams}),t[45]=c.organization,t[46]=o,t[47]=J):J=t[47];let j;t[48]!==n?.kind||t[49]!==w?(j=n?.kind==="create"&&(0,l.jsx)(Pt,{mode:"create",onClose:C,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=j):j=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,l.jsx)(Pt,{mode:"edit",onClose:C,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let P;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(P=n?.kind==="delete"&&(0,l.jsx)(Zt,{action:m(async()=>{let M=D(n.org.id);await e.deleteAuthOrganization({organizationId:M}),a($=>$===M?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:C,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=P):P=t[58];let Y;return t[59]!==R||t[60]!==F||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==j||t[66]!==U||t[67]!==P?(Y=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[R,F,Z,B,K,J,j,U,P]}),t[59]=R,t[60]=F,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=j,t[66]=U,t[67]=P,t[68]=Y):Y=t[68],Y},"Ml");export{$r as default};
|
|
1
|
+
import{a as Ot}from"./chunk-FPI7AMQJ.js";import{a as Et}from"./chunk-XR2JH2A7.js";import{a as me}from"./chunk-WVWCUB4S.js";import{a as Lt}from"./chunk-QJLHH3ET.js";import{a as Mt}from"./chunk-37WYCOQ2.js";import{a as _t,b as jt}from"./chunk-VQRCJJXS.js";import"./chunk-PSMQQV6S.js";import{a as be,b as Ft}from"./chunk-4TYCTORB.js";import{i as X}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as L}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as he}from"./chunk-T2JHVL34.js";import{l as oe}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as ge}from"./chunk-RWVIV3U7.js";import{a as Nt,b as At,c as Dt,d as Ve,e as de,f as ce}from"./chunk-HCTJKP5J.js";import{a as zt,e as kt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Rt,p as D,q as St,u as $t}from"./chunk-74IYYDDI.js";import{a as m,d as wt,e as Yt,f as qt,g as Gt}from"./chunk-I26MS5PJ.js";var H=wt(qt(),1);var E=wt(Yt(),1);var l=wt(Gt(),1);var Kt=m(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Pt"),Wt=m(t=>{let e=Kt(t),r={};for(let[c,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${c}" must map to an array of action strings`);r[c]=h}return r},"qt"),Qt=m(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jt"),W=m(t=>{let e=(0,H.c)(6),{children:r,htmlFor:c,label:h}=t,i;e[0]!==c||e[1]!==h?(i=(0,l.jsx)(Mt,{htmlFor:c,children:h}),e[0]=c,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"W"),ue=m(({busy:t,canSubmit:e,children:r,destructive:c=!1,error:h,onClose:i,onSubmit:o,submitLabel:a,testId:n,title:d})=>{let s=Q();return(0,l.jsxs)(Lt,{label:d,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d}),r,h!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,l.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,l.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:c?"destructive":"default",children:t?s("Saving\u2026"):a})]})]})},"de"),Pt=m(t=>{let e=(0,H.c)(79),{mode:r,onClose:c,onDone:h,org:i}=t,o=oe(),a=Q(),{busy:n,error:d,run:s}=me(),p;e[0]!==i?(p=i?D(i.name):"",e[0]=i,e[1]=p):p=e[1];let[u,b]=(0,E.useState)(p),v;e[2]!==i?(v=i?D(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,f]=(0,E.useState)(v),z;e[4]!==i?(z=i?D(i.logo):"",e[4]=i,e[5]=z):z=e[5];let[y,C]=(0,E.useState)(z),[x,w]=(0,E.useState)(""),I;e[6]!==r||e[7]!==i?.metadata?(I=r==="edit"?Qt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=I):I=e[8];let[k,S]=(0,E.useState)(I),_;e[9]!==o||e[10]!==y||e[11]!==k||e[12]!==r||e[13]!==u||e[14]!==c||e[15]!==h||e[16]!==i?.id||e[17]!==x||e[18]!==s||e[19]!==g?(_=m(()=>{s(async()=>{let N=k.trim()===""?void 0:Kt(k);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:N,name:u.trim()===""?void 0:u.trim(),organizationId:D(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),c()})},"O"),e[9]=o,e[10]=y,e[11]=k,e[12]=r,e[13]=u,e[14]=c,e[15]=h,e[16]=i?.id,e[17]=x,e[18]=s,e[19]=g,e[20]=_):_=e[20];let A=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==a?(T=a(r==="create"?"Create":"Save"),e[24]=r,e[25]=a,e[26]=T):T=e[26];let R;e[27]!==r||e[28]!==a?(R=a(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=a,e[29]=R):R=e[29];let F;e[30]!==a?(F=a("name"),e[30]=a,e[31]=F):F=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=m(N=>{b(N.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,l.jsx)(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==F?(K=(0,l.jsx)(W,{htmlFor:"org-form-name",label:F,children:B}),e[35]=B,e[36]=F,e[37]=K):K=e[37];let J;e[38]!==a?(J=a("Slug (optional \u2014 derived from name)"),e[38]=a,e[39]=J):J=e[39];let j;e[40]===Symbol.for("react.memo_cache_sentinel")?(j=m(N=>{f(N.target.value)},"F"),e[40]=j):j=e[40];let U;e[41]!==g?(U=(0,l.jsx)(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:j,value:g}),e[41]=g,e[42]=U):U=e[42];let P;e[43]!==J||e[44]!==U?(P=(0,l.jsx)(W,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=P):P=e[45];let Y;e[46]!==a?(Y=a("Logo URL (optional)"),e[46]=a,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=m(N=>{C(N.target.value)},"M"),e[48]=M):M=e[48];let $;e[49]!==y?($=(0,l.jsx)(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=$):$=e[50];let q;e[51]!==Y||e[52]!==$?(q=(0,l.jsx)(W,{htmlFor:"org-form-logo",label:Y,children:$}),e[51]=Y,e[52]=$,e[53]=q):q=e[53];let V;e[54]!==r||e[55]!==x||e[56]!==a?(V=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-form-owner",label:a("Owner user id (optional)"),children:(0,l.jsx)(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:m(N=>{w(N.target.value)},"onChange"),value:x})}),e[54]=r,e[55]=x,e[56]=a,e[57]=V):V=e[57];let te;e[58]!==a?(te=a("Metadata (JSON, optional)"),e[58]=a,e[59]=te):te=e[59];let le;e[60]===Symbol.for("react.memo_cache_sentinel")?(le=m(N=>{S(N.target.value)},"oe"),e[60]=le):le=e[60];let re;e[61]!==k?(re=(0,l.jsx)(Ot,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:le,value:k}),e[61]=k,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,l.jsx)(W,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let ae;return e[66]!==n||e[67]!==d||e[68]!==c||e[69]!==A||e[70]!==K||e[71]!==P||e[72]!==q||e[73]!==V||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==R?(ae=(0,l.jsxs)(ue,{busy:n,canSubmit:O,error:d,onClose:c,onSubmit:A,submitLabel:T,testId:"org-form",title:R,children:[K,P,q,V,ee]}),e[66]=n,e[67]=d,e[68]=c,e[69]=A,e[70]=K,e[71]=P,e[72]=q,e[73]=V,e[74]=ee,e[75]=O,e[76]=T,e[77]=R,e[78]=ae):ae=e[78],ae},"Dt"),Xt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==h||e[4]!==u||e[5]!==d||e[6]!==s?(v=m(()=>{d(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),c(),r()})},"p"),e[0]=i,e[1]=r,e[2]=c,e[3]=h,e[4]=u,e[5]=d,e[6]=s,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Add member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-add-member-user",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-add-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Kt"),Vt=m(t=>{let e=(0,H.c)(40),{onClose:r,onDone:c,organizationId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),[u,b]=(0,E.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==c||e[4]!==h||e[5]!==u||e[6]!==d?(v=m(()=>{d(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),c(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=c,e[4]=h,e[5]=u,e[6]=d,e[7]=v):v=e[7];let g=v,f;e[8]!==s?(f=s.trim(),e[8]=s,e[9]=f):f=e[9];let z=f!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let C;e[12]!==o?(C=o("Invite member"),e[12]=o,e[13]=C):C=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=m(R=>{p(R.target.value)},"I"),e[16]=w):w=e[16];let I;e[17]!==s?(I=(0,l.jsx)(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=I):I=e[18];let k;e[19]!==x||e[20]!==I?(k=(0,l.jsx)(W,{htmlFor:"org-invite-member-email",label:x,children:I}),e[19]=x,e[20]=I,e[21]=k):k=e[21];let S;e[22]!==o?(S=o("Role (optional)"),e[22]=o,e[23]=S):S=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{b(R.target.value)},"O"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,l.jsx)(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=A):A=e[26];let O;e[27]!==S||e[28]!==A?(O=(0,l.jsx)(W,{htmlFor:"org-invite-member-role",label:S,children:A}),e[27]=S,e[28]=A,e[29]=O):O=e[29];let T;return e[30]!==a||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==z||e[36]!==y||e[37]!==C||e[38]!==k?(T=(0,l.jsxs)(ue,{busy:a,canSubmit:z,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:C,children:[k,O]}),e[30]=a,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=z,e[36]=y,e[37]=C,e[38]=k,e[39]=T):T=e[39],T},"Vt"),er=m(t=>{let e=(0,H.c)(32),{member:r,onClose:c,onDone:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),s;e[0]!==r.role?(s=m(()=>D(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[p,u]=(0,E.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==c||e[5]!==h||e[6]!==p||e[7]!==d?(b=m(()=>{d(async()=>{await i.setAuthOrgMemberRole({memberId:D(r.id),role:p.trim()}),h(),c()})},"g"),e[2]=i,e[3]=r.id,e[4]=c,e[5]=h,e[6]=p,e[7]=d,e[8]=b):b=e[8];let v=b,g;e[9]!==p?(g=p.trim(),e[9]=p,e[10]=g):g=e[10];let f=g!=="",z;e[11]!==o?(z=o("Save"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let C;e[15]!==o?(C=o("Role"),e[15]=o,e[16]=C):C=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=m(S=>{u(S.target.value)},"x"),e[17]=x):x=e[17];let w;e[18]!==p?(w=(0,l.jsx)(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:p}),e[18]=p,e[19]=w):w=e[19];let I;e[20]!==C||e[21]!==w?(I=(0,l.jsx)(W,{htmlFor:"org-member-role-value",label:C,children:w}),e[20]=C,e[21]=w,e[22]=I):I=e[22];let k;return e[23]!==a||e[24]!==n||e[25]!==c||e[26]!==v||e[27]!==I||e[28]!==f||e[29]!==z||e[30]!==y?(k=(0,l.jsx)(ue,{busy:a,canSubmit:f,error:n,onClose:c,onSubmit:v,submitLabel:z,testId:"org-member-role",title:y,children:I}),e[23]=a,e[24]=n,e[25]=c,e[26]=v,e[27]=I,e[28]=f,e[29]=z,e[30]=y,e[31]=k):k=e[31],k},"Wt"),Bt=m(t=>{let e=(0,H.c)(36),{mode:r,onClose:c,onDone:h,organizationId:i,team:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==a||e[3]!==r||e[4]!==b||e[5]!==c||e[6]!==h||e[7]!==i||e[8]!==p||e[9]!==o?.id?(g=m(()=>{p(async()=>{await(r==="create"?a.createAuthOrgTeam({name:b.trim(),organizationId:i}):a.updateAuthOrgTeam({name:b.trim(),teamId:D(o?.id)})),h(),c()})},"f"),e[2]=a,e[3]=r,e[4]=b,e[5]=c,e[6]=h,e[7]=i,e[8]=p,e[9]=o?.id,e[10]=g):g=e[10];let f=g,z;e[11]!==b?(z=b.trim(),e[11]=b,e[12]=z):z=e[12];let y=z!=="",C;e[13]!==r||e[14]!==n?(C=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=C):C=e[15];let x;e[16]!==r||e[17]!==n?(x=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=x):x=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=m(A=>{v(A.target.value)},"C"),e[21]=I):I=e[21];let k;e[22]!==b?(k=(0,l.jsx)(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:I,value:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==w||e[25]!==k?(S=(0,l.jsx)(W,{htmlFor:"org-team-form-name",label:w,children:k}),e[24]=w,e[25]=k,e[26]=S):S=e[26];let _;return e[27]!==d||e[28]!==s||e[29]!==c||e[30]!==f||e[31]!==S||e[32]!==y||e[33]!==C||e[34]!==x?(_=(0,l.jsx)(ue,{busy:d,canSubmit:y,error:s,onClose:c,onSubmit:f,submitLabel:C,testId:"org-team-form",title:x,children:S}),e[27]=d,e[28]=s,e[29]=c,e[30]=f,e[31]=S,e[32]=y,e[33]=C,e[34]=x,e[35]=_):_=e[35],_},"zt"),tr=m(t=>{let e=(0,H.c)(30),{onClose:r,onDone:c,teamId:h}=t,i=oe(),o=Q(),{busy:a,error:n,run:d}=me(),[s,p]=(0,E.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==s?(u=m(()=>{d(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),c(),r()})},"c"),e[0]=i,e[1]=r,e[2]=c,e[3]=d,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",f;e[9]!==o?(f=o("Add member"),e[9]=o,e[10]=f):f=e[10];let z;e[11]!==o?(z=o("Add team member"),e[11]=o,e[12]=z):z=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=m(k=>{p(k.target.value)},"y"),e[15]=C):C=e[15];let x;e[16]!==s?(x=(0,l.jsx)(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:C,value:s}),e[16]=s,e[17]=x):x=e[17];let w;e[18]!==y||e[19]!==x?(w=(0,l.jsx)(W,{htmlFor:"org-team-add-member-user",label:y,children:x}),e[18]=y,e[19]=x,e[20]=w):w=e[20];let I;return e[21]!==a||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==f||e[27]!==z||e[28]!==w?(I=(0,l.jsx)(ue,{busy:a,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:f,testId:"org-team-add-member",title:z,children:w}),e[21]=a,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=f,e[27]=z,e[28]=w,e[29]=I):I=e[29],I},"Xt"),Jt=m(t=>{let e=(0,H.c)(47),{mode:r,onClose:c,onDone:h,organizationId:i,role:o}=t,a=oe(),n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==o?(u=o?D(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,E.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Qt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[f,z]=(0,E.useState)(g),y;e[5]!==a||e[6]!==r||e[7]!==b||e[8]!==c||e[9]!==h||e[10]!==i||e[11]!==f||e[12]!==o?.id||e[13]!==p?(y=m(()=>{p(async()=>{let R=Wt(f);await(r==="create"?a.createAuthOrgRole({organizationId:i,permission:R,role:b.trim()}):a.updateAuthOrgRole({permission:R,roleId:D(o?.id)})),h(),c()})},"v"),e[5]=a,e[6]=r,e[7]=b,e[8]=c,e[9]=h,e[10]=i,e[11]=f,e[12]=o?.id,e[13]=p,e[14]=y):y=e[14];let C=y,x;e[15]!==r||e[16]!==b||e[17]!==f?(x=f.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=f,e[18]=x):x=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let I;e[22]!==r||e[23]!==n?(I=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=I):I=e[24];let k;e[25]!==r||e[26]!==b||e[27]!==n?(k=r==="create"&&(0,l.jsx)(W,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,l.jsx)(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:m(R=>{v(R.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=k):k=e[28];let S;e[29]!==n?(S=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=S):S=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=m(R=>{z(R.target.value)},"O"),e[31]=_):_=e[31];let A;e[32]!==f?(A=(0,l.jsx)(Ot,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:f}),e[32]=f,e[33]=A):A=e[33];let O;e[34]!==A||e[35]!==S?(O=(0,l.jsx)(W,{htmlFor:"org-role-form-permission",label:S,children:A}),e[34]=A,e[35]=S,e[36]=O):O=e[36];let T;return e[37]!==d||e[38]!==s||e[39]!==c||e[40]!==C||e[41]!==O||e[42]!==x||e[43]!==w||e[44]!==I||e[45]!==k?(T=(0,l.jsxs)(ue,{busy:d,canSubmit:x,error:s,onClose:c,onSubmit:C,submitLabel:w,testId:"org-role-form",title:I,children:[k,O]}),e[37]=d,e[38]=s,e[39]=c,e[40]=C,e[41]=O,e[42]=x,e[43]=w,e[44]=I,e[45]=k,e[46]=T):T=e[46],T},"At"),Zt=m(t=>{let e=(0,H.c)(18),{action:r,message:c,onClose:h,onDone:i,testId:o,title:a}=t,n=Q(),{busy:d,error:s,run:p}=me(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==p?(u=m(()=>{p(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=p,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==c?(g=(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:c}),e[7]=c,e[8]=g):g=e[8];let f;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==a?(f=(0,l.jsx)(ue,{busy:d,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:a,children:g}),e[9]=d,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=a,e[17]=f):f=e[17],f},"Lt"),et=m(t=>{let e=(0,H.c)(13),{action:r,children:c,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let a;e[2]!==r?(a=r!==void 0&&(0,l.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=a):a=e[3];let n;e[4]!==o||e[5]!==a?(n=(0,l.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,a]}),e[4]=o,e[5]=a,e[6]=n):n=e[6];let d;e[7]!==c?(d=(0,l.jsx)(kt,{className:"px-0",children:c}),e[7]=c,e[8]=d):d=e[8];let s;return e[9]!==n||e[10]!==d||e[11]!==i?(s=(0,l.jsxs)(zt,{className:"overflow-hidden py-0","data-testid":i,children:[n,d]}),e[9]=n,e[10]=d,e[11]=i,e[12]=s):s=e[12],s},"Ye"),tt=m(t=>{let e=(0,H.c)(23),{columns:r,rowActions:c,rowPrefix:h,rows:i}=t,o=Q(),a;e[0]!==r?(a=r.map(rr),e[0]=r,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==n?(d=(0,l.jsx)(de,{"aria-label":n}),e[4]=n,e[5]=d):d=e[5];let s;e[6]!==a||e[7]!==d?(s=(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[a,d]})}),e[6]=a,e[7]=d,e[8]=s):s=e[8];let p;if(e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==c||e[16]!==h?(v=m((g,f)=>{let z=D(g.id),y=z===""?`index-${f.toString()}`:z;return(0,l.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(C=>(0,l.jsx)(ce,{className:C.className,children:C.render(g)},C.head)),(0,l.jsx)(ce,{children:(0,l.jsx)("div",{className:"flex justify-end gap-1",children:c(g)})})]},y)},"p"),e[14]=r,e[15]=c,e[16]=h,e[17]=v):v=e[17],p=i.map(v),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=p}else p=e[13];let u;e[18]!==p?(u=(0,l.jsx)(Dt,{children:p}),e[18]=p,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,l.jsxs)(Nt,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"et");function rr(t){return(0,l.jsx)(de,{children:t.head},t.head)}m(rr,"Yt");var or=m(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:c,memberColumns:h,members:i,onDialog:o}=t,a=Q(),n;e[0]!==o?(n=m(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let d;e[2]!==a?(d=a("Add member"),e[2]=a,e[3]=d):d=e[3];let s;e[4]!==n||e[5]!==d?(s=(0,l.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:d}),e[4]=n,e[5]=d,e[6]=s):s=e[6];let p;e[7]!==o?(p=m(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=p):p=e[8];let u;e[9]!==a?(u=a("Invite member"),e[9]=a,e[10]=u):u=e[10];let b;e[11]!==p||e[12]!==u?(b=(0,l.jsx)(L,{"data-testid":"org-open-invite-member",onClick:p,size:"xs",type:"button",variant:"outline",children:u}),e[11]=p,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,l.jsxs)(l.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==a?(g=a("Members"),e[17]=a,e[18]=g):g=e[18];let f;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==c||e[24]!==a?(f=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-members-empty",title:a("No members.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(y=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-member-role-${D(y.id)}`,onClick:m(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Change role")}),(0,l.jsx)(L,{"data-testid":`org-remove-member-${D(y.id)}`,disabled:r,onClick:m(()=>{c(D(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=c,e[24]=a,e[25]=f):f=e[25];let z;return e[26]!==v||e[27]!==g||e[28]!==f?(z=(0,l.jsx)(et,{action:v,heading:g,testId:"org-members",children:f}),e[26]=v,e[27]=g,e[28]=f,e[29]=z):z=e[29],z},"el"),lr=m(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:c,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:a}=t,n=Q(),d;e[0]!==c?(d=m(()=>{c({kind:"team-create"})},"m"),e[0]=c,e[1]=d):d=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let p;e[4]!==d||e[5]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-create-team",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[4]=d,e[5]=s,e[6]=p):p=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-teams-empty",title:n("No teams.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"aria-pressed":i===D(g.id),"data-testid":`org-team-select-${D(g.id)}`,onClick:m(()=>{h(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,l.jsx)(L,{"data-testid":`org-team-rename-${D(g.id)}`,onClick:m(()=>{c({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,l.jsx)(L,{"data-testid":`org-team-delete-${D(g.id)}`,onClick:m(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:a}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=a,e[16]=b):b=e[16];let v;return e[17]!==p||e[18]!==u||e[19]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-teams",children:b}),e[17]=p,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"tl"),ar=m(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:c,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:a}=t,n=Q(),d;e[0]!==h||e[1]!==i?(d=m(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=d):d=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let p;e[5]!==d||e[6]!==s?(p=(0,l.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:d,size:"xs",type:"button",variant:"outline",children:s}),e[5]=d,e[6]=s,e[7]=p):p=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(b=a.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,l.jsx)(tt,{columns:o,rowActions:m(g=>(0,l.jsx)(L,{"data-testid":`org-team-remove-member-${D(g.id)}`,disabled:r,onClick:m(()=>{c(D(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:a}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let v;return e[16]!==p||e[17]!==u||e[18]!==b?(v=(0,l.jsx)(et,{action:p,heading:u,testId:"org-team-members",children:b}),e[16]=p,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"ll"),nr=m(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:c,roleColumns:h,roles:i}=t,o=Q(),a;e[0]!==c?(a=m(()=>{c({kind:"role-create"})},"i"),e[0]=c,e[1]=a):a=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==a||e[5]!==n?(d=(0,l.jsx)(L,{"data-testid":"org-open-create-role",onClick:a,size:"xs",type:"button",variant:"outline",children:n}),e[4]=a,e[5]=n,e[6]=d):d=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let p;e[9]!==r||e[10]!==c||e[11]!==h||e[12]!==i||e[13]!==o?(p=i.length===0?(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)(ge,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,l.jsx)(tt,{columns:h,rowActions:m(b=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L,{"data-testid":`org-role-edit-${D(b.id)}`,onClick:m(()=>{c({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,l.jsx)(L,{"data-testid":`org-role-delete-${D(b.id)}`,onClick:m(()=>{r(D(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=c,e[11]=h,e[12]=i,e[13]=o,e[14]=p):p=e[14];let u;return e[15]!==d||e[16]!==s||e[17]!==p?(u=(0,l.jsx)(et,{action:d,heading:s,testId:"org-roles",children:p}),e[15]=d,e[16]=s,e[17]=p,e[18]=u):u=e[18],u},"ol"),Ut=200,ir=m(t=>{let e=(0,H.c)(217),{organizationId:r,rolesEnabled:c,teamsEnabled:h}=t,i=oe(),o=Q(),[a,n]=(0,E.useState)(null),[d,s]=(0,E.useState)(null),[p,u]=(0,E.useState)(!1),[b,v]=(0,E.useState)(null),[g,f]=jt(r),z;e[0]!==g||e[1]!==r?(z=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=z):z=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=m(()=>i.listAuthOrgMembers({limit:Ut,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let C=he(z,y),x;e[7]!==r?(x=["lunora-auth-org-invitations",r],e[7]=r,e[8]=x):x=e[8];let w;e[9]!==i||e[10]!==r?(w=m(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let I=he(x,w),k;e[12]!==r?(k=["lunora-auth-org-teams",r],e[12]=r,e[13]=k):k=e[13];let S;e[14]!==i||e[15]!==r?(S=m(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"k"),e[14]=i,e[15]=r,e[16]=S):S=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let A=he(k,S,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=m(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let R;e[24]!==c?(R={enabled:c},e[24]=c,e[25]=R):R=e[25];let F=he(O,T,R),Z;e[26]!==d?(Z=["lunora-auth-org-team-members",d],e[26]=d,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==d?(B=m(()=>i.listAuthOrgTeamMembers({limit:200,teamId:d??""}),"B"),e[28]=i,e[29]=d,e[30]=B):B=e[30];let K=d!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let j=he(Z,B,J),U;e[33]!==C.data?.rows?(U=C.data?.rows??[],e[33]=C.data?.rows,e[34]=U):U=e[34];let P=U,Y;e[35]!==I.data?.rows?(Y=I.data?.rows??[],e[35]=I.data?.rows,e[36]=Y):Y=e[36];let M=Y,$;e[37]!==A.data?.rows?($=A.data?.rows??[],e[37]=A.data?.rows,e[38]=$):$=e[38];let q=$,V;e[39]!==F.data?.rows?(V=F.data?.rows??[],e[39]=F.data?.rows,e[40]=V):V=e[40];let te=V,le;e[41]!==d||e[42]!==j.data?.rows?(le=d===null?[]:j.data?.rows??[],e[41]=d,e[42]=j.data?.rows,e[43]=le):le=e[43];let re=le,ee=C.error??I.error??A.error??F.error??j.error,ae;if(e[44]!==I||e[45]!==C||e[46]!==c||e[47]!==F||e[48]!==d||e[49]!==j||e[50]!==h||e[51]!==A){let G=m(()=>{let se=[C.poll(),I.poll()];return h&&se.push(A.poll()),c&&se.push(F.poll()),d!==null&&se.push(j.poll()),Ft(se)},"V");ae=m(()=>{St(G())},"ie"),e[44]=I,e[45]=C,e[46]=c,e[47]=F,e[48]=d,e[49]=j,e[50]=h,e[51]=A,e[52]=ae}else ae=e[52];let N=ae,rt;e[53]!==C?(rt=m(()=>C.poll(),"tt"),e[53]=C,e[54]=rt):rt=e[54],be(rt,!0);let ot;e[55]!==I?(ot=m(()=>I.poll(),"lt"),e[55]=I,e[56]=ot):ot=e[56],be(ot,!0);let lt;e[57]!==A?(lt=m(()=>A.poll(),"ot"),e[57]=A,e[58]=lt):lt=e[58],be(lt,h);let at;e[59]!==F?(at=m(()=>F.poll(),"it"),e[59]=F,e[60]=at):at=e[60],be(at,c);let nt;e[61]!==j?(nt=m(()=>j.poll(),"rt"),e[61]=j,e[62]=nt):nt=e[62],be(nt,d!==null);let it;e[63]===Symbol.for("react.memo_cache_sentinel")?(it=m(()=>{n(null)},"st"),e[63]=it):it=e[63];let ne=it,st;e[64]!==N?(st=m(G=>{St((async()=>{u(!0),v(null);try{await G(),N(),u(!1)}catch(se){v(Rt(se)),u(!1)}})())},"nt"),e[64]=N,e[65]=st):st=e[65];let ie=st,mt;e[66]!==i||e[67]!==o?(mt=m(G=>{let se=D(G.id);n({action:m(async()=>{await i.removeAuthOrgTeam({teamId:se}),s(Tt=>Tt===se?null:Tt)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"at"),e[66]=i,e[67]=o,e[68]=mt):mt=e[68];let pt=mt,pe;e[69]!==o?(pe=o("userId"),e[69]=o,e[70]=pe):pe=e[70];let fe;e[71]!==pe?(fe={head:pe,render:sr},e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o?(ve=o("role"),e[73]=o,e[74]=ve):ve=e[74];let ye;e[75]!==ve?(ye={head:ve,render:mr},e[75]=ve,e[76]=ye):ye=e[76];let dt;e[77]!==fe||e[78]!==ye?(dt=[fe,ye],e[77]=fe,e[78]=ye,e[79]=dt):dt=e[79];let ft=dt,Ce;e[80]!==o?(Ce=o("email"),e[80]=o,e[81]=Ce):Ce=e[81];let Ie;e[82]!==Ce?(Ie={head:Ce,render:dr},e[82]=Ce,e[83]=Ie):Ie=e[83];let xe;e[84]!==o?(xe=o("role"),e[84]=o,e[85]=xe):xe=e[85];let we;e[86]!==xe?(we={head:xe,render:cr},e[86]=xe,e[87]=we):we=e[87];let ze;e[88]!==o?(ze=o("status"),e[88]=o,e[89]=ze):ze=e[89];let ke;e[90]!==ze?(ke={head:ze,render:ur},e[90]=ze,e[91]=ke):ke=e[91];let ct;e[92]!==Ie||e[93]!==we||e[94]!==ke?(ct=[Ie,we,ke],e[92]=Ie,e[93]=we,e[94]=ke,e[95]=ct):ct=e[95];let vt=ct,Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let Ne;e[98]!==Se?(Ne={className:"font-mono text-xs",head:Se,render:gr},e[98]=Se,e[99]=Ne):Ne=e[99];let Ae;e[100]!==o?(Ae=o("name"),e[100]=o,e[101]=Ae):Ae=e[101];let De;e[102]!==Ae?(De={head:Ae,render:hr},e[102]=Ae,e[103]=De):De=e[103];let ut;e[104]!==Ne||e[105]!==De?(ut=[Ne,De],e[104]=Ne,e[105]=De,e[106]=ut):ut=e[106];let yt=ut,Oe;e[107]!==o?(Oe=o("userId"),e[107]=o,e[108]=Oe):Oe=e[108];let gt;e[109]!==Oe?(gt=[{head:Oe,render:br}],e[109]=Oe,e[110]=gt):gt=e[110];let Ct=gt,_e;e[111]!==o?(_e=o("role"),e[111]=o,e[112]=_e):_e=e[112];let Te;e[113]!==_e?(Te={head:_e,render:pr},e[113]=_e,e[114]=Te):Te=e[114];let Re;e[115]!==o?(Re=o("Permission"),e[115]=o,e[116]=Re):Re=e[116];let $e;e[117]!==Re?($e={className:"font-mono text-xs whitespace-pre-wrap",head:Re,render:fr},e[117]=Re,e[118]=$e):$e=e[118];let ht;e[119]!==Te||e[120]!==$e?(ht=[Te,$e],e[119]=Te,e[120]=$e,e[121]=ht):ht=e[121];let It=ht,Me;e[122]!==ee?(Me=ee!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Me):Me=e[123];let Fe;e[124]!==b?(Fe=b!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[124]=b,e[125]=Fe):Fe=e[125];let je;e[126]!==i||e[127]!==ie?(je=m(G=>{ie(()=>i.removeAuthOrgMember({memberId:G}))},"Me"),e[126]=i,e[127]=ie,e[128]=je):je=e[128];let Ee;e[129]!==p||e[130]!==ft||e[131]!==P||e[132]!==je?(Ee=(0,l.jsx)(or,{actionBusy:p,memberColumns:ft,members:P,onDialog:n,onRemoveMember:je}),e[129]=p,e[130]=ft,e[131]=P,e[132]=je,e[133]=Ee):Ee=e[133];let xt=C.data?.total,Le;e[134]!==P.length||e[135]!==g||e[136]!==f||e[137]!==xt?(Le=(0,l.jsx)(_t,{count:P.length,offset:g,onOffsetChange:f,pageSize:Ut,prefix:"org-members",total:xt}),e[134]=P.length,e[135]=g,e[136]=f,e[137]=xt,e[138]=Le):Le=e[138];let Pe;e[139]!==p||e[140]!==i||e[141]!==vt||e[142]!==M||e[143]!==ie||e[144]!==o?(Pe=M.length>0&&(0,l.jsx)(et,{heading:o("Invitations"),testId:"org-invitations",children:(0,l.jsx)(tt,{columns:vt,rowActions:m(G=>(0,l.jsx)(L,{"data-testid":`org-cancel-invitation-${D(G.id)}`,disabled:p,onClick:m(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:D(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[139]=p,e[140]=i,e[141]=vt,e[142]=M,e[143]=ie,e[144]=o,e[145]=Pe):Pe=e[145];let Be;e[146]!==pt||e[147]!==d||e[148]!==yt||e[149]!==q||e[150]!==h?(Be=h&&(0,l.jsx)(lr,{onConfirmDeleteTeam:pt,onDialog:n,onSelectTeam:s,selectedTeam:d,teamColumns:yt,teams:q}),e[146]=pt,e[147]=d,e[148]=yt,e[149]=q,e[150]=h,e[151]=Be):Be=e[151];let Je;e[152]!==p||e[153]!==i||e[154]!==ie||e[155]!==d||e[156]!==Ct||e[157]!==re||e[158]!==h?(Je=h&&d!==null&&(0,l.jsx)(ar,{actionBusy:p,onDialog:n,onRemoveTeamMember:m(G=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:d,teamMemberColumns:Ct,teamMembers:re}),e[152]=p,e[153]=i,e[154]=ie,e[155]=d,e[156]=Ct,e[157]=re,e[158]=h,e[159]=Je):Je=e[159];let Ue;e[160]!==i||e[161]!==It||e[162]!==te||e[163]!==c||e[164]!==o?(Ue=c&&(0,l.jsx)(nr,{onConfirmDeleteRole:m(G=>{n({action:m(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:It,roles:te}),e[160]=i,e[161]=It,e[162]=te,e[163]=c,e[164]=o,e[165]=Ue):Ue=e[165];let He;e[166]!==a?.kind||e[167]!==r||e[168]!==N?(He=a?.kind==="add-member"&&(0,l.jsx)(Xt,{onClose:ne,onDone:N,organizationId:r}),e[166]=a?.kind,e[167]=r,e[168]=N,e[169]=He):He=e[169];let Ke;e[170]!==a?.kind||e[171]!==r||e[172]!==N?(Ke=a?.kind==="invite-member"&&(0,l.jsx)(Vt,{onClose:ne,onDone:N,organizationId:r}),e[170]=a?.kind,e[171]=r,e[172]=N,e[173]=Ke):Ke=e[173];let Qe;e[174]!==a||e[175]!==N?(Qe=a?.kind==="member-role"&&(0,l.jsx)(er,{member:a.member,onClose:ne,onDone:N}),e[174]=a,e[175]=N,e[176]=Qe):Qe=e[176];let Ze;e[177]!==a?.kind||e[178]!==r||e[179]!==N?(Ze=a?.kind==="team-create"&&(0,l.jsx)(Bt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[177]=a?.kind,e[178]=r,e[179]=N,e[180]=Ze):Ze=e[180];let Ye;e[181]!==a||e[182]!==r||e[183]!==N?(Ye=a?.kind==="team-rename"&&(0,l.jsx)(Bt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,team:a.team}),e[181]=a,e[182]=r,e[183]=N,e[184]=Ye):Ye=e[184];let qe;e[185]!==a||e[186]!==N?(qe=a?.kind==="team-add-member"&&(0,l.jsx)(tr,{onClose:ne,onDone:N,teamId:a.teamId}),e[185]=a,e[186]=N,e[187]=qe):qe=e[187];let Ge;e[188]!==a?.kind||e[189]!==r||e[190]!==N?(Ge=a?.kind==="role-create"&&(0,l.jsx)(Jt,{mode:"create",onClose:ne,onDone:N,organizationId:r}),e[188]=a?.kind,e[189]=r,e[190]=N,e[191]=Ge):Ge=e[191];let We;e[192]!==a||e[193]!==r||e[194]!==N?(We=a?.kind==="role-edit"&&(0,l.jsx)(Jt,{mode:"edit",onClose:ne,onDone:N,organizationId:r,role:a.role}),e[192]=a,e[193]=r,e[194]=N,e[195]=We):We=e[195];let Xe;e[196]!==a||e[197]!==N?(Xe=a?.kind==="confirm"&&(0,l.jsx)(Zt,{action:a.action,message:a.message,onClose:ne,onDone:N,testId:a.testId,title:a.title}),e[196]=a,e[197]=N,e[198]=Xe):Xe=e[198];let bt;return e[199]!==Me||e[200]!==Fe||e[201]!==Ee||e[202]!==Le||e[203]!==Pe||e[204]!==Be||e[205]!==Je||e[206]!==Ue||e[207]!==He||e[208]!==Ke||e[209]!==Qe||e[210]!==Ze||e[211]!==Ye||e[212]!==qe||e[213]!==Ge||e[214]!==We||e[215]!==Xe?(bt=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Me,Fe,Ee,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge,We,Xe]}),e[199]=Me,e[200]=Fe,e[201]=Ee,e[202]=Le,e[203]=Pe,e[204]=Be,e[205]=Je,e[206]=Ue,e[207]=He,e[208]=Ke,e[209]=Qe,e[210]=Ze,e[211]=Ye,e[212]=qe,e[213]=Ge,e[214]=We,e[215]=Xe,e[216]=bt):bt=e[216],bt},"il");function sr(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(sr,"rl");function mr(t){return D(t.role)}m(mr,"sl");function dr(t){return D(t.email)}m(dr,"nl");function cr(t){return D(t.role)}m(cr,"al");function ur(t){return D(t.status)}m(ur,"ml");function gr(t){return D(t.id)}m(gr,"dl");function hr(t){return D(t.name)}m(hr,"cl");function br(t){return(0,l.jsx)("span",{className:"font-mono text-xs",children:D(t.userId)})}m(br,"fl");function pr(t){return D(t.role)}m(pr,"ul");function fr(t){return D(t.permission)}m(fr,"gl");var Ht=100,$r=m(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:c,ready:h}=Et(),i=c.capabilities.organization,[o,a]=(0,E.useState)(null),[n,d]=(0,E.useState)(null),[s,p]=(0,E.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=m(()=>e.listAuthOrganizations({limit:Ht,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=he(u,b,v),f=g.data?.rows??null,z;t[7]!==g?(z=m(()=>g.poll(),"S"),t[7]=g,t[8]=z):z=t[8],be(z,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=m(()=>{d(null)},"v"),t[9]=y):y=t[9];let C=y,x;t[10]!==g?(x=m(()=>{g.refetch()},"x"),t[10]=g,t[11]=x):x=t[11];let w=x,I;t[12]===Symbol.for("react.memo_cache_sentinel")?(I=m(M=>{a(M)},"C"),t[12]=I):I=t[12];let k=I;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let $;t[15]!==r?($=r("Organizations are not enabled."),t[15]=r,t[16]=$):$=t[16];let q;return t[17]!==M||t[18]!==$?(q=(0,l.jsx)(ge,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=q):q=t[19],q}let S;t[20]!==r?(S=r("Organizations"),t[20]=r,t[21]=S):S=t[21];let _;t[22]!==S?(_=(0,l.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),t[22]=S,t[23]=_):_=t[23];let A;t[24]===Symbol.for("react.memo_cache_sentinel")?(A=m(()=>{d({kind:"create"})},"z"),t[24]=A):A=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,l.jsx)(L,{"data-testid":"org-new",onClick:A,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let R;t[29]!==T||t[30]!==_?(R=(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=R):R=t[31];let F;t[32]!==g.error?(F=g.error!==null&&(0,l.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=F):F=t[33];let Z;t[34]!==f||t[35]!==r?(Z=f!==null&&f.length===0&&(0,l.jsx)(ge,{testId:"org-empty",title:r("No organizations.")}),t[34]=f,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==f||t[38]!==o||t[39]!==r?(B=f!==null&&f.length>0&&(0,l.jsx)(zt,{className:"overflow-hidden py-0",children:(0,l.jsx)(kt,{className:"px-0",children:(0,l.jsxs)(Nt,{"data-testid":"org-table",children:[(0,l.jsx)(At,{children:(0,l.jsxs)(Ve,{children:[(0,l.jsx)(de,{children:r("id")}),(0,l.jsx)(de,{children:r("name")}),(0,l.jsx)(de,{children:r("slug")}),(0,l.jsx)(de,{children:r("created")}),(0,l.jsx)(de,{"aria-label":r("Actions")})]})}),(0,l.jsx)(Dt,{children:f.map(M=>{let $=D(M.id);return(0,l.jsxs)(Ve,{"data-testid":`org-row-${$}`,children:[(0,l.jsx)(ce,{className:"font-mono text-xs",children:$}),(0,l.jsx)(ce,{children:D(M.name)}),(0,l.jsx)(ce,{children:D(M.slug)}),(0,l.jsx)(ce,{className:"text-muted-foreground tabular-nums",children:$t(M.createdAt)}),(0,l.jsx)(ce,{children:(0,l.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,l.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:m(()=>{k($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,l.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:m(()=>{d({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,l.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:m(()=>{d({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[37]=f,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==f||t[43]!==g.data?.total?(K=f!==null&&(0,l.jsx)(_t,{count:f.length,offset:s,onOffsetChange:p,pageSize:Ht,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=f,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==c.organization||t[46]!==o?(J=o!==null&&(0,l.jsx)(ir,{organizationId:o,rolesEnabled:c.organization.roles,teamsEnabled:c.organization.teams}),t[45]=c.organization,t[46]=o,t[47]=J):J=t[47];let j;t[48]!==n?.kind||t[49]!==w?(j=n?.kind==="create"&&(0,l.jsx)(Pt,{mode:"create",onClose:C,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=j):j=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,l.jsx)(Pt,{mode:"edit",onClose:C,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let P;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(P=n?.kind==="delete"&&(0,l.jsx)(Zt,{action:m(async()=>{let M=D(n.org.id);await e.deleteAuthOrganization({organizationId:M}),a($=>$===M?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:C,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=P):P=t[58];let Y;return t[59]!==R||t[60]!==F||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==j||t[66]!==U||t[67]!==P?(Y=(0,l.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[R,F,Z,B,K,J,j,U,P]}),t[59]=R,t[60]=F,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=j,t[66]=U,t[67]=P,t[68]=Y):Y=t[68],Y},"Ml");export{$r as default};
|