@lunora/studio 1.0.0-alpha.362 → 1.0.0-alpha.363

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 (64) hide show
  1. package/dist/standalone/{chunk-J6XQKD2F.js → chunk-32V7XGNC.js} +1 -1
  2. package/dist/standalone/{chunk-Q2J73V2C.js → chunk-4L55URI5.js} +1 -1
  3. package/dist/standalone/{chunk-FBDIQ67D.js → chunk-4N76XUNG.js} +1 -1
  4. package/dist/standalone/{chunk-6KE7ILEZ.js → chunk-53XKGQEE.js} +1 -1
  5. package/dist/standalone/{chunk-7KJCRT4B.js → chunk-5QUTVSHM.js} +1 -1
  6. package/dist/standalone/{chunk-MJTVTUNI.js → chunk-5RX5CQSU.js} +1 -1
  7. package/dist/standalone/{chunk-ZG3IUVQ2.js → chunk-5Z2U4KBN.js} +1 -1
  8. package/dist/standalone/{chunk-ZKEYRU5C.js → chunk-75TRPM7O.js} +1 -1
  9. package/dist/standalone/{chunk-GC3GKGWD.js → chunk-7MLX5CGD.js} +1 -1
  10. package/dist/standalone/{chunk-BO5NNWMO.js → chunk-7TQ7BZ67.js} +1 -1
  11. package/dist/standalone/{chunk-H7BQUL7D.js → chunk-AD5J2ANS.js} +1 -1
  12. package/dist/standalone/{chunk-COLSZPCE.js → chunk-ALR4VAUE.js} +1 -1
  13. package/dist/standalone/{chunk-5EWIOOBI.js → chunk-AXE2SDRU.js} +1 -1
  14. package/dist/standalone/{chunk-JENPPZFV.js → chunk-BAEIW3YS.js} +1 -1
  15. package/dist/standalone/{chunk-BX7TFVCC.js → chunk-BBDTJG2K.js} +1 -1
  16. package/dist/standalone/{chunk-ZFQ253FX.js → chunk-BI6MZHZJ.js} +1 -1
  17. package/dist/standalone/{chunk-EE2COWFF.js → chunk-CP7QNLR4.js} +1 -1
  18. package/dist/standalone/{chunk-OP4QEV27.js → chunk-D57B4MFK.js} +1 -1
  19. package/dist/standalone/{chunk-53CGUTRT.js → chunk-DZFXH55R.js} +1 -1
  20. package/dist/standalone/{chunk-J3BZWYJQ.js → chunk-EPWCW2DF.js} +1 -1
  21. package/dist/standalone/{chunk-PAZKX7I6.js → chunk-FJLRSFTE.js} +1 -1
  22. package/dist/standalone/{chunk-L26RMC2W.js → chunk-FVCBNFQW.js} +1 -1
  23. package/dist/standalone/{chunk-UW6QNC74.js → chunk-GVQPNM3T.js} +1 -1
  24. package/dist/standalone/{chunk-7WV3EPE6.js → chunk-H3EIPYRZ.js} +1 -1
  25. package/dist/standalone/{chunk-HCCQTUHS.js → chunk-H5TMLWIS.js} +1 -1
  26. package/dist/standalone/{chunk-LPFUEJZ4.js → chunk-HBG6SSE2.js} +1 -1
  27. package/dist/standalone/{chunk-5O7ICPWV.js → chunk-HC2B7SXW.js} +1 -1
  28. package/dist/standalone/{chunk-IDZLHZIA.js → chunk-HGCOTYPV.js} +1 -1
  29. package/dist/standalone/{chunk-Q2KL457J.js → chunk-HLHMHCXS.js} +1 -1
  30. package/dist/standalone/{chunk-WADY55J2.js → chunk-HSF2DCJ2.js} +1 -1
  31. package/dist/standalone/{chunk-QEFLZBT7.js → chunk-I3SSF2T6.js} +1 -1
  32. package/dist/standalone/{chunk-ALQHMFOC.js → chunk-I5QX75DE.js} +1 -1
  33. package/dist/standalone/{chunk-JCRFMCNP.js → chunk-ICHZ2IBL.js} +1 -1
  34. package/dist/standalone/{chunk-E2FFHKGI.js → chunk-IG5VD7R7.js} +1 -1
  35. package/dist/standalone/{chunk-ABMHWBYA.js → chunk-KKMQUBYH.js} +1 -1
  36. package/dist/standalone/{chunk-AEU3EF4T.js → chunk-LDHJRHPZ.js} +1 -1
  37. package/dist/standalone/{chunk-X54WR7FF.js → chunk-MNYDT3RH.js} +1 -1
  38. package/dist/standalone/{chunk-OPIMGKWU.js → chunk-MT4ICMXJ.js} +1 -1
  39. package/dist/standalone/{chunk-N7WQJPOM.js → chunk-MXJTD2OX.js} +1 -1
  40. package/dist/standalone/{chunk-WCWP4EAW.js → chunk-OZAOWE7T.js} +1 -1
  41. package/dist/standalone/{chunk-GVZ3VFGG.js → chunk-Q3IA6HPX.js} +1 -1
  42. package/dist/standalone/{chunk-3RZD6VJ7.js → chunk-RBIVXSXT.js} +1 -1
  43. package/dist/standalone/{chunk-JHTL3QHW.js → chunk-SDDEOSQB.js} +1 -1
  44. package/dist/standalone/chunk-SHHGIT7M.js +7 -0
  45. package/dist/standalone/{chunk-Z57KMMOK.js → chunk-SVQWZPO4.js} +1 -1
  46. package/dist/standalone/{chunk-YX2N5PJW.js → chunk-TEMI7MVE.js} +1 -1
  47. package/dist/standalone/{chunk-VHPTPEZ4.js → chunk-U5MPNEM2.js} +1 -1
  48. package/dist/standalone/{chunk-5NIQHOPN.js → chunk-ULQNADMJ.js} +1 -1
  49. package/dist/standalone/{chunk-66LYVBXB.js → chunk-UPPNZ6MI.js} +1 -1
  50. package/dist/standalone/{chunk-ZSLKFLWE.js → chunk-UTQLJKHH.js} +1 -1
  51. package/dist/standalone/{chunk-FQEZUQ36.js → chunk-UVG3ZISC.js} +1 -1
  52. package/dist/standalone/{chunk-2FTGLXYA.js → chunk-VQDTA4P6.js} +1 -1
  53. package/dist/standalone/{chunk-7O5SGABV.js → chunk-WLHQ4FKC.js} +1 -1
  54. package/dist/standalone/{chunk-XWWQIAF6.js → chunk-XPFVUAPX.js} +1 -1
  55. package/dist/standalone/{chunk-NF2Q75WM.js → chunk-Y3IGTWUE.js} +1 -1
  56. package/dist/standalone/{chunk-J6FR2B77.js → chunk-Y64STA6O.js} +1 -1
  57. package/dist/standalone/{chunk-IUGNIG6L.js → chunk-YEXTJUKQ.js} +1 -1
  58. package/dist/standalone/{chunk-RE7GRXBM.js → chunk-YFTPHGS2.js} +1 -1
  59. package/dist/standalone/{chunk-EXFERMUT.js → chunk-Z64BZNPS.js} +1 -1
  60. package/dist/standalone/{chunk-TMWKF4XM.js → chunk-Z6VILGGP.js} +1 -1
  61. package/dist/standalone/{chunk-MQTI3STP.js → chunk-ZBOB33BA.js} +1 -1
  62. package/dist/standalone/studio.js +1 -1
  63. package/package.json +3 -3
  64. package/dist/standalone/chunk-FACXM2UB.js +0 -7
@@ -1 +1 @@
1
- import{a as D}from"./chunk-ELSQ4FVH.js";import{a as L}from"./chunk-RCXNYW7P.js";import{b as S}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-7QEZ2SFW.js";import"./chunk-4PI2OSSP.js";import{a as C}from"./chunk-2W4UO5BC.js";import{c as w}from"./chunk-FBDIQ67D.js";import{a as I,e as $}from"./chunk-OK2QU2EV.js";import"./chunk-FACXM2UB.js";import"./chunk-ZPQBVYNN.js";import{B as b}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as _}from"./chunk-GWNGVKLG.js";import{b as j}from"./chunk-6G3E4PJ2.js";import{a as f,d as y}from"./chunk-5PEAXTYQ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=b(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=w(C.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(S,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
1
+ import{a as D}from"./chunk-ELSQ4FVH.js";import{a as L}from"./chunk-RCXNYW7P.js";import{b as S}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-7QEZ2SFW.js";import"./chunk-4PI2OSSP.js";import{a as C}from"./chunk-2W4UO5BC.js";import{c as w}from"./chunk-4N76XUNG.js";import{a as I,e as $}from"./chunk-OK2QU2EV.js";import"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as b}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as _}from"./chunk-GWNGVKLG.js";import{b as j}from"./chunk-6G3E4PJ2.js";import{a as f,d as y}from"./chunk-5PEAXTYQ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=b(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=w(C.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(L,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(I,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(S,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
@@ -1,2 +1,2 @@
1
- import{a as fe}from"./chunk-2NGKUO32.js";import{a as pe}from"./chunk-J3BZWYJQ.js";import"./chunk-O3AZ7JKE.js";import{a as ie}from"./chunk-NGZNXNRD.js";import"./chunk-D65UVZIA.js";import{i as me}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as b}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as he}from"./chunk-RCXNYW7P.js";import{b as ce}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as ue}from"./chunk-IUGNIG6L.js";import"./chunk-LSEUUZN4.js";import"./chunk-WCWP4EAW.js";import"./chunk-BX7TFVCC.js";import"./chunk-4PI2OSSP.js";import{a as H}from"./chunk-2W4UO5BC.js";import{c as oe}from"./chunk-FBDIQ67D.js";import{m as se}from"./chunk-FACXM2UB.js";import"./chunk-ZPQBVYNN.js";import{B as de,h as Z,i as ee,j as te,s as ae,v as le,w as re,x as ne}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as ge,b as Ne}from"./chunk-6G3E4PJ2.js";import{a as l,d as Y}from"./chunk-5PEAXTYQ.js";var t=Y(Ne(),1);var be=Y(ve(),1),v=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}l(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=l(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),N=l(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"v"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=l(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=l((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},"Ce"),je=l((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),Le=Z(H.clearCapturedMail),_e=Z(H.sendTestMail),Me=l(a=>{let e=(0,be.c)(36),{limit:s}=a,o=se(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:I,error:y,errorSource:w,isLoading:g,poll:P,refetch:c}=oe(H.getCapturedMail,p),[C,f]=(0,v.useState)(null),[q,k]=(0,v.useState)(null),[i,h]=(0,v.useState)("html"),[x,B]=(0,v.useState)(""),r=I?.entries??[],m=y??C,D=y===null?C:w,S;e[2]!==o||e[3]!==c?(S=l(async()=>{f(null);try{await o.query(Le,{},ee("")),k(null),c()}catch(d){f(te(d))}},"S"),e[2]=o,e[3]=c,e[4]=S):S=e[4];let R=S,T;e[5]!==o||e[6]!==c?(T=l(async()=>{f(null);try{await o.query(_e,{},ee("")),c()}catch(d){f(te(d))}},"T"),e[5]=o,e[6]=c,e[7]=T):T=e[7];let Q=T;pe(P,!0);let j;e[8]!==R?(j=l(()=>{ae(R())},"k"),e[8]=R,e[9]=j):j=e[9];let U=j,L;e[10]!==Q?(L=l(()=>{ae(Q())},"A"),e[10]=Q,e[11]=L):L=e[11];let W=L,_;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=l(d=>{B(d.currentTarget.value)},"E"),e[12]=_):_=e[12];let G=_,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=l(d=>{let{id:u}=d.currentTarget.dataset;u!==void 0&&k(u)},"_"),e[13]=M):M=e[13];let J=M,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=l(d=>{let u=d.currentTarget.dataset.tab;(u==="headers"||u==="html"||u==="text")&&h(u)},"L"),e[14]=z):z=e[14];let K=z,$=Te(r,x),A=je($,q),n=Se(A),O;e[15]!==n?(O=l(()=>{n!==void 0&&le(n)},"j"),e[15]=n,e[16]=O):O=e[16];let V=O,F;e[17]!==n?(F=l(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"$"),e[17]=n,e[18]=F):F=e[18];let X=F,E;return e[19]!==r||e[20]!==m||e[21]!==D||e[22]!==x||e[23]!==g||e[24]!==n||e[25]!==U||e[26]!==V||e[27]!==G||e[28]!==X||e[29]!==J||e[30]!==K||e[31]!==W||e[32]!==A||e[33]!==i||e[34]!==$?(E={entries:r,error:m,errorSource:D,filter:x,isLoading:g,link:n,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:A,tab:i,visible:$},e[19]=r,e[20]=m,e[21]=D,e[22]=x,e[23]=g,e[24]=n,e[25]=U,e[26]=V,e[27]=G,e[28]=X,e[29]=J,e[30]=K,e[31]=W,e[32]=A,e[33]=i,e[34]=$,e[35]=E):E=e[35],E},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=l(a=>`${ze}${a}`,"_e"),Ke=l(({limit:a=100})=>{let e=de(),{entries:s,error:o,errorSource:p,filter:I,isLoading:y,link:w,onClear:g,onCopyLink:P,onFilterChange:c,onOpenLink:C,onSelectMessage:f,onSelectTab:q,onSendTest:k,selected:i,tab:h,visible:x}=Me({limit:a}),B=l(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"H");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:k,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ce,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(ue,{error:p,testId:"mail-error"}),o===null&&!y&&s.length===0&&(0,t.jsx)(he,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(me,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:c,placeholder:e("Filter messages"),type:"search",value:I}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:x.map(r=>{let m=r.id===i?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${m?"bg-muted":""}`,"data-active":m,"data-id":r.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),i!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(i.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:P,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:C,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":h===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:q,role:"tab",size:"sm",type:"button",variant:h===r?"secondary":"ghost",children:B(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[h==="html"&&(i.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(i.html),title:e("Email preview")})),h==="text"&&(i.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),h==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([r,m])=>`${r}: ${m}`).join(`
1
+ import{a as fe}from"./chunk-2NGKUO32.js";import{a as pe}from"./chunk-EPWCW2DF.js";import"./chunk-O3AZ7JKE.js";import{a as ie}from"./chunk-NGZNXNRD.js";import"./chunk-D65UVZIA.js";import{i as me}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as b}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as he}from"./chunk-RCXNYW7P.js";import{b as ce}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as ue}from"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as H}from"./chunk-2W4UO5BC.js";import{c as oe}from"./chunk-4N76XUNG.js";import{m as se}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as de,h as Z,i as ee,j as te,s as ae,v as le,w as re,x as ne}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as ge,b as Ne}from"./chunk-6G3E4PJ2.js";import{a as l,d as Y}from"./chunk-5PEAXTYQ.js";var t=Y(Ne(),1);var be=Y(ve(),1),v=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}l(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=l(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),N=l(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"v"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=l(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=l((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},"Ce"),je=l((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),Le=Z(H.clearCapturedMail),_e=Z(H.sendTestMail),Me=l(a=>{let e=(0,be.c)(36),{limit:s}=a,o=se(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:I,error:y,errorSource:w,isLoading:g,poll:P,refetch:c}=oe(H.getCapturedMail,p),[C,f]=(0,v.useState)(null),[q,k]=(0,v.useState)(null),[i,h]=(0,v.useState)("html"),[x,B]=(0,v.useState)(""),r=I?.entries??[],m=y??C,D=y===null?C:w,S;e[2]!==o||e[3]!==c?(S=l(async()=>{f(null);try{await o.query(Le,{},ee("")),k(null),c()}catch(d){f(te(d))}},"S"),e[2]=o,e[3]=c,e[4]=S):S=e[4];let R=S,T;e[5]!==o||e[6]!==c?(T=l(async()=>{f(null);try{await o.query(_e,{},ee("")),c()}catch(d){f(te(d))}},"T"),e[5]=o,e[6]=c,e[7]=T):T=e[7];let Q=T;pe(P,!0);let j;e[8]!==R?(j=l(()=>{ae(R())},"k"),e[8]=R,e[9]=j):j=e[9];let U=j,L;e[10]!==Q?(L=l(()=>{ae(Q())},"A"),e[10]=Q,e[11]=L):L=e[11];let W=L,_;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=l(d=>{B(d.currentTarget.value)},"E"),e[12]=_):_=e[12];let G=_,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=l(d=>{let{id:u}=d.currentTarget.dataset;u!==void 0&&k(u)},"_"),e[13]=M):M=e[13];let J=M,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=l(d=>{let u=d.currentTarget.dataset.tab;(u==="headers"||u==="html"||u==="text")&&h(u)},"L"),e[14]=z):z=e[14];let K=z,$=Te(r,x),A=je($,q),n=Se(A),O;e[15]!==n?(O=l(()=>{n!==void 0&&le(n)},"j"),e[15]=n,e[16]=O):O=e[16];let V=O,F;e[17]!==n?(F=l(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"$"),e[17]=n,e[18]=F):F=e[18];let X=F,E;return e[19]!==r||e[20]!==m||e[21]!==D||e[22]!==x||e[23]!==g||e[24]!==n||e[25]!==U||e[26]!==V||e[27]!==G||e[28]!==X||e[29]!==J||e[30]!==K||e[31]!==W||e[32]!==A||e[33]!==i||e[34]!==$?(E={entries:r,error:m,errorSource:D,filter:x,isLoading:g,link:n,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:A,tab:i,visible:$},e[19]=r,e[20]=m,e[21]=D,e[22]=x,e[23]=g,e[24]=n,e[25]=U,e[26]=V,e[27]=G,e[28]=X,e[29]=J,e[30]=K,e[31]=W,e[32]=A,e[33]=i,e[34]=$,e[35]=E):E=e[35],E},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=l(a=>`${ze}${a}`,"_e"),Ke=l(({limit:a=100})=>{let e=de(),{entries:s,error:o,errorSource:p,filter:I,isLoading:y,link:w,onClear:g,onCopyLink:P,onFilterChange:c,onOpenLink:C,onSelectMessage:f,onSelectTab:q,onSendTest:k,selected:i,tab:h,visible:x}=Me({limit:a}),B=l(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"H");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:k,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ce,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(ue,{error:p,testId:"mail-error"}),o===null&&!y&&s.length===0&&(0,t.jsx)(he,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(me,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:c,placeholder:e("Filter messages"),type:"search",value:I}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:x.map(r=>{let m=r.id===i?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${m?"bg-muted":""}`,"data-active":m,"data-id":r.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),i!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(i.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:P,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:C,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":h===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:q,role:"tab",size:"sm",type:"button",variant:h===r?"secondary":"ghost",children:B(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[h==="html"&&(i.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(i.html),title:e("Email preview")})),h==="text"&&(i.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),h==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([r,m])=>`${r}: ${m}`).join(`
2
2
  `)}))]})]})]})]})},"Qe");export{Ke as MailPanel};
@@ -1 +1 @@
1
- import{b as j,c as v,d as D,m as q}from"./chunk-FACXM2UB.js";import{h as g,i as S,j as P,s as w}from"./chunk-GNI37YCV.js";import{a as M}from"./chunk-GWNGVKLG.js";import{a as L}from"./chunk-6G3E4PJ2.js";import{a as i,d as A}from"./chunk-5PEAXTYQ.js";var E=A(M(),1);var p=A(L(),1);var I=300,l=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"c"),u=i(t=>t.filter(r=>r!==void 0).join(" "),"u"),T=i(t=>{let r=Array.isArray(t.filters)?t.filters.length:0,e=typeof t.search=="string"&&t.search!=="";return r===0&&!e?"no predicate":u([r===0?void 0:`${String(r)} filters`,e?"search":void 0])},"q"),N={clearTable:i(t=>u([l(t.table),"whole table"]),"clearTable"),deleteRows:i(t=>u([l(t.table),T(t)]),"deleteRows"),facetColumn:i(t=>u([l(t.table),l(t.column)]),"facetColumn"),importShard:i(t=>{if(!Array.isArray(t.rows))return"";let r=[...new Set(t.rows.filter(e=>typeof e=="object"&&e!==null).map(e=>e.table).filter(e=>typeof e=="string"))].toSorted((e,s)=>e.localeCompare(s));return u([`${String(t.rows.length)} rows`,r.length===0?void 0:`into ${r.join(", ")}`])},"importShard"),lintSql:i(()=>"sql","lintSql"),patchRows:i(t=>u([l(t.table),typeof t.doc=="object"&&t.doc!==null?`set ${Object.keys(t.doc).join(", ")}`:void 0,T(t)]),"patchRows"),pitrRestore:i(t=>u([l(t.time)===void 0?void 0:`to ${String(t.time)}`,typeof t.bookmark=="string"&&t.bookmark!==""?"from bookmark":void 0,t.restart===!0?"restart now":void 0]),"pitrRestore"),readTablePage:i(t=>u([l(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>u([l(t.id),l(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>u([l(t.table),"1 row"]),"writeRow")},$="__lunora_admin__:",F=i((t,r)=>{let e=t.startsWith($)?t.slice($.length):t,s=N[e];if(s!==void 0)return s(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"M"),V=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let r of Object.values(t))if(Array.isArray(r))return r.length}},"K"),k=class{static{i(this,"x")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,e,s){return this.append(r,e,s,"call","pending")}startSubscription(r,e,s){return this.append(r,e,s,"subscription","live")}recordPush(r){if(this.listeners.size===0){let e=this.entries.find(s=>s.seq===r);e!==void 0&&(e.pushes=(e.pushes??0)+1);return}this.patch(r,e=>({...e,pushes:(e.pushes??0)+1}))}failSubscription(r,e){this.patch(r,s=>({...s,error:e,status:"error"}))}endSubscription(r){this.patch(r,e=>e.status==="error"?e:{...e,durationMs:Date.now()-e.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,e){this.patch(r,s=>({...s,durationMs:Date.now()-s.startedAt,...e.error===void 0?{resultCount:V(e.result),status:"ok"}:{error:e.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,e,s,n,a){let c=this.nextSeq;this.nextSeq+=1;let d={functionPath:r,kind:n,seq:c,shardKey:s,startedAt:Date.now(),status:a,summary:F(r,e),...n==="subscription"?{pushes:0}:{}},o=[...this.entries,d];return this.entries=o.length>I?o.slice(o.length-I):o,this.emit(),c}patch(r,e){let s=this.entries.findIndex(n=>n.seq===r);s!==-1&&(this.entries=this.entries.with(s,e(this.entries[s])),this.emit())}emit(){for(let r of this.listeners)r()}},f=new k,O=i((t,r,e)=>["lunora-admin",t,r,e.trim()],"E"),_=i((t,r)=>[...t,r],"j");function W(t,r,e={}){let s=q(),{enabled:n=!0,keepPreviousData:a=!1,staleTime:c=0}=e,d=_(t,s.clientIdentifier()),o=D({enabled:n,queryFn:r,placeholderData:a?j:void 0,queryKey:d,staleTime:c});return{data:o.data,error:o.error?P(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{w(o.refetch())},"refetch"),poll:i(async()=>{await o.refetch({throwOnError:!0})},"poll")}}i(W,"F");function Y(t,r,e={}){let s=q(),n=v(),{enabled:a=!0,keepPreviousData:c=!1,live:d=!1,shardKey:o="",staleTime:R}=e,m=O(t,r,o),C=W(m,()=>s.query(g(t),r,S(o)),{enabled:a,keepPreviousData:c,staleTime:R??(d?Number.POSITIVE_INFINITY:0)}),[K,b]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!d)return;b(void 0);let y=f.startSubscription(t,r,o),x=s.subscribe(g(t),r,h=>{f.recordPush(y),b(void 0),n.setQueryData(_(m,s.clientIdentifier()),h)},{...S(o),onError:i(h=>{f.failSubscription(y,h.message),b(h.message)},"onError")});return()=>{f.endSubscription(y),x()}},[s,Q,a,d]),{...C,liveError:a&&d?K:void 0}}i(Y,"U");var B=i(()=>{let t=(0,E.c)(2),r=v(),e;return t[0]!==r?(e=i((s,n,a)=>{let c=n===void 0?["lunora-admin",s]:O(s,n,a??"");w(r.invalidateQueries({queryKey:c}))},"r"),t[0]=r,t[1]=e):e=t[1],e},"W");export{f as a,W as b,Y as c,B as d};
1
+ import{g as j,h as v,i as D,m as q}from"./chunk-SHHGIT7M.js";import{h as g,i as S,j as P,s as w}from"./chunk-GNI37YCV.js";import{a as M}from"./chunk-GWNGVKLG.js";import{a as L}from"./chunk-6G3E4PJ2.js";import{a as i,d as A}from"./chunk-5PEAXTYQ.js";var E=A(M(),1);var p=A(L(),1);var I=300,l=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"c"),u=i(t=>t.filter(r=>r!==void 0).join(" "),"u"),T=i(t=>{let r=Array.isArray(t.filters)?t.filters.length:0,e=typeof t.search=="string"&&t.search!=="";return r===0&&!e?"no predicate":u([r===0?void 0:`${String(r)} filters`,e?"search":void 0])},"q"),N={clearTable:i(t=>u([l(t.table),"whole table"]),"clearTable"),deleteRows:i(t=>u([l(t.table),T(t)]),"deleteRows"),facetColumn:i(t=>u([l(t.table),l(t.column)]),"facetColumn"),importShard:i(t=>{if(!Array.isArray(t.rows))return"";let r=[...new Set(t.rows.filter(e=>typeof e=="object"&&e!==null).map(e=>e.table).filter(e=>typeof e=="string"))].toSorted((e,s)=>e.localeCompare(s));return u([`${String(t.rows.length)} rows`,r.length===0?void 0:`into ${r.join(", ")}`])},"importShard"),lintSql:i(()=>"sql","lintSql"),patchRows:i(t=>u([l(t.table),typeof t.doc=="object"&&t.doc!==null?`set ${Object.keys(t.doc).join(", ")}`:void 0,T(t)]),"patchRows"),pitrRestore:i(t=>u([l(t.time)===void 0?void 0:`to ${String(t.time)}`,typeof t.bookmark=="string"&&t.bookmark!==""?"from bookmark":void 0,t.restart===!0?"restart now":void 0]),"pitrRestore"),readTablePage:i(t=>u([l(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>u([l(t.id),l(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>u([l(t.table),"1 row"]),"writeRow")},$="__lunora_admin__:",F=i((t,r)=>{let e=t.startsWith($)?t.slice($.length):t,s=N[e];if(s!==void 0)return s(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"M"),V=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let r of Object.values(t))if(Array.isArray(r))return r.length}},"K"),k=class{static{i(this,"x")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,e,s){return this.append(r,e,s,"call","pending")}startSubscription(r,e,s){return this.append(r,e,s,"subscription","live")}recordPush(r){if(this.listeners.size===0){let e=this.entries.find(s=>s.seq===r);e!==void 0&&(e.pushes=(e.pushes??0)+1);return}this.patch(r,e=>({...e,pushes:(e.pushes??0)+1}))}failSubscription(r,e){this.patch(r,s=>({...s,error:e,status:"error"}))}endSubscription(r){this.patch(r,e=>e.status==="error"?e:{...e,durationMs:Date.now()-e.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,e){this.patch(r,s=>({...s,durationMs:Date.now()-s.startedAt,...e.error===void 0?{resultCount:V(e.result),status:"ok"}:{error:e.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,e,s,n,a){let c=this.nextSeq;this.nextSeq+=1;let d={functionPath:r,kind:n,seq:c,shardKey:s,startedAt:Date.now(),status:a,summary:F(r,e),...n==="subscription"?{pushes:0}:{}},o=[...this.entries,d];return this.entries=o.length>I?o.slice(o.length-I):o,this.emit(),c}patch(r,e){let s=this.entries.findIndex(n=>n.seq===r);s!==-1&&(this.entries=this.entries.with(s,e(this.entries[s])),this.emit())}emit(){for(let r of this.listeners)r()}},f=new k,O=i((t,r,e)=>["lunora-admin",t,r,e.trim()],"E"),_=i((t,r)=>[...t,r],"j");function W(t,r,e={}){let s=q(),{enabled:n=!0,keepPreviousData:a=!1,staleTime:c=0}=e,d=_(t,s.clientIdentifier()),o=D({enabled:n,queryFn:r,placeholderData:a?j:void 0,queryKey:d,staleTime:c});return{data:o.data,error:o.error?P(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{w(o.refetch())},"refetch"),poll:i(async()=>{await o.refetch({throwOnError:!0})},"poll")}}i(W,"F");function Y(t,r,e={}){let s=q(),n=v(),{enabled:a=!0,keepPreviousData:c=!1,live:d=!1,shardKey:o="",staleTime:R}=e,m=O(t,r,o),C=W(m,()=>s.query(g(t),r,S(o)),{enabled:a,keepPreviousData:c,staleTime:R??(d?Number.POSITIVE_INFINITY:0)}),[K,b]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!d)return;b(void 0);let y=f.startSubscription(t,r,o),x=s.subscribe(g(t),r,h=>{f.recordPush(y),b(void 0),n.setQueryData(_(m,s.clientIdentifier()),h)},{...S(o),onError:i(h=>{f.failSubscription(y,h.message),b(h.message)},"onError")});return()=>{f.endSubscription(y),x()}},[s,Q,a,d]),{...C,liveError:a&&d?K:void 0}}i(Y,"U");var B=i(()=>{let t=(0,E.c)(2),r=v(),e;return t[0]!==r?(e=i((s,n,a)=>{let c=n===void 0?["lunora-admin",s]:O(s,n,a??"");w(r.invalidateQueries({queryKey:c}))},"r"),t[0]=r,t[1]=e):e=t[1],e},"W");export{f as a,W as b,Y as c,B as d};
@@ -1 +1 @@
1
- import{b as g}from"./chunk-TMWKF4XM.js";import"./chunk-IUGNIG6L.js";import"./chunk-LSEUUZN4.js";import"./chunk-7QEZ2SFW.js";import"./chunk-WCWP4EAW.js";import"./chunk-BX7TFVCC.js";import"./chunk-4PI2OSSP.js";import{a as m}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-FBDIQ67D.js";import"./chunk-OK2QU2EV.js";import"./chunk-FACXM2UB.js";import"./chunk-ZPQBVYNN.js";import{B as f}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as S}from"./chunk-GWNGVKLG.js";import{b as A}from"./chunk-6G3E4PJ2.js";import{a as r,d as h}from"./chunk-5PEAXTYQ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=f(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=p(m.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
1
+ import{b as g}from"./chunk-Z6VILGGP.js";import"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as m}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-4N76XUNG.js";import"./chunk-OK2QU2EV.js";import"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as f}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as S}from"./chunk-GWNGVKLG.js";import{b as A}from"./chunk-6G3E4PJ2.js";import{a as r,d as h}from"./chunk-5PEAXTYQ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=f(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=p(m.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};