@lunora/studio 1.0.0-alpha.323 → 1.0.0-alpha.325

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.
Files changed (68) hide show
  1. package/dist/standalone/{chunk-WP2AS7SZ.js → chunk-3S4PZ7KQ.js} +1 -1
  2. package/dist/standalone/{chunk-ESSG4L6C.js → chunk-3T4K7XUT.js} +1 -1
  3. package/dist/standalone/{chunk-EXYBVVHU.js → chunk-4HBHTD3A.js} +1 -1
  4. package/dist/standalone/{chunk-NDGHCEE3.js → chunk-4UKHYUNB.js} +1 -1
  5. package/dist/standalone/{chunk-6YQ3RTCB.js → chunk-5BLNLZXF.js} +1 -1
  6. package/dist/standalone/{chunk-2QLSWJDL.js → chunk-5LBBEWDQ.js} +1 -1
  7. package/dist/standalone/{chunk-WFNUMMDF.js → chunk-5QYM3MYE.js} +2 -2
  8. package/dist/standalone/{chunk-SB4443ME.js → chunk-7PER26LF.js} +1 -1
  9. package/dist/standalone/{chunk-U4YBJ4OW.js → chunk-7Q6GOHAD.js} +1 -1
  10. package/dist/standalone/{chunk-NYHYH5Z5.js → chunk-7UQC3B6P.js} +1 -1
  11. package/dist/standalone/{chunk-3YH5TM3G.js → chunk-7VJPXCOU.js} +1 -1
  12. package/dist/standalone/{chunk-DL6TTBE6.js → chunk-A5U37V2S.js} +1 -1
  13. package/dist/standalone/{chunk-R4ILI46D.js → chunk-ASA7UJIH.js} +1 -1
  14. package/dist/standalone/chunk-BWKZ6FFW.js +9 -0
  15. package/dist/standalone/{chunk-QZRKA2E4.js → chunk-CDB3QQA6.js} +1 -1
  16. package/dist/standalone/{chunk-2JH7ZYVY.js → chunk-CGYVHQAD.js} +1 -1
  17. package/dist/standalone/{chunk-4Y5AFETG.js → chunk-CQ23LQGY.js} +1 -1
  18. package/dist/standalone/{chunk-4K6CXILB.js → chunk-CVBWPFHY.js} +1 -1
  19. package/dist/standalone/{chunk-MTGFTTXO.js → chunk-CY7FSXYX.js} +1 -1
  20. package/dist/standalone/{chunk-Z6THFOLU.js → chunk-CZKN2SRN.js} +1 -1
  21. package/dist/standalone/{chunk-N7LJO732.js → chunk-DYR23C3V.js} +2 -2
  22. package/dist/standalone/{chunk-HER5A45F.js → chunk-EOE2E73Q.js} +1 -1
  23. package/dist/standalone/{chunk-QSUWAGXH.js → chunk-FSXPV7YQ.js} +1 -1
  24. package/dist/standalone/{chunk-SQ2LCZBH.js → chunk-HXR3HVAR.js} +1 -1
  25. package/dist/standalone/{chunk-JNBWPXNV.js → chunk-HY7DUJVI.js} +1 -1
  26. package/dist/standalone/{chunk-SNJ5HRZO.js → chunk-IZ3OOKZL.js} +1 -1
  27. package/dist/standalone/{chunk-XTQR2C6N.js → chunk-JN2DUGT5.js} +1 -1
  28. package/dist/standalone/{chunk-JL6LEVHQ.js → chunk-JSGD6M6E.js} +1 -1
  29. package/dist/standalone/{chunk-MB5JGSN6.js → chunk-KHCM76LG.js} +1 -1
  30. package/dist/standalone/{chunk-7AF3FZCB.js → chunk-LJIMLABC.js} +1 -1
  31. package/dist/standalone/{chunk-ICU56FBP.js → chunk-LLN6LEHZ.js} +1 -1
  32. package/dist/standalone/{chunk-NW6FNJ4L.js → chunk-LU6UOZWK.js} +1 -1
  33. package/dist/standalone/{chunk-3OHVDOV5.js → chunk-MK4H5D3L.js} +1 -1
  34. package/dist/standalone/{chunk-POKVFO6Q.js → chunk-NTZX6RJQ.js} +1 -1
  35. package/dist/standalone/{chunk-OM3B3V47.js → chunk-P2OIRN2O.js} +1 -1
  36. package/dist/standalone/{chunk-5WOMOENH.js → chunk-PLPA2F6L.js} +1 -1
  37. package/dist/standalone/{chunk-MJ3SSK6L.js → chunk-QLKZIBWQ.js} +1 -1
  38. package/dist/standalone/{chunk-OK35SLOW.js → chunk-QPZG3NV6.js} +1 -1
  39. package/dist/standalone/{chunk-DSIY2CMT.js → chunk-QUXXMJPZ.js} +1 -1
  40. package/dist/standalone/{chunk-UDMY3BMT.js → chunk-QZRACAES.js} +1 -1
  41. package/dist/standalone/{chunk-ZJQI4C3A.js → chunk-R2GYDPPC.js} +1 -1
  42. package/dist/standalone/{chunk-7RAYXTNN.js → chunk-R73OPTTE.js} +1 -1
  43. package/dist/standalone/{chunk-KU3IXE36.js → chunk-RI6LCPJQ.js} +1 -1
  44. package/dist/standalone/{chunk-RBAD4SMG.js → chunk-SMCCFWX3.js} +1 -1
  45. package/dist/standalone/{chunk-RDJCY5PQ.js → chunk-SR2FQOVJ.js} +1 -1
  46. package/dist/standalone/{chunk-22TUDRBR.js → chunk-SUTA66KR.js} +1 -1
  47. package/dist/standalone/{chunk-6MFVEI7C.js → chunk-SYPUVLW6.js} +1 -1
  48. package/dist/standalone/{chunk-F3UUFO2C.js → chunk-U6IDPJGC.js} +1 -1
  49. package/dist/standalone/{chunk-HM57YJY5.js → chunk-UMHLRQOR.js} +1 -1
  50. package/dist/standalone/{chunk-VFL7VJWF.js → chunk-UPO3FC7D.js} +1 -1
  51. package/dist/standalone/{chunk-HOGQLP3J.js → chunk-VBUNOAPR.js} +1 -1
  52. package/dist/standalone/{chunk-VKURTWDH.js → chunk-VNHJSWBS.js} +1 -1
  53. package/dist/standalone/{chunk-KLTGKTSL.js → chunk-VRG5BACA.js} +1 -1
  54. package/dist/standalone/{chunk-TIQ7OBZJ.js → chunk-WHDFMKYB.js} +1 -1
  55. package/dist/standalone/{chunk-MRJB4FPI.js → chunk-WHJDJ4OD.js} +1 -1
  56. package/dist/standalone/{chunk-MGEACGEE.js → chunk-WTNHJS56.js} +1 -1
  57. package/dist/standalone/{chunk-CUJGTNYR.js → chunk-WY5WGFM3.js} +1 -1
  58. package/dist/standalone/{chunk-WAX5WY6F.js → chunk-X4JXFRIZ.js} +1 -1
  59. package/dist/standalone/{chunk-WJHMDTV2.js → chunk-XEKXUZWX.js} +1 -1
  60. package/dist/standalone/{chunk-OX6JWCPF.js → chunk-XXMXVSAN.js} +1 -1
  61. package/dist/standalone/{chunk-W3LXMSGC.js → chunk-Y2DTPEO4.js} +1 -1
  62. package/dist/standalone/{chunk-2H5IXFGR.js → chunk-Y2O72Z46.js} +1 -1
  63. package/dist/standalone/{chunk-OH7DVC7S.js → chunk-ZCQJFVF2.js} +1 -1
  64. package/dist/standalone/{chunk-R6PJYMJT.js → chunk-ZNVNSNDU.js} +1 -1
  65. package/dist/standalone/{chunk-EEDIMNRC.js → chunk-ZRB4HPDU.js} +1 -1
  66. package/dist/standalone/studio.js +1 -1
  67. package/package.json +5 -5
  68. package/dist/standalone/chunk-BOYS4DOC.js +0 -9
@@ -1 +1 @@
1
- import{a as oe}from"./chunk-FPI7AMQJ.js";import{a as se}from"./chunk-XHRKNCCI.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-DSIY2CMT.js";import{l as Y}from"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import"./chunk-N7LJO732.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,m as te,p as R}from"./chunk-HJHSQPHW.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-XHRKNCCI.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-QUXXMJPZ.js";import{l as Y}from"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import"./chunk-DYR23C3V.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,m as te,p as R}from"./chunk-HJHSQPHW.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{a as N}from"./chunk-3YH5TM3G.js";import{a as v,b as w,c as y,d,e as c,f as i}from"./chunk-HCTJKP5J.js";import{a as x,e as b}from"./chunk-2IKDEUCX.js";import{d as h}from"./chunk-HJHSQPHW.js";import{a,d as p,e as I,g as R,i as g}from"./chunk-I26MS5PJ.js";var $=p(I(),1);var e=p(R(),1);var A={ERROR:"error",INFO:"info",WARN:"warning"},q=a(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:A[r.level]}},"z"),C=["error","warning","info"],O={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},S=a((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"$"),j=a((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"k"),z=a((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"V"),F=a(r=>{let n={error:0,info:0,warning:0};for(let o of r??[])n[o.level]+=1;return n},"O"),B=a(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let s=h(),[m,k]=(0,$.useState)("error"),T=F(o),u=(o??[]).filter(t=>t.level===m),E=a(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:C.map(t=>(0,e.jsxs)("button",{"aria-selected":m===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:g("size-2 rounded-sm",O[t])}),S(s,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:j(s,t,T[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(N,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(x,{className:"overflow-hidden py-0",children:(0,e.jsx)(b,{className:"px-0",children:(0,e.jsxs)(v,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:s("Issue type")}),(0,e.jsx)(c,{children:s("Entity/item")}),(0,e.jsx)(c,{children:s("Description")})]})}),(0,e.jsx)(y,{children:u.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:z(s,m)}),(0,e.jsx)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"F");export{q as a,B as b};
1
+ import{a as N}from"./chunk-7VJPXCOU.js";import{a as v,b as w,c as y,d,e as c,f as i}from"./chunk-HCTJKP5J.js";import{a as x,e as b}from"./chunk-2IKDEUCX.js";import{d as h}from"./chunk-HJHSQPHW.js";import{a,d as p,e as I,g as R,i as g}from"./chunk-I26MS5PJ.js";var $=p(I(),1);var e=p(R(),1);var A={ERROR:"error",INFO:"info",WARN:"warning"},q=a(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:A[r.level]}},"z"),C=["error","warning","info"],O={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},S=a((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"$"),j=a((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"k"),z=a((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"V"),F=a(r=>{let n={error:0,info:0,warning:0};for(let o of r??[])n[o.level]+=1;return n},"O"),B=a(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let s=h(),[m,k]=(0,$.useState)("error"),T=F(o),u=(o??[]).filter(t=>t.level===m),E=a(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:C.map(t=>(0,e.jsxs)("button",{"aria-selected":m===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:g("size-2 rounded-sm",O[t])}),S(s,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:j(s,t,T[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(N,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(x,{className:"overflow-hidden py-0",children:(0,e.jsx)(b,{className:"px-0",children:(0,e.jsxs)(v,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:s("Issue type")}),(0,e.jsx)(c,{children:s("Entity/item")}),(0,e.jsx)(c,{children:s("Description")})]})}),(0,e.jsx)(y,{children:u.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:z(s,m)}),(0,e.jsx)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"F");export{q as a,B as b};
@@ -1,3 +1,3 @@
1
- import{a as nt}from"./chunk-FUYEZFBP.js";import{i as Pe}from"./chunk-OQ6I6OXT.js";import{a as We}from"./chunk-7G4Z6Q7X.js";import{b as Ve}from"./chunk-Q6ED4KUL.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _e}from"./chunk-DSIY2CMT.js";import{l as Te}from"./chunk-BOYS4DOC.js";import{a as Xe}from"./chunk-RWVIV3U7.js";import{a as T,e as Fe}from"./chunk-2IKDEUCX.js";import{d as j,f as Ye,g as Ze,l as Qe,p as Ne,r as et,s as tt}from"./chunk-HJHSQPHW.js";import{a as d,d as De,e as lt,f as it,g as ct,i as Ee}from"./chunk-I26MS5PJ.js";var _=De(it(),1);var M=De(lt(),1);var a=De(ct(),1);var dt=Ye(B.studioFeatures),Je={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=d(t=>{if(t===null||typeof t!="object")return;let{id:e,name:s,unsupported:n}=t;if(!(typeof e!="string"||typeof s!="string"||!Array.isArray(n)))return{id:e,name:s,unsupported:n.filter(r=>typeof r=="string")}},"dt"),ut=d(t=>{if(t===null||typeof t!="object")return Je;let e=t,s=d(n=>typeof e[n]=="boolean"?e[n]:!0,"n");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),notifications:s("notifications"),payments:s("payments"),privacy:s("privacy"),platform:mt(e.platform),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"ut"),pt={...Je,settled:!1},ft=d(()=>{let t=(0,_.c)(3),e=Te(),[s,n]=(0,M.useState)(void 0),r,o;return t[0]!==e?(r=d(()=>{let i=new AbortController;return Ne((async()=>{let l;try{l={...ut(await e.query(dt,{},Ze(""))),settled:!0}}catch{l={...Je,settled:!0}}i.signal.aborted||n({client:e,features:l})})()),()=>{i.abort()}},"a"),o=[e],t[0]=e,t[1]=r,t[2]=o):(r=t[1],o=t[2]),(0,M.useEffect)(r,o),s?.client===e?s.features:pt},"ft"),ht=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"pt"),gt=d(t=>{let e=(0,_.c)(24),{group:s}=t,n=j(),r=Pe(),o;e[0]!==s.tab||e[1]!==r?(o=d(()=>{Ne(r({to:`/${s.tab}`}))},"r"),e[0]=s.tab,e[1]=r,e[2]=o):o=e[2];let i=o,l=s.bindings.length,c;e[3]!==s.label?(c=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(ht,{}),e[5]=u):u=e[5];let p;e[6]!==c?(p=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=p):p=e[7];let m;e[8]!==l||e[9]!==n?(m=l===1?n("1 binding"):n("{count} bindings",{count:l}),e[8]=l,e[9]=n,e[10]=m):m=e[10];let f;e[11]!==m?(f=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),e[11]=m,e[12]=f):f=e[12];let h;e[13]!==l||e[14]!==s.bindings?(h=l>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=l,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==f||e[18]!==h?(g=(0,a.jsxs)(Fe,{className:"flex flex-col gap-2 py-4",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==i||e[22]!==g?(x=(0,a.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:i,children:g}),e[20]=s.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},"ht"),at=["kv","files","vectors"],xt=d((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,n)=>at.indexOf(s.tab)-at.indexOf(n.tab)),"gt"),bt=d(()=>{let t=(0,_.c)(19),e=Te(),s=ft(),n=j(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[o,i]=(0,M.useState)(r),l,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==n?(l=d(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:n("KV Namespaces"),load:d(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:n("R2 Buckets"),load:d(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:n("Vectorize Indexes"),load:d(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let k={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,k))}}catch{}})());return()=>{g.cancelled=!0}},"o"),c=[e,s.kv,s.storage,s.vectors,n],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=n,t[6]=l,t[7]=c):(l=t[6],c=t[7]),(0,M.useEffect)(l,c),o.length===0)return null;let u;t[8]!==n?(u=n("Bindings"),t[8]=n,t[9]=u):u=t[9];let p;t[10]!==u?(p=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=p):p=t[11];let m;t[12]!==o?(m=o.map(_t),t[12]=o,t[13]=m):m=t[13];let f;t[14]!==m?(f=(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:m}),t[14]=m,t[15]=f):f=t[15];let h;return t[16]!==p||t[17]!==f?(h=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[p,f]}),t[16]=p,t[17]=f,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,a.jsx)(Ve,{variant:"secondary",children:t},t)}d(yt,"bt");function vt(t){return t.binding}d(vt,"yt");function Nt(t){return t.name}d(Nt,"vt");function _t(t){return(0,a.jsx)(gt,{group:t},t.tab)}d(_t,"Nt");var kt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=d(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),St=d(t=>{let e=kt.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
1
+ import{a as nt}from"./chunk-FUYEZFBP.js";import{i as Pe}from"./chunk-OQ6I6OXT.js";import{a as We}from"./chunk-7G4Z6Q7X.js";import{b as Ve}from"./chunk-Q6ED4KUL.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _e}from"./chunk-QUXXMJPZ.js";import{l as Te}from"./chunk-BWKZ6FFW.js";import{a as Xe}from"./chunk-RWVIV3U7.js";import{a as T,e as Fe}from"./chunk-2IKDEUCX.js";import{d as j,f as Ye,g as Ze,l as Qe,p as Ne,r as et,s as tt}from"./chunk-HJHSQPHW.js";import{a as d,d as De,e as lt,f as it,g as ct,i as Ee}from"./chunk-I26MS5PJ.js";var _=De(it(),1);var M=De(lt(),1);var a=De(ct(),1);var dt=Ye(B.studioFeatures),Je={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=d(t=>{if(t===null||typeof t!="object")return;let{id:e,name:s,unsupported:n}=t;if(!(typeof e!="string"||typeof s!="string"||!Array.isArray(n)))return{id:e,name:s,unsupported:n.filter(r=>typeof r=="string")}},"dt"),ut=d(t=>{if(t===null||typeof t!="object")return Je;let e=t,s=d(n=>typeof e[n]=="boolean"?e[n]:!0,"n");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),notifications:s("notifications"),payments:s("payments"),privacy:s("privacy"),platform:mt(e.platform),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"ut"),pt={...Je,settled:!1},ft=d(()=>{let t=(0,_.c)(3),e=Te(),[s,n]=(0,M.useState)(void 0),r,o;return t[0]!==e?(r=d(()=>{let i=new AbortController;return Ne((async()=>{let l;try{l={...ut(await e.query(dt,{},Ze(""))),settled:!0}}catch{l={...Je,settled:!0}}i.signal.aborted||n({client:e,features:l})})()),()=>{i.abort()}},"a"),o=[e],t[0]=e,t[1]=r,t[2]=o):(r=t[1],o=t[2]),(0,M.useEffect)(r,o),s?.client===e?s.features:pt},"ft"),ht=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"pt"),gt=d(t=>{let e=(0,_.c)(24),{group:s}=t,n=j(),r=Pe(),o;e[0]!==s.tab||e[1]!==r?(o=d(()=>{Ne(r({to:`/${s.tab}`}))},"r"),e[0]=s.tab,e[1]=r,e[2]=o):o=e[2];let i=o,l=s.bindings.length,c;e[3]!==s.label?(c=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(ht,{}),e[5]=u):u=e[5];let p;e[6]!==c?(p=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=p):p=e[7];let m;e[8]!==l||e[9]!==n?(m=l===1?n("1 binding"):n("{count} bindings",{count:l}),e[8]=l,e[9]=n,e[10]=m):m=e[10];let f;e[11]!==m?(f=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),e[11]=m,e[12]=f):f=e[12];let h;e[13]!==l||e[14]!==s.bindings?(h=l>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=l,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==f||e[18]!==h?(g=(0,a.jsxs)(Fe,{className:"flex flex-col gap-2 py-4",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==i||e[22]!==g?(x=(0,a.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:i,children:g}),e[20]=s.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},"ht"),at=["kv","files","vectors"],xt=d((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,n)=>at.indexOf(s.tab)-at.indexOf(n.tab)),"gt"),bt=d(()=>{let t=(0,_.c)(19),e=Te(),s=ft(),n=j(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[o,i]=(0,M.useState)(r),l,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==n?(l=d(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:n("KV Namespaces"),load:d(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:n("R2 Buckets"),load:d(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:n("Vectorize Indexes"),load:d(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let k={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,k))}}catch{}})());return()=>{g.cancelled=!0}},"o"),c=[e,s.kv,s.storage,s.vectors,n],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=n,t[6]=l,t[7]=c):(l=t[6],c=t[7]),(0,M.useEffect)(l,c),o.length===0)return null;let u;t[8]!==n?(u=n("Bindings"),t[8]=n,t[9]=u):u=t[9];let p;t[10]!==u?(p=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=p):p=t[11];let m;t[12]!==o?(m=o.map(_t),t[12]=o,t[13]=m):m=t[13];let f;t[14]!==m?(f=(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:m}),t[14]=m,t[15]=f):f=t[15];let h;return t[16]!==p||t[17]!==f?(h=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[p,f]}),t[16]=p,t[17]=f,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,a.jsx)(Ve,{variant:"secondary",children:t},t)}d(yt,"bt");function vt(t){return t.binding}d(vt,"yt");function Nt(t){return t.name}d(Nt,"vt");function _t(t){return(0,a.jsx)(gt,{group:t},t.tab)}d(_t,"Nt");var kt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=d(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),St=d(t=>{let e=kt.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
- `)},"kt"),At=1500,Ct=d(()=>{let t=(0,_.c)(40),e=j(),{url:s}=Te(),n;t[0]!==s?(n=et(s),t[0]=s,t[1]=n):n=t[1];let r=n,[o,i]=(0,M.useState)(null),l,c;t[2]!==o?(l=d(()=>{if(o===null)return;let $=globalThis.setTimeout(()=>{i(null)},At);return()=>{globalThis.clearTimeout($)}},"o"),c=[o],t[2]=o,t[3]=l,t[4]=c):(l=t[3],c=t[4]),(0,M.useEffect)(l,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=d(($,O)=>{tt(O)&&i($)},"u"),t[5]=u):u=t[5];let p=u,m;t[6]!==r?(m=d(()=>{p("config",wt(r))},"d"),t[6]=r,t[7]=m):m=t[7];let f=m,h;t[8]!==r?(h=d(()=>{p("prompt",St(r))},"p"),t[8]=r,t[9]=h):h=t[9];let g=h,x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let k;t[16]!==v?(k=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=k):k=t[17];let w;t[18]!==b||t[19]!==k?(w=(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[b,k]}),t[18]=b,t[19]=k,t[20]=w):w=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=I):I=t[21];let y;t[22]!==o||t[23]!==e?(y=e(o==="config"?"Copied":"Copy MCP config"),t[22]=o,t[23]=e,t[24]=y):y=t[24];let S;t[25]!==f||t[26]!==y?(S=(0,a.jsx)(We,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=S):S=t[27];let A;t[28]!==o||t[29]!==e?(A=e(o==="prompt"?"Copied":"Copy agent prompt"),t[28]=o,t[29]=e,t[30]=A):A=t[30];let C;t[31]!==g||t[32]!==A?(C=(0,a.jsx)(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:A}),t[31]=g,t[32]=A,t[33]=C):C=t[33];let N;t[34]!==S||t[35]!==C?(N=(0,a.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[I,(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[S,C]})]}),t[34]=S,t[35]=C,t[36]=N):N=t[36];let L;return t[37]!==w||t[38]!==N?(L=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[w,N]}),t[37]=w,t[38]=N,t[39]=L):L=t[39],L},"Ct"),Lt=(0,M.lazy)(()=>import("./chunk-VFL7VJWF.js")),Mt=d((t,e)=>{if(e==null)return t("cache not enabled");let s=e.hits+e.misses;return s===0?t("no cache traffic yet"):`${Math.round(e.hits/s*100).toString()}% ${t("cache hit")}`},"$t"),He=d(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Pe"),It=d((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let n=Math.round(s/60);if(n<60)return`${String(n)}m ago`;let r=Math.round(n/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"Lt"),st=d((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let n of t)s.set(n.bucketMs,(s.get(n.bucketMs)??0)+n[e]);return[...s.entries()].toSorted(([n],[r])=>n-r).map(([,n])=>n)},"Qe"),rt=d((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),n=t.slice(0,s).reduce((i,l)=>i+l,0),r=t.slice(s).reduce((i,l)=>i+l,0);if(n===0)return null;let o=(r-n)/n*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},"He"),Oe=d(t=>{let e=(0,_.c)(24),{delta:s,footer:n,label:r,trend:o,unit:i,value:l}=t,c=j(),u;e[0]!==r?(u=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=u):u=e[1];let p;e[2]!==l?(p=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:l}),e[2]=l,e[3]=p):p=e[3];let m;e[4]!==i?(m=i!==void 0&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=m):m=e[5];let f;e[6]!==p||e[7]!==m?(f=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[p,m]}),e[6]=p,e[7]=m,e[8]=f):f=e[8];let h;e[9]!==o?(h=o!==void 0&&(0,a.jsx)(M.Suspense,{fallback:(0,a.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,a.jsx)(Lt,{data:o})}),e[9]=o,e[10]=h):h=e[10];let g;e[11]!==f||e[12]!==h?(g=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==n||e[19]!==c?(b=s==null?n!=null&&(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}):(0,a.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,a.jsx)("span",{className:Ee("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,a.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=n,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Te"),$t=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Mt"),Ue=d(t=>{let e=(0,_.c)(7),{command:s,label:n}=t,r;e[0]!==n?(r=(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:n})}),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,o]}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i},"De"),ot=d(t=>{let e=(0,_.c)(18),{count:s,onView:n,testId:r,title:o}=t,i=j(),l;e[0]!==o?(l=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s||e[3]!==i?(c=s===null?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):(0,a.jsx)(Ve,{variant:s>0?"destructive":"success",children:s>0?s:i("All clear")}),e[2]=s,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==l||e[6]!==c?(u=(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[l,c]}),e[5]=l,e[6]=c,e[7]=u):u=e[7];let p;e[8]!==i?(p=i("View"),e[8]=i,e[9]=p):p=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)($t,{}),e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==p?(f=(0,a.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:n,type:"button",children:[p,m]}),e[11]=n,e[12]=p,e[13]=f):f=e[13];let h;return e[14]!==u||e[15]!==f||e[16]!==r?(h=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[u,f]}),e[14]=u,e[15]=f,e[16]=r,e[17]=h):h=e[17],h},"Ge"),jt=d(t=>{let e=(0,_.c)(7),{functions:s}=t,n=j(),r;if(e[0]!==s||e[1]!==n){let o=[...s].toSorted(qt).slice(0,5),i;e[3]!==n?(i=n("Top functions"),e[3]=n,e[4]=i):i=e[4];let l;e[5]!==i?(l=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=l):l=e[6],r=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[l,o.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No functions called yet.")}):(0,a.jsxs)("div",{className:"divide-y divide-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,a.jsx)("span",{children:n("Function")}),(0,a.jsx)("span",{className:"text-end",children:n("Calls")}),(0,a.jsx)("span",{className:"w-12 text-end",children:n("Avg")}),(0,a.jsx)("span",{className:"w-8 text-end",children:n("Err")})]}),o.map(Kt)]})]}),e[0]=s,e[1]=n,e[2]=r}else r=e[2];return r},"It"),Tt=d(t=>{let e=(0,_.c)(26),{subs:s}=t,n=j(),r;e[0]!==n?(r=n("Live connections"),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==r?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=o):o=e[3];let i=s?.totalConnections??0,l;e[4]!==i?(l=i.toLocaleString(),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==l?(c=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==n?(u=n("sockets"),e[8]=n,e[9]=u):u=e[9];let p;e[10]!==u?(p=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=p):p=e[11];let m;e[12]!==c||e[13]!==p?(m=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,p]}),e[12]=c,e[13]=p,e[14]=m):m=e[14];let f=s?.totalSubscriptions??0,h;e[15]!==f?(h=f.toLocaleString(),e[15]=f,e[16]=h):h=e[16];let g;e[17]!==n?(g=n("active subscriptions"),e[17]=n,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==m?(b=(0,a.jsx)(T,{"data-testid":"home-live-connections",children:(0,a.jsxs)(Fe,{className:"flex flex-col gap-2.5 py-4",children:[o,m,x]})}),e[22]=x,e[23]=o,e[24]=m,e[25]=b):b=e[25],b},"Tt"),Ot=d(t=>{let e=(0,_.c)(7),{entries:s}=t,n=j(),r;if(e[0]!==s||e[1]!==n){let o=Date.now(),i;e[3]!==n?(i=n("Recent activity"),e[3]=n,e[4]=i):i=e[4];let l;e[5]!==i?(l=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=l):l=e[6],r=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[l,s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No recent activity.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,a.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:It(c.ts,o)})]},c.seq))})]}),e[0]=s,e[1]=n,e[2]=r}else r=e[2];return r},"Ot"),Rt=d(t=>{let e=t.reduce((s,n)=>s+n.calls,0);return e===0?null:t.reduce((s,n)=>s+n.totalDurationMs,0)/e},"Rt"),Yt=d(t=>{let e=(0,_.c)(149),{initialShardKey:s}=t,n=j(),r=Pe(),o=s??"",i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let l;e[1]!==o?(l={shardKey:o},e[1]=o,e[2]=l):l=e[2];let c=_e(B.getMetrics,i,l),u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let p;e[4]!==o?(p={shardKey:o},e[4]=o,e[5]=p):p=e[5];let m=_e(B.getFunctionStats,u,p),f,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},h={shardKey:""},e[6]=f,e[7]=h):(f=e[6],h=e[7]);let g=_e(B.getSecurityAudit,f,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];let v=_e(B.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let w;e[12]!==o?(w={shardKey:o},e[12]=o,e[13]=w):w=e[13];let I=_e(B.getAuditLog,k,w),y=c.data??null,S,A,C,N,L,$,O,R,q,D,P,E,K,z,V,W,F,U;if(e[14]!==I.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==m.data||e[20]!==v.data||e[21]!==n){N=Array.isArray(m.data?.functions)?m.data.functions:[],O=v.data??null;let Ae;e[40]!==I.data?(Ae=Array.isArray(I.data?.entries)?I.data.entries:[],e[40]=I.data,e[41]=Ae):Ae=e[41],A=Ae,L=c.data===void 0||m.data===void 0?null:nt(y,N).length,$=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=d(()=>{Ne(r({to:"/security"}))},"Ce"),e[42]=r,e[43]=Ce):Ce=e[43],U=Ce;let Le;e[44]!==r?(Le=d(()=>{Ne(r({to:"/insights"}))},"Ae"),e[44]=r,e[45]=Le):Le=e[45],F=Le;let Me=st(y?.history,"calls"),Ie=st(y?.history,"errors"),Ge=Rt(N),$e=Math.max(0,...N.map(zt)),je;e[46]!==y||e[47]!==n?(je=y===null?void 0:Mt(n,y.cache),e[46]=y,e[47]=n,e[48]=je):je=e[48],C=je,V="flex flex-col gap-6",W="lunora-home",P="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=rt(Me),xe;e[49]!==n?(xe=n("Requests"),e[49]=n,e[50]=xe):xe=e[50];let Ke=y?.requests??0,be;e[51]!==Ke?(be=Ke.toLocaleString(),e[51]=Ke,e[52]=be):be=e[52],e[53]!==Me||e[54]!==qe||e[55]!==xe||e[56]!==be?(K=(0,a.jsx)(Oe,{delta:qe,label:xe,trend:Me,value:be}),e[53]=Me,e[54]=qe,e[55]=xe,e[56]=be,e[57]=K):K=e[57];let ze=rt(Ie,!1),ye;e[58]!==n?(ye=n("Errors"),e[58]=n,e[59]=ye):ye=e[59];let Be=y?.errors??0,ve;e[60]!==Be?(ve=Be.toLocaleString(),e[60]=Be,e[61]=ve):ve=e[61],e[62]!==Ie||e[63]!==ze||e[64]!==ye||e[65]!==ve?(z=(0,a.jsx)(Oe,{delta:ze,label:ye,trend:Ie,value:ve}),e[62]=Ie,e[63]=ze,e[64]=ye,e[65]=ve,e[66]=z):z=e[66],S=Oe,e[67]!==$e||e[68]!==n?(R=$e>0?`${n("max")} ${He($e)}`:void 0,e[67]=$e,e[68]=n,e[69]=R):R=e[69],e[70]!==n?(q=n("Avg latency"),e[70]=n,e[71]=q):q=e[71],D=Ge===null?"\u2014":He(Ge),e[14]=I.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=m.data,e[20]=v.data,e[21]=n,e[22]=S,e[23]=A,e[24]=C,e[25]=N,e[26]=L,e[27]=$,e[28]=O,e[29]=R,e[30]=q,e[31]=D,e[32]=P,e[33]=E,e[34]=K,e[35]=z,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else S=e[22],A=e[23],C=e[24],N=e[25],L=e[26],$=e[27],O=e[28],R=e[29],q=e[30],D=e[31],P=e[32],E=e[33],K=e[34],z=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==S||e[73]!==R||e[74]!==q||e[75]!==D?(H=(0,a.jsx)(S,{footer:R,label:q,value:D}),e[72]=S,e[73]=R,e[74]=q,e[75]=D,e[76]=H):H=e[76];let J;e[77]!==n?(J=n("Database size"),e[77]=n,e[78]=J):J=e[78];let Re=y?.databaseSize??null,G;e[79]!==Re?(G=Qe(Re),e[79]=Re,e[80]=G):G=e[80];let X;e[81]!==C||e[82]!==J||e[83]!==G?(X=(0,a.jsx)(Oe,{footer:C,label:J,value:G}),e[81]=C,e[82]=J,e[83]=G,e[84]=X):X=e[84];let Y;e[85]!==P||e[86]!==E||e[87]!==K||e[88]!==z||e[89]!==H||e[90]!==X?(Y=(0,a.jsxs)("div",{className:P,"data-testid":E,children:[K,z,H,X]}),e[85]=P,e[86]=E,e[87]=K,e[88]=z,e[89]=H,e[90]=X,e[91]=Y):Y=e[91];let ke;e[92]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,a.jsx)(bt,{}),e[92]=ke):ke=e[92];let Z;e[93]!==N?(Z=(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsx)(jt,{functions:N})}),e[93]=N,e[94]=Z):Z=e[94];let Q;e[95]!==O?(Q=(0,a.jsx)(Tt,{subs:O}),e[95]=O,e[96]=Q):Q=e[96];let ee;e[97]!==A?(ee=(0,a.jsx)(Ot,{entries:A}),e[97]=A,e[98]=ee):ee=e[98];let te;e[99]!==Q||e[100]!==ee?(te=(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[Q,ee]}),e[99]=Q,e[100]=ee,e[101]=te):te=e[101];let ne;e[102]!==Z||e[103]!==te?(ne=(0,a.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[102]=Z,e[103]=te,e[104]=ne):ne=e[104];let ae;e[105]!==n?(ae=n("Advisors"),e[105]=n,e[106]=ae):ae=e[106];let se;e[107]!==ae?(se=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[107]=ae,e[108]=se):se=e[108];let re;e[109]!==L||e[110]!==$||e[111]!==n||e[112]!==F||e[113]!==U?(re=$===0&&L===0?(0,a.jsx)(Xe,{description:n("No security or performance issues detected."),icon:(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,a.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:n("No issues found")}):(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsx)(ot,{count:$,onView:U,testId:"home-security",title:n("Security findings")}),(0,a.jsx)(ot,{count:L,onView:F,testId:"home-performance",title:n("Performance issues")})]}),e[109]=L,e[110]=$,e[111]=n,e[112]=F,e[113]=U,e[114]=re):re=e[114];let oe;e[115]!==se||e[116]!==re?(oe=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,re]}),e[115]=se,e[116]=re,e[117]=oe):oe=e[117];let le;e[118]!==n?(le=n("Get connected"),e[118]=n,e[119]=le):le=e[119];let ie;e[120]!==le?(ie=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:le}),e[120]=le,e[121]=ie):ie=e[121];let ce;e[122]!==n?(ce=n("Client SDK"),e[122]=n,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,a.jsx)(Ue,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==n?(me=n("React"),e[126]=n,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,a.jsx)(Ue,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==n?(pe=n("CLI"),e[130]=n,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,a.jsx)(Ue,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let we;e[138]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(Ct,{}),e[138]=we):we=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,we]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let Se;return e[142]!==V||e[143]!==W||e[144]!==Y||e[145]!==ne||e[146]!==oe||e[147]!==ge?(Se=(0,a.jsxs)("div",{className:V,"data-testid":W,children:[Y,ke,ne,oe,ge]}),e[142]=V,e[143]=W,e[144]=Y,e[145]=ne,e[146]=oe,e[147]=ge,e[148]=Se):Se=e[148],Se},"Xt");function qt(t,e){return e.calls-t.calls}d(qt,"Et");function Kt(t){return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,a.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,a.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,a.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:He(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,a.jsx)("span",{className:Ee("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}d(Kt,"jt");function zt(t){return t.maxDurationMs}d(zt,"Bt");export{ft as a,Yt as b};
3
+ `)},"kt"),At=1500,Ct=d(()=>{let t=(0,_.c)(40),e=j(),{url:s}=Te(),n;t[0]!==s?(n=et(s),t[0]=s,t[1]=n):n=t[1];let r=n,[o,i]=(0,M.useState)(null),l,c;t[2]!==o?(l=d(()=>{if(o===null)return;let $=globalThis.setTimeout(()=>{i(null)},At);return()=>{globalThis.clearTimeout($)}},"o"),c=[o],t[2]=o,t[3]=l,t[4]=c):(l=t[3],c=t[4]),(0,M.useEffect)(l,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=d(($,O)=>{tt(O)&&i($)},"u"),t[5]=u):u=t[5];let p=u,m;t[6]!==r?(m=d(()=>{p("config",wt(r))},"d"),t[6]=r,t[7]=m):m=t[7];let f=m,h;t[8]!==r?(h=d(()=>{p("prompt",St(r))},"p"),t[8]=r,t[9]=h):h=t[9];let g=h,x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let k;t[16]!==v?(k=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=k):k=t[17];let w;t[18]!==b||t[19]!==k?(w=(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[b,k]}),t[18]=b,t[19]=k,t[20]=w):w=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=I):I=t[21];let y;t[22]!==o||t[23]!==e?(y=e(o==="config"?"Copied":"Copy MCP config"),t[22]=o,t[23]=e,t[24]=y):y=t[24];let S;t[25]!==f||t[26]!==y?(S=(0,a.jsx)(We,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=S):S=t[27];let A;t[28]!==o||t[29]!==e?(A=e(o==="prompt"?"Copied":"Copy agent prompt"),t[28]=o,t[29]=e,t[30]=A):A=t[30];let C;t[31]!==g||t[32]!==A?(C=(0,a.jsx)(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:A}),t[31]=g,t[32]=A,t[33]=C):C=t[33];let N;t[34]!==S||t[35]!==C?(N=(0,a.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[I,(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[S,C]})]}),t[34]=S,t[35]=C,t[36]=N):N=t[36];let L;return t[37]!==w||t[38]!==N?(L=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[w,N]}),t[37]=w,t[38]=N,t[39]=L):L=t[39],L},"Ct"),Lt=(0,M.lazy)(()=>import("./chunk-UPO3FC7D.js")),Mt=d((t,e)=>{if(e==null)return t("cache not enabled");let s=e.hits+e.misses;return s===0?t("no cache traffic yet"):`${Math.round(e.hits/s*100).toString()}% ${t("cache hit")}`},"$t"),He=d(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Pe"),It=d((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let n=Math.round(s/60);if(n<60)return`${String(n)}m ago`;let r=Math.round(n/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"Lt"),st=d((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let n of t)s.set(n.bucketMs,(s.get(n.bucketMs)??0)+n[e]);return[...s.entries()].toSorted(([n],[r])=>n-r).map(([,n])=>n)},"Qe"),rt=d((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),n=t.slice(0,s).reduce((i,l)=>i+l,0),r=t.slice(s).reduce((i,l)=>i+l,0);if(n===0)return null;let o=(r-n)/n*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},"He"),Oe=d(t=>{let e=(0,_.c)(24),{delta:s,footer:n,label:r,trend:o,unit:i,value:l}=t,c=j(),u;e[0]!==r?(u=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=u):u=e[1];let p;e[2]!==l?(p=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:l}),e[2]=l,e[3]=p):p=e[3];let m;e[4]!==i?(m=i!==void 0&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=m):m=e[5];let f;e[6]!==p||e[7]!==m?(f=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[p,m]}),e[6]=p,e[7]=m,e[8]=f):f=e[8];let h;e[9]!==o?(h=o!==void 0&&(0,a.jsx)(M.Suspense,{fallback:(0,a.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,a.jsx)(Lt,{data:o})}),e[9]=o,e[10]=h):h=e[10];let g;e[11]!==f||e[12]!==h?(g=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==n||e[19]!==c?(b=s==null?n!=null&&(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}):(0,a.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,a.jsx)("span",{className:Ee("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,a.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=n,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Te"),$t=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Mt"),Ue=d(t=>{let e=(0,_.c)(7),{command:s,label:n}=t,r;e[0]!==n?(r=(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:n})}),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,o]}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i},"De"),ot=d(t=>{let e=(0,_.c)(18),{count:s,onView:n,testId:r,title:o}=t,i=j(),l;e[0]!==o?(l=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s||e[3]!==i?(c=s===null?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):(0,a.jsx)(Ve,{variant:s>0?"destructive":"success",children:s>0?s:i("All clear")}),e[2]=s,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==l||e[6]!==c?(u=(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[l,c]}),e[5]=l,e[6]=c,e[7]=u):u=e[7];let p;e[8]!==i?(p=i("View"),e[8]=i,e[9]=p):p=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)($t,{}),e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==p?(f=(0,a.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:n,type:"button",children:[p,m]}),e[11]=n,e[12]=p,e[13]=f):f=e[13];let h;return e[14]!==u||e[15]!==f||e[16]!==r?(h=(0,a.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[u,f]}),e[14]=u,e[15]=f,e[16]=r,e[17]=h):h=e[17],h},"Ge"),jt=d(t=>{let e=(0,_.c)(7),{functions:s}=t,n=j(),r;if(e[0]!==s||e[1]!==n){let o=[...s].toSorted(qt).slice(0,5),i;e[3]!==n?(i=n("Top functions"),e[3]=n,e[4]=i):i=e[4];let l;e[5]!==i?(l=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=l):l=e[6],r=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[l,o.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No functions called yet.")}):(0,a.jsxs)("div",{className:"divide-y divide-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,a.jsx)("span",{children:n("Function")}),(0,a.jsx)("span",{className:"text-end",children:n("Calls")}),(0,a.jsx)("span",{className:"w-12 text-end",children:n("Avg")}),(0,a.jsx)("span",{className:"w-8 text-end",children:n("Err")})]}),o.map(Kt)]})]}),e[0]=s,e[1]=n,e[2]=r}else r=e[2];return r},"It"),Tt=d(t=>{let e=(0,_.c)(26),{subs:s}=t,n=j(),r;e[0]!==n?(r=n("Live connections"),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==r?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=o):o=e[3];let i=s?.totalConnections??0,l;e[4]!==i?(l=i.toLocaleString(),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==l?(c=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==n?(u=n("sockets"),e[8]=n,e[9]=u):u=e[9];let p;e[10]!==u?(p=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=p):p=e[11];let m;e[12]!==c||e[13]!==p?(m=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,p]}),e[12]=c,e[13]=p,e[14]=m):m=e[14];let f=s?.totalSubscriptions??0,h;e[15]!==f?(h=f.toLocaleString(),e[15]=f,e[16]=h):h=e[16];let g;e[17]!==n?(g=n("active subscriptions"),e[17]=n,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==m?(b=(0,a.jsx)(T,{"data-testid":"home-live-connections",children:(0,a.jsxs)(Fe,{className:"flex flex-col gap-2.5 py-4",children:[o,m,x]})}),e[22]=x,e[23]=o,e[24]=m,e[25]=b):b=e[25],b},"Tt"),Ot=d(t=>{let e=(0,_.c)(7),{entries:s}=t,n=j(),r;if(e[0]!==s||e[1]!==n){let o=Date.now(),i;e[3]!==n?(i=n("Recent activity"),e[3]=n,e[4]=i):i=e[4];let l;e[5]!==i?(l=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=l):l=e[6],r=(0,a.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[l,s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No recent activity.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,a.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:It(c.ts,o)})]},c.seq))})]}),e[0]=s,e[1]=n,e[2]=r}else r=e[2];return r},"Ot"),Rt=d(t=>{let e=t.reduce((s,n)=>s+n.calls,0);return e===0?null:t.reduce((s,n)=>s+n.totalDurationMs,0)/e},"Rt"),Yt=d(t=>{let e=(0,_.c)(149),{initialShardKey:s}=t,n=j(),r=Pe(),o=s??"",i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let l;e[1]!==o?(l={shardKey:o},e[1]=o,e[2]=l):l=e[2];let c=_e(B.getMetrics,i,l),u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let p;e[4]!==o?(p={shardKey:o},e[4]=o,e[5]=p):p=e[5];let m=_e(B.getFunctionStats,u,p),f,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},h={shardKey:""},e[6]=f,e[7]=h):(f=e[6],h=e[7]);let g=_e(B.getSecurityAudit,f,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];let v=_e(B.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let w;e[12]!==o?(w={shardKey:o},e[12]=o,e[13]=w):w=e[13];let I=_e(B.getAuditLog,k,w),y=c.data??null,S,A,C,N,L,$,O,R,q,D,P,E,K,z,V,W,F,U;if(e[14]!==I.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==m.data||e[20]!==v.data||e[21]!==n){N=Array.isArray(m.data?.functions)?m.data.functions:[],O=v.data??null;let Ae;e[40]!==I.data?(Ae=Array.isArray(I.data?.entries)?I.data.entries:[],e[40]=I.data,e[41]=Ae):Ae=e[41],A=Ae,L=c.data===void 0||m.data===void 0?null:nt(y,N).length,$=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=d(()=>{Ne(r({to:"/security"}))},"Ce"),e[42]=r,e[43]=Ce):Ce=e[43],U=Ce;let Le;e[44]!==r?(Le=d(()=>{Ne(r({to:"/insights"}))},"Ae"),e[44]=r,e[45]=Le):Le=e[45],F=Le;let Me=st(y?.history,"calls"),Ie=st(y?.history,"errors"),Ge=Rt(N),$e=Math.max(0,...N.map(zt)),je;e[46]!==y||e[47]!==n?(je=y===null?void 0:Mt(n,y.cache),e[46]=y,e[47]=n,e[48]=je):je=e[48],C=je,V="flex flex-col gap-6",W="lunora-home",P="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=rt(Me),xe;e[49]!==n?(xe=n("Requests"),e[49]=n,e[50]=xe):xe=e[50];let Ke=y?.requests??0,be;e[51]!==Ke?(be=Ke.toLocaleString(),e[51]=Ke,e[52]=be):be=e[52],e[53]!==Me||e[54]!==qe||e[55]!==xe||e[56]!==be?(K=(0,a.jsx)(Oe,{delta:qe,label:xe,trend:Me,value:be}),e[53]=Me,e[54]=qe,e[55]=xe,e[56]=be,e[57]=K):K=e[57];let ze=rt(Ie,!1),ye;e[58]!==n?(ye=n("Errors"),e[58]=n,e[59]=ye):ye=e[59];let Be=y?.errors??0,ve;e[60]!==Be?(ve=Be.toLocaleString(),e[60]=Be,e[61]=ve):ve=e[61],e[62]!==Ie||e[63]!==ze||e[64]!==ye||e[65]!==ve?(z=(0,a.jsx)(Oe,{delta:ze,label:ye,trend:Ie,value:ve}),e[62]=Ie,e[63]=ze,e[64]=ye,e[65]=ve,e[66]=z):z=e[66],S=Oe,e[67]!==$e||e[68]!==n?(R=$e>0?`${n("max")} ${He($e)}`:void 0,e[67]=$e,e[68]=n,e[69]=R):R=e[69],e[70]!==n?(q=n("Avg latency"),e[70]=n,e[71]=q):q=e[71],D=Ge===null?"\u2014":He(Ge),e[14]=I.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=m.data,e[20]=v.data,e[21]=n,e[22]=S,e[23]=A,e[24]=C,e[25]=N,e[26]=L,e[27]=$,e[28]=O,e[29]=R,e[30]=q,e[31]=D,e[32]=P,e[33]=E,e[34]=K,e[35]=z,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else S=e[22],A=e[23],C=e[24],N=e[25],L=e[26],$=e[27],O=e[28],R=e[29],q=e[30],D=e[31],P=e[32],E=e[33],K=e[34],z=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==S||e[73]!==R||e[74]!==q||e[75]!==D?(H=(0,a.jsx)(S,{footer:R,label:q,value:D}),e[72]=S,e[73]=R,e[74]=q,e[75]=D,e[76]=H):H=e[76];let J;e[77]!==n?(J=n("Database size"),e[77]=n,e[78]=J):J=e[78];let Re=y?.databaseSize??null,G;e[79]!==Re?(G=Qe(Re),e[79]=Re,e[80]=G):G=e[80];let X;e[81]!==C||e[82]!==J||e[83]!==G?(X=(0,a.jsx)(Oe,{footer:C,label:J,value:G}),e[81]=C,e[82]=J,e[83]=G,e[84]=X):X=e[84];let Y;e[85]!==P||e[86]!==E||e[87]!==K||e[88]!==z||e[89]!==H||e[90]!==X?(Y=(0,a.jsxs)("div",{className:P,"data-testid":E,children:[K,z,H,X]}),e[85]=P,e[86]=E,e[87]=K,e[88]=z,e[89]=H,e[90]=X,e[91]=Y):Y=e[91];let ke;e[92]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,a.jsx)(bt,{}),e[92]=ke):ke=e[92];let Z;e[93]!==N?(Z=(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsx)(jt,{functions:N})}),e[93]=N,e[94]=Z):Z=e[94];let Q;e[95]!==O?(Q=(0,a.jsx)(Tt,{subs:O}),e[95]=O,e[96]=Q):Q=e[96];let ee;e[97]!==A?(ee=(0,a.jsx)(Ot,{entries:A}),e[97]=A,e[98]=ee):ee=e[98];let te;e[99]!==Q||e[100]!==ee?(te=(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[Q,ee]}),e[99]=Q,e[100]=ee,e[101]=te):te=e[101];let ne;e[102]!==Z||e[103]!==te?(ne=(0,a.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[102]=Z,e[103]=te,e[104]=ne):ne=e[104];let ae;e[105]!==n?(ae=n("Advisors"),e[105]=n,e[106]=ae):ae=e[106];let se;e[107]!==ae?(se=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[107]=ae,e[108]=se):se=e[108];let re;e[109]!==L||e[110]!==$||e[111]!==n||e[112]!==F||e[113]!==U?(re=$===0&&L===0?(0,a.jsx)(Xe,{description:n("No security or performance issues detected."),icon:(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,a.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:n("No issues found")}):(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsx)(ot,{count:$,onView:U,testId:"home-security",title:n("Security findings")}),(0,a.jsx)(ot,{count:L,onView:F,testId:"home-performance",title:n("Performance issues")})]}),e[109]=L,e[110]=$,e[111]=n,e[112]=F,e[113]=U,e[114]=re):re=e[114];let oe;e[115]!==se||e[116]!==re?(oe=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,re]}),e[115]=se,e[116]=re,e[117]=oe):oe=e[117];let le;e[118]!==n?(le=n("Get connected"),e[118]=n,e[119]=le):le=e[119];let ie;e[120]!==le?(ie=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:le}),e[120]=le,e[121]=ie):ie=e[121];let ce;e[122]!==n?(ce=n("Client SDK"),e[122]=n,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,a.jsx)(Ue,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==n?(me=n("React"),e[126]=n,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,a.jsx)(Ue,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==n?(pe=n("CLI"),e[130]=n,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,a.jsx)(Ue,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let we;e[138]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(Ct,{}),e[138]=we):we=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,we]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let Se;return e[142]!==V||e[143]!==W||e[144]!==Y||e[145]!==ne||e[146]!==oe||e[147]!==ge?(Se=(0,a.jsxs)("div",{className:V,"data-testid":W,children:[Y,ke,ne,oe,ge]}),e[142]=V,e[143]=W,e[144]=Y,e[145]=ne,e[146]=oe,e[147]=ge,e[148]=Se):Se=e[148],Se},"Xt");function qt(t,e){return e.calls-t.calls}d(qt,"Et");function Kt(t){return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,a.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,a.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,a.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:He(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,a.jsx)("span",{className:Ee("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}d(Kt,"jt");function zt(t){return t.maxDurationMs}d(zt,"Bt");export{ft as a,Yt as b};
@@ -1 +1 @@
1
- import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-MTGFTTXO.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-6HLARDYO.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import"./chunk-N7LJO732.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,p as ge}from"./chunk-HJHSQPHW.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
1
+ import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-CY7FSXYX.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-6HLARDYO.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import"./chunk-DYR23C3V.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,p as ge}from"./chunk-HJHSQPHW.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
@@ -1 +1 @@
1
- import{a as q}from"./chunk-JQXA2OYK.js";import{a as F}from"./chunk-R6U22RSY.js";import{a as D}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as S}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as L}from"./chunk-3YH5TM3G.js";import"./chunk-NCPW7WHO.js";import"./chunk-WP2AS7SZ.js";import"./chunk-55UGUCQ6.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-DSIY2CMT.js";import"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import"./chunk-N7LJO732.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-HCTJKP5J.js";import{a as M,e as T}from"./chunk-2IKDEUCX.js";import{d as A,m as E}from"./chunk-HJHSQPHW.js";import{a as N,d as j,f as H,g as U}from"./chunk-I26MS5PJ.js";var R=j(H(),1);var t=j(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=A(),{queryShardKey:l,setShardKey:i,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:u,refetch:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==o||e[4]!==u||e[5]!==s||e[6]!==i||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==i||e[11]!==m?(c=(0,t.jsx)(D,{onChange:i,testId:"subs-shard-input",value:m}),e[10]=i,e[11]=m,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==u?(v=o!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=o,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)($,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(M,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=u,e[5]=s,e[6]=i,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
1
+ import{a as q}from"./chunk-JQXA2OYK.js";import{a as F}from"./chunk-R6U22RSY.js";import{a as D}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as S}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as L}from"./chunk-7VJPXCOU.js";import"./chunk-NCPW7WHO.js";import"./chunk-3S4PZ7KQ.js";import"./chunk-55UGUCQ6.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-QUXXMJPZ.js";import"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import"./chunk-DYR23C3V.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-HCTJKP5J.js";import{a as M,e as T}from"./chunk-2IKDEUCX.js";import{d as A,m as E}from"./chunk-HJHSQPHW.js";import{a as N,d as j,f as H,g as U}from"./chunk-I26MS5PJ.js";var R=j(H(),1);var t=j(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=A(),{queryShardKey:l,setShardKey:i,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:u,refetch:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==o||e[4]!==u||e[5]!==s||e[6]!==i||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==i||e[11]!==m?(c=(0,t.jsx)(D,{onChange:i,testId:"subs-shard-input",value:m}),e[10]=i,e[11]=m,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==u?(v=o!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=o,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)($,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(M,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=u,e[5]=s,e[6]=i,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
@@ -1 +1 @@
1
- import{a as Ze}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Xe}from"./chunk-FPI7AMQJ.js";import{a as Ye}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{a as Ve}from"./chunk-XHRKNCCI.js";import{i as Pe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as le}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as de}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ke}from"./chunk-3YH5TM3G.js";import{a as He}from"./chunk-NCPW7WHO.js";import"./chunk-WP2AS7SZ.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-DSIY2CMT.js";import{l as ze}from"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import"./chunk-N7LJO732.js";import{a as ie}from"./chunk-RWVIV3U7.js";import{a as Te,b as _e,c as Be,d as z,e as C,f as w}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ae}from"./chunk-2IKDEUCX.js";import{d as F,f as ce,g as ue,h as H,m as Ue,p as me,t as Ge}from"./chunk-HJHSQPHW.js";import{a as c,d as Ee,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Ee(ut(),1);var Q=Ee(ct(),1);var t=Ee(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),De="topic:",$e=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Ae"),tt=c(n=>`${De}${n}`,"We"),ht=c((n,e)=>n.startsWith(De)?(e.get(n.slice(De.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ce(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ue(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:H(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ce(W.replayQueueMessage),Nt=ce(W.clearQueueMessages),et=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Ue)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>et?`${n.slice(0,et)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),at=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"Ge"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=$e(d),m;e[4]!==r?(m=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(ie,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Queue")}),(0,t.jsx)(C,{children:r("Mode")}),(0,t.jsx)(C,{children:r("Binding")}),(0,t.jsx)(C,{children:r("Dead-letter")})]})}),(0,t.jsxs)(Be,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(Q.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let P=bt(a.body);o=z,f=`queues-message-${a.id}`;let U=a.exportName??a.queue;e[19]!==U?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:U}),e[19]=U,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let L=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=vt(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let I;e[27]!==a.outcome||e[28]!==L||e[29]!==T?(I=(0,t.jsx)(de,{"data-testid":L,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=L,e[29]=T,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=P,p=qt(P),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let q;e[43]!==a.capturedAt?(q=Ge(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let v=`queues-replay-${a.id}`,E=r!==null,M;e[47]!==a.id||e[48]!==r||e[49]!==s?(M=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=M):M=e[50];let A;e[51]!==a.id||e[52]!==d||e[53]!==v||e[54]!==E||e[55]!==M?(A=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":v,disabled:E,onClick:d,size:"xs",type:"button",variant:"outline",children:M})}),e[51]=a.id,e[52]=d,e[53]=v,e[54]=E,e[55]=M,e[56]=A):A=e[56];let $;return e[57]!==o||e[58]!==b||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?($=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,b,A]}),e[57]=o,e[58]=b,e[59]=A,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=$):$=e[66],$},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ve,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(ie,{description:o("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:o("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsx)(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:o("Export")}),(0,t.jsx)(C,{children:o("Message")}),(0,t.jsx)(C,{children:o("Attempts")}),(0,t.jsx)(C,{children:o("Outcome")}),(0,t.jsx)(C,{children:o("Body")}),(0,t.jsx)(C,{children:o("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:d.map(b=>(0,t.jsx)(Ct,{message:b,onReplay:s,replayingId:l},b.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let q;return e[26]!==N||e[27]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=q):q=e[28],q},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(ie,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...$e(p).topics].map(b=>{let[v,E]=b;return(0,t.jsx)("option",{value:tt(v),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:E.length,topic:v})},v)})]}),(0,t.jsx)(Pe,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Xe,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let q;return e[17]!==N||e[18]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=q):q=e[19],q},"_t"),Yt=c(n=>{let e=(0,D.c)(57),{limit:a}=n,d=a??gt,r=ze(),s=F(),[l,o]=(0,Q.useState)("declared"),[m,i]=(0,Q.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Le(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:q,refetch:b}=Le(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],E=N?.entries??[],{deadLetteredCount:M,queuesWithoutDlq:A,showReliabilityWarning:$}=pt(v,E),[P,U]=(0,Q.useState)(""),[L,T]=(0,Q.useState)(""),[I,_]=(0,Q.useState)(""),[G,st]=(0,Q.useState)(!1),[pe,ke]=(0,Q.useState)(!1),[he,Oe]=(0,Q.useState)(null),{topics:Re}=$e(v),Je=[...v.map(Tt),...[...Re.keys()].map(_t)],K=Je.includes(P)?P:Je[0]??"",je=l==="messages"?y:x,nt=l==="messages"?q:u,ge=je??m,fe=je===null?m:nt,V;e[3]!==b?(V=c(()=>{b()},"V"),e[3]=b,e[4]=V):V=e[4],Ye(V,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,Fe=L.trim();if(Fe!=="")try{S=JSON.parse(Fe)}catch{i(s("Body must be valid JSON."));return}let Qe,We=I.trim();if(We!==""){let B=Number(We);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Qe=B}if(G&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}ke(!0);let it=ht(g,Re).map(B=>G?{batch:S,delaySeconds:Qe,exportName:B}:{body:S,delaySeconds:Qe,exportName:B});try{i(await xt(r,it,s)),b()}catch(B){i(H(B))}ke(!1)},"Ve"),X;e[5]!==r||e[6]!==b?(X=c(async g=>{i(null),Oe(g);try{await r.query(yt,{id:g},ue("")),b()}catch(S){i(H(S))}Oe(null)},"X"),e[5]=r,e[6]=b,e[7]=X):X=e[7];let xe=X,Y;e[8]!==r||e[9]!==b?(Y=c(async()=>{i(null);try{await r.query(Nt,{},ue("")),b()}catch(g){i(H(g))}},"Y"),e[8]=r,e[9]=b,e[10]=Y):Y=e[10];let ye=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"K"),e[11]=Z):Z=e[11];let ot=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{U(g.currentTarget.value)},"Z"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{T(g.currentTarget.value)},"ee"),e[13]=te):te=e[13];let be=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{_(g.currentTarget.value)},"te"),e[14]=ae):ae=e[14];let qe=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{st(g.currentTarget.checked)},"se"),e[15]=se):se=e[15];let ve=se,Se=c(()=>{me(rt())},"xe"),ne;e[16]!==xe?(ne=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&me(xe(S))},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,re;e[18]!==ye?(re=c(()=>{me(ye())},"re"),e[18]=ye,e[19]=re):re=e[19];let Ce=re,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[20]!==s||e[21]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(le,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[20]=s,e[21]=l,e[22]=k):k=e[22];let O;e[23]!==ge||e[24]!==fe?(O=ge!==null&&(0,t.jsx)(Ke,{error:fe,testId:"queues-error"}),e[23]=ge,e[24]=fe,e[25]=O):O=e[25];let Ie=$&&(0,t.jsx)(He,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[A.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:A.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),M>0&&(0,t.jsx)("p",{className:A.length>0?"text-muted-foreground":"font-medium",children:M===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:M})})]})}),R;e[26]!==v||e[27]!==f||e[28]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[26]=v,e[27]=f,e[28]=l,e[29]=R):R=e[29];let J;e[30]!==E||e[31]!==y||e[32]!==Ce||e[33]!==we||e[34]!==he||e[35]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:E,onClear:Ce,onReplay:we,replayingId:he}),e[30]=E,e[31]=y,e[32]=Ce,e[33]=we,e[34]=he,e[35]=l,e[36]=J):J=e[36];let j;e[37]!==G||e[38]!==L||e[39]!==I||e[40]!==ve||e[41]!==be||e[42]!==qe||e[43]!==Ne||e[44]!==Se||e[45]!==v||e[46]!==K||e[47]!==pe||e[48]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:G,bodyText:L,delayText:I,onBatchModeChange:ve,onBodyChange:be,onDelayChange:qe,onSelectExport:Ne,onSend:Se,queues:v,selectedExportName:K,sending:pe}),e[37]=G,e[38]=L,e[39]=I,e[40]=ve,e[41]=be,e[42]=qe,e[43]=Ne,e[44]=Se,e[45]=v,e[46]=K,e[47]=pe,e[48]=l,e[49]=j):j=e[49];let oe;return e[50]!==k||e[51]!==O||e[52]!==Ie||e[53]!==R||e[54]!==J||e[55]!==j?(oe=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ie,R,J,j]}),e[50]=k,e[51]=O,e[52]=Ie,e[53]=R,e[54]=J,e[55]=j,e[56]=oe):oe=e[56],oe},"es");function Et(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return tt(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
1
+ import{a as Ze}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Xe}from"./chunk-FPI7AMQJ.js";import{a as Ye}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{a as Ve}from"./chunk-XHRKNCCI.js";import{i as Pe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as le}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as de}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ke}from"./chunk-7VJPXCOU.js";import{a as He}from"./chunk-NCPW7WHO.js";import"./chunk-3S4PZ7KQ.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-QUXXMJPZ.js";import{l as ze}from"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import"./chunk-DYR23C3V.js";import{a as ie}from"./chunk-RWVIV3U7.js";import{a as Te,b as _e,c as Be,d as z,e as C,f as w}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ae}from"./chunk-2IKDEUCX.js";import{d as F,f as ce,g as ue,h as H,m as Ue,p as me,t as Ge}from"./chunk-HJHSQPHW.js";import{a as c,d as Ee,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Ee(ut(),1);var Q=Ee(ct(),1);var t=Ee(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),De="topic:",$e=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Ae"),tt=c(n=>`${De}${n}`,"We"),ht=c((n,e)=>n.startsWith(De)?(e.get(n.slice(De.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ce(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ue(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:H(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ce(W.replayQueueMessage),Nt=ce(W.clearQueueMessages),et=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Ue)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>et?`${n.slice(0,et)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),at=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"Ge"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=$e(d),m;e[4]!==r?(m=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(ie,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Queue")}),(0,t.jsx)(C,{children:r("Mode")}),(0,t.jsx)(C,{children:r("Binding")}),(0,t.jsx)(C,{children:r("Dead-letter")})]})}),(0,t.jsxs)(Be,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(Q.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let P=bt(a.body);o=z,f=`queues-message-${a.id}`;let U=a.exportName??a.queue;e[19]!==U?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:U}),e[19]=U,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let L=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=vt(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let I;e[27]!==a.outcome||e[28]!==L||e[29]!==T?(I=(0,t.jsx)(de,{"data-testid":L,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=L,e[29]=T,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=P,p=qt(P),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let q;e[43]!==a.capturedAt?(q=Ge(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let v=`queues-replay-${a.id}`,E=r!==null,M;e[47]!==a.id||e[48]!==r||e[49]!==s?(M=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=M):M=e[50];let A;e[51]!==a.id||e[52]!==d||e[53]!==v||e[54]!==E||e[55]!==M?(A=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":v,disabled:E,onClick:d,size:"xs",type:"button",variant:"outline",children:M})}),e[51]=a.id,e[52]=d,e[53]=v,e[54]=E,e[55]=M,e[56]=A):A=e[56];let $;return e[57]!==o||e[58]!==b||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?($=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,b,A]}),e[57]=o,e[58]=b,e[59]=A,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=$):$=e[66],$},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ve,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(ie,{description:o("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:o("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsx)(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:o("Export")}),(0,t.jsx)(C,{children:o("Message")}),(0,t.jsx)(C,{children:o("Attempts")}),(0,t.jsx)(C,{children:o("Outcome")}),(0,t.jsx)(C,{children:o("Body")}),(0,t.jsx)(C,{children:o("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:d.map(b=>(0,t.jsx)(Ct,{message:b,onReplay:s,replayingId:l},b.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let q;return e[26]!==N||e[27]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=q):q=e[28],q},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(ie,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...$e(p).topics].map(b=>{let[v,E]=b;return(0,t.jsx)("option",{value:tt(v),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:E.length,topic:v})},v)})]}),(0,t.jsx)(Pe,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Xe,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let q;return e[17]!==N||e[18]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=q):q=e[19],q},"_t"),Yt=c(n=>{let e=(0,D.c)(57),{limit:a}=n,d=a??gt,r=ze(),s=F(),[l,o]=(0,Q.useState)("declared"),[m,i]=(0,Q.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Le(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:q,refetch:b}=Le(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],E=N?.entries??[],{deadLetteredCount:M,queuesWithoutDlq:A,showReliabilityWarning:$}=pt(v,E),[P,U]=(0,Q.useState)(""),[L,T]=(0,Q.useState)(""),[I,_]=(0,Q.useState)(""),[G,st]=(0,Q.useState)(!1),[pe,ke]=(0,Q.useState)(!1),[he,Oe]=(0,Q.useState)(null),{topics:Re}=$e(v),Je=[...v.map(Tt),...[...Re.keys()].map(_t)],K=Je.includes(P)?P:Je[0]??"",je=l==="messages"?y:x,nt=l==="messages"?q:u,ge=je??m,fe=je===null?m:nt,V;e[3]!==b?(V=c(()=>{b()},"V"),e[3]=b,e[4]=V):V=e[4],Ye(V,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,Fe=L.trim();if(Fe!=="")try{S=JSON.parse(Fe)}catch{i(s("Body must be valid JSON."));return}let Qe,We=I.trim();if(We!==""){let B=Number(We);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Qe=B}if(G&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}ke(!0);let it=ht(g,Re).map(B=>G?{batch:S,delaySeconds:Qe,exportName:B}:{body:S,delaySeconds:Qe,exportName:B});try{i(await xt(r,it,s)),b()}catch(B){i(H(B))}ke(!1)},"Ve"),X;e[5]!==r||e[6]!==b?(X=c(async g=>{i(null),Oe(g);try{await r.query(yt,{id:g},ue("")),b()}catch(S){i(H(S))}Oe(null)},"X"),e[5]=r,e[6]=b,e[7]=X):X=e[7];let xe=X,Y;e[8]!==r||e[9]!==b?(Y=c(async()=>{i(null);try{await r.query(Nt,{},ue("")),b()}catch(g){i(H(g))}},"Y"),e[8]=r,e[9]=b,e[10]=Y):Y=e[10];let ye=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"K"),e[11]=Z):Z=e[11];let ot=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{U(g.currentTarget.value)},"Z"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{T(g.currentTarget.value)},"ee"),e[13]=te):te=e[13];let be=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{_(g.currentTarget.value)},"te"),e[14]=ae):ae=e[14];let qe=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{st(g.currentTarget.checked)},"se"),e[15]=se):se=e[15];let ve=se,Se=c(()=>{me(rt())},"xe"),ne;e[16]!==xe?(ne=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&me(xe(S))},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,re;e[18]!==ye?(re=c(()=>{me(ye())},"re"),e[18]=ye,e[19]=re):re=e[19];let Ce=re,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[20]!==s||e[21]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(le,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[20]=s,e[21]=l,e[22]=k):k=e[22];let O;e[23]!==ge||e[24]!==fe?(O=ge!==null&&(0,t.jsx)(Ke,{error:fe,testId:"queues-error"}),e[23]=ge,e[24]=fe,e[25]=O):O=e[25];let Ie=$&&(0,t.jsx)(He,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[A.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:A.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),M>0&&(0,t.jsx)("p",{className:A.length>0?"text-muted-foreground":"font-medium",children:M===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:M})})]})}),R;e[26]!==v||e[27]!==f||e[28]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[26]=v,e[27]=f,e[28]=l,e[29]=R):R=e[29];let J;e[30]!==E||e[31]!==y||e[32]!==Ce||e[33]!==we||e[34]!==he||e[35]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:E,onClear:Ce,onReplay:we,replayingId:he}),e[30]=E,e[31]=y,e[32]=Ce,e[33]=we,e[34]=he,e[35]=l,e[36]=J):J=e[36];let j;e[37]!==G||e[38]!==L||e[39]!==I||e[40]!==ve||e[41]!==be||e[42]!==qe||e[43]!==Ne||e[44]!==Se||e[45]!==v||e[46]!==K||e[47]!==pe||e[48]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:G,bodyText:L,delayText:I,onBatchModeChange:ve,onBodyChange:be,onDelayChange:qe,onSelectExport:Ne,onSend:Se,queues:v,selectedExportName:K,sending:pe}),e[37]=G,e[38]=L,e[39]=I,e[40]=ve,e[41]=be,e[42]=qe,e[43]=Ne,e[44]=Se,e[45]=v,e[46]=K,e[47]=pe,e[48]=l,e[49]=j):j=e[49];let oe;return e[50]!==k||e[51]!==O||e[52]!==Ie||e[53]!==R||e[54]!==J||e[55]!==j?(oe=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ie,R,J,j]}),e[50]=k,e[51]=O,e[52]=Ie,e[53]=R,e[54]=J,e[55]=j,e[56]=oe):oe=e[56],oe},"es");function Et(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return tt(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-NCPW7WHO.js";import{a as T}from"./chunk-WP2AS7SZ.js";import{b as E}from"./chunk-55UGUCQ6.js";import{b as A}from"./chunk-N7LJO732.js";import{d as H,h as I,j as O,k as S}from"./chunk-HJHSQPHW.js";import{a as C,d as q,f as _,g as z}from"./chunk-I26MS5PJ.js";var K=q(_(),1);var l=q(z(),1);var P=C(U=>{let e=(0,K.c)(42),{className:y,error:t,testId:g}=U,k=H(),r=E(),n,i,a,c,m,p,o,s,d;if(e[0]!==y||e[1]!==t||e[2]!==r||e[3]!==g){let V=O(t),b;e[13]!==t?(b=S(t),e[13]=t,e[14]=b):b=e[14],i=b;let v;e[15]!==t?(v=T(t),e[15]=t,e[16]=v):v=e[16];let j=v,w=t?.why,N;e[17]!==r||e[18]!==j?(N=C(()=>{r?.openConsole({errorsOnly:!0,seq:j})},"y"),e[17]=r,e[18]=j,e[19]=N):N=e[19],a=N,n=D,c=y,m=g,p="destructive";let h;e[20]!==t?(h=I(t),e[20]=t,e[21]=h):h=e[21],e[22]!==h?(o=(0,l.jsx)("p",{className:"font-medium",children:h}),e[22]=h,e[23]=o):o=e[23],e[24]!==w?(s=typeof w=="string"?(0,l.jsx)("p",{className:"mt-1 text-xs opacity-90",children:w}):null,e[24]=w,e[25]=s):s=e[25],d=V===void 0?null:(0,l.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:A(V)}),e[0]=y,e[1]=t,e[2]=r,e[3]=g,e[4]=n,e[5]=i,e[6]=a,e[7]=c,e[8]=m,e[9]=p,e[10]=o,e[11]=s,e[12]=d}else n=e[4],i=e[5],a=e[6],c=e[7],m=e[8],p=e[9],o=e[10],s=e[11],d=e[12];let f;e[26]!==i?(f=i===void 0?null:(0,l.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:i,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[26]=i,e[27]=f):f=e[27];let u;e[28]!==r||e[29]!==a||e[30]!==k?(u=r===void 0?null:(0,l.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:a,type:"button",children:k("Show in console")}),e[28]=r,e[29]=a,e[30]=k,e[31]=u):u=e[31];let x;return e[32]!==n||e[33]!==c||e[34]!==m||e[35]!==p||e[36]!==o||e[37]!==s||e[38]!==d||e[39]!==f||e[40]!==u?(x=(0,l.jsxs)(n,{className:c,testId:m,variant:p,children:[o,s,d,f,u]}),e[32]=n,e[33]=c,e[34]=m,e[35]=p,e[36]=o,e[37]=s,e[38]=d,e[39]=f,e[40]=u,e[41]=x):x=e[41],x},"K");export{P as a};
1
+ import{a as D}from"./chunk-NCPW7WHO.js";import{a as T}from"./chunk-3S4PZ7KQ.js";import{b as E}from"./chunk-55UGUCQ6.js";import{b as A}from"./chunk-DYR23C3V.js";import{d as H,h as I,j as O,k as S}from"./chunk-HJHSQPHW.js";import{a as C,d as q,f as _,g as z}from"./chunk-I26MS5PJ.js";var K=q(_(),1);var l=q(z(),1);var P=C(U=>{let e=(0,K.c)(42),{className:y,error:t,testId:g}=U,k=H(),r=E(),n,i,a,c,m,p,o,s,d;if(e[0]!==y||e[1]!==t||e[2]!==r||e[3]!==g){let V=O(t),b;e[13]!==t?(b=S(t),e[13]=t,e[14]=b):b=e[14],i=b;let v;e[15]!==t?(v=T(t),e[15]=t,e[16]=v):v=e[16];let j=v,w=t?.why,N;e[17]!==r||e[18]!==j?(N=C(()=>{r?.openConsole({errorsOnly:!0,seq:j})},"y"),e[17]=r,e[18]=j,e[19]=N):N=e[19],a=N,n=D,c=y,m=g,p="destructive";let h;e[20]!==t?(h=I(t),e[20]=t,e[21]=h):h=e[21],e[22]!==h?(o=(0,l.jsx)("p",{className:"font-medium",children:h}),e[22]=h,e[23]=o):o=e[23],e[24]!==w?(s=typeof w=="string"?(0,l.jsx)("p",{className:"mt-1 text-xs opacity-90",children:w}):null,e[24]=w,e[25]=s):s=e[25],d=V===void 0?null:(0,l.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:A(V)}),e[0]=y,e[1]=t,e[2]=r,e[3]=g,e[4]=n,e[5]=i,e[6]=a,e[7]=c,e[8]=m,e[9]=p,e[10]=o,e[11]=s,e[12]=d}else n=e[4],i=e[5],a=e[6],c=e[7],m=e[8],p=e[9],o=e[10],s=e[11],d=e[12];let f;e[26]!==i?(f=i===void 0?null:(0,l.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:i,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[26]=i,e[27]=f):f=e[27];let u;e[28]!==r||e[29]!==a||e[30]!==k?(u=r===void 0?null:(0,l.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:a,type:"button",children:k("Show in console")}),e[28]=r,e[29]=a,e[30]=k,e[31]=u):u=e[31];let x;return e[32]!==n||e[33]!==c||e[34]!==m||e[35]!==p||e[36]!==o||e[37]!==s||e[38]!==d||e[39]!==f||e[40]!==u?(x=(0,l.jsxs)(n,{className:c,testId:m,variant:p,children:[o,s,d,f,u]}),e[32]=n,e[33]=c,e[34]=m,e[35]=p,e[36]=o,e[37]=s,e[38]=d,e[39]=f,e[40]=u,e[41]=x):x=e[41],x},"K");export{P as a};
@@ -1,3 +1,3 @@
1
- import{a as Ie}from"./chunk-FPI7AMQJ.js";import{a as Se}from"./chunk-XHRKNCCI.js";import{a as we}from"./chunk-YVR4SEPU.js";import{b as pe}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as Ne}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{d as ye}from"./chunk-DSIY2CMT.js";import{c as xe,d as be,l as he}from"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import{d as se}from"./chunk-N7LJO732.js";import{a as ne,e as ie}from"./chunk-2IKDEUCX.js";import{d as ge,f as ce,g as de,h as ee,p as me}from"./chunk-HJHSQPHW.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-I26MS5PJ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(G.exportShard),Oe=ce(G.importShard),Le=s(x=>x.map(e=>JSON.stringify(xe(e))).join(`
1
+ import{a as Ie}from"./chunk-FPI7AMQJ.js";import{a as Se}from"./chunk-XHRKNCCI.js";import{a as we}from"./chunk-YVR4SEPU.js";import{b as pe}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as Ne}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{d as ye}from"./chunk-QUXXMJPZ.js";import{c as xe,d as be,l as he}from"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import{d as se}from"./chunk-DYR23C3V.js";import{a as ne,e as ie}from"./chunk-2IKDEUCX.js";import{d as ge,f as ce,g as de,h as ee,p as me}from"./chunk-HJHSQPHW.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-I26MS5PJ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(G.exportShard),Oe=ce(G.importShard),Le=s(x=>x.map(e=>JSON.stringify(xe(e))).join(`
2
2
  `),"Ce"),Je=s(x=>{let e=[],te=x.split(`
3
3
  `);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=be(JSON.parse(t));if(typeof o!="object"||o===null)throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"Te"),Ge=s(x=>{let e=(0,ve.c)(94),{initialShardKey:te}=x,n=he(),N=ye(),t=ge(),[o,b]=(0,g.useState)(te??""),[a,fe]=(0,g.useState)(""),[d,F]=(0,g.useState)(!1),[H,K]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[y,ue]=(0,g.useState)(null),Q;e[0]!==n||e[1]!==o?(Q=s(async()=>{F(!0),K(null),re(null);try{let c=await n.query(Ae,{},de(o));pe(o),fe(Le(c.rows)),ue(c.rows.length)}catch(c){K(ee(c))}F(!1)},"G"),e[0]=n,e[1]=o,e[2]=Q):Q=e[2];let M=Q,V;e[3]!==n||e[4]!==N||e[5]!==a||e[6]!==o||e[7]!==t?(V=s(async()=>{F(!0),K(null),re(null),ue(null);let c;try{c=Je(a)}catch(l){K(t("Invalid NDJSON: {message}",{message:ee(l)})),F(!1);return}try{let l=await n.query(Oe,{rows:c},de(o));pe(o),re(l),N(G.readTablePage),N(G.listTables)}catch(l){K(ee(l))}F(!1)},"Q"),e[3]=n,e[4]=N,e[5]=a,e[6]=o,e[7]=t,e[8]=V):V=e[8];let z=V,w,S,I,m,v,p,f,j,C,u,T;if(e[9]!==d||e[10]!==y||e[11]!==M||e[12]!==i||e[13]!==z||e[14]!==a||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(_e,0),l;e[28]!==M?(l=s(()=>{me(M())},"o"),e[28]=M,e[29]=l):l=e[29];let oe=l,Y;e[30]!==z?(Y=s(()=>{me(z())},"Y"),e[30]=z,e[31]=Y):Y=e[31];let ae=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=s(h=>{fe(h.target.value)},"Z"),e[32]=Z):Z=e[32];let je=Z;T="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(we,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(Ne,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==y||e[49]!==t?(q=y!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:y})}),e[48]=y,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="gap-0 py-0 rounded-xl border border-border bg-card shadow-xs";let P;e[57]!==t?(P=t("Import"),e[57]=t,e[58]=P):P=e[58],e[59]!==P?(u=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P})}),e[59]=P,e[60]=u):u=e[60],w=ie,v="flex flex-col gap-3 p-4",e[61]!==a?(p=(0,r.jsx)(Ie,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:je,placeholder:'{"table":"messages","doc":{\u2026}}',value:a}),e[61]=a,e[62]=p):p=e[62];let R;e[63]!==t?(R=t("Import (writes rows)?"),e[63]=t,e[64]=R):R=e[64];let U;e[65]!==d||e[66]!==a?(U=d||a.trim()==="",e[65]=d,e[66]=a,e[67]=U):U=e[67];let W;e[68]!==t?(W=t("Import"),e[68]=t,e[69]=W):W=e[69],e[70]!==ae||e[71]!==R||e[72]!==U||e[73]!==W?(f=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(Se,{confirmLabel:R,disabled:U,onConfirm:ae,testId:"ei-import",children:W})}),e[70]=ae,e[71]=R,e[72]=U,e[73]=W,e[74]=f):f=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=y,e[11]=M,e[12]=i,e[13]=z,e[14]=a,e[15]=o,e[16]=t,e[17]=w,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=f,e[24]=j,e[25]=C,e[26]=u,e[27]=T}else w=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],f=e[23],j=e[24],C=e[25],u=e[26],T=e[27];let E;e[75]!==w||e[76]!==v||e[77]!==p||e[78]!==f||e[79]!==j?(E=(0,r.jsxs)(w,{className:v,children:[p,f,j]}),e[75]=w,e[76]=v,e[77]=p,e[78]=f,e[79]=j,e[80]=E):E=e[80];let A;e[81]!==S||e[82]!==E||e[83]!==C||e[84]!==u?(A=(0,r.jsxs)(S,{className:C,children:[u,E]}),e[81]=S,e[82]=E,e[83]=C,e[84]=u,e[85]=A):A=e[85];let O;e[86]!==H?(O=H!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:H}),e[86]=H,e[87]=O):O=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==A||e[91]!==O||e[92]!==T?(X=(0,r.jsxs)("div",{className:T,"data-testid":I,children:[m,A,O]}),e[88]=I,e[89]=m,e[90]=A,e[91]=O,e[92]=T,e[93]=X):X=e[93],X},"Ue");function _e(x,e){return x+e}s(_e,"Ae");export{Ge as ExportImportPanel};
@@ -1 +1 @@
1
- import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-DSIY2CMT.js";import{l as k}from"./chunk-BOYS4DOC.js";import"./chunk-QAQDMS6R.js";import"./chunk-N7LJO732.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-HJHSQPHW.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
1
+ import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-QUXXMJPZ.js";import{l as k}from"./chunk-BWKZ6FFW.js";import"./chunk-QAQDMS6R.js";import"./chunk-DYR23C3V.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-HJHSQPHW.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};