@lunora/studio 1.0.0-alpha.34 → 1.0.0-alpha.36

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 (93) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.js +6 -6
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  7. package/dist/packem_chunks/FileBrowser.js +1 -1
  8. package/dist/packem_chunks/FunctionRunner.js +1 -1
  9. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  10. package/dist/packem_chunks/HealthPanel.js +1 -1
  11. package/dist/packem_chunks/InsightsPanel.js +1 -1
  12. package/dist/packem_chunks/LogsPanel.js +1 -1
  13. package/dist/packem_chunks/MailPanel.js +3 -91
  14. package/dist/packem_chunks/MetricsPanel.js +1 -1
  15. package/dist/packem_chunks/MigrationsPanel.js +1 -1
  16. package/dist/packem_chunks/PitrPanel.js +1 -1
  17. package/dist/packem_chunks/SchemaViewer.js +1 -1
  18. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  19. package/dist/packem_chunks/SettingsPanel.js +1 -1
  20. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  21. package/dist/packem_chunks/TableEditor.js +1 -1
  22. package/dist/packem_chunks/containers-panel.js +1 -1
  23. package/dist/packem_chunks/dashboards-panel.js +1 -1
  24. package/dist/packem_chunks/fanout-panel.js +1 -1
  25. package/dist/packem_chunks/flags-panel.js +1 -1
  26. package/dist/packem_chunks/kv-browser.js +1 -1
  27. package/dist/packem_chunks/payments-panel.js +1 -1
  28. package/dist/packem_chunks/permissions-panel.js +1 -1
  29. package/dist/packem_chunks/queues-panel.js +975 -71
  30. package/dist/packem_chunks/rls-panel.js +1 -1
  31. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  32. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  33. package/dist/packem_chunks/workflows-panel.js +1 -1
  34. package/dist/packem_shared/{ADMIN_FUNCTIONS-CdaxLGkE.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +4 -0
  35. package/dist/packem_shared/{ApiDocsPanel-Cu6mD4u7.js → ApiDocsPanel-D4CJf2ad.js} +1 -1
  36. package/dist/packem_shared/{DataBrowser-DSNK1tPg.js → DataBrowser-BeVNxSVm.js} +1 -1
  37. package/dist/packem_shared/{HomePanel-DQk3P8xX.js → HomePanel-D9MQk8I7.js} +2 -2
  38. package/dist/packem_shared/{Studio-Biu37c3O.js → Studio-C48P1K5W.js} +2 -2
  39. package/dist/packem_shared/{StudioApp-D6a2ZmXS.js → StudioApp-Cqh-SYm2.js} +1 -1
  40. package/dist/packem_shared/{home-panel-Bo-Mgrkn.js → home-panel-CoGxi-oj.js} +1 -1
  41. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  42. package/dist/packem_shared/{studio-C4sgu0F7.js → studio-CPHA_-3I.js} +1 -1
  43. package/dist/standalone/{chunk-TY7L2V4E.js → chunk-22W5VKZ6.js} +1 -1
  44. package/dist/standalone/{chunk-GZDWDDXN.js → chunk-2THHW7BC.js} +1 -1
  45. package/dist/standalone/{chunk-YM6BBZDN.js → chunk-46K3NKPA.js} +1 -1
  46. package/dist/standalone/{chunk-T5HRXUSY.js → chunk-6WRZP62V.js} +1 -1
  47. package/dist/standalone/{chunk-JIDZFLTB.js → chunk-7SLSB2TS.js} +1 -1
  48. package/dist/standalone/{chunk-MFPTVCJ6.js → chunk-ATYUMPDM.js} +1 -1
  49. package/dist/standalone/{chunk-PA3LN4XJ.js → chunk-BI35RXKQ.js} +1 -1
  50. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  51. package/dist/standalone/chunk-DC72CQY4.js +76 -0
  52. package/dist/standalone/{chunk-K4ZDRTQM.js → chunk-DVC6YWVP.js} +1 -1
  53. package/dist/standalone/{chunk-G2ICR3DL.js → chunk-DWTBY343.js} +1 -1
  54. package/dist/standalone/chunk-EUIHTPKI.js +1 -0
  55. package/dist/standalone/{chunk-E6WUCLSI.js → chunk-ILCTSAOB.js} +1 -1
  56. package/dist/standalone/{chunk-KTK3V4DC.js → chunk-IOFMK4D7.js} +1 -1
  57. package/dist/standalone/{chunk-XIGIWZLO.js → chunk-JE2YOAB7.js} +1 -1
  58. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  59. package/dist/standalone/{chunk-O77VNUFD.js → chunk-LAK5VSPI.js} +1 -1
  60. package/dist/standalone/{chunk-QHIIRFG7.js → chunk-LD2R263D.js} +1 -1
  61. package/dist/standalone/{chunk-ISJAJWYI.js → chunk-M55U7NHO.js} +1 -1
  62. package/dist/standalone/{chunk-VEZO7G5Q.js → chunk-MPTM7ZU3.js} +1 -1
  63. package/dist/standalone/{chunk-E7WLF6IU.js → chunk-NKJDGOM3.js} +1 -1
  64. package/dist/standalone/{chunk-BET2625I.js → chunk-OCHNCAXJ.js} +1 -1
  65. package/dist/standalone/{chunk-EVPLBWUT.js → chunk-OIZ4CHPN.js} +1 -1
  66. package/dist/standalone/{chunk-SGDQIWAR.js → chunk-OY3GVYS7.js} +1 -1
  67. package/dist/standalone/{chunk-7M3F6U4L.js → chunk-PACH5AHG.js} +1 -1
  68. package/dist/standalone/{chunk-VSHUSN6T.js → chunk-Q52CHOSY.js} +1 -1
  69. package/dist/standalone/chunk-QLM6FYZW.js +2 -0
  70. package/dist/standalone/{chunk-X72PYOEW.js → chunk-RRAFQ5G2.js} +1 -1
  71. package/dist/standalone/{chunk-25VHPD2I.js → chunk-SG3ALJJU.js} +1 -1
  72. package/dist/standalone/{chunk-SYEIXTEU.js → chunk-SLKF2L74.js} +1 -1
  73. package/dist/standalone/{chunk-DCECRP45.js → chunk-TO4JQX7W.js} +1 -1
  74. package/dist/standalone/{chunk-DFP2DADO.js → chunk-TOJ3TC35.js} +1 -1
  75. package/dist/standalone/{chunk-TM7CMA7X.js → chunk-VTGBPW24.js} +1 -1
  76. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  77. package/dist/standalone/{chunk-5PQMXK24.js → chunk-X5P2WRYI.js} +1 -1
  78. package/dist/standalone/{chunk-VYMCCC6O.js → chunk-XLQ4BHBD.js} +1 -1
  79. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  80. package/dist/standalone/{chunk-GJ6PGSES.js → chunk-YEVCU7TB.js} +1 -1
  81. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  82. package/dist/standalone/{chunk-4MLAVZP4.js → chunk-ZU4DZ6NK.js} +1 -1
  83. package/dist/standalone/{chunk-4H2OJBXO.js → chunk-ZYRGPDZB.js} +1 -1
  84. package/dist/standalone/studio.js +1 -1
  85. package/dist/styles.css +2 -2
  86. package/package.json +6 -6
  87. package/dist/standalone/chunk-55YA7ZZI.js +0 -76
  88. package/dist/standalone/chunk-AQGOX5DK.js +0 -1
  89. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  90. package/dist/standalone/chunk-GVRM4U6W.js +0 -2
  91. package/dist/standalone/chunk-SVR644RF.js +0 -1
  92. package/dist/standalone/chunk-UDSVXA42.js +0 -1
  93. package/dist/standalone/chunk-UII66UVF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as De,b as X,c as ve}from"./chunk-4H2OJBXO.js";import{a as Oe}from"./chunk-6GFEVKJP.js";import{a as Me}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Ee}from"./chunk-XNJNSCLM.js";import{a as qe,b as Ie,c as Re,d as he,e as Le,f as Ae}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as we}from"./chunk-K3GNLVYK.js";import{b as ke}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as re}from"./chunk-AQGOX5DK.js";import"./chunk-CKSHCYGC.js";import{f as be}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,e as se,f as le,g as Te,k as V}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as pe,f as Ct,g as Tt,h as kt,j as ne}from"./chunk-RRCPZMC2.js";var Y=pe(Tt(),1);var q=pe(Ct(),1);var s=pe(kt(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Et=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),qt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),It=wt.map(n=>({pattern:new RegExp(String.raw`\b${n.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:n})),Rt=Et.map(n=>({pattern:new RegExp(String.raw`\s+${n.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
1
+ import{a as De,b as X,c as ve}from"./chunk-ZYRGPDZB.js";import{a as Oe}from"./chunk-6GFEVKJP.js";import{a as Me}from"./chunk-7VF3IAAW.js";import"./chunk-PN5NCZDX.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-TDL7NEWA.js";import"./chunk-KEGAWN6Y.js";import{a as Ee}from"./chunk-XNJNSCLM.js";import{a as qe,b as Ie,c as Re,d as he,e as Le,f as Ae}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as we}from"./chunk-K3GNLVYK.js";import{b as ke}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as re}from"./chunk-BOXSWNXZ.js";import"./chunk-CKSHCYGC.js";import{f as be}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,e as se,f as le,g as Te,k as V}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as r,e as pe,f as Ct,g as Tt,h as kt,j as ne}from"./chunk-RRCPZMC2.js";var Y=pe(Tt(),1);var q=pe(Ct(),1);var s=pe(kt(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Et=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],ae=String.fromCodePoint(0),qt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),It=wt.map(n=>({pattern:new RegExp(String.raw`\b${n.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:n})),Rt=Et.map(n=>({pattern:new RegExp(String.raw`\s+${n.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
2
2
  ${n}`})),Lt=r(n=>{let e=[],t=n.replaceAll(/'(?:[^']|'')*'/gu,l=>(e.push(l),`${ae}${(e.length-1).toString()}${ae}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:l,replacement:a}of It)t=t.replaceAll(l,a);for(let{pattern:l,replacement:a}of Rt)t=t.replaceAll(l,a);return t=t.replaceAll(qt,(l,a)=>e[Number(a)]??""),t},"formatSql"),ie=8,At=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],Ot=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Mt=/[\w$]/,Pe=r(n=>n!==void 0&&Mt.test(n),"isWordChar"),_e=r(n=>{let e=n.length;for(;e>0&&Pe(n[e-1]);)e-=1;return n.slice(e)},"trailingWord"),He=r((n,e)=>{let o=e;for(;o>0&&Pe(n[o-1]);)o-=1;return{end:e,start:o,text:n.slice(o,e)}},"tokenAt"),$e=r((n,e)=>{let o=n.slice(0,e).trimEnd();return o.endsWith(".")||Ot.has(_e(o).toUpperCase())},"prefersColumns"),Dt=r((n,e)=>{let o=n.slice(0,e);if(!o.endsWith("."))return;let t=_e(o.slice(0,-1));return t===""?void 0:t},"qualifierTable"),Ne=r((n,e)=>n.toLowerCase().startsWith(e.toLowerCase()),"matches"),Be=r((n,e,o,t)=>{let l=[];for(let a of n)if(Ne(a,e)&&(l.push(t(a)),l.length>=o))break;return l},"takeMatches"),$t=r((n,e,o)=>{let t=new Map;for(let[l,a]of Object.entries(n.columns))for(let d of a)if(Ne(d,e)&&!t.has(d)&&(t.set(d,l),t.size>=o))return[...t].map(([m,c])=>({detail:c,kind:"column",label:m}));return[...t].map(([l,a])=>({detail:a,kind:"column",label:l}))},"takeColumnMatches"),Bt=r((n,e,o)=>{let t=He(n,e),l=Dt(n,t.start);if(l!==void 0){let u=o.columns[l]??o.columns[l.toLowerCase()]??[];return Be(u,t.text,ie,y=>({detail:l,kind:"column",label:y}))}if(t.text===""&&!$e(n,t.start))return[];let a=Be(o.tables,t.text,ie,u=>({kind:"table",label:u})),d=$t(o,t.text,ie),m=At.filter(u=>t.text!==""&&Ne(u,t.text)&&u.toLowerCase()!==t.text.toLowerCase()).map(u=>({kind:"keyword",label:u}));return($e(n,t.start)?[...d,...a,...m]:[...a,...d,...m]).slice(0,ie)},"suggestionsFor"),Pt=r((n,e,o)=>{let t=He(n,e),l=n.slice(0,t.start)+o.label+n.slice(t.end);return{caret:t.start+o.label.length,value:l}},"acceptSuggestion"),_t=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],Ht=r((n,e)=>{let o=globalThis.getComputedStyle(n),t=globalThis.document.createElement("div"),{style:l}=t;l.position="absolute",l.visibility="hidden",l.whiteSpace="pre-wrap",l.overflowWrap="break-word";for(let c of _t)l[c]=o[c];t.textContent=n.value.slice(0,Math.max(0,e));let a=globalThis.document.createElement("span");a.textContent=n.value.slice(Math.max(0,e))||".",t.append(a),globalThis.document.body.append(t);let d=a.offsetLeft-n.scrollLeft,m=a.offsetTop-n.scrollTop;return t.remove(),{left:d,top:m}},"caretOffset"),Wt=r((n,e,o)=>{let t=(0,Y.c)(13),[l,a]=(0,q.useState)(null),d;t[0]!==n||t[1]!==e?(d=r((N,x)=>{let S=Bt(N,x,n);if(S.length===0){a(null);return}let h=e.current,{left:w,top:T}=h===null?{left:0,top:0}:Ht(h,x);a({active:0,left:w,suggestions:S,top:T})},"t0"),t[0]=n,t[1]=e,t[2]=d):d=t[2];let m=d,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=r(()=>{a(null)},"t1"),t[3]=c):c=t[3];let u=c,y;t[4]===Symbol.for("react.memo_cache_sentinel")?(y=r(N=>{a(x=>{if(x===null)return x;let S=x.suggestions.length,h=(x.active+N+S)%S;return{...x,active:h}})},"t2"),t[4]=y):y=t[4];let g=y,v;t[5]!==o||t[6]!==l||t[7]!==e?(v=r(()=>{let N=e.current;if(l===null||N===null)return!1;let x=l.suggestions[l.active];if(x===void 0)return!1;let S=Pt(N.value,N.selectionStart,x);return o(S.value),a(null),requestAnimationFrame(()=>{let h=e.current;h!==null&&(h.focus(),h.setSelectionRange(S.caret,S.caret))}),!0},"t3"),t[5]=o,t[6]=l,t[7]=e,t[8]=v):v=t[8];let p=v,f;return t[9]!==p||t[10]!==m||t[11]!==l?(f={close:u,commit:p,move:g,refresh:m,state:l},t[9]=p,t[10]=m,t[11]=l,t[12]=f):f=t[12],f},"useSqlAutocomplete"),Ft={column:"column",keyword:"keyword",table:"table"},zt=20,Ut=r(n=>{let e=(0,Y.c)(17),{listboxId:o,onPick:t,state:l}=n,a=G(),d;e[0]!==l?(d=l===null?void 0:{left:l.left,top:l.top+zt},e[0]=l,e[1]=d):d=e[1];let m=d;if(l===null)return null;let c;if(e[2]!==o||e[3]!==t||e[4]!==l.active||e[5]!==l.suggestions||e[6]!==a){let y;e[8]!==o||e[9]!==t||e[10]!==l.active||e[11]!==a?(y=r((g,v)=>(0,s.jsxDEV)("li",{"aria-selected":v===l.active,className:ne("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",v===l.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${o}-opt-${v.toString()}`,onMouseDown:r(p=>{p.preventDefault(),t(v)},"onMouseDown"),role:"option",children:[(0,s.jsxDEV)("span",{className:"truncate font-mono",children:g.label},void 0,!1),g.detail!==void 0&&(0,s.jsxDEV)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:g.detail},void 0,!1),(0,s.jsxDEV)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:a(Ft[g.kind])},void 0,!1)]},`${g.kind}:${g.label}`,!0),"t32"),e[8]=o,e[9]=t,e[10]=l.active,e[11]=a,e[12]=y):y=e[12],c=l.suggestions.map(y),e[2]=o,e[3]=t,e[4]=l.active,e[5]=l.suggestions,e[6]=a,e[7]=c}else c=e[7];let u;return e[13]!==o||e[14]!==m||e[15]!==c?(u=(0,s.jsxDEV)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:o,role:"listbox",style:m,children:c},void 0,!1),e[13]=o,e[14]=m,e[15]=c,e[16]=u):u=e[16],u},"AutocompletePopover"),We=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Yt=r(n=>{let e=(0,Y.c)(29),{active:o,onDelete:t,onSelect:l,query:a}=n,d=G(),m;e[0]!==l||e[1]!==a.id?(m=r(()=>{l(a.id)},"t1"),e[0]=l,e[1]=a.id,e[2]=m):m=e[2];let c=m,u;e[3]!==t||e[4]!==a.id?(u=r(O=>{O.stopPropagation(),t(a.id)},"t2"),e[3]=t,e[4]=a.id,e[5]=u):u=e[5];let y=u,g=o?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",v;e[6]!==g?(v=ne("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",g),e[6]=g,e[7]=v):v=e[7];let p=`sql-query-${a.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M4 6h16M4 12h10M4 18h7"},void 0,!1)},void 0,!1),e[8]=f):f=e[8];let N;e[9]!==a.name?(N=(0,s.jsxDEV)("span",{className:"truncate",children:a.name},void 0,!1),e[9]=a.name,e[10]=N):N=e[10];let x;e[11]!==o||e[12]!==c||e[13]!==v||e[14]!==p||e[15]!==N?(x=(0,s.jsxDEV)("button",{"aria-pressed":o,className:v,"data-testid":p,onClick:c,type:"button",children:[f,N]},void 0,!0),e[11]=o,e[12]=c,e[13]=v,e[14]=p,e[15]=N,e[16]=x):x=e[16];let S;e[17]!==d?(S=d("Delete query"),e[17]=d,e[18]=S):S=e[18];let h;e[19]!==d?(h=d("Delete query"),e[19]=d,e[20]=h):h=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[21]=w):w=e[21];let T;e[22]!==y||e[23]!==h||e[24]!==S?(T=(0,s.jsxDEV)("button",{"aria-label":S,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:y,title:h,type:"button",children:w},void 0,!1),e[22]=y,e[23]=h,e[24]=S,e[25]=T):T=e[25];let R;return e[26]!==T||e[27]!==x?(R=(0,s.jsxDEV)("li",{className:"group/q flex items-center",children:[x,T]},void 0,!0),e[26]=T,e[27]=x,e[28]=R):R=e[28],R},"QueryRow"),jt=r(n=>{let e=(0,Y.c)(58),{activeId:o,history:t,listRef:l,onClearHistory:a,onDelete:d,onLoadHistory:m,onLoadTemplate:c,onNew:u,onSearchChange:y,onSelect:g,queries:v,search:p}=n,f=G(),N;if(e[0]!==v||e[1]!==p){let k=p.trim().toLowerCase();N=k===""?[...v]:v.filter(j=>j.name.toLowerCase().includes(k)),e[0]=v,e[1]=p,e[2]=N}else N=e[2];let x=N,S;e[3]!==f?(S=f("Search queries\u2026"),e[3]=f,e[4]=S):S=e[4];let h;e[5]!==y||e[6]!==p||e[7]!==S?(h=(0,s.jsxDEV)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:y,placeholder:S,type:"text",value:p},void 0,!1),e[5]=y,e[6]=p,e[7]=S,e[8]=h):h=e[8];let w;e[9]!==f?(w=f("New query"),e[9]=f,e[10]=w):w=e[10];let T;e[11]!==f?(T=f("New query"),e[11]=f,e[12]=T):T=e[12];let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1),e[13]=R):R=e[13];let O;e[14]!==u||e[15]!==w||e[16]!==T?(O=(0,s.jsxDEV)("button",{"aria-label":w,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:u,title:T,type:"button",children:R},void 0,!1),e[14]=u,e[15]=w,e[16]=T,e[17]=O):O=e[17];let A;e[18]!==h||e[19]!==O?(A=(0,s.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[h,O]},void 0,!0),e[18]=h,e[19]=O,e[20]=A):A=e[20];let M;e[21]!==f?(M=f("Private"),e[21]=f,e[22]=M):M=e[22];let z;e[23]!==M?(z=(0,s.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M},void 0,!1),e[23]=M,e[24]=z):z=e[24];let B;e[25]!==o||e[26]!==x||e[27]!==l||e[28]!==d||e[29]!==g||e[30]!==f?(B=x.length===0?(0,s.jsxDEV)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:f("No saved queries yet \u2014 they save to this browser as you type.")},void 0,!1):(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:l,children:x.map(k=>(0,s.jsxDEV)(Yt,{active:o===k.id,onDelete:d,onSelect:g,query:k},k.id,!1))},void 0,!1),e[25]=o,e[26]=x,e[27]=l,e[28]=d,e[29]=g,e[30]=f,e[31]=B):B=e[31];let P;e[32]!==z||e[33]!==B?(P=(0,s.jsxDEV)("div",{children:[z,B]},void 0,!0),e[32]=z,e[33]=B,e[34]=P):P=e[34];let H;e[35]!==f?(H=f("Reference"),e[35]=f,e[36]=H):H=e[36];let U;e[37]!==H?(U=(0,s.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:H},void 0,!1),e[37]=H,e[38]=U):U=e[38];let I;e[39]!==c?(I=We.map(k=>(0,s.jsxDEV)("li",{children:(0,s.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":k.sql,onClick:c,type:"button",children:[(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"},void 0,!1)},void 0,!1),k.label]},void 0,!0)},k.label,!1)),e[39]=c,e[40]=I):I=e[40];let L;e[41]!==I?(L=(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px",children:I},void 0,!1),e[41]=I,e[42]=L):L=e[42];let D;e[43]!==U||e[44]!==L?(D=(0,s.jsxDEV)("div",{children:[U,L]},void 0,!0),e[43]=U,e[44]=L,e[45]=D):D=e[45];let _;e[46]!==t||e[47]!==a||e[48]!==m||e[49]!==f?(_=t.length>0&&(0,s.jsxDEV)("div",{children:[(0,s.jsxDEV)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,s.jsxDEV)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")},void 0,!1),(0,s.jsxDEV)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:a,type:"button",children:f("Clear history")},void 0,!1)]},void 0,!0),(0,s.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(k=>(0,s.jsxDEV)("li",{children:(0,s.jsxDEV)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":k.sql,"data-testid":"sql-history-item",onClick:m,title:k.sql,type:"button",children:[(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"},void 0,!1)},void 0,!1),(0,s.jsxDEV)("span",{className:"truncate font-mono",children:k.sql},void 0,!1)]},void 0,!0)},`${k.at.toString()}:${k.sql}`,!1))},void 0,!1)]},void 0,!0),e[46]=t,e[47]=a,e[48]=m,e[49]=f,e[50]=_):_=e[50];let $;e[51]!==P||e[52]!==D||e[53]!==_?($=(0,s.jsxDEV)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-2",children:[P,D,_]},void 0,!0),e[51]=P,e[52]=D,e[53]=_,e[54]=$):$=e[54];let E;return e[55]!==$||e[56]!==A?(E=(0,s.jsxDEV)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",children:[A,$]},void 0,!0),e[55]=$,e[56]=A,e[57]=E):E=e[57],E},"SqlQuerySidebar"),Kt=se(re.listTables),Gt=se(re.readTablePage),Jt=r(n=>{let e=(0,Y.c)(16),o=be(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[l,a]=(0,q.useState)(t),d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];let[m,c]=(0,q.useState)(d),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let y=(0,q.useRef)(u),g,v;e[3]!==o||e[4]!==n?(g=r(()=>{let h={cancelled:!1};return V(r(async()=>{try{let T=await o.query(Kt,{},le(n));h.cancelled||(a(T.map(Vt)),c({}),y.current=new Set)}catch{h.cancelled||(a([]),c({}),y.current=new Set)}},"load")()),()=>{h.cancelled=!0}},"t3"),v=[o,n],e[3]=o,e[4]=n,e[5]=g,e[6]=v):(g=e[5],v=e[6]),(0,q.useEffect)(g,v);let p;e[7]!==o||e[8]!==n?(p=r(h=>{if(y.current.has(h))return;y.current.add(h),V(r(async()=>{try{let T=await o.query(Gt,{limit:1,offset:0,table:h},le(n));c(R=>({...R,[h]:T.columns}))}catch{y.current.delete(h)}},"fetchColumns")())},"t5"),e[7]=o,e[8]=n,e[9]=p):p=e[9];let f=p,N;e[10]!==m||e[11]!==l?(N={columns:m,tables:l},e[10]=m,e[11]=l,e[12]=N):N=e[12];let x=N,S;return e[13]!==f||e[14]!==x?(S={probe:f,schema:x},e[13]=f,e[14]=x,e[15]=S):S=e[15],S},"useSqlSchema"),ge=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,Qt=r(n=>{let e=new Set;ge.lastIndex=0;let o=ge.exec(n);for(;o!==null;)e.add(o[1]??o[2]),o=ge.exec(n);return[...e]},"referencedTables");function Vt(n){return n.name}r(Vt,"_temp$2");var Xt="lunora-studio-sql-tabs",Zt="lunora-studio-sql-active-tab",ye=12,Z=r((n="",e="")=>({activeId:null,id:ve("tab"),name:e,sql:n}),"makeTab"),eo=r(()=>{let n=(0,Y.c)(5),[e,o]=X(Zt),t;n[0]!==o?(t=r(m=>{o(c=>{let u=c[0]??"";return[typeof m=="function"?m(u):m]})},"t0"),n[0]=o,n[1]=t):t=n[1];let l=t,a=e[0]??"",d;return n[2]!==l||n[3]!==a?(d=[a,l],n[2]=l,n[3]=a,n[4]=d):d=n[4],d},"usePersistedActive"),to=r(n=>{let[e,o]=X(Xt),[t,l]=eo(),a=(0,q.useRef)(null);e.length===0&&a.current===null&&(a.current=n()),(0,q.useEffect)(()=>{if(e.length===0&&a.current!==null){let c=a.current;o([c])}},[o,e.length]);let d=e.length===0&&a.current!==null?[a.current]:e;return{activeId:d.some(c=>c.id===t)?t:d[0]?.id??"",setActiveId:l,setTabs:o,tabs:d}},"usePersistedTabs"),Fe=r(n=>n.activeId===null&&n.sql.trim()!=="","isDirty"),oo=r((n,e)=>[...n,e].slice(-ye),"addTab"),no=r((n,e,o)=>{let t=n.findIndex(d=>d.id===e);if(t===-1)return{activeId:n[0]?.id??"",tabs:[...n]};let l=n.filter(d=>d.id!==e);if(l.length===0){let d=o();return{activeId:d.id,tabs:[d]}}return{activeId:l[Math.min(t,l.length-1)].id,tabs:l}},"closeTab"),so=r((n,e)=>{let o=n.filter(t=>t.id===e);return o.length===0?{activeId:n[0]?.id??"",tabs:[...n]}:{activeId:e,tabs:o}},"closeOtherTabs"),lo=r((n,e,o)=>{let t=n.findIndex(a=>a.id===e);if(t===-1)return{activeId:o,tabs:[...n]};let l=n.slice(0,t+1);return{activeId:l.some(a=>a.id===o)?o:e,tabs:l}},"closeTabsToRight"),ro=r(n=>{let e=n();return{activeId:e.id,tabs:[e]}},"closeAllTabs"),io=r((n,e,o)=>{if(n==="others")return e.filter(t=>t.id!==o);if(n==="right"){let t=e.findIndex(l=>l.id===o);return t===-1?[]:e.slice(t+1)}return[...e]},"tabsClosedBy"),ao=r((n,e)=>n.trim()===""?e:(n.split(`
3
3
  `)[0]??n).slice(0,24),"derivedTabLabel"),co=r(n=>{let e=(0,Y.c)(14),{initial:o,onCancel:t,onCommit:l,placeholder:a,testId:d}=n,m=G(),c=mo,u;e[0]!==l?(u=r(N=>{l(N.currentTarget.value.trim())},"t1"),e[0]=l,e[1]=u):u=e[1];let y=u,g;e[2]!==t||e[3]!==l?(g=r(N=>{N.key==="Enter"?l(N.currentTarget.value.trim()):N.key==="Escape"&&t()},"t2"),e[2]=t,e[3]=l,e[4]=g):g=e[4];let v=g,p;e[5]!==m?(p=m("Tab title"),e[5]=m,e[6]=p):p=e[6];let f;return e[7]!==o||e[8]!==y||e[9]!==v||e[10]!==a||e[11]!==p||e[12]!==d?(f=(0,s.jsxDEV)("input",{"aria-label":p,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":d,defaultValue:o,onBlur:y,onKeyDown:v,placeholder:a,ref:c,type:"text"},void 0,!1),e[7]=o,e[8]=y,e[9]=v,e[10]=a,e[11]=p,e[12]=d,e[13]=f):f=e[13],f},"TabRenameInput"),uo=r(n=>{let e=(0,Y.c)(29),{idBase:o,onDiscard:t,onKeep:l}=n,a=G(),d=`sql-tab-close-prompt-${o}`,m;e[0]!==a?(m=a("Discard?"),e[0]=a,e[1]=m):m=e[1];let c;e[2]!==m?(c=(0,s.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=c):c=e[3];let u;e[4]!==a?(u=a("Discard changes"),e[4]=a,e[5]=u):u=e[5];let y=`sql-tab-close-confirm-${o}`,g;e[6]!==a?(g=a("Discard changes"),e[6]=a,e[7]=g):g=e[7];let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M5 13l4 4L19 7"},void 0,!1)},void 0,!1),e[8]=v):v=e[8];let p;e[9]!==t||e[10]!==u||e[11]!==y||e[12]!==g?(p=(0,s.jsxDEV)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":y,onClick:t,title:g,type:"button",children:v},void 0,!1),e[9]=t,e[10]=u,e[11]=y,e[12]=g,e[13]=p):p=e[13];let f;e[14]!==a?(f=a("Keep editing"),e[14]=a,e[15]=f):f=e[15];let N=`sql-tab-close-cancel-${o}`,x;e[16]!==a?(x=a("Keep editing"),e[16]=a,e[17]=x):x=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1),e[18]=S):S=e[18];let h;e[19]!==l||e[20]!==N||e[21]!==x||e[22]!==f?(h=(0,s.jsxDEV)("button",{"aria-label":f,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":N,onClick:l,title:x,type:"button",children:S},void 0,!1),e[19]=l,e[20]=N,e[21]=x,e[22]=f,e[23]=h):h=e[23];let w;return e[24]!==d||e[25]!==h||e[26]!==c||e[27]!==p?(w=(0,s.jsxDEV)("span",{className:"flex shrink-0 items-center gap-1","data-testid":d,role:"group",children:[c,p,h]},void 0,!0),e[24]=d,e[25]=h,e[26]=c,e[27]=p,e[28]=w):w=e[28],w},"TabCloseConfirm"),fo=r(n=>{let e=(0,Y.c)(47),{active:o,canClose:t,onClose:l,onMenu:a,onRename:d,onSelect:m,tab:c}=n,u=G(),[y,g]=(0,q.useState)(!1),[v,p]=(0,q.useState)(!1),f;e[0]!==a||e[1]!==c.id?(f=r(W=>{a(c.id,W)},"t1"),e[0]=a,e[1]=c.id,e[2]=f):f=e[2];let N=f,x;e[3]!==m||e[4]!==c.id?(x=r(()=>{m(c.id)},"t2"),e[3]=m,e[4]=c.id,e[5]=x):x=e[5];let S=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=r(()=>{g(!0)},"t3"),e[6]=h):h=e[6];let w=h,T;e[7]!==l||e[8]!==c?(T=r(W=>{W.stopPropagation(),Fe(c)?p(!0):l(c.id)},"t4"),e[7]=l,e[8]=c,e[9]=T):T=e[9];let R=T,O;e[10]!==l||e[11]!==c.id?(O=r(W=>{W.stopPropagation(),p(!1),l(c.id)},"t5"),e[10]=l,e[11]=c.id,e[12]=O):O=e[12];let A=O,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=r(W=>{W.stopPropagation(),p(!1)},"t6"),e[13]=M):M=e[13];let z=M,B;e[14]!==d||e[15]!==c.id?(B=r(W=>{d(c.id,W),g(!1)},"t7"),e[14]=d,e[15]=c.id,e[16]=B):B=e[16];let P=B,H;e[17]===Symbol.for("react.memo_cache_sentinel")?(H=r(()=>{g(!1)},"t8"),e[17]=H):H=e[17];let U=H,I;e[18]!==c.name?(I=c.name.trim(),e[18]=c.name,e[19]=I):I=e[19];let L=I,D;e[20]!==u||e[21]!==c.sql?(D=ao(c.sql,u("Untitled")),e[20]=u,e[21]=c.sql,e[22]=D):D=e[22];let _=D,$=o?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",E;e[23]!==$?(E=ne("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",$),e[23]=$,e[24]=E):E=e[24];let k=`sql-tab-${c.id}`,j;e[25]!==o||e[26]!==P||e[27]!==L||e[28]!==_||e[29]!==y||e[30]!==S||e[31]!==u||e[32]!==c.id?(j=y?(0,s.jsxDEV)(co,{initial:L,onCancel:U,onCommit:P,placeholder:_,testId:`sql-tab-rename-${c.id}`},void 0,!1):(0,s.jsxDEV)("button",{"aria-pressed":o,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${c.id}`,onClick:S,onDoubleClick:w,title:u("Double-click to rename"),type:"button",children:L===""?_:L},void 0,!1),e[25]=o,e[26]=P,e[27]=L,e[28]=_,e[29]=y,e[30]=S,e[31]=u,e[32]=c.id,e[33]=j):j=e[33];let K;e[34]!==t||e[35]!==A||e[36]!==v||e[37]!==R||e[38]!==u||e[39]!==c.id?(K=t&&(v?(0,s.jsxDEV)(uo,{idBase:c.id,onDiscard:A,onKeep:z},void 0,!1):(0,s.jsxDEV)("button",{"aria-label":u("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${c.id}`,onClick:R,title:u("Close tab"),type:"button",children:(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1)},void 0,!1)),e[34]=t,e[35]=A,e[36]=v,e[37]=R,e[38]=u,e[39]=c.id,e[40]=K):K=e[40];let J;return e[41]!==N||e[42]!==E||e[43]!==k||e[44]!==j||e[45]!==K?(J=(0,s.jsxDEV)("div",{className:E,"data-testid":k,onContextMenu:N,children:[j,K]},void 0,!0),e[41]=N,e[42]=E,e[43]=k,e[44]=j,e[45]=K,e[46]=J):J=e[46],J},"TabButton");function mo(n){n?.focus(),n?.select()}r(mo,"_temp$1");var po=se(re.runSql),bo="lunora-studio-sql-queries",ho="lunora-studio-sql-history",vo=25,go={minWidth:"2.75rem",paddingInline:"0.5rem"},xe={error:null,pane:"results",result:null},xo=r(n=>{let e=(0,Y.c)(16),{result:o}=n;if(o.columns.length===0){let c=o.rowCount===0?"0 rows":"",u;return e[0]!==c?(u=(0,s.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground",children:c},void 0,!1),e[0]=c,e[1]=u):u=e[1],u}let t;e[2]!==o.columns?(t=o.columns.map(yo),e[2]=o.columns,e[3]=t):t=e[3];let l;e[4]!==t?(l=(0,s.jsxDEV)(Ie,{className:"sticky top-0 z-10 bg-muted",children:(0,s.jsxDEV)(he,{children:t},void 0,!1)},void 0,!1),e[4]=t,e[5]=l):l=e[5];let a;if(e[6]!==o.columns||e[7]!==o.rows){let c;e[9]!==o.columns?(c=r((u,y)=>(0,s.jsxDEV)(he,{"data-testid":"sql-row",children:o.columns.map(g=>(0,s.jsxDEV)(Ae,{className:"max-w-md truncate font-mono text-xs",children:(0,s.jsxDEV)(Oe,{value:u[g]},void 0,!1)},g,!1))},y,!1),"t42"),e[9]=o.columns,e[10]=c):c=e[10],a=o.rows.map(c),e[6]=o.columns,e[7]=o.rows,e[8]=a}else a=e[8];let d;e[11]!==a?(d=(0,s.jsxDEV)(Re,{children:a},void 0,!1),e[11]=a,e[12]=d):d=e[12];let m;return e[13]!==l||e[14]!==d?(m=(0,s.jsxDEV)(qe,{"data-testid":"sql-rows",children:[l,d]},void 0,!0),e[13]=l,e[14]=d,e[15]=m):m=e[15],m},"SqlResultTable"),Oo=r(({initialShardKey:n})=>{let e=be(),o=G(),[t,l]=X(bo),[a,d]=X(ho),[m,c]=(0,q.useState)(""),u=r(()=>Z(We[0]?.sql??""),"seedTab"),{activeId:y,setActiveId:g,setTabs:v,tabs:p}=to(u),[f,N]=(0,q.useState)({}),[x,S]=(0,q.useState)(n??""),[h,w]=(0,q.useState)(!1),[T,R]=(0,q.useState)(null),[O,A]=(0,q.useState)(null),M=(0,q.useRef)(null),z=(0,q.useRef)(null),B=(0,q.useRef)(null),P=(0,q.useId)(),{probe:H,schema:U}=Jt(x),I=p.find(i=>i.id===y)??p[0]??Z(),L=I.sql,{activeId:D}=I,_=f[I.id]??xe,{error:$,result:E}=_,k=_.pane,j=r(i=>{v(b=>b.map(C=>C.id===I.id?{...C,...i}:C))},"patchActiveTab"),K=r(i=>{N(b=>{let C=b[I.id]??xe;return{...b,[I.id]:{error:i.error,pane:i.pane??C.pane,result:i.result}}})},"setActiveOutput"),J=r(i=>{N(b=>{let C=b[I.id]??xe;return{...b,[I.id]:{...C,pane:i}}})},"setActivePane"),W=r(i=>{j({sql:i}),D!==null&&l(b=>b.map(C=>C.id===D?{...C,sql:i}:C))},"setDraft"),ze=Wt(U,z,W),{close:ce,commit:Se,move:de,refresh:ee,state:Q}=ze,Ue=r(i=>{de(i-(Q?.active??0)),Se()},"onPickSuggestion");(0,q.useEffect)(()=>{let i=z.current;i!==null&&i===document.activeElement&&ee(i.value,i.selectionStart)},[ee,U]);let Ye=r(i=>{d(b=>b[0]?.sql===i?b:[{at:Date.now(),sql:i},...b.filter(F=>F.sql!==i)].slice(0,vo))},"recordHistory"),ue=r(async i=>{if(L.trim()==="")return;w(!0);let b=i==="explain"?`EXPLAIN QUERY PLAN ${L}`:L;try{let C=await e.query(po,{sql:b},le(x));K({error:null,pane:i,result:C}),ke(x),Ye(b)}catch(C){K({error:Te(C),pane:i,result:null})}finally{w(!1)}},"run"),je=r(()=>{V(ue("results"))},"onRun"),Ke=r(i=>{let{selectionStart:b,value:C}=i.target;W(C);for(let F of Qt(C))H(F);ee(C,b)},"onDraftChange"),Ge=r(i=>{let b=i.currentTarget;ee(b.value,b.selectionStart)},"onEditorSelect"),Je=r(i=>{if(Q!==null){if(i.key==="ArrowDown"){i.preventDefault(),de(1);return}if(i.key==="ArrowUp"){i.preventDefault(),de(-1);return}if(i.key==="Escape"){i.preventDefault(),ce();return}if((i.key==="Enter"||i.key==="Tab")&&!i.metaKey&&!i.ctrlKey&&Se()){i.preventDefault();return}}(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),V(ue(k)))},"onEditorKeyDown"),Qe=r(()=>{requestAnimationFrame(()=>{ce()})},"onEditorBlur"),Ve=r(i=>{M.current!==null&&(M.current.scrollTop=i.currentTarget.scrollTop)},"onEditorScroll"),te=r((i,b)=>{v(C=>C.map(F=>F.id===I.id?{...F,activeId:b,sql:i}:F)),K({error:null,result:null})},"loadIntoActiveTab"),Xe=r(()=>{let i={id:ve("q"),name:o("Untitled query"),sql:""};l(b=>[i,...b]),te("",i.id)},"newQuery"),Ze=r(i=>{let b=t.find(C=>C.id===i);b!==void 0&&(te(b.sql,i),B.current?.querySelector(`[data-testid="sql-query-${i}"]`)?.scrollIntoView({block:"nearest"}))},"selectQuery"),et=r(i=>{l(b=>b.filter(C=>C.id!==i)),v(b=>b.map(C=>C.activeId===i?{...C,activeId:null}:C))},"deleteQuery"),tt=r(i=>{te(i.currentTarget.dataset.sql??"",null)},"loadTemplate"),ot=r(i=>{te(i.currentTarget.dataset.sql??"",null)},"loadFromHistory"),nt=r(()=>{d([])},"clearHistory"),st=r(()=>{W(Lt(L))},"formatDraft"),lt=r(()=>{if(p.length>=ye)return;let i=Z();v(b=>oo(b,i)),g(i.id)},"addEditorTab"),oe=r(i=>{R(null),A(null),v(i.tabs),g(i.activeId);let b=new Set(i.tabs.map(C=>C.id));N(C=>Object.fromEntries(Object.entries(C).filter(([F])=>b.has(F))))},"commitTabs"),rt=r(i=>{oe(no(p,i,Z))},"closeEditorTab"),Ce=r((i,b)=>{oe(i==="others"?so(p,b):i==="right"?lo(p,b,y):ro(Z))},"applyBulk"),fe=r(i=>{T!==null&&(io(i,p,T.id).some(b=>Fe(b))?A(i):Ce(i,T.id))},"requestBulk"),it=r((i,b)=>{b.preventDefault(),A(null),R({id:i,x:b.clientX,y:b.clientY})},"openTabMenu"),at=r(()=>{R(null),A(null)},"closeTabMenu"),ct=r(i=>{i.preventDefault(),R(null),A(null)},"onBackdropContextMenu"),dt=r(()=>{fe("others")},"onCloseOthers"),ut=r(()=>{fe("right")},"onCloseToRight"),ft=r(()=>{fe("all")},"onCloseAll"),mt=r(()=>{T!==null&&O!==null&&Ce(O,T.id),A(null)},"confirmBulk"),pt=r(()=>{A(null)},"cancelBulk"),bt=T===null?void 0:{left:T.x,top:T.y},ht=r(i=>{ce(),g(i)},"selectTab"),vt=r((i,b)=>{v(C=>C.map(F=>F.id===i?{...F,name:b}:F))},"renameTab"),gt=r(()=>{J("results")},"showResults"),xt=r(()=>{V(ue("explain"))},"showExplain"),yt=r(()=>{J("chart")},"showChart"),Nt=L.split(`
4
4
  `).length,St=r(i=>{c(i.target.value)},"onSearchChange"),me=r(i=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${i?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"tabClass");return(0,s.jsxDEV)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,s.jsxDEV)(jt,{activeId:D,history:a,listRef:B,onClearHistory:nt,onDelete:et,onLoadHistory:ot,onLoadTemplate:tt,onNew:Xe,onSearchChange:St,onSelect:Ze,queries:t,search:m},void 0,!1),(0,s.jsxDEV)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,s.jsxDEV)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[p.map(i=>(0,s.jsxDEV)(fo,{active:i.id===I.id,canClose:p.length>1,onClose:rt,onMenu:it,onRename:vt,onSelect:ht,tab:i},i.id,!1)),(0,s.jsxDEV)("button",{"aria-label":o("New tab"),className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:p.length>=ye,onClick:lt,title:o("New tab"),type:"button",children:(0,s.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,s.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0),T!==null&&(0,s.jsxDEV)(s.Fragment,{children:[(0,s.jsxDEV)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:at,onContextMenu:ct,role:"presentation"},void 0,!1),(0,s.jsxDEV)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:bt,children:O===null?(0,s.jsxDEV)(s.Fragment,{children:[(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:p.length<=1,onClick:dt,role:"menuitem",type:"button",children:o("Close other tabs")},void 0,!1),(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:p.findIndex(i=>i.id===T.id)>=p.length-1,onClick:ut,role:"menuitem",type:"button",children:o("Close tabs to the right")},void 0,!1),(0,s.jsxDEV)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:ft,role:"menuitem",type:"button",children:o("Close all tabs")},void 0,!1)]},void 0,!0):(0,s.jsxDEV)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,s.jsxDEV)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")},void 0,!1),(0,s.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:mt,type:"button",children:o("Discard")},void 0,!1),(0,s.jsxDEV)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:pt,type:"button",children:o("Cancel")},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,s.jsxDEV)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxDEV)("div",{"aria-hidden":"true",className:"shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",ref:M,style:go,children:Array.from({length:Nt},(i,b)=>(0,s.jsxDEV)("div",{children:b+1},b,!1))},void 0,!1),(0,s.jsxDEV)("div",{className:"relative min-w-0 flex-1",children:[(0,s.jsxDEV)("textarea",{"aria-activedescendant":Q===null?void 0:`${P}-opt-${Q.active.toString()}`,"aria-autocomplete":"list","aria-controls":Q===null?void 0:P,"aria-expanded":Q!==null,"aria-label":o("SQL query"),className:"size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none","data-testid":"sql-input",onBlur:Qe,onChange:Ke,onKeyDown:Je,onScroll:Ve,onSelect:Ge,placeholder:"SELECT * FROM \u2026",ref:z,role:"combobox",spellCheck:!1,value:L},void 0,!1),(0,s.jsxDEV)(Ut,{listboxId:P,onPick:Ue,state:Q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,s.jsxDEV)("div",{className:"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border",children:[(0,s.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[(0,s.jsxDEV)("button",{className:me(k==="results"),"data-testid":"sql-tab-results",onClick:gt,type:"button",children:o("Results")},void 0,!1),(0,s.jsxDEV)("button",{className:me(k==="chart"),"data-testid":"sql-tab-chart",onClick:yt,type:"button",children:o("Chart")},void 0,!1),(0,s.jsxDEV)("button",{className:me(k==="explain"),"data-testid":"sql-tab-explain",onClick:xt,type:"button",children:o("Explain")},void 0,!1),(0,s.jsxDEV)("div",{className:"ms-auto flex items-center gap-2",children:[E!==null&&E.columns.length>0&&(0,s.jsxDEV)(Me,{columns:E.columns,name:"query-result",rows:E.rows},void 0,!1),(0,s.jsxDEV)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:h,onClick:st,type:"button",children:o("Format")},void 0,!1),(0,s.jsxDEV)(we,{onChange:S,testId:"sql-shard-input",value:x},void 0,!1),(0,s.jsxDEV)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:h,onClick:je,type:"button",children:[o(h?"Running\u2026":"Run"),(0,s.jsxDEV)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,s.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto",children:[$!==null&&(0,s.jsxDEV)(Ee,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:$},void 0,!1),$===null&&E===null&&(0,s.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:o("Click Run to execute your query.")},void 0,!1),$===null&&E!==null&&(0,s.jsxDEV)("div",{"data-testid":"sql-result",children:[k==="chart"?(0,s.jsxDEV)(De,{result:E},void 0,!1):(0,s.jsxDEV)(xo,{result:E},void 0,!1),(0,s.jsxDEV)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:E.truncated?o("Showing the first {max} of {count} rows.",{count:E.rowCount,max:E.rows.length}):o("{count} rows",{count:E.rowCount})},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"SqlEditorPanel");function yo(n){return(0,s.jsxDEV)(Le,{children:n},n,!1)}r(yo,"_temp");export{Oo as SqlEditorPanel};
@@ -1 +1 @@
1
- import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as _}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as R}from"./chunk-AQGOX5DK.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as K}from"./chunk-DVKPRFIJ.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"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"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
1
+ import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as _}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as R}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as K}from"./chunk-DVKPRFIJ.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"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"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
@@ -1 +1 @@
1
- import{a as d,b as u}from"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import"./chunk-KEGAWN6Y.js";import"./chunk-HV7G6DFP.js";import"./chunk-3OA7PECS.js";import"./chunk-GMSGZDDH.js";import{a as c,e as m,g as p,h as v}from"./chunk-RRCPZMC2.js";var h=m(p(),1);var o=m(v(),1);var y={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},g=c(n=>{let e=(0,h.c)(6),{data:i}=n,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let f=i.slice(-16);if(f.length<3){r=null;break e}a=f.map(_)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.jsxDEV)(u,{dataKey:"value"},void 0,!1),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,o.jsxDEV)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,o.jsxDEV)(d,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:y,data:s,children:t},void 0,!1)},void 0,!1),e[4]=s,e[5]=l):l=e[5],l},"Sparkline");function _(n,e){return{index:e,value:n}}c(_,"_temp");export{g as Sparkline};
1
+ import{a as d,b as u}from"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import"./chunk-HV7G6DFP.js";import"./chunk-3OA7PECS.js";import"./chunk-GMSGZDDH.js";import{a as c,e as m,g as p,h as v}from"./chunk-RRCPZMC2.js";var h=m(p(),1);var o=m(v(),1);var y={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},g=c(n=>{let e=(0,h.c)(6),{data:i}=n,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let f=i.slice(-16);if(f.length<3){r=null;break e}a=f.map(_)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.jsxDEV)(u,{dataKey:"value"},void 0,!1),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,o.jsxDEV)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,o.jsxDEV)(d,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:y,data:s,children:t},void 0,!1)},void 0,!1),e[4]=s,e[5]=l):l=e[5],l},"Sparkline");function _(n,e){return{index:e,value:n}}c(_,"_temp");export{g as Sparkline};
@@ -0,0 +1,2 @@
1
+ import{a as q}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as T}from"./chunk-QAFAJBAW.js";import{a as H}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as D}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{R as F}from"./chunk-3CJW6NWG.js";import{c}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as p}from"./chunk-BOXSWNXZ.js";import{a as O}from"./chunk-TAD43CG5.js";import{b as B}from"./chunk-DVKPRFIJ.js";import{b as P}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as j}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as $,e as g,f as N,g as w,k as y,l as R,n as C}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as o,e as M,f as oe,h as se,j as z}from"./chunk-RRCPZMC2.js";var d=M(oe(),1);var e=M(se(),1);function de({className:r,orientation:m="horizontal",...a}){return(0,e.jsxDEV)(T,{"data-slot":"separator",orientation:m,className:z("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...a},void 0,!1)}o(de,"Separator");var le=g(p.clearCapturedMail),ne=g(p.sendTestMail),ce=/https?:\/\/[^\s"'<>)]+/i,_=o(r=>r===void 0?void 0:ce.exec(r)?.[0],"firstLink"),me=o(r=>{if(r!==void 0)return _(r.html)??_(r.text)},"selectedLink"),ue=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,fe=o(r=>`${ue}${r}`,"withPreviewCsp"),v=o(r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,"recipientText"),Ie=o(({limit:r=100})=>{let m=j(),a=$(),{data:S,error:k,errorSource:U,isLoading:V,refetch:x}=B(p.getCapturedMail,{limit:r}),[E,h]=(0,d.useState)(null),[A,L]=(0,d.useState)(null),[u,W]=(0,d.useState)("html"),[b,K]=(0,d.useState)(""),l=(0,d.useMemo)(()=>S?.entries??[],[S]),I=k??E,Q=k===null?E:U,G=o(async()=>{h(null);try{await m.query(le,{},N("")),L(null),x()}catch(t){h(w(t))}},"clearInbox"),J=o(async()=>{h(null);try{await m.query(ne,{},N("")),x()}catch(t){h(w(t))}},"sendTest");H(()=>{x()},!0);let X=o(()=>{y(G())},"onClear"),Y=o(()=>{y(J())},"onSendTest"),Z=o(t=>{K(t.currentTarget.value)},"onFilterChange"),ee=o(t=>{let{id:s}=t.currentTarget.dataset;s!==void 0&&L(s)},"onSelectMessage"),te=o(t=>{let s=t.currentTarget.dataset.tab;(s==="headers"||s==="html"||s==="text")&&W(s)},"onSelectTab"),ae=o(t=>a(t==="html"?"HTML":t==="text"?"Plain text":"Headers"),"tabTitle"),f=(0,d.useMemo)(()=>{let t=b.trim().toLowerCase();return t===""?l:l.filter(s=>`${s.subject} ${v(s.to)}`.toLowerCase().includes(t))},[l,b]),i=(0,d.useMemo)(()=>{if(f.length!==0)return f.find(t=>t.id===A)??f[0]},[f,A]),n=me(i),re=o(()=>{n!==void 0&&R(n)},"onCopyLink"),ie=o(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"onOpenLink");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-send-test",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Send test")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-clear",disabled:l.length===0,onClick:X,size:"sm",type:"button",variant:"outline",children:a("Clear inbox")},void 0,!1),l.length>0&&(0,e.jsxDEV)(P,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:a("{count} messages",{count:l.length})},void 0,!1)]},void 0,!0),I!==null&&(0,e.jsxDEV)(D,{error:Q,testId:"mail-error"},void 0,!1),I===null&&!V&&l.length===0&&(0,e.jsxDEV)(O,{description:a("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsxDEV)("path",{d:"M4 5h16v14H4z"},void 0,!1),(0,e.jsxDEV)("path",{d:"m4 6 8 6 8-6"},void 0,!1)]},void 0,!0),testId:"mail-empty",title:a("No captured email.")},void 0,!1),l.length>0&&(0,e.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(F,{"aria-label":a("Search messages"),"data-testid":"mail-search",onChange:Z,placeholder:a("Filter messages"),type:"search",value:b},void 0,!1),(0,e.jsxDEV)(q,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,e.jsxDEV)("ul",{className:"divide-y",children:f.map(t=>{let s=t.id===i?.id;return(0,e.jsxDEV)("li",{children:(0,e.jsxDEV)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${s?"bg-muted":""}`,"data-active":s,"data-id":t.id,"data-testid":"mail-list-item",onClick:ee,type:"button",children:[(0,e.jsxDEV)("span",{className:"w-full truncate font-medium",children:t.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("span",{className:"w-full truncate text-xs text-muted-foreground",children:v(t.to)},void 0,!1),(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground tabular-nums",children:C(t.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)},t.id,!1)})},void 0,!1)},void 0,!1)]},void 0,!0),i!==void 0&&(0,e.jsxDEV)("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,e.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,e.jsxDEV)("dt",{children:a("From")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:i.from??"\u2014"},void 0,!1),(0,e.jsxDEV)("dt",{children:a("To")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.to)},void 0,!1),i.cc!==void 0&&i.cc.length>0&&(0,e.jsxDEV)(e.Fragment,{children:[(0,e.jsxDEV)("dt",{children:a("Cc")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.cc)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("dt",{children:a("Sent")},void 0,!1),(0,e.jsxDEV)("dd",{className:"tabular-nums",children:C(i.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-copy-link",disabled:n===void 0,onClick:re,size:"sm",type:"button",variant:"outline",children:a("Copy link")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-open-link",disabled:n===void 0,onClick:ie,size:"sm",type:"button",variant:"outline",children:a("Open in new tab")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(de,{},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(t=>(0,e.jsxDEV)(c,{"aria-selected":u===t,"data-tab":t,"data-testid":`mail-tab-${t}`,onClick:te,role:"tab",size:"sm",type:"button",variant:u===t?"secondary":"ghost",children:ae(t)},t,!1))},void 0,!1),(0,e.jsxDEV)("div",{className:"min-h-[12rem]",children:[u==="html"&&(i.html===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No HTML body.")},void 0,!1):(0,e.jsxDEV)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:fe(i.html),title:a("Email preview")},void 0,!1)),u==="text"&&(i.text===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No text body.")},void 0,!1):(0,e.jsxDEV)("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},void 0,!1)),u==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No headers.")},void 0,!1):(0,e.jsxDEV)("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(([t,s])=>`${t}: ${s}`).join(`
2
+ `)},void 0,!1))]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"MailPanel");export{Ie as MailPanel};
@@ -1 +1 @@
1
- import{a as R}from"./chunk-WXPWVBIY.js";import{a as w,b as O,c as D,d as C,e as v,f as h}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-AQGOX5DK.js";import{a as S}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-DVKPRFIJ.js";import{a as A,e as I}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as u,e as T,f as M,g as P,h as V}from"./chunk-RRCPZMC2.js";var B=T(P(),1),K=T(M(),1);var t=T(V(),1);var k="container:",F={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},H=u(e=>{let r=e.indexOf(":");if(r===-1)return{event:e.trim()};let a=e.slice(r+1).trim(),s=e.slice(0,r).trim();return a===""?{event:s}:{detail:a,event:s}},"parseContainerMessage"),W=u(e=>{let r=new Map;for(let a of e){let s=a.functionPath??"";if(!s.startsWith(k))continue;let n=s.slice(k.length);if(n==="")continue;let i=r.get(n);if(i!==void 0&&i.timestamp>=a.timestamp)continue;let{detail:x,event:o}=H(a.message);r.set(n,{detail:x,event:o,level:a.level,name:n,state:F[o]??"unknown",timestamp:a.timestamp})}return[...r.values()].toSorted((a,s)=>a.name.localeCompare(s.name))},"foldContainerInstances"),$={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},j=u(e=>{let{entries:r}=e??{};return Array.isArray(r)?r:[]},"entriesOf"),ee=u(()=>{let e=(0,B.c)(23),r=b(),a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);let{data:n,error:i,liveError:x}=_(L.getLogs,a,s),o=n!==void 0,N;e[2]!==n?(N=W(j(n)),e[2]=n,e[3]=N):N=e[3];let g=N,l;e[4]!==i?(l=i!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:i},void 0,!1),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per container \u2014 ports and health checks aren't carried in that stream."),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==c?(d=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c},void 0,!1),e[8]=c,e[9]=d):d=e[9];let m;e[10]!==x?(m=(0,t.jsxDEV)(R,{message:x,prefix:"containers"},void 0,!1),e[10]=x,e[11]=m):m=e[11];let f;e[12]!==d||e[13]!==m?(f=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[d,m]},void 0,!0),e[12]=d,e[13]=m,e[14]=f):f=e[14];let p;e[15]!==o||e[16]!==g||e[17]!==r?(p=o&&g.length===0?(0,t.jsxDEV)(S,{description:r("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:r("No container activity")},void 0,!1):(0,t.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(I,{className:"px-0",children:(0,t.jsxDEV)(w,{"data-testid":"containers-table",children:[(0,t.jsxDEV)(O,{children:(0,t.jsxDEV)(C,{children:[(0,t.jsxDEV)(v,{children:r("Container")},void 0,!1),(0,t.jsxDEV)(v,{children:r("State")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Last event")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Detail")},void 0,!1),(0,t.jsxDEV)(v,{children:r("When")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(D,{children:g.map(G)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[15]=o,e[16]=g,e[17]=r,e[18]=p):p=e[18];let y;return e[19]!==l||e[20]!==f||e[21]!==p?(y=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[l,f,p]},void 0,!0),e[19]=l,e[20]=f,e[21]=p,e[22]=y):y=e[22],y},"ContainersPanel");function G(e){return(0,t.jsxDEV)(C,{"data-testid":`containers-row-${e.name}`,children:[(0,t.jsxDEV)(h,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,t.jsxDEV)(h,{children:(0,t.jsxDEV)(E,{variant:$[e.state],children:e.state},void 0,!1)},void 0,!1),(0,t.jsxDEV)(h,{className:"font-mono text-xs text-muted-foreground",children:e.event},void 0,!1),(0,t.jsxDEV)(h,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"},void 0,!1),(0,t.jsxDEV)(h,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()},void 0,!1)]},e.name,!0)}u(G,"_temp");export{ee as ContainersPanel};
1
+ import{a as R}from"./chunk-WXPWVBIY.js";import{a as w,b as O,c as D,d as C,e as v,f as h}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as S}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-DVKPRFIJ.js";import{a as A,e as I}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as u,e as T,f as M,g as P,h as V}from"./chunk-RRCPZMC2.js";var B=T(P(),1),K=T(M(),1);var t=T(V(),1);var k="container:",F={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},H=u(e=>{let r=e.indexOf(":");if(r===-1)return{event:e.trim()};let a=e.slice(r+1).trim(),s=e.slice(0,r).trim();return a===""?{event:s}:{detail:a,event:s}},"parseContainerMessage"),W=u(e=>{let r=new Map;for(let a of e){let s=a.functionPath??"";if(!s.startsWith(k))continue;let n=s.slice(k.length);if(n==="")continue;let i=r.get(n);if(i!==void 0&&i.timestamp>=a.timestamp)continue;let{detail:x,event:o}=H(a.message);r.set(n,{detail:x,event:o,level:a.level,name:n,state:F[o]??"unknown",timestamp:a.timestamp})}return[...r.values()].toSorted((a,s)=>a.name.localeCompare(s.name))},"foldContainerInstances"),$={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},j=u(e=>{let{entries:r}=e??{};return Array.isArray(r)?r:[]},"entriesOf"),ee=u(()=>{let e=(0,B.c)(23),r=b(),a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);let{data:n,error:i,liveError:x}=_(L.getLogs,a,s),o=n!==void 0,N;e[2]!==n?(N=W(j(n)),e[2]=n,e[3]=N):N=e[3];let g=N,l;e[4]!==i?(l=i!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:i},void 0,!1),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per container \u2014 ports and health checks aren't carried in that stream."),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==c?(d=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c},void 0,!1),e[8]=c,e[9]=d):d=e[9];let m;e[10]!==x?(m=(0,t.jsxDEV)(R,{message:x,prefix:"containers"},void 0,!1),e[10]=x,e[11]=m):m=e[11];let f;e[12]!==d||e[13]!==m?(f=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[d,m]},void 0,!0),e[12]=d,e[13]=m,e[14]=f):f=e[14];let p;e[15]!==o||e[16]!==g||e[17]!==r?(p=o&&g.length===0?(0,t.jsxDEV)(S,{description:r("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:r("No container activity")},void 0,!1):(0,t.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(I,{className:"px-0",children:(0,t.jsxDEV)(w,{"data-testid":"containers-table",children:[(0,t.jsxDEV)(O,{children:(0,t.jsxDEV)(C,{children:[(0,t.jsxDEV)(v,{children:r("Container")},void 0,!1),(0,t.jsxDEV)(v,{children:r("State")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Last event")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Detail")},void 0,!1),(0,t.jsxDEV)(v,{children:r("When")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(D,{children:g.map(G)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[15]=o,e[16]=g,e[17]=r,e[18]=p):p=e[18];let y;return e[19]!==l||e[20]!==f||e[21]!==p?(y=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[l,f,p]},void 0,!0),e[19]=l,e[20]=f,e[21]=p,e[22]=y):y=e[22],y},"ContainersPanel");function G(e){return(0,t.jsxDEV)(C,{"data-testid":`containers-row-${e.name}`,children:[(0,t.jsxDEV)(h,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,t.jsxDEV)(h,{children:(0,t.jsxDEV)(E,{variant:$[e.state],children:e.state},void 0,!1)},void 0,!1),(0,t.jsxDEV)(h,{className:"font-mono text-xs text-muted-foreground",children:e.event},void 0,!1),(0,t.jsxDEV)(h,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"},void 0,!1),(0,t.jsxDEV)(h,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()},void 0,!1)]},e.name,!0)}u(G,"_temp");export{ee as ContainersPanel};
@@ -1 +1 @@
1
- import{a as g,b as S}from"./chunk-55YA7ZZI.js";import{a as i,e as m,g as v,h as C,j as d}from"./chunk-RRCPZMC2.js";var w=i(e=>{let t=0,n=0,o=0,r=0,s=0,l=0,c=0;for(let{metrics:a}of e){if(a===null){s+=1;continue}r+=1,t+=a.requests,n+=a.errors,o+=a.databaseSize??0,a.cache!==null&&(l+=a.cache.hits,c+=a.cache.hits+a.cache.misses)}return{failed:s,hitRate:c===0?null:l/c,reachable:r,totalDatabaseSize:o,totalErrors:n,totalRequests:t}},"aggregateMetrics"),E=i((e,t)=>{let n=new Set,o=[];for(let r of["",e.trim(),...t])n.has(r)||(n.add(r),o.push(r));return o},"shardsToAggregate"),x=i((e,t)=>{if(e.length===0)return 0;if(e.sort((o,r)=>o-r),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let n=Math.ceil(t/100*e.length)-1;return e[n]??0},"percentile"),N=i(e=>{let n=e.functions;if(!n||n.length===0)return{p90:0,p95:0};let o=1e3,r=[];for(let s of n){if(s.calls<=0)continue;let l=s.totalDurationMs/s.calls,c=Math.min(s.calls,o);for(let a=0;a<c;a+=1)r.push(l)}return r.length===0?{p90:0,p95:0}:{p90:x([...r],90),p95:x([...r],95)}},"computeLatencyPercentiles");var _=i(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"enrichQueryStats");var b=m(v(),1);var p=m(C(),1);var D={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},P=i(e=>{let t=(0,b.c)(12),{ariaLabel:n,className:o,series:r,testId:s}=e;if(r.length<2)return null;let l;t[0]!==r?(l=r.slice(-40).map(M),t[0]=r,t[1]=l):l=t[1];let c=l,a;t[2]!==o?(a=d("h-6 w-[120px]",o),t[2]=o,t[3]=a):a=t[3];let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,p.jsxDEV)(S,{dataKey:"value"},void 0,!1),t[4]=u):u=t[4];let f;t[5]!==c?(f=(0,p.jsxDEV)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:D,data:c,children:u},void 0,!1),t[5]=c,t[6]=f):f=t[6];let h;return t[7]!==n||t[8]!==a||t[9]!==f||t[10]!==s?(h=(0,p.jsxDEV)("div",{"aria-label":n,className:a,"data-testid":s,role:"img",children:f},void 0,!1),t[7]=n,t[8]=a,t[9]=f,t[10]=s,t[11]=h):h=t[11],h},"Sparkline");function M(e,t){return{index:t,value:e}}i(M,"_temp");export{w as a,E as b,N as c,_ as d,P as e};
1
+ import{a as g,b as S}from"./chunk-DC72CQY4.js";import{a as i,e as m,g as v,h as C,j as d}from"./chunk-RRCPZMC2.js";var w=i(e=>{let t=0,n=0,o=0,r=0,s=0,l=0,c=0;for(let{metrics:a}of e){if(a===null){s+=1;continue}r+=1,t+=a.requests,n+=a.errors,o+=a.databaseSize??0,a.cache!==null&&(l+=a.cache.hits,c+=a.cache.hits+a.cache.misses)}return{failed:s,hitRate:c===0?null:l/c,reachable:r,totalDatabaseSize:o,totalErrors:n,totalRequests:t}},"aggregateMetrics"),E=i((e,t)=>{let n=new Set,o=[];for(let r of["",e.trim(),...t])n.has(r)||(n.add(r),o.push(r));return o},"shardsToAggregate"),x=i((e,t)=>{if(e.length===0)return 0;if(e.sort((o,r)=>o-r),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let n=Math.ceil(t/100*e.length)-1;return e[n]??0},"percentile"),N=i(e=>{let n=e.functions;if(!n||n.length===0)return{p90:0,p95:0};let o=1e3,r=[];for(let s of n){if(s.calls<=0)continue;let l=s.totalDurationMs/s.calls,c=Math.min(s.calls,o);for(let a=0;a<c;a+=1)r.push(l)}return r.length===0?{p90:0,p95:0}:{p90:x([...r],90),p95:x([...r],95)}},"computeLatencyPercentiles");var _=i(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"enrichQueryStats");var b=m(v(),1);var p=m(C(),1);var D={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},P=i(e=>{let t=(0,b.c)(12),{ariaLabel:n,className:o,series:r,testId:s}=e;if(r.length<2)return null;let l;t[0]!==r?(l=r.slice(-40).map(M),t[0]=r,t[1]=l):l=t[1];let c=l,a;t[2]!==o?(a=d("h-6 w-[120px]",o),t[2]=o,t[3]=a):a=t[3];let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,p.jsxDEV)(S,{dataKey:"value"},void 0,!1),t[4]=u):u=t[4];let f;t[5]!==c?(f=(0,p.jsxDEV)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:D,data:c,children:u},void 0,!1),t[5]=c,t[6]=f):f=t[6];let h;return t[7]!==n||t[8]!==a||t[9]!==f||t[10]!==s?(h=(0,p.jsxDEV)("div",{"aria-label":n,className:a,"data-testid":s,role:"img",children:f},void 0,!1),t[7]=n,t[8]=a,t[9]=f,t[10]=s,t[11]=h):h=t[11],h},"Sparkline");function M(e,t){return{index:t,value:e}}i(M,"_temp");export{w as a,E as b,N as c,_ as d,P as e};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-J6J54MBP.js";import{a as E}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as x,b as I,c as N,d as u,e as l,f as o}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-AQGOX5DK.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as y}from"./chunk-DVKPRFIJ.js";import{a as m,e as h}from"./chunk-SEU5V7I6.js";import{b as v}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,n as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as c,e as Q,h as V}from"./chunk-RRCPZMC2.js";var e=Q(V(),1);var P=new Set(["active","trialing"]),D=new Set(["past_due","unpaid"]),a=c((t,s)=>{if(t[s]!==void 0)return t[s];let d=t.__doc__;if(typeof d=="string")try{let n=JSON.parse(d);if(n!==null&&typeof n=="object"&&!Array.isArray(n))return n[s]}catch{}},"readField"),i=c(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),F=c(t=>P.has(t)?"default":D.has(t)?"destructive":"outline","badgeVariant"),K=c(({limit:t=100})=>{let s=S(),d=y(g.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),n=y(g.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});C(()=>{d.refetch(),n.refetch()},!0);let f=d.data?.rows??[],R=n.data?.rows??[],B=d.error??n.error,w=d.error===null?n.errorSource:d.errorSource,T=f.filter(r=>P.has(i(a(r,"state")))).length,j=R.toSorted((r,p)=>Number(a(p,"processedAt")??0)-Number(a(r,"processedAt")??0));return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxDEV)(m,{className:"justify-between gap-0 py-0",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Subscriptions")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T},void 0,!1),(0,e.jsxDEV)(v,{variant:"default",children:s("{count} active",{count:T})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s("{total} total",{total:f.length})},void 0,!1)]},void 0,!0)},void 0,!1),B===null?void 0:(0,e.jsxDEV)(E,{error:w},void 0,!1),f.length===0&&!d.isLoading?(0,e.jsxDEV)(A,{testId:"payments-empty",title:s("No subscriptions yet")},void 0,!1):(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:[(0,e.jsxDEV)(I,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(l,{children:s("Provider")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Reference")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Plan")},void 0,!1),(0,e.jsxDEV)(l,{children:s("State")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(N,{children:f.map(r=>{let p=i(a(r,"state"));return(0,e.jsxDEV)(u,{"data-testid":"payment-subscription-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"referenceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"priceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(v,{variant:F(p),children:p},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"currentPeriodEnd"))},void 0,!1)]},i(a(r,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Recent webhook events")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:(0,e.jsxDEV)(N,{children:j.map(r=>(0,e.jsxDEV)(u,{"data-testid":"payment-event-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{className:"font-medium",children:i(a(r,"type"))},void 0,!1),(0,e.jsxDEV)(o,{className:"text-muted-foreground",children:i(a(r,"providerEventId"))},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"processedAt"))},void 0,!1)]},i(a(r,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel");export{K as PaymentsPanel};
1
+ import{a as C}from"./chunk-J6J54MBP.js";import{a as E}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as x,b as I,c as N,d as u,e as l,f as o}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as y}from"./chunk-DVKPRFIJ.js";import{a as m,e as h}from"./chunk-SEU5V7I6.js";import{b as v}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,n as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as c,e as Q,h as V}from"./chunk-RRCPZMC2.js";var e=Q(V(),1);var P=new Set(["active","trialing"]),D=new Set(["past_due","unpaid"]),a=c((t,s)=>{if(t[s]!==void 0)return t[s];let d=t.__doc__;if(typeof d=="string")try{let n=JSON.parse(d);if(n!==null&&typeof n=="object"&&!Array.isArray(n))return n[s]}catch{}},"readField"),i=c(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),F=c(t=>P.has(t)?"default":D.has(t)?"destructive":"outline","badgeVariant"),K=c(({limit:t=100})=>{let s=S(),d=y(g.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),n=y(g.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});C(()=>{d.refetch(),n.refetch()},!0);let f=d.data?.rows??[],R=n.data?.rows??[],B=d.error??n.error,w=d.error===null?n.errorSource:d.errorSource,T=f.filter(r=>P.has(i(a(r,"state")))).length,j=R.toSorted((r,p)=>Number(a(p,"processedAt")??0)-Number(a(r,"processedAt")??0));return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxDEV)(m,{className:"justify-between gap-0 py-0",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Subscriptions")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T},void 0,!1),(0,e.jsxDEV)(v,{variant:"default",children:s("{count} active",{count:T})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s("{total} total",{total:f.length})},void 0,!1)]},void 0,!0)},void 0,!1),B===null?void 0:(0,e.jsxDEV)(E,{error:w},void 0,!1),f.length===0&&!d.isLoading?(0,e.jsxDEV)(A,{testId:"payments-empty",title:s("No subscriptions yet")},void 0,!1):(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:[(0,e.jsxDEV)(I,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(l,{children:s("Provider")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Reference")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Plan")},void 0,!1),(0,e.jsxDEV)(l,{children:s("State")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(N,{children:f.map(r=>{let p=i(a(r,"state"));return(0,e.jsxDEV)(u,{"data-testid":"payment-subscription-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"referenceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"priceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(v,{variant:F(p),children:p},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"currentPeriodEnd"))},void 0,!1)]},i(a(r,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Recent webhook events")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:(0,e.jsxDEV)(N,{children:j.map(r=>(0,e.jsxDEV)(u,{"data-testid":"payment-event-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{className:"font-medium",children:i(a(r,"type"))},void 0,!1),(0,e.jsxDEV)(o,{className:"text-muted-foreground",children:i(a(r,"providerEventId"))},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"processedAt"))},void 0,!1)]},i(a(r,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel");export{K as PaymentsPanel};
@@ -1 +1 @@
1
- import{a as S}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{a as C}from"./chunk-AQGOX5DK.js";import{a as u}from"./chunk-TAD43CG5.js";import{b as T}from"./chunk-DVKPRFIJ.js";import{a as N,e as b}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as h}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
1
+ import{a as S}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{a as C}from"./chunk-BOXSWNXZ.js";import{a as u}from"./chunk-TAD43CG5.js";import{b as T}from"./chunk-DVKPRFIJ.js";import{a as N,e as b}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as h}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
@@ -1 +1 @@
1
- import{a as k,b as j}from"./chunk-FKO3HO6I.js";import{a as D}from"./chunk-WXPWVBIY.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-AQGOX5DK.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-DVKPRFIJ.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,n as R}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
1
+ import{a as k,b as j}from"./chunk-KJJ3WM6H.js";import{a as D}from"./chunk-WXPWVBIY.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-DVKPRFIJ.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,n as R}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-AQGOX5DK.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-DVKPRFIJ.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
1
+ import{a as w}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-DVKPRFIJ.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};