@lunora/studio 1.0.0-alpha.48 → 1.0.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/agents-panel.js +326 -0
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_shared/{Studio-sfBFghzO.js → Studio-MB2VTLwI.js} +1 -1
- package/dist/packem_shared/{StudioApp-Ism1gXfJ.js → StudioApp-Ds6u0iY5.js} +1 -1
- package/dist/packem_shared/{app.d-CNLRTrWw.d.ts → app.d-Bly6zmWK.d.ts} +1 -1
- package/dist/packem_shared/{studio-CFC_pv0f.js → studio-Bv27fj7n.js} +602 -575
- package/dist/standalone/{chunk-JQ4WOPMF.js → chunk-2CCWLKQW.js} +1 -1
- package/dist/standalone/{chunk-EYSL7KEQ.js → chunk-2JUOJEKE.js} +1 -1
- package/dist/standalone/{chunk-FNQQ3B5G.js → chunk-2O4BHAHA.js} +1 -1
- package/dist/standalone/{chunk-7YXOPTWI.js → chunk-3GXGLNKW.js} +1 -1
- package/dist/standalone/{chunk-4KSX53SI.js → chunk-3JXKA6BH.js} +1 -1
- package/dist/standalone/chunk-4TV6S6AO.js +3 -0
- package/dist/standalone/{chunk-CTPCJNOP.js → chunk-5OZQHQ26.js} +1 -1
- package/dist/standalone/{chunk-ADP5UEHQ.js → chunk-5YPIP3G7.js} +1 -1
- package/dist/standalone/{chunk-Y2GJJVS5.js → chunk-6U45TJXA.js} +1 -1
- package/dist/standalone/{chunk-37HPVOYP.js → chunk-7LDYSHOU.js} +1 -1
- package/dist/standalone/{chunk-2CQ2YNER.js → chunk-A3ZJACVT.js} +1 -1
- package/dist/standalone/{chunk-CGGZAYGG.js → chunk-AHDVD4KF.js} +1 -1
- package/dist/standalone/{chunk-PL2KY6IG.js → chunk-ALTQC4S5.js} +1 -1
- package/dist/standalone/{chunk-QBAT52GB.js → chunk-APSSZB6Z.js} +1 -1
- package/dist/standalone/{chunk-HROXYAZT.js → chunk-BGG56IF5.js} +1 -1
- package/dist/standalone/{chunk-GSCV2N3F.js → chunk-BTODL6SI.js} +1 -1
- package/dist/standalone/{chunk-K2CB2CHL.js → chunk-CCRVGYTN.js} +1 -1
- package/dist/standalone/{chunk-CJTT4TBP.js → chunk-CDHEMVIY.js} +1 -1
- package/dist/standalone/{chunk-V4ECZI2R.js → chunk-CTOOUWO4.js} +1 -1
- package/dist/standalone/{chunk-DDE62TRL.js → chunk-ECJPFPHR.js} +1 -1
- package/dist/standalone/{chunk-YAECF5LW.js → chunk-EOE5NDMK.js} +1 -1
- package/dist/standalone/{chunk-SHK6RAFG.js → chunk-FFCUV3TZ.js} +1 -1
- package/dist/standalone/{chunk-SEQ43UW2.js → chunk-GA6K5WS5.js} +1 -1
- package/dist/standalone/{chunk-WD2LBHJZ.js → chunk-JUDPYSJZ.js} +1 -1
- package/dist/standalone/{chunk-CLMGPTAI.js → chunk-L4UCG6XZ.js} +1 -1
- package/dist/standalone/{chunk-DH4K2OLM.js → chunk-LUP4YTBS.js} +1 -1
- package/dist/standalone/{chunk-YSPZSTDI.js → chunk-N4TGVH2R.js} +1 -1
- package/dist/standalone/{chunk-YFA7NUCL.js → chunk-NH4FSHFO.js} +1 -1
- package/dist/standalone/{chunk-3HS3ZXFB.js → chunk-NS23QR4W.js} +1 -1
- package/dist/standalone/{chunk-3OZDR3RM.js → chunk-Q6356GAQ.js} +1 -1
- package/dist/standalone/{chunk-FKVCHCYV.js → chunk-Q7HPS6TW.js} +1 -1
- package/dist/standalone/{chunk-WOXVMXSQ.js → chunk-QCW4BAH5.js} +1 -1
- package/dist/standalone/{chunk-F4HDP4XW.js → chunk-R2HA2NVX.js} +1 -1
- package/dist/standalone/{chunk-F5I22A4W.js → chunk-R6H6DUPU.js} +1 -1
- package/dist/standalone/{chunk-XVR74IFC.js → chunk-RE4LLVPN.js} +1 -1
- package/dist/standalone/chunk-RYF5EUQA.js +1 -0
- package/dist/standalone/{chunk-VON7JUPG.js → chunk-S5NTGHCG.js} +1 -1
- package/dist/standalone/{chunk-LRYLU6EY.js → chunk-SDMZKBTD.js} +1 -1
- package/dist/standalone/{chunk-KSKXW5PX.js → chunk-SHERR7ZP.js} +1 -1
- package/dist/standalone/{chunk-BIBCC7EE.js → chunk-TO6D2PJC.js} +1 -1
- package/dist/standalone/{chunk-5UKRVDFD.js → chunk-UTHHHJYS.js} +1 -1
- package/dist/standalone/{chunk-KCMKEMUL.js → chunk-UWSLX56Q.js} +1 -1
- package/dist/standalone/{chunk-LNZIB2MD.js → chunk-V43BLH4J.js} +1 -1
- package/dist/standalone/{chunk-3CJW6NWG.js → chunk-VL23Y44O.js} +1 -1
- package/dist/standalone/{chunk-L7WR3C4Z.js → chunk-W5BAQMIE.js} +1 -1
- package/dist/standalone/{chunk-HVRDZZHL.js → chunk-W666BB6V.js} +1 -1
- package/dist/standalone/{chunk-S3Q6R7BA.js → chunk-W6JKUZKD.js} +1 -1
- package/dist/standalone/{chunk-WMWDJLRO.js → chunk-WK7VHQTQ.js} +1 -1
- package/dist/standalone/{chunk-IXDH4GL5.js → chunk-WVTPZ6CM.js} +1 -1
- package/dist/standalone/{chunk-TXTJPS5F.js → chunk-XGPFWZPJ.js} +1 -1
- package/dist/standalone/{chunk-H27CRIP3.js → chunk-XPLUSBKA.js} +1 -1
- package/dist/standalone/{chunk-KKD46QVN.js → chunk-ZANX3V5B.js} +1 -1
- package/dist/standalone/{chunk-AYANIT5P.js → chunk-ZVLQVBTM.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/standalone/chunk-IRSIK3HT.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Pe}from"./chunk-SDQE2IUJ.js";import{a as Be}from"./chunk-JM7XBQVK.js";import{a as $e}from"./chunk-
|
|
1
|
+
import{a as Pe}from"./chunk-SDQE2IUJ.js";import{a as Be}from"./chunk-JM7XBQVK.js";import{a as $e}from"./chunk-TO6D2PJC.js";import"./chunk-V43BLH4J.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import"./chunk-AHILM3ZP.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-X4QFAAZ5.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-EEWKIQUE.js";import"./chunk-KEGAWN6Y.js";import{a as Re}from"./chunk-XNJNSCLM.js";import{a as Le,b as Ae,c as Oe,d as xe,e as Me,f as De}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as Ie}from"./chunk-LUP4YTBS.js";import{b as qe}from"./chunk-4PC7IXNY.js";import{d as re,e as ve,f as ge}from"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as le}from"./chunk-BOXSWNXZ.js";import{f as he}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as G,f as ne,g as se,h as Ee,l as Q}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as be,f as It,g as Rt,h as Lt,j as oe}from"./chunk-RRCPZMC2.js";var K=be(Rt(),1);var q=be(It(),1);var n=be(Lt(),1);var At=["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"],Ot=["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),Mt=new RegExp(`${ae}${String.raw`(\d+)`}${ae}`,"gu"),Dt=At.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Bt=Ot.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
|
|
2
2
|
${s}`})),$t=r(s=>{let e=[],o=s.replaceAll(/'(?:[^']|'')*'/gu,l=>(e.push(l),`${ae}${(e.length-1).toString()}${ae}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:l,replacement:a}of Dt)o=o.replaceAll(l,a);for(let{pattern:l,replacement:a}of Bt)o=o.replaceAll(l,a);return o=o.replaceAll(Mt,(l,a)=>e[Number(a)]??""),o},"formatSql"),ie=8,Pt=["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"],_t=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Wt=/[\w$]/,He=r(s=>s!==void 0&&Wt.test(s),"isWordChar"),Fe=r(s=>{let e=s.length;for(;e>0&&He(s[e-1]);)e-=1;return s.slice(e)},"trailingWord"),ze=r((s,e)=>{let t=e;for(;t>0&&He(s[t-1]);)t-=1;return{end:e,start:t,text:s.slice(t,e)}},"tokenAt"),_e=r((s,e)=>{let t=s.slice(0,e).trimEnd();return t.endsWith(".")||_t.has(Fe(t).toUpperCase())},"prefersColumns"),Ht=r((s,e)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=Fe(t.slice(0,-1));return o===""?void 0:o},"qualifierTable"),ke=r((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"matches"),We=r((s,e,t,o)=>{let l=[];for(let a of s)if(ke(a,e)&&(l.push(o(a)),l.length>=t))break;return l},"takeMatches"),Ft=r((s,e,t)=>{let o=new Map;for(let[l,a]of Object.entries(s.columns))for(let d of a)if(ke(d,e)&&!o.has(d)&&(o.set(d,l),o.size>=t))return[...o].map(([p,c])=>({detail:c,kind:"column",label:p}));return[...o].map(([l,a])=>({detail:a,kind:"column",label:l}))},"takeColumnMatches"),zt=r((s,e,t)=>{let o=ze(s,e),l=Ht(s,o.start);if(l!==void 0){let u=t.columns[l]??t.columns[l.toLowerCase()]??[];return We(u,o.text,ie,y=>({detail:l,kind:"column",label:y}))}if(o.text===""&&!_e(s,o.start))return[];let a=We(t.tables,o.text,ie,u=>({kind:"table",label:u})),d=Ft(t,o.text,ie),p=Pt.filter(u=>o.text!==""&&ke(u,o.text)&&u.toLowerCase()!==o.text.toLowerCase()).map(u=>({kind:"keyword",label:u}));return(_e(s,o.start)?[...d,...a,...p]:[...a,...d,...p]).slice(0,ie)},"suggestionsFor"),Ut=r((s,e,t)=>{let o=ze(s,e),l=s.slice(0,o.start)+t.label+s.slice(o.end);return{caret:o.start+t.label.length,value:l}},"acceptSuggestion"),Yt=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],jt=r((s,e)=>{let t=globalThis.getComputedStyle(s),o=globalThis.document.createElement("div"),{style:l}=o;l.position="absolute",l.visibility="hidden",l.whiteSpace="pre-wrap",l.overflowWrap="break-word";for(let c of Yt)l[c]=t[c];o.textContent=s.value.slice(0,Math.max(0,e));let a=globalThis.document.createElement("span");a.textContent=s.value.slice(Math.max(0,e))||".",o.append(a),globalThis.document.body.append(o);let d=a.offsetLeft-s.scrollLeft,p=a.offsetTop-s.scrollTop;return o.remove(),{left:d,top:p}},"caretOffset"),Kt=r((s,e,t)=>{let o=(0,K.c)(13),[l,a]=(0,q.useState)(null),d;o[0]!==s||o[1]!==e?(d=r((N,x)=>{let S=zt(N,x,s);if(S.length===0){a(null);return}let h=e.current,{left:w,top:C}=h===null?{left:0,top:0}:jt(h,x);a({active:0,left:w,suggestions:S,top:C})},"t0"),o[0]=s,o[1]=e,o[2]=d):d=o[2];let p=d,c;o[3]===Symbol.for("react.memo_cache_sentinel")?(c=r(()=>{a(null)},"t1"),o[3]=c):c=o[3];let u=c,y;o[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"),o[4]=y):y=o[4];let g=y,v;o[5]!==t||o[6]!==l||o[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=Ut(N.value,N.selectionStart,x);return t(S.value),a(null),requestAnimationFrame(()=>{let h=e.current;h!==null&&(h.focus(),h.setSelectionRange(S.caret,S.caret))}),!0},"t3"),o[5]=t,o[6]=l,o[7]=e,o[8]=v):v=o[8];let m=v,f;return o[9]!==m||o[10]!==p||o[11]!==l?(f={close:u,commit:m,move:g,refresh:p,state:l},o[9]=m,o[10]=p,o[11]=l,o[12]=f):f=o[12],f},"useSqlAutocomplete"),Gt={column:"column",keyword:"keyword",table:"table"},Vt=20,Jt=r(s=>{let e=(0,K.c)(17),{listboxId:t,onPick:o,state:l}=s,a=G(),d;e[0]!==l?(d=l===null?void 0:{left:l.left,top:l.top+Vt},e[0]=l,e[1]=d):d=e[1];let p=d;if(l===null)return null;let c;if(e[2]!==t||e[3]!==o||e[4]!==l.active||e[5]!==l.suggestions||e[6]!==a){let y;e[8]!==t||e[9]!==o||e[10]!==l.active||e[11]!==a?(y=r((g,v)=>(0,n.jsxDEV)("li",{"aria-selected":v===l.active,className:oe("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:`${t}-opt-${v.toString()}`,onMouseDown:r(m=>{m.preventDefault(),o(v)},"onMouseDown"),role:"option",children:[(0,n.jsxDEV)("span",{className:"truncate font-mono",children:g.label},void 0,!1),g.detail!==void 0&&(0,n.jsxDEV)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:g.detail},void 0,!1),(0,n.jsxDEV)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:a(Gt[g.kind])},void 0,!1)]},`${g.kind}:${g.label}`,!0),"t32"),e[8]=t,e[9]=o,e[10]=l.active,e[11]=a,e[12]=y):y=e[12],c=l.suggestions.map(y),e[2]=t,e[3]=o,e[4]=l.active,e[5]=l.suggestions,e[6]=a,e[7]=c}else c=e[7];let u;return e[13]!==t||e[14]!==p||e[15]!==c?(u=(0,n.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:t,role:"listbox",style:p,children:c},void 0,!1),e[13]=t,e[14]=p,e[15]=c,e[16]=u):u=e[16],u},"AutocompletePopover"),Ue=[{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;"}],Qt=r(s=>{let e=(0,K.c)(29),{active:t,onDelete:o,onSelect:l,query:a}=s,d=G(),p;e[0]!==l||e[1]!==a.id?(p=r(()=>{l(a.id)},"t1"),e[0]=l,e[1]=a.id,e[2]=p):p=e[2];let c=p,u;e[3]!==o||e[4]!==a.id?(u=r(E=>{E.stopPropagation(),o(a.id)},"t2"),e[3]=o,e[4]=a.id,e[5]=u):u=e[5];let y=u,g=t?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",v;e[6]!==g?(v=oe("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 m=`sql-query-${a.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.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,n.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,n.jsxDEV)("span",{className:"truncate",children:a.name},void 0,!1),e[9]=a.name,e[10]=N):N=e[10];let x;e[11]!==t||e[12]!==c||e[13]!==v||e[14]!==m||e[15]!==N?(x=(0,n.jsxDEV)("button",{"aria-pressed":t,className:v,"data-testid":m,onClick:c,type:"button",children:[f,N]},void 0,!0),e[11]=t,e[12]=c,e[13]=v,e[14]=m,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,n.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,n.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[21]=w):w=e[21];let C;e[22]!==y||e[23]!==h||e[24]!==S?(C=(0,n.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]=C):C=e[25];let A;return e[26]!==C||e[27]!==x?(A=(0,n.jsxDEV)("li",{className:"group/q flex items-center",children:[x,C]},void 0,!0),e[26]=C,e[27]=x,e[28]=A):A=e[28],A},"QueryRow"),Xt=r(s=>{let e=(0,K.c)(58),{activeId:t,history:o,listRef:l,onClearHistory:a,onDelete:d,onLoadHistory:p,onLoadTemplate:c,onNew:u,onSearchChange:y,onSelect:g,queries:v,search:m}=s,f=G(),N;if(e[0]!==v||e[1]!==m){let T=m.trim().toLowerCase();N=T===""?[...v]:v.filter(R=>R.name.toLowerCase().includes(T)),e[0]=v,e[1]=m,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]!==m||e[7]!==S?(h=(0,n.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:m},void 0,!1),e[5]=y,e[6]=m,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 C;e[11]!==f?(C=f("New query"),e[11]=f,e[12]=C):C=e[12];let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.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,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1),e[13]=A):A=e[13];let E;e[14]!==u||e[15]!==w||e[16]!==C?(E=(0,n.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:C,type:"button",children:A},void 0,!1),e[14]=u,e[15]=w,e[16]=C,e[17]=E):E=e[17];let M;e[18]!==h||e[19]!==E?(M=(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[h,E]},void 0,!0),e[18]=h,e[19]=E,e[20]=M):M=e[20];let D;e[21]!==f?(D=f("Private"),e[21]=f,e[22]=D):D=e[22];let O;e[23]!==D?(O=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:D},void 0,!1),e[23]=D,e[24]=O):O=e[24];let B;e[25]!==t||e[26]!==x||e[27]!==l||e[28]!==d||e[29]!==g||e[30]!==f?(B=x.length===0?(0,n.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,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:l,children:x.map(T=>(0,n.jsxDEV)(Qt,{active:t===T.id,onDelete:d,onSelect:g,query:T},T.id,!1))},void 0,!1),e[25]=t,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]!==O||e[33]!==B?(P=(0,n.jsxDEV)("div",{children:[O,B]},void 0,!0),e[32]=O,e[33]=B,e[34]=P):P=e[34];let _;e[35]!==f?(_=f("Reference"),e[35]=f,e[36]=_):_=e[36];let Y;e[37]!==_?(Y=(0,n.jsxDEV)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_},void 0,!1),e[37]=_,e[38]=Y):Y=e[38];let F;e[39]!==c?(F=Ue.map(T=>(0,n.jsxDEV)("li",{children:(0,n.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":T.sql,onClick:c,type:"button",children:[(0,n.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,n.jsxDEV)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"},void 0,!1)},void 0,!1),T.label]},void 0,!0)},T.label,!1)),e[39]=c,e[40]=F):F=e[40];let $;e[41]!==F?($=(0,n.jsxDEV)("ul",{className:"flex flex-col gap-px",children:F},void 0,!1),e[41]=F,e[42]=$):$=e[42];let I;e[43]!==Y||e[44]!==$?(I=(0,n.jsxDEV)("div",{children:[Y,$]},void 0,!0),e[43]=Y,e[44]=$,e[45]=I):I=e[45];let L;e[46]!==o||e[47]!==a||e[48]!==p||e[49]!==f?(L=o.length>0&&(0,n.jsxDEV)("div",{children:[(0,n.jsxDEV)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,n.jsxDEV)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")},void 0,!1),(0,n.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,n.jsxDEV)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:o.map(T=>(0,n.jsxDEV)("li",{children:(0,n.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":T.sql,"data-testid":"sql-history-item",onClick:p,title:T.sql,type:"button",children:[(0,n.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,n.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,n.jsxDEV)("span",{className:"truncate font-mono",children:T.sql},void 0,!1)]},void 0,!0)},`${T.at.toString()}:${T.sql}`,!1))},void 0,!1)]},void 0,!0),e[46]=o,e[47]=a,e[48]=p,e[49]=f,e[50]=L):L=e[50];let W;e[51]!==P||e[52]!==I||e[53]!==L?(W=(0,n.jsxDEV)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-2",children:[P,I,L]},void 0,!0),e[51]=P,e[52]=I,e[53]=L,e[54]=W):W=e[54];let H;return e[55]!==W||e[56]!==M?(H=(0,n.jsxDEV)("aside",{className:"flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",children:[M,W]},void 0,!0),e[55]=W,e[56]=M,e[57]=H):H=e[57],H},"SqlQuerySidebar"),Zt=ne(le.listTables),eo=ne(le.readTablePage),to=r(s=>{let e=(0,K.c)(16),t=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let[l,a]=(0,q.useState)(o),d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];let[p,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]!==t||e[4]!==s?(g=r(()=>{let h={cancelled:!1};return Q(r(async()=>{try{let C=await t.query(Zt,{},se(s));h.cancelled||(a(C.map(no)),c({}),y.current=new Set)}catch{h.cancelled||(a([]),c({}),y.current=new Set)}},"load")()),()=>{h.cancelled=!0}},"t3"),v=[t,s],e[3]=t,e[4]=s,e[5]=g,e[6]=v):(g=e[5],v=e[6]),(0,q.useEffect)(g,v);let m;e[7]!==t||e[8]!==s?(m=r(h=>{if(y.current.has(h))return;y.current.add(h),Q(r(async()=>{try{let C=await t.query(eo,{limit:1,offset:0,table:h},se(s));c(A=>({...A,[h]:C.columns}))}catch{y.current.delete(h)}},"fetchColumns")())},"t5"),e[7]=t,e[8]=s,e[9]=m):m=e[9];let f=m,N;e[10]!==p||e[11]!==l?(N={columns:p,tables:l},e[10]=p,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"),ye=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,oo=r(s=>{let e=new Set;ye.lastIndex=0;let t=ye.exec(s);for(;t!==null;)e.add(t[1]??t[2]),t=ye.exec(s);return[...e]},"referencedTables");function no(s){return s.name}r(no,"_temp$2");var so="lunora-studio-sql-tabs",lo="lunora-studio-sql-active-tab",Se=12,X=r((s="",e="")=>({activeId:null,id:ge("tab"),name:e,sql:s}),"makeTab"),ro=r(()=>ve(lo,""),"usePersistedActive"),io=r(s=>{let[e,t]=re(so),[o,l]=ro(),a=(0,q.useRef)(null);e.length===0&&a.current===null&&(a.current=s()),(0,q.useEffect)(()=>{if(e.length===0&&a.current!==null){let c=a.current;t([c])}},[t,e.length]);let d=e.length===0&&a.current!==null?[a.current]:e;return{activeId:d.some(c=>c.id===o)?o:d[0]?.id??"",setActiveId:l,setTabs:t,tabs:d}},"usePersistedTabs"),Ye=r(s=>s.activeId===null&&s.sql.trim()!=="","isDirty"),ao=r((s,e)=>[...s,e].slice(-Se),"addTab"),co=r((s,e,t)=>{let o=s.findIndex(d=>d.id===e);if(o===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let l=s.filter(d=>d.id!==e);if(l.length===0){let d=t();return{activeId:d.id,tabs:[d]}}return{activeId:l[Math.min(o,l.length-1)].id,tabs:l}},"closeTab"),uo=r((s,e)=>{let t=s.filter(o=>o.id===e);return t.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:t}},"closeOtherTabs"),fo=r((s,e,t)=>{let o=s.findIndex(a=>a.id===e);if(o===-1)return{activeId:t,tabs:[...s]};let l=s.slice(0,o+1);return{activeId:l.some(a=>a.id===t)?t:e,tabs:l}},"closeTabsToRight"),mo=r(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"closeAllTabs"),po=r((s,e,t)=>{if(s==="others")return e.filter(o=>o.id!==t);if(s==="right"){let o=e.findIndex(l=>l.id===t);return o===-1?[]:e.slice(o+1)}return[...e]},"tabsClosedBy"),bo=r((s,e)=>s.trim()===""?e:(s.split(`
|
|
3
3
|
`)[0]??s).slice(0,24),"derivedTabLabel"),ho=r(s=>{let e=(0,K.c)(14),{initial:t,onCancel:o,onCommit:l,placeholder:a,testId:d}=s,p=G(),c=xo,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]!==o||e[3]!==l?(g=r(N=>{N.key==="Enter"?l(N.currentTarget.value.trim()):N.key==="Escape"&&o()},"t2"),e[2]=o,e[3]=l,e[4]=g):g=e[4];let v=g,m;e[5]!==p?(m=p("Tab title"),e[5]=p,e[6]=m):m=e[6];let f;return e[7]!==t||e[8]!==y||e[9]!==v||e[10]!==a||e[11]!==m||e[12]!==d?(f=(0,n.jsxDEV)("input",{"aria-label":m,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":d,defaultValue:t,onBlur:y,onKeyDown:v,placeholder:a,ref:c,type:"text"},void 0,!1),e[7]=t,e[8]=y,e[9]=v,e[10]=a,e[11]=m,e[12]=d,e[13]=f):f=e[13],f},"TabRenameInput"),vo=r(s=>{let e=(0,K.c)(29),{idBase:t,onDiscard:o,onKeep:l}=s,a=G(),d=`sql-tab-close-prompt-${t}`,p;e[0]!==a?(p=a("Discard?"),e[0]=a,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,n.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:p},void 0,!1),e[2]=p,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-${t}`,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,n.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,n.jsxDEV)("path",{d:"M5 13l4 4L19 7"},void 0,!1)},void 0,!1),e[8]=v):v=e[8];let m;e[9]!==o||e[10]!==u||e[11]!==y||e[12]!==g?(m=(0,n.jsxDEV)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":y,onClick:o,title:g,type:"button",children:v},void 0,!1),e[9]=o,e[10]=u,e[11]=y,e[12]=g,e[13]=m):m=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-${t}`,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,n.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,n.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,n.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]!==m?(w=(0,n.jsxDEV)("span",{className:"flex shrink-0 items-center gap-1","data-testid":d,role:"group",children:[c,m,h]},void 0,!0),e[24]=d,e[25]=h,e[26]=c,e[27]=m,e[28]=w):w=e[28],w},"TabCloseConfirm"),go=r(s=>{let e=(0,K.c)(47),{active:t,canClose:o,onClose:l,onMenu:a,onRename:d,onSelect:p,tab:c}=s,u=G(),[y,g]=(0,q.useState)(!1),[v,m]=(0,q.useState)(!1),f;e[0]!==a||e[1]!==c.id?(f=r(z=>{a(c.id,z)},"t1"),e[0]=a,e[1]=c.id,e[2]=f):f=e[2];let N=f,x;e[3]!==p||e[4]!==c.id?(x=r(()=>{p(c.id)},"t2"),e[3]=p,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,C;e[7]!==l||e[8]!==c?(C=r(z=>{z.stopPropagation(),Ye(c)?m(!0):l(c.id)},"t4"),e[7]=l,e[8]=c,e[9]=C):C=e[9];let A=C,E;e[10]!==l||e[11]!==c.id?(E=r(z=>{z.stopPropagation(),m(!1),l(c.id)},"t5"),e[10]=l,e[11]=c.id,e[12]=E):E=e[12];let M=E,D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=r(z=>{z.stopPropagation(),m(!1)},"t6"),e[13]=D):D=e[13];let O=D,B;e[14]!==d||e[15]!==c.id?(B=r(z=>{d(c.id,z),g(!1)},"t7"),e[14]=d,e[15]=c.id,e[16]=B):B=e[16];let P=B,_;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=r(()=>{g(!1)},"t8"),e[17]=_):_=e[17];let Y=_,F;e[18]!==c.name?(F=c.name.trim(),e[18]=c.name,e[19]=F):F=e[19];let $=F,I;e[20]!==u||e[21]!==c.sql?(I=bo(c.sql,u("Untitled")),e[20]=u,e[21]=c.sql,e[22]=I):I=e[22];let L=I,W=t?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",H;e[23]!==W?(H=oe("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",W),e[23]=W,e[24]=H):H=e[24];let T=`sql-tab-${c.id}`,R;e[25]!==t||e[26]!==P||e[27]!==$||e[28]!==L||e[29]!==y||e[30]!==S||e[31]!==u||e[32]!==c.id?(R=y?(0,n.jsxDEV)(ho,{initial:$,onCancel:Y,onCommit:P,placeholder:L,testId:`sql-tab-rename-${c.id}`},void 0,!1):(0,n.jsxDEV)("button",{"aria-pressed":t,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:$},void 0,!1),e[25]=t,e[26]=P,e[27]=$,e[28]=L,e[29]=y,e[30]=S,e[31]=u,e[32]=c.id,e[33]=R):R=e[33];let j;e[34]!==o||e[35]!==M||e[36]!==v||e[37]!==A||e[38]!==u||e[39]!==c.id?(j=o&&(v?(0,n.jsxDEV)(vo,{idBase:c.id,onDiscard:M,onKeep:O},void 0,!1):(0,n.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:A,title:u("Close tab"),type:"button",children:(0,n.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,n.jsxDEV)("path",{d:"M6 6l12 12M18 6 6 18"},void 0,!1)},void 0,!1)},void 0,!1)),e[34]=o,e[35]=M,e[36]=v,e[37]=A,e[38]=u,e[39]=c.id,e[40]=j):j=e[40];let J;return e[41]!==N||e[42]!==H||e[43]!==T||e[44]!==R||e[45]!==j?(J=(0,n.jsxDEV)("div",{className:H,"data-testid":T,onContextMenu:N,children:[R,j]},void 0,!0),e[41]=N,e[42]=H,e[43]=T,e[44]=R,e[45]=j,e[46]=J):J=e[46],J},"TabButton");function xo(s){s?.focus(),s?.select()}r(xo,"_temp$1");var yo=ne(le.runSql),No="lunora-studio-sql-queries",So="lunora-studio-sql-history",ko="lunora-studio-sql-split-view",Co=25,wo={minWidth:"2.75rem",paddingInline:"0.5rem"},Ne={error:null,pane:"results",result:null},To=r(s=>{let e=(0,K.c)(16),{result:t}=s;if(t.columns.length===0){let c=t.rowCount===0?"0 rows":"",u;return e[0]!==c?(u=(0,n.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 o;e[2]!==t.columns?(o=t.columns.map(Eo),e[2]=t.columns,e[3]=o):o=e[3];let l;e[4]!==o?(l=(0,n.jsxDEV)(Ae,{className:"sticky top-0 z-10 bg-muted",children:(0,n.jsxDEV)(xe,{children:o},void 0,!1)},void 0,!1),e[4]=o,e[5]=l):l=e[5];let a;if(e[6]!==t.columns||e[7]!==t.rows){let c;e[9]!==t.columns?(c=r((u,y)=>(0,n.jsxDEV)(xe,{"data-testid":"sql-row",children:t.columns.map(g=>(0,n.jsxDEV)(De,{className:"max-w-md truncate font-mono text-xs",children:(0,n.jsxDEV)(Be,{value:u[g]},void 0,!1)},g,!1))},y,!1),"t42"),e[9]=t.columns,e[10]=c):c=e[10],a=t.rows.map(c),e[6]=t.columns,e[7]=t.rows,e[8]=a}else a=e[8];let d;e[11]!==a?(d=(0,n.jsxDEV)(Oe,{children:a},void 0,!1),e[11]=a,e[12]=d):d=e[12];let p;return e[13]!==l||e[14]!==d?(p=(0,n.jsxDEV)(Le,{"data-testid":"sql-rows",children:[l,d]},void 0,!0),e[13]=l,e[14]=d,e[15]=p):p=e[15],p},"SqlResultTable"),Ho=r(({initialShardKey:s})=>{let e=he(),t=G(),[o,l]=re(No),[a,d]=re(So),[p,c]=(0,q.useState)(""),u=r(()=>X(Ue[0]?.sql??""),"seedTab"),{activeId:y,setActiveId:g,setTabs:v,tabs:m}=io(u),[f,N]=(0,q.useState)({}),[x,S]=(0,q.useState)(s??""),[h,w]=(0,q.useState)(!1),[C,A]=ve(ko,!1),[E,M]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),B=(0,q.useRef)(null),P=(0,q.useRef)(null),_=(0,q.useRef)(null),Y=(0,q.useId)(),{probe:F,schema:$}=to(x),I=m.find(i=>i.id===y)??m[0]??X(),L=I.sql,{activeId:W}=I,H=f[I.id]??Ne,{error:T,result:R}=H,j=H.pane,J=r(i=>{v(b=>b.map(k=>k.id===I.id?{...k,...i}:k))},"patchActiveTab"),z=r(i=>{N(b=>{let k=b[I.id]??Ne;return{...b,[I.id]:{error:i.error,pane:i.pane??k.pane,result:i.result}}})},"setActiveOutput"),Ce=r(i=>{N(b=>{let k=b[I.id]??Ne;return{...b,[I.id]:{...k,pane:i}}})},"setActivePane"),ce=r(i=>{J({sql:i}),W!==null&&l(b=>b.map(k=>k.id===W?{...k,sql:i}:k))},"setDraft"),je=Kt($,P,ce),{close:de,commit:we,move:ue,refresh:Z,state:V}=je,Ke=r(i=>{ue(i-(V?.active??0)),we()},"onPickSuggestion");(0,q.useEffect)(()=>{let i=P.current;i!==null&&i===document.activeElement&&Z(i.value,i.selectionStart)},[Z,$]);let Ge=r(i=>{d(b=>b[0]?.sql===i?b:[{at:Date.now(),sql:i},...b.filter(U=>U.sql!==i)].slice(0,Co))},"recordHistory"),fe=r(async i=>{if(L.trim()==="")return;w(!0);let b=i==="explain"?`EXPLAIN QUERY PLAN ${L}`:L;try{let k=await e.query(yo,{sql:b},se(x));z({error:null,pane:i,result:k}),qe(x),Ge(b)}catch(k){z({error:Ee(k),pane:i,result:null})}finally{w(!1)}},"run"),Ve=r(()=>{Q(fe("results"))},"onRun"),Je=r(i=>{let{selectionStart:b,value:k}=i.target;ce(k);for(let U of oo(k))F(U);Z(k,b)},"onDraftChange"),Qe=r(i=>{let b=i.currentTarget;Z(b.value,b.selectionStart)},"onEditorSelect"),Xe=r(i=>{if(V!==null){if(i.key==="ArrowDown"){i.preventDefault(),ue(1);return}if(i.key==="ArrowUp"){i.preventDefault(),ue(-1);return}if(i.key==="Escape"){i.preventDefault(),de();return}if((i.key==="Enter"||i.key==="Tab")&&!i.metaKey&&!i.ctrlKey&&we()){i.preventDefault();return}}(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),Q(fe(j)))},"onEditorKeyDown"),Ze=r(()=>{requestAnimationFrame(()=>{de()})},"onEditorBlur"),et=r(i=>{B.current!==null&&(B.current.scrollTop=i.currentTarget.scrollTop)},"onEditorScroll"),ee=r((i,b)=>{v(k=>k.map(U=>U.id===I.id?{...U,activeId:b,sql:i}:U)),z({error:null,result:null})},"loadIntoActiveTab"),tt=r(()=>{let i={id:ge("q"),name:t("Untitled query"),sql:""};l(b=>[i,...b]),ee("",i.id)},"newQuery"),ot=r(i=>{let b=o.find(k=>k.id===i);b!==void 0&&(ee(b.sql,i),_.current?.querySelector(`[data-testid="sql-query-${i}"]`)?.scrollIntoView({block:"nearest"}))},"selectQuery"),nt=r(i=>{l(b=>b.filter(k=>k.id!==i)),v(b=>b.map(k=>k.activeId===i?{...k,activeId:null}:k))},"deleteQuery"),st=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadTemplate"),lt=r(i=>{ee(i.currentTarget.dataset.sql??"",null)},"loadFromHistory"),rt=r(()=>{d([])},"clearHistory"),it=r(()=>{ce($t(L))},"formatDraft"),at=r(()=>{if(m.length>=Se)return;let i=X();v(b=>ao(b,i)),g(i.id)},"addEditorTab"),te=r(i=>{M(null),O(null),v(i.tabs),g(i.activeId);let b=new Set(i.tabs.map(k=>k.id));N(k=>Object.fromEntries(Object.entries(k).filter(([U])=>b.has(U))))},"commitTabs"),ct=r(i=>{te(co(m,i,X))},"closeEditorTab"),Te=r((i,b)=>{te(i==="others"?uo(m,b):i==="right"?fo(m,b,y):mo(X))},"applyBulk"),me=r(i=>{E!==null&&(po(i,m,E.id).some(b=>Ye(b))?O(i):Te(i,E.id))},"requestBulk"),dt=r((i,b)=>{b.preventDefault(),O(null),M({id:i,x:b.clientX,y:b.clientY})},"openTabMenu"),ut=r(()=>{M(null),O(null)},"closeTabMenu"),ft=r(i=>{i.preventDefault(),M(null),O(null)},"onBackdropContextMenu"),mt=r(()=>{me("others")},"onCloseOthers"),pt=r(()=>{me("right")},"onCloseToRight"),bt=r(()=>{me("all")},"onCloseAll"),ht=r(()=>{E!==null&&D!==null&&Te(D,E.id),O(null)},"confirmBulk"),vt=r(()=>{O(null)},"cancelBulk"),gt=E===null?void 0:{left:E.x,top:E.y},xt=r(i=>{de(),g(i)},"selectTab"),yt=r((i,b)=>{v(k=>k.map(U=>U.id===i?{...U,name:b}:U))},"renameTab"),Nt=r(()=>{Ce("results")},"showResults"),St=r(()=>{Q(fe("explain"))},"showExplain"),kt=r(()=>{Ce("chart")},"showChart"),Ct=r(()=>{A(!C)},"toggleSplit"),wt=L.split(`
|
|
4
4
|
`).length,Tt=r(i=>{c(i.target.value)},"onSearchChange"),pe=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"),Et=C?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",qt=C?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";return(0,n.jsxDEV)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,n.jsxDEV)(Xt,{activeId:W,history:a,listRef:_,onClearHistory:rt,onDelete:nt,onLoadHistory:lt,onLoadTemplate:st,onNew:tt,onSearchChange:Tt,onSelect:ot,queries:o,search:p},void 0,!1),(0,n.jsxDEV)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.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:[m.map(i=>(0,n.jsxDEV)(go,{active:i.id===I.id,canClose:m.length>1,onClose:ct,onMenu:dt,onRename:yt,onSelect:xt,tab:i},i.id,!1)),(0,n.jsxDEV)("button",{"aria-label":t("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:m.length>=Se,onClick:at,title:t("New tab"),type:"button",children:(0,n.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,n.jsxDEV)("path",{d:"M12 5v14M5 12h14"},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0),E!==null&&(0,n.jsxDEV)(n.Fragment,{children:[(0,n.jsxDEV)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:ut,onContextMenu:ft,role:"presentation"},void 0,!1),(0,n.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:gt,children:D===null?(0,n.jsxDEV)(n.Fragment,{children:[(0,n.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:m.length<=1,onClick:mt,role:"menuitem",type:"button",children:t("Close other tabs")},void 0,!1),(0,n.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:m.findIndex(i=>i.id===E.id)>=m.length-1,onClick:pt,role:"menuitem",type:"button",children:t("Close tabs to the right")},void 0,!1),(0,n.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:bt,role:"menuitem",type:"button",children:t("Close all tabs")},void 0,!1)]},void 0,!0):(0,n.jsxDEV)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,n.jsxDEV)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:t("Discard unsaved tabs?")},void 0,!1),(0,n.jsxDEV)("div",{className:"flex items-center gap-1.5",children:[(0,n.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:ht,type:"button",children:t("Discard")},void 0,!1),(0,n.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:vt,type:"button",children:t("Cancel")},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,n.jsxDEV)("div",{className:Et,children:[(0,n.jsxDEV)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,n.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:B,style:wo,children:Array.from({length:wt},(i,b)=>(0,n.jsxDEV)("div",{children:b+1},b,!1))},void 0,!1),(0,n.jsxDEV)("div",{className:"relative min-w-0 flex-1",children:[(0,n.jsxDEV)("textarea",{"aria-activedescendant":V===null?void 0:`${Y}-opt-${V.active.toString()}`,"aria-autocomplete":"list","aria-controls":V===null?void 0:Y,"aria-expanded":V!==null,"aria-label":t("SQL query"),className:"size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none","data-testid":"sql-input",onBlur:Ze,onChange:Je,onKeyDown:Xe,onScroll:et,onSelect:Qe,placeholder:"SELECT * FROM \u2026",ref:P,role:"combobox",spellCheck:!1,value:L},void 0,!1),(0,n.jsxDEV)(Jt,{listboxId:Y,onPick:Ke,state:V},void 0,!1)]},void 0,!0)]},void 0,!0),(0,n.jsxDEV)("div",{className:qt,children:[(0,n.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[(0,n.jsxDEV)("button",{className:pe(j==="results"),"data-testid":"sql-tab-results",onClick:Nt,type:"button",children:t("Results")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="chart"),"data-testid":"sql-tab-chart",onClick:kt,type:"button",children:t("Chart")},void 0,!1),(0,n.jsxDEV)("button",{className:pe(j==="explain"),"data-testid":"sql-tab-explain",onClick:St,type:"button",children:t("Explain")},void 0,!1),(0,n.jsxDEV)("div",{className:"ms-auto flex items-center gap-2",children:[(0,n.jsxDEV)("button",{"aria-label":t("Split editor and results"),"aria-pressed":C,className:`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${C?"bg-accent text-foreground":"text-muted-foreground"}`,"data-testid":"sql-split-toggle",onClick:Ct,title:t("Split editor and results"),type:"button",children:(0,n.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,n.jsxDEV)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"},void 0,!1),(0,n.jsxDEV)("path",{d:"M12 4v16"},void 0,!1)]},void 0,!0)},void 0,!1),R!==null&&R.columns.length>0&&(0,n.jsxDEV)($e,{columns:R.columns,name:"query-result",rows:R.rows},void 0,!1),(0,n.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:it,type:"button",children:t("Format")},void 0,!1),(0,n.jsxDEV)(Ie,{onChange:S,testId:"sql-shard-input",value:x},void 0,!1),(0,n.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:Ve,type:"button",children:[t(h?"Running\u2026":"Run"),(0,n.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,n.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto",children:[T!==null&&(0,n.jsxDEV)(Re,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:T},void 0,!1),T===null&&R===null&&(0,n.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:t("Click Run to execute your query.")},void 0,!1),T===null&&R!==null&&(0,n.jsxDEV)("div",{"data-testid":"sql-result",children:[j==="chart"?(0,n.jsxDEV)(Pe,{result:R},void 0,!1):(0,n.jsxDEV)(To,{result:R},void 0,!1),(0,n.jsxDEV)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:R.truncated?t("Showing the first {max} of {count} rows.",{count:R.rowCount,max:R.rows.length}):t("{count} rows",{count:R.rowCount})},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"SqlEditorPanel");function Eo(s){return(0,n.jsxDEV)(Me,{children:s},s,!1)}r(Eo,"_temp");export{Ho as SqlEditorPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as a,J as j,Y as de,c as J,e as ce,f as le,g as pe,h as fe,ma as me,wa as ge}from"./chunk-
|
|
1
|
+
import{D as a,J as j,Y as de,c as J,e as ce,f as le,g as pe,h as fe,ma as me,wa as ge}from"./chunk-SHERR7ZP.js";import{b as H}from"./chunk-5OIBXYZM.js";import{F as B,J as k,O as Y,P as z,h as ue,p as ae}from"./chunk-VL23Y44O.js";import{a as re}from"./chunk-HV7G6DFP.js";import{a as P,c as F,i as ie,r as se}from"./chunk-O3NAGRTR.js";import{g as O,i as w}from"./chunk-CKSHCYGC.js";import{a as we}from"./chunk-3OA7PECS.js";import{a as r,e as b,f as q}from"./chunk-RRCPZMC2.js";var he=b(q(),1),Q=b(re(),1);function $e(e,t){let n=he.useRef(null);function o(u){Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))}),pe(n.current)?.focus()}r(o,"handlePreFocusGuardFocus");function c(u){let i=e.select("positionerElement");if(i&&fe(u,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))});let s=le(e.context.triggerFocusTargetRef.current||t.current);for(;s!==null&&ae(i,s);){let m=s;if(s=ce(s),s===m)break}s?.focus()}}return r(c,"handleFocusTargetFocus"),{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}r($e,"useTriggerFocusGuards");var l=b(q(),1),ve=b(re(),1);var M=b(q(),1);function X(e){let t=se(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,c=ie(e),u=c?e.offsetWidth:n,i=c?e.offsetHeight:o;return(J(n)!==u||J(o)!==i)&&(n=u,o=i),{width:n,height:o}}r(X,"getCssDimensions");function Re(e){let{popupElement:t,positionerElement:n,content:o,mounted:c,onMeasureLayout:u,onMeasureLayoutComplete:i,side:s,direction:m}=e,x=k(t,!0,!1),g=B(),p=M.useRef(null),D=M.useRef(!0),f=M.useRef(O),I=F(u),v=F(i),C=M.useMemo(()=>{let h=s==="top",R=s==="left";return m==="rtl"?(h=h||s==="inline-end",R=R||s==="inline-end"):(h=h||s==="inline-start",R=R||s==="inline-start"),h?{position:"absolute",[s==="top"?"bottom":"top"]:"0",[R?"right":"left"]:"0"}:w},[s,m]);P(()=>{if(!c){f.current=O,D.current=!0,p.current=null;return}if(!t||!n)return;f.current=ye(t,C),Z(t,"auto");let h=K(t,"position","static"),R=K(t,"transform","none"),U=K(t,"scale","1"),y=ye(n,{"--available-width":"max-content","--available-height":"max-content"});function T(){h(),R(),y()}r(T,"restoreMeasurementOverrides");function L(){T(),U()}if(r(L,"restoreMeasurementOverridesIncludingScale"),I?.(),D.current||p.current===null){G(n,"max-content");let E=X(t);return p.current=E,G(n,E),L(),v?.(null,E),D.current=!1,()=>{f.current(),f.current=O}}G(n,"max-content");let N=p.current,S=X(t);p.current=S,Z(t,N),L(),v?.(N,S),G(n,S);let $=new AbortController;return g.request(()=>{Z(t,S),x(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},$.signal)}),()=>{$.abort(),g.cancel(),f.current(),f.current=O}},[o,t,n,x,g,c,I,v,C])}r(Re,"usePopupAutoResize");function K(e,t,n){let o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,o)}}r(K,"overrideElementStyle");function ye(e,t){let n=[];for(let[o,c]of Object.entries(t))n.push(K(e,o,c));return n.length?()=>{n.forEach(o=>o())}:O}r(ye,"applyElementStyles");function Z(e,t){let n=t==="auto"?"auto":`${t.width}px`,o=t==="auto"?"auto":`${t.height}px`;e.style.setProperty("--popup-width",n),e.style.setProperty("--popup-height",o)}r(Z,"setPopupCssSize");function G(e,t){let n=t==="max-content"?"max-content":`${t.width}px`,o=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",n),e.style.setProperty("--positioner-height",o)}r(G,"setPositionerCssSize");var A=b(we(),1);function pt(e){let{store:t,side:n,cssVars:o,children:c}=e,u=H(),i=t.useState("activeTriggerElement"),s=t.useState("activeTriggerId"),m=t.useState("open"),x=t.useState("payload"),g=t.useState("mounted"),p=t.useState("popupElement"),D=t.useState("positionerElement"),f=ge(m?i:null),I=Ae(s,x),v=l.useRef(null),[C,h]=l.useState(null),[R,U]=l.useState(null),y=l.useRef(null),T=l.useRef(null),L=k(y,!0,!1),N=B(),[S,$]=l.useState(null),[E,te]=l.useState(!1);P(()=>(t.set("hasViewport",!0),()=>{t.set("hasViewport",!1)}),[t]);let Te=F(()=>{y.current?.style.setProperty("animation","none"),y.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Ee=F(d=>{y.current?.style.removeProperty("animation"),y.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),d&&$(d)}),W=l.useRef(null);P(()=>{(!m||!g)&&(W.current=null)},[m,g]),P(()=>{if(i&&f&&i!==f&&W.current!==i&&v.current){h(v.current),te(!0);let d=Me(f,i);U(d),N.request(()=>{ve.flushSync(()=>{te(!1)}),L(()=>{h(null),$(null),v.current=null})}),W.current=i}},[i,f,C,L,N]),P(()=>{let d=y.current;if(!d)return;let oe=ue(d).createElement("div");for(let Oe of Array.from(d.childNodes))oe.appendChild(Oe.cloneNode(!0));v.current=oe});let ne=C!=null,_;ne?_=(0,A.jsxs)(l.Fragment,{children:[(0,A.jsx)("div",{"data-previous":!0,inert:me(!0),ref:T,style:{...S?{[o.popupWidth]:`${S.width}px`,[o.popupHeight]:`${S.height}px`}:null,position:"absolute"},"data-ending-style":E?void 0:""},"previous"),(0,A.jsx)("div",{"data-current":!0,ref:y,"data-starting-style":E?"":void 0,children:c},I)]}):_=(0,A.jsx)("div",{"data-current":!0,ref:y,children:c},I),P(()=>{let d=T.current;!d||!C||d.replaceChildren(...Array.from(C.childNodes))},[C]),Re({popupElement:p,positionerElement:D,mounted:g,content:x,onMeasureLayout:Te,onMeasureLayoutComplete:Ee,side:n,direction:u});let be={activationDirection:Fe(R),transitioning:ne};return{children:_,state:be}}r(pt,"usePopupViewport");function Fe(e){if(e)return`${Pe(e.horizontal,5,"right","left")} ${Pe(e.vertical,5,"down","up")}`}r(Fe,"getActivationDirection");function Pe(e,t,n,o){return e>t?n:e<-t?o:""}r(Pe,"getValueWithTolerance");function Me(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),c={x:n.left+n.width/2,y:n.top+n.height/2},u={x:o.left+o.width/2,y:o.top+o.height/2};return{horizontal:u.x-c.x,vertical:u.y-c.y}}r(Me,"calculateRelativePosition");function Ae(e,t){let[n,o]=l.useState(0),c=l.useRef(e),u=l.useRef(t),i=l.useRef(!1);return P(()=>{let s=c.current,m=u.current,x=e!==s,g=t!==m;x?(o(p=>p+1),i.current=!g):i.current&&g&&(o(p=>p+1),i.current=!1),c.current=e,u.current=t},[e,t]),`${e??"current"}-${n}`}r(Ae,"usePopupContentKey");function Ce(){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new de,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}r(Ce,"getEmptyRootContext");function St(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ce(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:w,inactiveTriggerProps:w,popupProps:w}}r(St,"createInitialPopupStoreState");function xt(e,t,n=!1){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}r(xt,"createPopupFloatingRootContext");var V=a(e=>e.triggerIdProp??e.activeTriggerId),ee=a(e=>e.openProp??e.open),Se=a(e=>(e.popupElement?.id??e.floatingId)||void 0);function xe(e,t){return t!==void 0&&ee(e)&&V(e)===t}r(xe,"triggerOwnsOpenPopup");function De(e,t){return xe(e,t)?!0:t!==void 0&&ee(e)&&V(e)==null&&e.triggerCount===1}r(De,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Tt={open:ee,mounted:a(e=>e.mounted),transitionStatus:a(e=>e.transitionStatus),floatingRootContext:a(e=>e.floatingRootContext),triggerCount:a(e=>e.triggerCount),preventUnmountingOnClose:a(e=>e.preventUnmountingOnClose),payload:a(e=>e.payload),activeTriggerId:V,activeTriggerElement:a(e=>e.mounted?e.activeTriggerElement:null),popupId:Se,isTriggerActive:a((e,t)=>t!==void 0&&V(e)===t),isOpenedByTrigger:a((e,t)=>xe(e,t)),isMountedByTrigger:a((e,t)=>t!==void 0&&V(e)===t&&e.mounted),triggerProps:a((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:a((e,t)=>De(e,t)?Se(e):void 0),popupProps:a(e=>e.popupProps),popupElement:a(e=>e.popupElement),positionerElement:a(e=>e.positionerElement)};export{St as a,xt as b,Tt as c,$e as d,pt as e};
|
|
@@ -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-WUFVFVHJ.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
|
|
1
|
+
import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as K}from"./chunk-W666BB6V.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 M,e as $}from"./chunk-SEU5V7I6.js";import{a as _}from"./chunk-LUP4YTBS.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as R}from"./chunk-BOXSWNXZ.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as D}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.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 $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-3CJW6NWG.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-HVRDZZHL.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as Q}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
1
|
+
import{b as ae}from"./chunk-W666BB6V.js";import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as K}from"./chunk-BOXSWNXZ.js";import{f as Q}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as V,f as X,g as Y,h as E,l as W}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f}from"./chunk-MDTNVR3G.js";import"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-MDTNVR3G.js";import"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as p}from"./chunk-W666BB6V.js";import"./chunk-GTM65MVX.js";import"./chunk-SEU5V7I6.js";import{a as R}from"./chunk-BOXSWNXZ.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as h}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as i,e as m,g as S,h as A}from"./chunk-RRCPZMC2.js";var g=m(S(),1);var k=m(A(),1);var _=i((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[s.kind],"findingTitle"),E=i(e=>Array.isArray(e.findings)?e.findings:[],"toFindings"),w=i(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"findingEntity"),T=i((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[s.kind],"findingDetail"),v=i(()=>{let e=(0,g.c)(8),s=h(),r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let{data:a,error:d,errorSource:c}=p(R.getSecurityAudit,r),o;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:E(a);o=u===null?null:u.map(t=>({description:T(s,t),entity:w(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=o}else o=e[3];let l=o,n;return e[4]!==d||e[5]!==c||e[6]!==l?(n=(0,k.jsxDEV)(f,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"},void 0,!1),e[4]=d,e[5]=c,e[6]=l,e[7]=n):n=e[7],n},"SecurityAdvisorPanel");export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"./chunk-AITOCPML.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
|
|
1
|
+
import{a as R}from"./chunk-AITOCPML.js";import{b as _}from"./chunk-W666BB6V.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 A,e as I}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as L}from"./chunk-BOXSWNXZ.js";import"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as S}from"./chunk-TAD43CG5.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.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,4 +1,4 @@
|
|
|
1
|
-
import{a as pS,b as rp,c as bS,d as hp,e as ES,f as TS,k as AS}from"./chunk-IRSIK3HT.js";import"./chunk-ZPUO7FNI.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import{a as SS}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{a as dp}from"./chunk-2MLA6WFH.js";import{R as yS}from"./chunk-3CJW6NWG.js";import{c as gS}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as ET}from"./chunk-HV7G6DFP.js";import"./chunk-BOXSWNXZ.js";import"./chunk-TAD43CG5.js";import"./chunk-HVRDZZHL.js";import"./chunk-SEU5V7I6.js";import"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as rS,e as hS}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as mS,d as fp,m as vS}from"./chunk-ITQKVEP7.js";import{b as sS}from"./chunk-22C6COGE.js";import{a as o,c as gf,e as Wi,f as fS,g as TT,h as dS,j as sp}from"./chunk-RRCPZMC2.js";var DS=gf(Ye=>{"use strict";(function(){function Me(){if(ot=!1,K){var z=Ye.unstable_now();Ae=z;var j=!0;try{e:{he=!1,Ue&&(Ue=!1,pt(Ke),Ke=-1),oe=!0;var q=V;try{t:{for(se(z),I=J(L);I!==null&&!(I.expirationTime>z&&A());){var xe=I.callback;if(typeof xe=="function"){I.callback=null,V=I.priorityLevel;var Ge=xe(I.expirationTime<=z);if(z=Ye.unstable_now(),typeof Ge=="function"){I.callback=Ge,se(z),j=!0;break t}I===J(L)&&G(L),se(z)}else G(L);I=J(L)}if(I!==null)j=!0;else{var ba=J(de);ba!==null&&ce(ae,ba.startTime-z),j=!1}}break e}finally{I=null,V=q,oe=!1}j=void 0}}finally{j?_e():K=!1}}}o(Me,"performWorkUntilDeadline");function r(z,j){var q=z.length;z.push(j);e:for(;0<q;){var xe=q-1>>>1,Ge=z[xe];if(0<ee(Ge,j))z[xe]=j,z[q]=Ge,q=xe;else break e}}o(r,"push");function J(z){return z.length===0?null:z[0]}o(J,"peek");function G(z){if(z.length===0)return null;var j=z[0],q=z.pop();if(q!==j){z[0]=q;e:for(var xe=0,Ge=z.length,ba=Ge>>>1;xe<ba;){var iu=2*(xe+1)-1,yo=z[iu],Sn=iu+1,it=z[Sn];if(0>ee(yo,q))Sn<Ge&&0>ee(it,yo)?(z[xe]=it,z[Sn]=q,xe=Sn):(z[xe]=yo,z[iu]=q,xe=iu);else if(Sn<Ge&&0>ee(it,q))z[xe]=it,z[Sn]=q,xe=Sn;else break e}}return j}o(G,"pop");function ee(z,j){var q=z.sortIndex-j.sortIndex;return q!==0?q:z.id-j.id}o(ee,"compare");function se(z){for(var j=J(de);j!==null;){if(j.callback===null)G(de);else if(j.startTime<=z)G(de),j.sortIndex=j.expirationTime,r(L,j);else break;j=J(de)}}o(se,"advanceTimers");function ae(z){if(Ue=!1,se(z),!he)if(J(L)!==null)he=!0,K||(K=!0,_e());else{var j=J(de);j!==null&&ce(ae,j.startTime-z)}}o(ae,"handleTimeout");function A(){return ot?!0:!(Ye.unstable_now()-Ae<U)}o(A,"shouldYieldToHost");function ce(z,j){Ke=Gt(function(){z(Ye.unstable_now())},j)}if(o(ce,"requestHostTimeout"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Ye.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var Be=performance;Ye.unstable_now=function(){return Be.now()}}else{var Ze=Date,ue=Ze.now();Ye.unstable_now=function(){return Ze.now()-ue}}var L=[],de=[],Te=1,I=null,V=3,oe=!1,he=!1,Ue=!1,ot=!1,Gt=typeof setTimeout=="function"?setTimeout:null,pt=typeof clearTimeout=="function"?clearTimeout:null,bt=typeof setImmediate<"u"?setImmediate:null,K=!1,Ke=-1,U=5,Ae=-1;if(typeof bt=="function")var _e=o(function(){bt(Me)},"schedulePerformWorkUntilDeadline");else if(typeof MessageChannel<"u"){var pe=new MessageChannel,ul=pe.port2;pe.port1.onmessage=Me,_e=o(function(){ul.postMessage(null)},"schedulePerformWorkUntilDeadline")}else _e=o(function(){Gt(Me,0)},"schedulePerformWorkUntilDeadline");Ye.unstable_IdlePriority=5,Ye.unstable_ImmediatePriority=1,Ye.unstable_LowPriority=4,Ye.unstable_NormalPriority=3,Ye.unstable_Profiling=null,Ye.unstable_UserBlockingPriority=2,Ye.unstable_cancelCallback=function(z){z.callback=null},Ye.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<z?Math.floor(1e3/z):5},Ye.unstable_getCurrentPriorityLevel=function(){return V},Ye.unstable_next=function(z){switch(V){case 1:case 2:case 3:var j=3;break;default:j=V}var q=V;V=j;try{return z()}finally{V=q}},Ye.unstable_requestPaint=function(){ot=!0},Ye.unstable_runWithPriority=function(z,j){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var q=V;V=z;try{return j()}finally{V=q}},Ye.unstable_scheduleCallback=function(z,j,q){var xe=Ye.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?xe+q:xe):q=xe,z){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5e3}return Ge=q+Ge,z={id:Te++,callback:j,priorityLevel:z,startTime:q,expirationTime:Ge,sortIndex:-1},q>xe?(z.sortIndex=q,r(de,z),J(L)===null&&z===J(de)&&(Ue?(pt(Ke),Ke=-1):Ue=!0,ce(ae,q-xe))):(z.sortIndex=Ge,r(L,z),he||oe||(he=!0,K||(K=!0,_e()))),z},Ye.unstable_shouldYield=A,Ye.unstable_wrapCallback=function(z){var j=V;return function(){var q=V;V=j;try{return z.apply(this,arguments)}finally{V=q}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var OS=gf((_T,RS)=>{"use strict";RS.exports=DS()});var zS=gf(vf=>{"use strict";(function(){function Me(e,t){for(e=e.memoizedState;e!==null&&0<t;)e=e.next,t--;return e}o(Me,"findHook");function r(e,t,n,l){if(n>=t.length)return l;var a=t[n],u=lt(e)?e.slice():F({},e);return u[a]=r(e[a],t,n+1,l),u}o(r,"copyWithSetImpl");function J(e,t,n){if(t.length!==n.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;l<n.length-1;l++)if(t[l]!==n[l]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return G(e,t,n,0)}}o(J,"copyWithRename");function G(e,t,n,l){var a=t[l],u=lt(e)?e.slice():F({},e);return l+1===t.length?(u[n[l]]=u[a],lt(u)?u.splice(a,1):delete u[a]):u[a]=G(e[a],t,n,l+1),u}o(G,"copyWithRenameImpl");function ee(e,t,n){var l=t[n],a=lt(e)?e.slice():F({},e);return n+1===t.length?(lt(a)?a.splice(l,1):delete a[l],a):(a[l]=ee(e[l],t,n+1),a)}o(ee,"copyWithDeleteImpl");function se(){return!1}o(se,"shouldSuspendImpl");function ae(){return null}o(ae,"shouldErrorImpl");function A(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}o(A,"warnInvalidHookAccess");function ce(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}o(ce,"warnInvalidContextAccess");function Be(){}o(Be,"noop");function Ze(){}o(Ze,"warnForMissingKey");function ue(e){var t=[];return e.forEach(function(n){t.push(n)}),t.sort().join(", ")}o(ue,"setToSortedString");function L(e,t,n,l){return new sb(e,t,n,l)}o(L,"createFiber");function de(e,t){e.context===Pl&&(Cd(e.current,2,t,e,null,null),Du())}o(de,"scheduleRoot");function Te(e,t){if(sn!==null){var n=t.staleFamilies;t=t.updatedFamilies,Jo(),mm(e.current,t,n),Du()}}o(Te,"scheduleRefresh");function I(e){sn=e}o(I,"setRefreshHandler");function V(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}o(V,"isValidContainer");function oe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}o(oe,"getNearestMountedFiber");function he(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(he,"getSuspenseInstanceFromFiber");function Ue(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(Ue,"getActivityInstanceFromFiber");function ot(e){if(oe(e)!==e)throw Error("Unable to find node on an unmounted component.")}o(ot,"assertIsMounted");function Gt(e){var t=e.alternate;if(!t){if(t=oe(e),t===null)throw Error("Unable to find node on an unmounted component.");return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var u=a.alternate;if(u===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===u.child){for(u=a.child;u;){if(u===n)return ot(a),e;if(u===l)return ot(a),t;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(n.return!==l.return)n=a,l=u;else{for(var i=!1,c=a.child;c;){if(c===n){i=!0,n=a,l=u;break}if(c===l){i=!0,l=a,n=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===n){i=!0,n=u,l=a;break}if(c===l){i=!0,l=u,n=a;break}c=c.sibling}if(!i)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(n.alternate!==l)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(n.tag!==3)throw Error("Unable to find node on an unmounted component.");return n.stateNode.current===n?e:t}o(Gt,"findCurrentFiberUsingSlowPath");function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=pt(e),t!==null)return t;e=e.sibling}return null}o(pt,"findCurrentHostFiberImpl");function bt(e){return e===null||typeof e!="object"?null:(e=Tg&&e[Tg]||e["@@iterator"],typeof e=="function"?e:null)}o(bt,"getIteratorFn");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _u:return"Fragment";case Bd:return"Profiler";case fs:return"StrictMode";case qd:return"Suspense";case jd:return"SuspenseList";case Yd:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Uu:return"Portal";case Kn:return e.displayName||"Context";case Nd:return(e._context.displayName||"Context")+".Consumer";case ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rs:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}o(K,"getComponentNameFromType");function Ke(e){return typeof e.tag=="number"?U(e):typeof e.name=="string"?e.name:null}o(Ke,"getComponentNameFromOwner");function U(e){var t=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(t._context.displayName||"Context")+".Consumer";case 10:return t.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(t);case 8:return t===fs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;break;case 29:if(t=e._debugInfo,t!=null){for(var n=t.length-1;0<=n;n--)if(typeof t[n].name=="string")return t[n].name}if(e.return!==null)return U(e.return)}return null}o(U,"getComponentNameFromFiber");function Ae(e){return{current:e}}o(Ae,"createCursor");function _e(e,t){0>ml?console.error("Unexpected pop."):(t!==Ld[ml]&&console.error("Unexpected Fiber popped."),e.current=Gd[ml],Gd[ml]=null,Ld[ml]=null,ml--)}o(_e,"pop");function pe(e,t,n){ml++,Gd[ml]=e.current,Ld[ml]=n,e.current=t}o(pe,"push");function ul(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}o(ul,"requiredContext");function z(e,t){pe($l,t,e),pe(li,e,e),pe(Jl,null,e);var n=t.nodeType;switch(n){case 9:case 11:n=n===9?"#document":"#fragment",t=(t=t.documentElement)&&(t=t.namespaceURI)?Jy(t):Ml;break;default:if(n=t.tagName,t=t.namespaceURI)t=Jy(t),t=$y(t,n);else switch(n){case"svg":t=ro;break;case"math":t=ff;break;default:t=Ml}}n=n.toLowerCase(),n=Gp(null,n),n={context:t,ancestorInfo:n},_e(Jl,e),pe(Jl,n,e)}o(z,"pushHostContainer");function j(e){_e(Jl,e),_e(li,e),_e($l,e)}o(j,"popHostContainer");function q(){return ul(Jl.current)}o(q,"getHostContext");function xe(e){e.memoizedState!==null&&pe(ds,e,e);var t=ul(Jl.current),n=e.type,l=$y(t.context,n);n=Gp(t.ancestorInfo,n),l={context:l,ancestorInfo:n},t!==l&&(pe(li,e,e),pe(Jl,l,e))}o(xe,"pushHostContext");function Ge(e){li.current===e&&(_e(Jl,e),_e(li,e)),ds.current===e&&(_e(ds,e),Ki._currentValue=ou)}o(Ge,"popHostContext");function ba(){}o(ba,"disabledLog");function iu(){if(ai===0){Ag=console.log,Dg=console.info,Rg=console.warn,Og=console.error,zg=console.group,Cg=console.groupCollapsed,Mg=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ba,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ai++}o(iu,"disableLogs");function yo(){if(ai--,ai===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Ag}),info:F({},e,{value:Dg}),warn:F({},e,{value:Rg}),error:F({},e,{value:Og}),group:F({},e,{value:zg}),groupCollapsed:F({},e,{value:Cg}),groupEnd:F({},e,{value:Mg})})}0>ai&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}o(yo,"reenableLogs");function Sn(e){var t=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=t,e.startsWith(`Error: react-stack-top-frame
|
|
1
|
+
import{a as pS,b as rp,c as bS,d as hp,e as ES,f as TS,k as AS}from"./chunk-4TV6S6AO.js";import"./chunk-ZPUO7FNI.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import{a as SS}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import"./chunk-W666BB6V.js";import"./chunk-SEU5V7I6.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{a as dp}from"./chunk-2MLA6WFH.js";import{R as yS}from"./chunk-VL23Y44O.js";import{a as ET}from"./chunk-HV7G6DFP.js";import{c as gS}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-BOXSWNXZ.js";import{a as rS,e as hS}from"./chunk-SDMZKBTD.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import"./chunk-TAD43CG5.js";import{a as mS,d as fp,m as vS}from"./chunk-ITQKVEP7.js";import{b as sS}from"./chunk-22C6COGE.js";import{a as o,c as gf,e as Wi,f as fS,g as TT,h as dS,j as sp}from"./chunk-RRCPZMC2.js";var DS=gf(Ye=>{"use strict";(function(){function Me(){if(ot=!1,K){var z=Ye.unstable_now();Ae=z;var j=!0;try{e:{he=!1,Ue&&(Ue=!1,pt(Ke),Ke=-1),oe=!0;var q=V;try{t:{for(se(z),I=J(L);I!==null&&!(I.expirationTime>z&&A());){var xe=I.callback;if(typeof xe=="function"){I.callback=null,V=I.priorityLevel;var Ge=xe(I.expirationTime<=z);if(z=Ye.unstable_now(),typeof Ge=="function"){I.callback=Ge,se(z),j=!0;break t}I===J(L)&&G(L),se(z)}else G(L);I=J(L)}if(I!==null)j=!0;else{var ba=J(de);ba!==null&&ce(ae,ba.startTime-z),j=!1}}break e}finally{I=null,V=q,oe=!1}j=void 0}}finally{j?_e():K=!1}}}o(Me,"performWorkUntilDeadline");function r(z,j){var q=z.length;z.push(j);e:for(;0<q;){var xe=q-1>>>1,Ge=z[xe];if(0<ee(Ge,j))z[xe]=j,z[q]=Ge,q=xe;else break e}}o(r,"push");function J(z){return z.length===0?null:z[0]}o(J,"peek");function G(z){if(z.length===0)return null;var j=z[0],q=z.pop();if(q!==j){z[0]=q;e:for(var xe=0,Ge=z.length,ba=Ge>>>1;xe<ba;){var iu=2*(xe+1)-1,yo=z[iu],Sn=iu+1,it=z[Sn];if(0>ee(yo,q))Sn<Ge&&0>ee(it,yo)?(z[xe]=it,z[Sn]=q,xe=Sn):(z[xe]=yo,z[iu]=q,xe=iu);else if(Sn<Ge&&0>ee(it,q))z[xe]=it,z[Sn]=q,xe=Sn;else break e}}return j}o(G,"pop");function ee(z,j){var q=z.sortIndex-j.sortIndex;return q!==0?q:z.id-j.id}o(ee,"compare");function se(z){for(var j=J(de);j!==null;){if(j.callback===null)G(de);else if(j.startTime<=z)G(de),j.sortIndex=j.expirationTime,r(L,j);else break;j=J(de)}}o(se,"advanceTimers");function ae(z){if(Ue=!1,se(z),!he)if(J(L)!==null)he=!0,K||(K=!0,_e());else{var j=J(de);j!==null&&ce(ae,j.startTime-z)}}o(ae,"handleTimeout");function A(){return ot?!0:!(Ye.unstable_now()-Ae<U)}o(A,"shouldYieldToHost");function ce(z,j){Ke=Gt(function(){z(Ye.unstable_now())},j)}if(o(ce,"requestHostTimeout"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Ye.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var Be=performance;Ye.unstable_now=function(){return Be.now()}}else{var Ze=Date,ue=Ze.now();Ye.unstable_now=function(){return Ze.now()-ue}}var L=[],de=[],Te=1,I=null,V=3,oe=!1,he=!1,Ue=!1,ot=!1,Gt=typeof setTimeout=="function"?setTimeout:null,pt=typeof clearTimeout=="function"?clearTimeout:null,bt=typeof setImmediate<"u"?setImmediate:null,K=!1,Ke=-1,U=5,Ae=-1;if(typeof bt=="function")var _e=o(function(){bt(Me)},"schedulePerformWorkUntilDeadline");else if(typeof MessageChannel<"u"){var pe=new MessageChannel,ul=pe.port2;pe.port1.onmessage=Me,_e=o(function(){ul.postMessage(null)},"schedulePerformWorkUntilDeadline")}else _e=o(function(){Gt(Me,0)},"schedulePerformWorkUntilDeadline");Ye.unstable_IdlePriority=5,Ye.unstable_ImmediatePriority=1,Ye.unstable_LowPriority=4,Ye.unstable_NormalPriority=3,Ye.unstable_Profiling=null,Ye.unstable_UserBlockingPriority=2,Ye.unstable_cancelCallback=function(z){z.callback=null},Ye.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<z?Math.floor(1e3/z):5},Ye.unstable_getCurrentPriorityLevel=function(){return V},Ye.unstable_next=function(z){switch(V){case 1:case 2:case 3:var j=3;break;default:j=V}var q=V;V=j;try{return z()}finally{V=q}},Ye.unstable_requestPaint=function(){ot=!0},Ye.unstable_runWithPriority=function(z,j){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var q=V;V=z;try{return j()}finally{V=q}},Ye.unstable_scheduleCallback=function(z,j,q){var xe=Ye.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?xe+q:xe):q=xe,z){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5e3}return Ge=q+Ge,z={id:Te++,callback:j,priorityLevel:z,startTime:q,expirationTime:Ge,sortIndex:-1},q>xe?(z.sortIndex=q,r(de,z),J(L)===null&&z===J(de)&&(Ue?(pt(Ke),Ke=-1):Ue=!0,ce(ae,q-xe))):(z.sortIndex=Ge,r(L,z),he||oe||(he=!0,K||(K=!0,_e()))),z},Ye.unstable_shouldYield=A,Ye.unstable_wrapCallback=function(z){var j=V;return function(){var q=V;V=j;try{return z.apply(this,arguments)}finally{V=q}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var OS=gf((_T,RS)=>{"use strict";RS.exports=DS()});var zS=gf(vf=>{"use strict";(function(){function Me(e,t){for(e=e.memoizedState;e!==null&&0<t;)e=e.next,t--;return e}o(Me,"findHook");function r(e,t,n,l){if(n>=t.length)return l;var a=t[n],u=lt(e)?e.slice():F({},e);return u[a]=r(e[a],t,n+1,l),u}o(r,"copyWithSetImpl");function J(e,t,n){if(t.length!==n.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;l<n.length-1;l++)if(t[l]!==n[l]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return G(e,t,n,0)}}o(J,"copyWithRename");function G(e,t,n,l){var a=t[l],u=lt(e)?e.slice():F({},e);return l+1===t.length?(u[n[l]]=u[a],lt(u)?u.splice(a,1):delete u[a]):u[a]=G(e[a],t,n,l+1),u}o(G,"copyWithRenameImpl");function ee(e,t,n){var l=t[n],a=lt(e)?e.slice():F({},e);return n+1===t.length?(lt(a)?a.splice(l,1):delete a[l],a):(a[l]=ee(e[l],t,n+1),a)}o(ee,"copyWithDeleteImpl");function se(){return!1}o(se,"shouldSuspendImpl");function ae(){return null}o(ae,"shouldErrorImpl");function A(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}o(A,"warnInvalidHookAccess");function ce(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}o(ce,"warnInvalidContextAccess");function Be(){}o(Be,"noop");function Ze(){}o(Ze,"warnForMissingKey");function ue(e){var t=[];return e.forEach(function(n){t.push(n)}),t.sort().join(", ")}o(ue,"setToSortedString");function L(e,t,n,l){return new sb(e,t,n,l)}o(L,"createFiber");function de(e,t){e.context===Pl&&(Cd(e.current,2,t,e,null,null),Du())}o(de,"scheduleRoot");function Te(e,t){if(sn!==null){var n=t.staleFamilies;t=t.updatedFamilies,Jo(),mm(e.current,t,n),Du()}}o(Te,"scheduleRefresh");function I(e){sn=e}o(I,"setRefreshHandler");function V(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}o(V,"isValidContainer");function oe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}o(oe,"getNearestMountedFiber");function he(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(he,"getSuspenseInstanceFromFiber");function Ue(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(Ue,"getActivityInstanceFromFiber");function ot(e){if(oe(e)!==e)throw Error("Unable to find node on an unmounted component.")}o(ot,"assertIsMounted");function Gt(e){var t=e.alternate;if(!t){if(t=oe(e),t===null)throw Error("Unable to find node on an unmounted component.");return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var u=a.alternate;if(u===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===u.child){for(u=a.child;u;){if(u===n)return ot(a),e;if(u===l)return ot(a),t;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(n.return!==l.return)n=a,l=u;else{for(var i=!1,c=a.child;c;){if(c===n){i=!0,n=a,l=u;break}if(c===l){i=!0,l=a,n=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===n){i=!0,n=u,l=a;break}if(c===l){i=!0,l=u,n=a;break}c=c.sibling}if(!i)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(n.alternate!==l)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(n.tag!==3)throw Error("Unable to find node on an unmounted component.");return n.stateNode.current===n?e:t}o(Gt,"findCurrentFiberUsingSlowPath");function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=pt(e),t!==null)return t;e=e.sibling}return null}o(pt,"findCurrentHostFiberImpl");function bt(e){return e===null||typeof e!="object"?null:(e=Tg&&e[Tg]||e["@@iterator"],typeof e=="function"?e:null)}o(bt,"getIteratorFn");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _u:return"Fragment";case Bd:return"Profiler";case fs:return"StrictMode";case qd:return"Suspense";case jd:return"SuspenseList";case Yd:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Uu:return"Portal";case Kn:return e.displayName||"Context";case Nd:return(e._context.displayName||"Context")+".Consumer";case ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rs:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}o(K,"getComponentNameFromType");function Ke(e){return typeof e.tag=="number"?U(e):typeof e.name=="string"?e.name:null}o(Ke,"getComponentNameFromOwner");function U(e){var t=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(t._context.displayName||"Context")+".Consumer";case 10:return t.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(t);case 8:return t===fs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;break;case 29:if(t=e._debugInfo,t!=null){for(var n=t.length-1;0<=n;n--)if(typeof t[n].name=="string")return t[n].name}if(e.return!==null)return U(e.return)}return null}o(U,"getComponentNameFromFiber");function Ae(e){return{current:e}}o(Ae,"createCursor");function _e(e,t){0>ml?console.error("Unexpected pop."):(t!==Ld[ml]&&console.error("Unexpected Fiber popped."),e.current=Gd[ml],Gd[ml]=null,Ld[ml]=null,ml--)}o(_e,"pop");function pe(e,t,n){ml++,Gd[ml]=e.current,Ld[ml]=n,e.current=t}o(pe,"push");function ul(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}o(ul,"requiredContext");function z(e,t){pe($l,t,e),pe(li,e,e),pe(Jl,null,e);var n=t.nodeType;switch(n){case 9:case 11:n=n===9?"#document":"#fragment",t=(t=t.documentElement)&&(t=t.namespaceURI)?Jy(t):Ml;break;default:if(n=t.tagName,t=t.namespaceURI)t=Jy(t),t=$y(t,n);else switch(n){case"svg":t=ro;break;case"math":t=ff;break;default:t=Ml}}n=n.toLowerCase(),n=Gp(null,n),n={context:t,ancestorInfo:n},_e(Jl,e),pe(Jl,n,e)}o(z,"pushHostContainer");function j(e){_e(Jl,e),_e(li,e),_e($l,e)}o(j,"popHostContainer");function q(){return ul(Jl.current)}o(q,"getHostContext");function xe(e){e.memoizedState!==null&&pe(ds,e,e);var t=ul(Jl.current),n=e.type,l=$y(t.context,n);n=Gp(t.ancestorInfo,n),l={context:l,ancestorInfo:n},t!==l&&(pe(li,e,e),pe(Jl,l,e))}o(xe,"pushHostContext");function Ge(e){li.current===e&&(_e(Jl,e),_e(li,e)),ds.current===e&&(_e(ds,e),Ki._currentValue=ou)}o(Ge,"popHostContext");function ba(){}o(ba,"disabledLog");function iu(){if(ai===0){Ag=console.log,Dg=console.info,Rg=console.warn,Og=console.error,zg=console.group,Cg=console.groupCollapsed,Mg=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ba,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ai++}o(iu,"disableLogs");function yo(){if(ai--,ai===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Ag}),info:F({},e,{value:Dg}),warn:F({},e,{value:Rg}),error:F({},e,{value:Og}),group:F({},e,{value:zg}),groupCollapsed:F({},e,{value:Cg}),groupEnd:F({},e,{value:Mg})})}0>ai&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}o(yo,"reenableLogs");function Sn(e){var t=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=t,e.startsWith(`Error: react-stack-top-frame
|
|
2
2
|
`)&&(e=e.slice(29)),t=e.indexOf(`
|
|
3
3
|
`),t!==-1&&(e=e.slice(t+1)),t=e.indexOf("react_stack_bottom_frame"),t!==-1&&(t=e.lastIndexOf(`
|
|
4
4
|
`,t)),t!==-1)e=e.slice(0,t);else return"";return e}o(Sn,"formatOwnerStack");function it(e){if(Vd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Vd=t&&t[1]||"",Ug=-1<n.stack.indexOf(`
|