@lunora/studio 1.0.0-alpha.115 → 1.0.0-alpha.116
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 +13 -16
- package/dist/index.js +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.js +1 -1
- package/dist/packem_chunks/ExportImportPanel.js +2 -2
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MetricsPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +9 -6
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/evals-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/migrations-route.js +1 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/sparkline.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +1 -1
- package/dist/packem_shared/{ApiReferencePanel-6W_QfOlv.js → ApiReferencePanel-DXrGI45U.js} +1 -1
- package/dist/packem_shared/CommandPalette-kQLn0xlS.js +1 -0
- package/dist/packem_shared/DataBrowser-BPCr2f8V.js +4 -0
- package/dist/packem_shared/{MigrationsPanel-CW4MNUa4.js → MigrationsPanel-CF73xHke.js} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-Cx-qwpZW.js → OpenRpcReferencePanel-DkYBLJGb.js} +1 -1
- package/dist/packem_shared/{ShardInput-XumEzeT0.js → ShardInput-CdawpUiS.js} +1 -1
- package/dist/packem_shared/{Studio-k_HuJZYW.js → Studio-RFVDC2sC.js} +1 -1
- package/dist/packem_shared/{StudioApp-CWpwayvp.js → StudioApp-jTW-QnDo.js} +1 -1
- package/dist/packem_shared/{bar-chart-CCyO67Uf.js → bar-chart-B6gzp_f9.js} +2 -2
- package/dist/packem_shared/browser-storage-BH1MxLZs.js +1 -0
- package/dist/packem_shared/{dropdown-menu-D_ewqsUU.js → dropdown-menu-U7Tjg1Nb.js} +1 -1
- package/dist/packem_shared/grid-features-AzpmpR3Q.js +6 -0
- package/dist/packem_shared/{reference-view-DhxnzBtf.js → reference-view-CxW7paCK.js} +1 -1
- package/dist/packem_shared/{schema-diagram-CPcjPZj3.js → schema-diagram-DLhppqVE.js} +1 -1
- package/dist/packem_shared/{shard-history-QcjcMnCA.js → shard-history-DU5b3QDI.js} +1 -1
- package/dist/packem_shared/shortcuts-lH4Vaqjc.js +1 -0
- package/dist/packem_shared/{sparkline-BreIqzDO.js → sparkline-CYbJzfA1.js} +1 -1
- package/dist/packem_shared/sql-result-table-blxdNVJ0.js +1 -0
- package/dist/packem_shared/studio-BdV57x3O.js +2 -0
- package/dist/packem_shared/{trace-handoff-C0CFV2ix.js → trace-handoff-z9sy89Ci.js} +1 -1
- package/dist/packem_shared/{use-open-trace-IfIlKEWd.js → use-open-trace-ClAdPkGD.js} +1 -1
- package/dist/standalone/chunk-22664OOM.js +1 -0
- package/dist/standalone/chunk-2P6N5XES.js +1 -0
- package/dist/standalone/{chunk-INBA3473.js → chunk-2SFSTQS4.js} +1 -1
- package/dist/standalone/{chunk-LDVDE3LE.js → chunk-2WAWYLUP.js} +1 -1
- package/dist/standalone/{chunk-HLEXBOCL.js → chunk-6UN4V2HB.js} +1 -1
- package/dist/standalone/{chunk-PNLUMMXO.js → chunk-BBXNPD22.js} +1 -1
- package/dist/standalone/chunk-CU7KGPAQ.js +1 -0
- package/dist/standalone/{chunk-ZHDCWHRT.js → chunk-CYLI7GO3.js} +1 -1
- package/dist/standalone/{chunk-KOH52XKG.js → chunk-CZK4GZ5C.js} +1 -1
- package/dist/standalone/{chunk-U2KBAKZ6.js → chunk-EEIKRCWD.js} +1 -1
- package/dist/standalone/{chunk-Q2G22JHG.js → chunk-F5YULDNX.js} +1 -1
- package/dist/standalone/{chunk-2UIT2HC2.js → chunk-FKNT7GEB.js} +1 -1
- package/dist/standalone/{chunk-NSR345ID.js → chunk-I4XA3BBM.js} +1 -1
- package/dist/standalone/{chunk-2CHFHPR3.js → chunk-IZ6AVENL.js} +1 -1
- package/dist/standalone/{chunk-6ZSAMAYN.js → chunk-J7GGD2O2.js} +1 -1
- package/dist/standalone/{chunk-7IQT5M4O.js → chunk-K5XFXW6D.js} +1 -1
- package/dist/standalone/{chunk-FEEZPSMA.js → chunk-KQ6HYQCE.js} +1 -1
- package/dist/standalone/{chunk-P52BY657.js → chunk-KVSQKUWD.js} +1 -1
- package/dist/standalone/chunk-LMAI2ESY.js +9 -0
- package/dist/standalone/{chunk-UKIDHICQ.js → chunk-MDWJRPZG.js} +1 -1
- package/dist/standalone/chunk-N7WIVIP2.js +3 -0
- package/dist/standalone/chunk-P2GOC5GL.js +6 -0
- package/dist/standalone/{chunk-INLHZKCS.js → chunk-PLI4LCPS.js} +1 -1
- package/dist/standalone/{chunk-D4HJ2VM2.js → chunk-R3VDUL6F.js} +1 -1
- package/dist/standalone/chunk-RND4232Z.js +1 -0
- package/dist/standalone/chunk-S6UHG354.js +1 -0
- package/dist/standalone/{chunk-OAXOITHK.js → chunk-T7DJP5HM.js} +1 -1
- package/dist/standalone/{chunk-RVQRXKRJ.js → chunk-TNFIYZPY.js} +1 -1
- package/dist/standalone/{chunk-UCA5MYCL.js → chunk-TNVZJKGN.js} +1 -1
- package/dist/standalone/chunk-TOZK5WX3.js +1 -0
- package/dist/standalone/chunk-TPAZM36C.js +1 -0
- package/dist/standalone/{chunk-OTZRXUHF.js → chunk-TYOIBCR6.js} +1 -1
- package/dist/standalone/{chunk-AG265V66.js → chunk-VKQZAEUQ.js} +1 -1
- package/dist/standalone/chunk-VTPKVALV.js +7 -0
- package/dist/standalone/{chunk-7TFEJVX4.js → chunk-VVB7SOO7.js} +1 -1
- package/dist/standalone/{chunk-MGC6PRMV.js → chunk-XOA5TTRA.js} +1 -1
- package/dist/standalone/{chunk-IWOZGUI2.js → chunk-YMVKAXBC.js} +1 -1
- package/dist/standalone/chunk-ZHPDAJBM.js +1 -0
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/CommandPalette-BAiOc1hT.js +0 -1
- package/dist/packem_shared/DataBrowser-CrkvQAMf.js +0 -1
- package/dist/packem_shared/browser-storage-Br_bLeBt.js +0 -1
- package/dist/packem_shared/grid-features-3wfN2PeE.js +0 -6
- package/dist/packem_shared/result-chart-Q-gVLi4_.js +0 -1
- package/dist/packem_shared/studio-BFvT56qK.js +0 -2
- package/dist/standalone/chunk-2Q7HAFRK.js +0 -1
- package/dist/standalone/chunk-44FJEOAY.js +0 -1
- package/dist/standalone/chunk-EQSVW6LZ.js +0 -3
- package/dist/standalone/chunk-GKHUQDVI.js +0 -1
- package/dist/standalone/chunk-H3M57MCN.js +0 -1
- package/dist/standalone/chunk-HLHO5AHK.js +0 -4
- package/dist/standalone/chunk-U7J3LXJ4.js +0 -6
- package/dist/standalone/chunk-UJXKS27L.js +0 -1
- package/dist/standalone/chunk-VNTEQQPP.js +0 -1
- package/dist/standalone/chunk-YYFHDYYT.js +0 -1
- package/dist/standalone/chunk-ZIHYXKQJ.js +0 -6
- /package/dist/standalone/{chunk-AECDJKXB.js → chunk-O2VDNK4B.js} +0 -0
- /package/dist/standalone/{chunk-APRVSWBH.js → chunk-XL2OT5WB.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as rt,b as ot}from"./chunk-CU7KGPAQ.js";import{a as nt}from"./chunk-P2GOC5GL.js";import{a as tt}from"./chunk-KEMHRM53.js";import"./chunk-O2VDNK4B.js";import"./chunk-CN2AINNY.js";import"./chunk-CP4ZFBVW.js";import"./chunk-5JLIP2HH.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as et}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-XL2OT5WB.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import"./chunk-2EJQ7SPV.js";import{a as Je}from"./chunk-6UN4V2HB.js";import{b as Xe}from"./chunk-KVSQKUWD.js";import{c as Ve,d as qe,e as Le,f as _e,g as Pe}from"./chunk-ZHPDAJBM.js";import{P as Ge}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as Ze}from"./chunk-PZ4QDWTI.js";import{a as Ne}from"./chunk-VDW32UET.js";import"./chunk-2UWKGSEA.js";import{f as Ee}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import{d as ce,f as we,g as ke,h as Ke,o as ue}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as We,e as vt,f as yt,g as St,i as me}from"./chunk-R5ZTCHCE.js";var G=We(yt(),1);var z=We(vt(),1);var c=We(St(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],kt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),Nt=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),qt=wt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ct=kt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
|
|
2
|
+
${s}`})),Tt=l(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Me}${(e.length-1).toString()}${Me}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of qt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Ct)n=n.replaceAll(t,o);return n=n.replaceAll(Nt,(t,o)=>e[Number(o)]??""),n},"Lt"),je="x",It={'"':'"',"'":"'","[":"]","`":"`"},Rt=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
|
|
3
|
+
`;)n+=1;return n},"qt"),Et=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"At"),ct=l(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=It[t];if(t==="-"&&s[n+1]==="-"){let r=Rt(s,n);e.fill(je,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=Et(s,n);if(r===-1)return;e.fill(je,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(je,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
|
|
4
|
+
`&&(e[t]=`
|
|
5
|
+
`);return e.join("")},"tt"),Lt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,_t=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|replace|truncate|update|vacuum)\b/iu,Ot=/^\w+/u,Dt=/;\s*$/u,Mt=/\s/u,At=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
|
|
6
|
+
`;)n+=1;return n},"Bt"),$t=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"Ht"),Bt=l(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&Mt.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=At(s,e);else if(n==="/"&&s[e+1]==="*"){let t=$t(s,e);if(t===-1)break;e=t}else break}return e},"Pt"),Ht=l(s=>{let e=Bt(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=n.replace(Dt,""),o=(ct(t)??t).indexOf(";");if(o!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+o};let r="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!Lt.test(t))return{code:"SQL_NOT_READONLY",length:Ot.exec(t)?.[0].length??1,message:r,offset:e};let a=_t.exec(t);if(a!==null)return{code:"SQL_NOT_READONLY",length:a[0].length,message:`${r} (\`${a[0].toUpperCase()}\` is not allowed)`,offset:e+a.index}},"Wt"),Fe=l((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=Ht(n);return[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"Qe"),dt=l(s=>{let e=ct(s);if(e===void 0)return Fe(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(...Fe(s.slice(t,o),t)),t=o+1);return n},"nt"),Wt=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,Pt=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,jt=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Qt=/[^\n]/gu,Ft=l((s,e)=>{let n=s[e];if(n==="'"){let t=e+1;for(;t<s.length&&s[t]!=="'";)t+=1;return Math.min(t+1,s.length)}if(n==="-"&&s[e+1]==="-"){let t=s.indexOf(`
|
|
7
|
+
`,e);return t===-1?s.length:t}if(n==="/"&&s[e+1]==="*"){let t=s.indexOf("*/",e+2);return t===-1?s.length:t+2}return-1},"zt"),zt=l(s=>{let e="",n=0;for(;n<s.length;){let t=Ft(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Qt," "),n=t)}return e},"Yt"),Ut=l(s=>{let e=new Set;for(let n of s.matchAll(Pt))e.add((n[1]??"").toLowerCase());return e},"Kt"),Yt=l((s,e)=>{let n=new Map;for(let t of s.matchAll(Wt)){let o=(t[1]??"").toLowerCase(),r=(t[2]??"").toLowerCase();e.has(o)&&(n.set(o,o),r!==""&&!jt.has(r)&&n.set(r,o))}return n},"Gt"),ut=l((s,e)=>{let n=zt(s),t=new Set(e.map(o=>o.toLowerCase()));return{ctes:Ut(n),masked:n,targets:Yt(n,t)}},"st"),Gt=/^(?:__lunora|sqlite_)/iu,Kt=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,Vt=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,Xt=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),Jt=l((s,e,n)=>{let t=[];for(let o of s.matchAll(Kt)){let r=o[1]??"",a=r.toLowerCase();!e.has(a)&&!n.has(a)&&!Xt.has(a)&&!Gt.test(r)&&t.push({length:r.length,message:`unknown table \`${r}\``,offset:o.index+o[0].length-r.length,severity:"error",source:"schema"})}return t},"en"),Zt=l((s,e,n)=>{let t=[],o=new Map;for(let[r,a]of Object.entries(e.columns))o.set(r.toLowerCase(),new Set(a.map(d=>d.toLowerCase())));for(let r of s.matchAll(Vt)){let a=(r[1]??"").toLowerCase(),d=r[2]??"",i=n.get(a),u=i===void 0?void 0:o.get(i);u!==void 0&&!u.has(d.toLowerCase())&&t.push({length:d.length,message:`\`${i??""}\` has no column \`${d}\``,offset:r.index+r[0].length-d.length,severity:"error",source:"schema"})}return t},"tn"),en=l((s,e)=>{if(s.trim()==="")return[];let n=dt(s),t=new Set(e.tables.map(r=>r.toLowerCase())),o=[];for(let r of n){let{offset:a,rejection:d}=r;if(d!==void 0){d.code!=="SQL_EMPTY"&&o.push({length:d.length,message:d.message,offset:d.offset===void 0?a:a+d.offset,severity:"error",source:"gate"});continue}let{ctes:i,masked:u,targets:p}=ut(r.sql,e.tables);o.push(...[...Jt(u,t,i),...Zt(u,e,p)].map(h=>({...h,offset:h.offset===void 0?a:a+h.offset})))}return o},"nn"),tn=we(Ne.lintSql),nn=600,rn=l((s,e,n)=>{let t=Ee(),[o,r]=(0,z.useState)([]),a=(0,z.useMemo)(()=>en(s,e),[s,e]),d=et(s,nn),i=a.some(h=>h.source==="gate")||d.trim()==="",u=(0,z.useCallback)(async h=>{try{let g=await t.query(tn,{sql:d},ke(n));h.cancelled||r(g.diagnostics??[])}catch{h.cancelled||r([])}},[t,d,n]);(0,z.useEffect)(()=>{if(i){r([]);return}let h={cancelled:!1};return ue(u(h)),()=>{h.cancelled=!0}},[u,i]);let p=d===s;return(0,z.useMemo)(()=>p?[...a,...o]:a,[a,o,p])},"ln"),Oe=8,on=["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"],sn=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),ln=/[\w$]/,mt=l(s=>s!==void 0&&ln.test(s),"ot"),ft=l(s=>{let e=s.length;for(;e>0&&mt(s[e-1]);)e-=1;return s.slice(e)},"lt"),ht=l((s,e)=>{let n=e;for(;n>0&&mt(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"rt"),st=l((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||sn.has(ft(n).toUpperCase())},"Je"),an=l((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=ft(t.slice(0,-1));if(o!=="")return ut(s,n).targets.get(o.toLowerCase())??o},"dn"),ze=l((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"ze"),lt=l((s,e,n,t)=>{let o=[];for(let r of s)if(ze(r,e)&&(o.push(t(r)),o.length>=n))break;return o},"Ve"),cn=l((s,e,n)=>{let t=new Map;for(let[o,r]of Object.entries(s.columns))for(let a of r)if(ze(a,e)&&!t.has(a)&&(t.set(a,o),t.size>=n))return[...t].map(([d,i])=>({detail:i,kind:"column",label:d}));return[...t].map(([o,r])=>({detail:r,kind:"column",label:o}))},"un"),dn=l((s,e,n)=>{let t=ht(s,e),o=an(s,t.start,n.tables);if(o!==void 0){let i=n.columns[o]??n.columns[o.toLowerCase()]??[];return lt(i,t.text,Oe,u=>({detail:o,kind:"column",label:u}))}if(t.text===""&&!st(s,t.start))return[];let r=lt(n.tables,t.text,Oe,i=>({kind:"table",label:i})),a=cn(n,t.text,Oe),d=on.flatMap(i=>t.text!==""&&ze(i,t.text)&&i.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:i}]:[]);return(st(s,t.start)?[...a,...r,...d]:[...r,...a,...d]).slice(0,Oe)},"fn"),un=l((s,e,n)=>{let t=ht(s,e),o=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:o}},"mn"),mn=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],fn=l((s,e)=>{let n=globalThis.getComputedStyle(s),t=globalThis.document.createElement("div"),{style:o}=t;o.position="absolute",o.visibility="hidden",o.whiteSpace="pre-wrap",o.overflowWrap="break-word";for(let i of mn)o[i]=n[i];t.textContent=s.value.slice(0,Math.max(0,e));let r=globalThis.document.createElement("span");r.textContent=s.value.slice(Math.max(0,e))||".",t.append(r),globalThis.document.body.append(t);let a=r.offsetLeft-s.scrollLeft,d=r.offsetTop-s.scrollTop;return t.remove(),{left:a,top:d}},"pn"),hn=l((s,e,n)=>{let t=(0,G.c)(16),[o,r]=(0,z.useState)(null),a;t[0]!==s||t[1]!==e?(a=l((v,b)=>{let k=dn(v,b,s);if(k.length===0){r(null);return}let S=e.current,{left:x,top:q}=S===null?{left:0,top:0}:fn(S,b);r(C=>C!==null&&C.active===0&&C.left===x&&C.top===q&&C.suggestions.length===k.length&&C.suggestions.every((R,T)=>{let _=k.at(T);return R.kind===_?.kind&&R.label===_.label&&R.detail===_.detail})?C:{active:0,left:x,suggestions:k,top:q})},"r"),t[0]=s,t[1]=e,t[2]=a):a=t[2];let d=a,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l(()=>{r(null)},"c"),t[3]=i):i=t[3];let u=i,p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=l(v=>{r(b=>{if(b===null)return b;let k=b.suggestions.length,S=(b.active+v+k)%k;return{...b,active:S}})},"m"),t[4]=p):p=t[4];let h=p,g;t[5]!==n||t[6]!==o||t[7]!==e?(g=l(v=>{let b=e.current;if(o===null||b===null)return!1;let k=o.suggestions[v??o.active];if(k===void 0)return!1;let S=un(b.value,b.selectionStart,k);return n(S.value),r(null),requestAnimationFrame(()=>{let x=e.current;x!==null&&(x.focus(),x.setSelectionRange(S.caret,S.caret))}),!0},"f"),t[5]=n,t[6]=o,t[7]=e,t[8]=g):g=t[8];let y=g,m;t[9]!==y?(m=l(()=>y(),"d"),t[9]=y,t[10]=m):m=t[10];let w=m,f;return t[11]!==w||t[12]!==y||t[13]!==d||t[14]!==o?(f={close:u,commit:w,commitAt:y,move:h,refresh:d,state:o},t[11]=w,t[12]=y,t[13]=d,t[14]=o,t[15]=f):f=t[15],f},"bn"),pn={column:"column",keyword:"keyword",table:"table"},bn=20,gn=l(s=>{let e=(0,G.c)(17),{listboxId:n,onPick:t,state:o}=s,r=ce(),a;e[0]!==o?(a=o===null?void 0:{left:o.left,top:o.top+bn},e[0]=o,e[1]=a):a=e[1];let d=a;if(o===null)return null;let i;if(e[2]!==n||e[3]!==t||e[4]!==o.active||e[5]!==o.suggestions||e[6]!==r){let p;e[8]!==n||e[9]!==t||e[10]!==o.active||e[11]!==r?(p=l((h,g)=>(0,c.jsxs)("li",{"aria-selected":g===o.active,className:me("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",g===o.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${n}-opt-${g.toString()}`,onMouseDown:l(y=>{y.preventDefault(),t(g)},"onMouseDown"),role:"option",children:[(0,c.jsx)("span",{className:"truncate font-mono",children:h.label}),h.detail!==void 0&&(0,c.jsx)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:h.detail}),(0,c.jsx)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:r(pn[h.kind])})]},`${h.kind}:${h.label}`),"m"),e[8]=n,e[9]=t,e[10]=o.active,e[11]=r,e[12]=p):p=e[12],i=o.suggestions.map(p),e[2]=n,e[3]=t,e[4]=o.active,e[5]=o.suggestions,e[6]=r,e[7]=i}else i=e[7];let u;return e[13]!==n||e[14]!==d||e[15]!==i?(u=(0,c.jsx)("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:n,role:"listbox",style:d,children:i}),e[13]=n,e[14]=d,e[15]=i,e[16]=u):u=e[16],u},"yn"),xn=we(Ne.listTables),vn=we(Ne.readTablePage),yn=l(s=>{let e=(0,G.c)(16),n=Ee(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[o,r]=(0,z.useState)(t),a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={},e[1]=a):a=e[1];let[d,i]=(0,z.useState)(a),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let p=(0,z.useRef)(u),h,g;e[3]!==n||e[4]!==s?(h=l(()=>{let b={cancelled:!1};return ue((async()=>{try{let k=await n.query(xn,{},ke(s));b.cancelled||(r(k.map(wn)),i({}),p.current=new Set)}catch{b.cancelled||(r([]),i({}),p.current=new Set)}})()),()=>{b.cancelled=!0}},"g"),g=[n,s],e[3]=n,e[4]=s,e[5]=h,e[6]=g):(h=e[5],g=e[6]),(0,z.useEffect)(h,g);let y;e[7]!==n||e[8]!==s?(y=l(b=>{p.current.has(b)||(p.current.add(b),ue((async()=>{try{let k=await n.query(vn,{limit:1,offset:0,table:b},ke(s));i(S=>({...S,[b]:k.columns}))}catch{p.current.delete(b)}})()))},"y"),e[7]=n,e[8]=s,e[9]=y):y=e[9];let m=y,w;e[10]!==d||e[11]!==o?(w={columns:d,tables:o},e[10]=d,e[11]=o,e[12]=w):w=e[12];let f=w,v;return e[13]!==m||e[14]!==f?(v={probe:m,schema:f},e[13]=m,e[14]=f,e[15]=v):v=e[15],v},"wn"),Qe=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,Sn=l(s=>{let e=new Set;Qe.lastIndex=0;let n=Qe.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=Qe.exec(s);return[...e]},"Cn");function wn(s){return s.name}l(wn,"Nn");var kn=l(s=>{let e=(0,G.c)(34),{onSubmit:n,probe:t,schema:o,setDraft:r}=s,a=(0,z.useId)(),d=(0,z.useRef)(null),i=(0,z.useRef)(null),u=(0,z.useRef)(null),p=hn(o,u,r),{close:h,commit:g,commitAt:y,move:m,refresh:w,state:f}=p,v;e[0]!==y?(v=l(N=>{y(N)},"x"),e[0]=y,e[1]=v):v=e[1];let b=v,k;e[2]!==w?(k=l(()=>{let N=u.current;N!==null&&N===document.activeElement&&w(N.value,N.selectionStart)},"C"),e[2]=w,e[3]=k):k=e[3];let S;e[4]!==w||e[5]!==o?(S=[w,o],e[4]=w,e[5]=o,e[6]=S):S=e[6],(0,z.useEffect)(k,S);let x;e[7]!==t||e[8]!==w||e[9]!==r?(x=l(N=>{let{selectionStart:j,value:I}=N.target;r(I);for(let $ of Sn(I))t($);w(I,j)},"p"),e[7]=t,e[8]=w,e[9]=r,e[10]=x):x=e[10];let q=x,C;e[11]!==w?(C=l(N=>{let j=N.currentTarget;w(j.value,j.selectionStart)},"N"),e[11]=w,e[12]=C):C=e[12];let R=C,T;e[13]!==f||e[14]!==h||e[15]!==g||e[16]!==m||e[17]!==n?(T=l(N=>{if(f!==null){if(N.key==="ArrowDown"){N.preventDefault(),m(1);return}if(N.key==="ArrowUp"){N.preventDefault(),m(-1);return}if(N.key==="Escape"){N.preventDefault(),h();return}if((N.key==="Enter"||N.key==="Tab")&&!N.metaKey&&!N.ctrlKey&&g()){N.preventDefault();return}}(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),n())},"E"),e[13]=f,e[14]=h,e[15]=g,e[16]=m,e[17]=n,e[18]=T):T=e[18];let _=T,E;e[19]!==h?(E=l(()=>{requestAnimationFrame(()=>{h()})},"T"),e[19]=h,e[20]=E):E=e[20];let O=E,D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=l(N=>{let{scrollLeft:j,scrollTop:I}=N.currentTarget;d.current!==null&&(d.current.scrollTop=I),i.current!==null&&(i.current.scrollTop=I,i.current.scrollLeft=j)},"_"),e[21]=D):D=e[21];let L=D,B;e[22]===Symbol.for("react.memo_cache_sentinel")?(B=l(N=>{let j=u.current;j===null||N.offset===void 0||(j.focus(),j.setSelectionRange(N.offset,N.offset+(N.length??0)))},"B"),e[22]=B):B=e[22];let A=B,P;e[23]!==q||e[24]!==O||e[25]!==_||e[26]!==R?(P={onBlur:O,onChange:q,onKeyDown:_,onScroll:L,onSelect:R},e[23]=q,e[24]=O,e[25]=_,e[26]=R,e[27]=P):P=e[27];let M;return e[28]!==f||e[29]!==h||e[30]!==a||e[31]!==b||e[32]!==P?(M={autocompleteState:f,closeAutocomplete:h,handlers:P,listboxId:a,onPickSuggestion:b,editorRef:u,gutterRef:d,overlayRef:i,revealDiagnostic:A},e[28]=f,e[29]=h,e[30]=a,e[31]=b,e[32]=P,e[33]=M):M=e[33],M},"kn"),Nn="lunora-studio-sql-tabs",qn="lunora-studio-sql-active-tab",Ue=12,Ce=l((s="",e="")=>({activeId:null,id:Pe("tab"),name:e,sql:s}),"we"),Cn=l(()=>_e(qn,""),"Rn"),Tn=l(s=>{let e=(0,G.c)(16),[n,t]=Le(Nn),[o,r]=Cn(),[a]=(0,z.useState)(s),d,i;e[0]!==a||e[1]!==t||e[2]!==n.length?(d=l(()=>{n.length===0&&t([a])},"i"),i=[a,t,n.length],e[0]=a,e[1]=t,e[2]=n.length,e[3]=d,e[4]=i):(d=e[3],i=e[4]),(0,z.useEffect)(d,i);let u;e[5]!==a||e[6]!==n?(u=n.length===0?[a]:n,e[5]=a,e[6]=n,e[7]=u):u=e[7];let p=u,h;e[8]!==o||e[9]!==p?(h=p.some(m=>m.id===o)?o:p[0]?.id??"",e[8]=o,e[9]=p,e[10]=h):h=e[10];let g=h,y;return e[11]!==g||e[12]!==r||e[13]!==t||e[14]!==p?(y={activeId:g,setActiveId:r,setTabs:t,tabs:p},e[11]=g,e[12]=r,e[13]=t,e[14]=p,e[15]=y):y=e[15],y},"Ln"),pt=l(s=>s.activeId===null&&s.sql.trim()!=="","it"),In=l((s,e)=>[...s,e].slice(-Ue),"In"),Rn=l((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let o=s.filter(r=>r.id!==e);if(o.length===0){let r=n();return{activeId:r.id,tabs:[r]}}return{activeId:o[Math.min(t,o.length-1)].id,tabs:o}},"qn"),En=l((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"An"),Ln=l((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:n,tabs:[...s]};let o=s.slice(0,t+1);return{activeId:o.some(r=>r.id===n)?n:e,tabs:o}},"_n"),_n=l(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"On"),On=l((s,e,n)=>{if(s==="others")return e.filter(t=>t.id!==n);if(s==="right"){let t=e.findIndex(o=>o.id===n);return t===-1?[]:e.slice(t+1)}return[...e]},"Dn"),at={error:null,pane:"results",result:null,running:!1},Dn=l(s=>{let e=(0,G.c)(66),{activeId:n,setActiveId:t,setTabs:o,tabs:r}=Tn(s),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let[d,i]=(0,z.useState)(a),[u,p]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),y;e[1]!==n||e[2]!==r?(y=r.find(W=>W.id===n)??r[0]??Ce(),e[1]=n,e[2]=r,e[3]=y):y=e[3];let m=y,w=d[m.id]??at,f;e[4]!==m.id||e[5]!==o?(f=l(W=>{o(U=>U.map(Y=>Y.id===m.id?{...Y,...W}:Y))},"u"),e[4]=m.id,e[5]=o,e[6]=f):f=e[6];let v=f,b;e[7]!==m.id?(b=l(W=>{i(U=>{let Y=U[m.id]??at;return{...U,[m.id]:{...Y,...W}}})},"h"),e[7]=m.id,e[8]=b):b=e[8];let k=b,S;e[9]!==t||e[10]!==o||e[11]!==r.length?(S=l(()=>{if(r.length>=Ue)return;let W=Ce();o(U=>In(U,W)),t(W.id)},"v"),e[9]=t,e[10]=o,e[11]=r.length,e[12]=S):S=e[12];let x=S,q;e[13]!==t||e[14]!==o?(q=l(W=>{p(null),g(null),o(W.tabs),t(W.activeId);let U=new Set(W.tabs.map(Mn));i(Y=>Object.fromEntries(Object.entries(Y).filter(X=>{let[fe]=X;return U.has(fe)})))},"k"),e[13]=t,e[14]=o,e[15]=q):q=e[15];let C=q,R;e[16]!==C||e[17]!==r?(R=l(W=>{C(Rn(r,W,Ce))},"L"),e[16]=C,e[17]=r,e[18]=R):R=e[18];let T=R,_;e[19]!==n||e[20]!==C||e[21]!==r?(_=l((W,U)=>{C(W==="others"?En(r,U):W==="right"?Ln(r,U,n):_n(Ce))},"q"),e[19]=n,e[20]=C,e[21]=r,e[22]=_):_=e[22];let E=_,O;e[23]!==E||e[24]!==u||e[25]!==r?(O=l(W=>{u!==null&&(On(W,r,u.id).some(An)?g(W):E(W,u.id))},"A"),e[23]=E,e[24]=u,e[25]=r,e[26]=O):O=e[26];let D=O,L;e[27]===Symbol.for("react.memo_cache_sentinel")?(L=l((W,U)=>{U.preventDefault(),g(null),p({id:W,x:U.clientX,y:U.clientY})},"I"),e[27]=L):L=e[27];let B=L,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=l(()=>{p(null),g(null)},"D"),e[28]=A):A=e[28];let P=A,M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M=l(W=>{W.preventDefault(),p(null),g(null)},"O"),e[29]=M):M=e[29];let N=M,j;e[30]!==D?(j=l(()=>{D("others")},"W"),e[30]=D,e[31]=j):j=e[31];let I=j,$;e[32]!==D?($=l(()=>{D("right")},"M"),e[32]=D,e[33]=$):$=e[33];let F=$,H;e[34]!==D?(H=l(()=>{D("all")},"$"),e[34]=D,e[35]=H):H=e[35];let J=H,Z;e[36]!==E||e[37]!==h||e[38]!==u?(Z=l(()=>{u!==null&&h!==null&&E(h,u.id),g(null)},"Z"),e[36]=E,e[37]=h,e[38]=u,e[39]=Z):Z=e[39];let ee=Z,te;e[40]===Symbol.for("react.memo_cache_sentinel")?(te=l(()=>{g(null)},"te"),e[40]=te):te=e[40];let ie=te,V;e[41]!==u?(V=u===null?void 0:{left:u.x,top:u.y},e[41]=u,e[42]=V):V=e[42];let Q=V,ne;e[43]!==o?(ne=l(W=>{o(U=>U.map(Y=>Y.activeId===W?{...Y,activeId:null}:Y))},"ne"),e[43]=o,e[44]=ne):ne=e[44];let re=ne,oe;e[45]!==o?(oe=l((W,U)=>{o(Y=>Y.map(X=>X.id===W?{...X,name:U}:X))},"oe"),e[45]=o,e[46]=oe):oe=e[46];let se=oe,le;return e[47]!==m||e[48]!==n||e[49]!==x||e[50]!==T||e[51]!==ee||e[52]!==J||e[53]!==I||e[54]!==F||e[55]!==w||e[56]!==k||e[57]!==v||e[58]!==h||e[59]!==se||e[60]!==t||e[61]!==u||e[62]!==Q||e[63]!==r||e[64]!==re?(le={activeTab:m,activeTabId:n,addEditorTab:x,cancelBulk:ie,closeEditorTab:T,closeTabMenu:P,confirmBulk:ee,menuStyle:Q,onBackdropContextMenu:N,onCloseAll:J,onCloseOthers:I,onCloseToRight:F,openTabMenu:B,output:w,patchActiveOutput:k,patchActiveTab:v,pendingBulk:h,renameTab:se,setActiveTabId:t,tabMenu:u,tabs:r,unlinkQuery:re},e[47]=m,e[48]=n,e[49]=x,e[50]=T,e[51]=ee,e[52]=J,e[53]=I,e[54]=F,e[55]=w,e[56]=k,e[57]=v,e[58]=h,e[59]=se,e[60]=t,e[61]=u,e[62]=Q,e[63]=r,e[64]=re,e[65]=le):le=e[65],le},"Mn");function Mn(s){return s.id}l(Mn,"$n");function An(s){return pt(s)}l(An,"Bn");var $n="lunora-studio-sql-queries",Se="lunora-studio-sql-history",Bn="lunora-studio-sql-remember-history",Hn=25,Wn=l(s=>{let e=(0,G.c)(41),{loadIntoActiveTab:n,unlinkQuery:t}=s,o=ce(),[r,a]=Le($n),[d,i]=_e(Bn,!1),[u,p]=Le(Se,d?"local":"session"),h,g;e[0]!==d?(h=l(()=>{d||qe(Se,"local")},"g"),g=[d],e[0]=d,e[1]=h,e[2]=g):(h=e[1],g=e[2]),(0,z.useEffect)(h,g);let[y,m]=(0,z.useState)(""),w=(0,z.useRef)(null),f;e[3]!==p?(f=l(I=>{p($=>$[0]?.sql===I?$:[{at:Date.now(),sql:I},...$.filter(F=>F.sql!==I)].slice(0,Hn))},"u"),e[3]=p,e[4]=f):f=e[4];let v=f,b;e[5]!==n||e[6]!==a||e[7]!==o?(b=l(()=>{let I={id:Pe("q"),name:o("Untitled query"),sql:""};a($=>[I,...$]),n("",I.id)},"h"),e[5]=n,e[6]=a,e[7]=o,e[8]=b):b=e[8];let k=b,S;e[9]!==n||e[10]!==r?(S=l(I=>{let $=r.find(F=>F.id===I);$!==void 0&&(n($.sql,I),w.current?.querySelector(`[data-testid="sql-query-${I}"]`)?.scrollIntoView({block:"nearest"}))},"v"),e[9]=n,e[10]=r,e[11]=S):S=e[11];let x=S,q;e[12]!==a||e[13]!==t?(q=l(I=>{a($=>$.filter(F=>F.id!==I)),t(I)},"k"),e[12]=a,e[13]=t,e[14]=q):q=e[14];let C=q,R;e[15]!==n?(R=l(I=>{n(I.currentTarget.dataset.sql??"",null)},"L"),e[15]=n,e[16]=R):R=e[16];let T=R,_;e[17]!==n?(_=l(I=>{n(I.currentTarget.dataset.sql??"",null)},"q"),e[17]=n,e[18]=_):_=e[18];let E=_,O;e[19]!==p?(O=l(()=>{p([]),qe(Se,"local"),qe(Se,"session")},"A"),e[19]=p,e[20]=O):O=e[20];let D=O,L;e[21]!==u||e[22]!==i?(L=l(I=>{Ve(Se,u,I?"local":"session"),I||qe(Se,"local"),i(I)},"I"),e[21]=u,e[22]=i,e[23]=L):L=e[23];let B=L,A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=l(I=>{m(I.target.value)},"D"),e[24]=A):A=e[24];let P=A,M;e[25]!==a?(M=l((I,$)=>{a(F=>F.map(H=>H.id===I?{...H,sql:$}:H))},"O"),e[25]=a,e[26]=M):M=e[26];let N=M,j;return e[27]!==D||e[28]!==C||e[29]!==u||e[30]!==E||e[31]!==T||e[32]!==k||e[33]!==r||e[34]!==v||e[35]!==d||e[36]!==y||e[37]!==x||e[38]!==B||e[39]!==N?(j={clearHistory:D,deleteQuery:C,history:u,listRef:w,loadFromHistory:E,loadTemplate:T,newQuery:k,onSearchChange:P,queries:r,recordHistory:v,rememberHistory:d,search:y,selectQuery:x,setRememberHistory:B,updateQuerySql:N},e[27]=D,e[28]=C,e[29]=u,e[30]=E,e[31]=T,e[32]=k,e[33]=r,e[34]=v,e[35]=d,e[36]=y,e[37]=x,e[38]=B,e[39]=N,e[40]=j):j=e[40],j},"Fn"),bt="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",Pn=l((s,e)=>{let n=[];for(let o of s){if(o.offset===void 0||o.length===void 0||o.length<=0)continue;let r=Math.max(0,Math.min(o.offset,e)),a=Math.max(r,Math.min(o.offset+o.length,e));r!==a&&n.push({end:a,severity:o.severity,start:r})}n.sort((o,r)=>o.start-r.start);let t=[];for(let o of n)o.start>=(t.at(-1)?.end??0)&&t.push(o);return t},"Qn"),jn=l(s=>s==="unsafe-response"?"The model returned a statement that is not read-only, so it was discarded.":s==="empty-response"?"The model returned nothing usable.":"The model could not be reached.","Un"),Qn=l(s=>{let e=(0,G.c)(51),{assistant:n,failed:t,onGenerated:o}=s,r=ce(),[a,d]=(0,z.useState)("");if(n.unavailable)return null;let i;e[0]!==n?(i=n.pending("sql"),e[0]=n,e[1]=i):i=e[1];let u=i,p;if(e[2]!==n||e[3]!==t||e[4]!==o||e[5]!==u||e[6]!==a||e[7]!==r){let h=n.reason("sql"),g;e[9]!==n||e[10]!==t||e[11]!==o||e[12]!==a?(g=l(E=>{let O=a.trim();O===""&&!E||ue((async()=>{let D=await n.generate(O===""?"fix the failing statement":O,E?t:void 0);D!==void 0&&o(D)})())},"f"),e[9]=n,e[10]=t,e[11]=o,e[12]=a,e[13]=g):g=e[13];let y=g,m;e[14]!==r?(m=r("Describe the query you want"),e[14]=r,e[15]=m):m=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=l(E=>{d(E.target.value)},"S"),e[16]=w):w=e[16];let f;e[17]!==y?(f=l(E=>{E.key==="Enter"&&(E.preventDefault(),y(!1))},"u"),e[17]=y,e[18]=f):f=e[18];let v;e[19]!==r?(v=r("Describe the query you want"),e[19]=r,e[20]=v):v=e[20];let b;e[21]!==u||e[22]!==a||e[23]!==m||e[24]!==f||e[25]!==v?(b=(0,c.jsx)(Ge,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:u,onChange:w,onKeyDown:f,placeholder:v,value:a}),e[21]=u,e[22]=a,e[23]=m,e[24]=f,e[25]=v,e[26]=b):b=e[26];let k=u&&"opacity-60",S;e[27]!==k?(S=me("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",k),e[27]=k,e[28]=S):S=e[28];let x;e[29]!==u||e[30]!==a?(x=u||a.trim()==="",e[29]=u,e[30]=a,e[31]=x):x=e[31];let q;e[32]!==y?(q=l(()=>{y(!1)},"k"),e[32]=y,e[33]=q):q=e[33];let C;e[34]!==u||e[35]!==r?(C=r(u?"Thinking\u2026":"Draft SQL"),e[34]=u,e[35]=r,e[36]=C):C=e[36];let R;e[37]!==S||e[38]!==x||e[39]!==q||e[40]!==C?(R=(0,c.jsx)("button",{className:S,"data-testid":"sql-assistant-generate",disabled:x,onClick:q,type:"button",children:C}),e[37]=S,e[38]=x,e[39]=q,e[40]=C,e[41]=R):R=e[41];let T;e[42]!==t||e[43]!==u||e[44]!==y||e[45]!==r?(T=t!==void 0&&(0,c.jsx)("button",{className:"rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-assistant-fix",disabled:u,onClick:l(()=>{y(!0)},"onClick"),type:"button",children:r("Fix this")}),e[42]=t,e[43]=u,e[44]=y,e[45]=r,e[46]=T):T=e[46];let _;e[47]!==R||e[48]!==T||e[49]!==b?(_=(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[b,R,T]}),e[47]=R,e[48]=T,e[49]=b,e[50]=_):_=e[50],p=(0,c.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border px-3 py-2","data-testid":"sql-assistant",children:[_,h!==void 0&&(0,c.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:jn(h)})]}),e[2]=n,e[3]=t,e[4]=o,e[5]=u,e[6]=a,e[7]=r,e[8]=p}else p=e[8];return p},"jn"),Fn=l(s=>{let e=(0,G.c)(8),{diagnostics:n,draft:t,scrollRef:o}=s,r,a;if(e[0]!==n||e[1]!==t){a=Symbol.for("react.early_return_sentinel");e:{let u=Pn(n,t.length);if(u.length===0){a=null;break e}r=[];let p=0;for(let[h,g]of u.entries())g.start>p&&r.push(t.slice(p,g.start)),r.push((0,c.jsx)("span",{className:me("decoration-wavy underline underline-offset-4",g.severity==="error"?"decoration-destructive":"decoration-amber-500"),children:t.slice(g.start,g.end)},`${g.start.toString()}-${h.toString()}`)),p=g.end;r.push(t.slice(p))}e[0]=n,e[1]=t,e[2]=r,e[3]=a}else r=e[2],a=e[3];if(a!==Symbol.for("react.early_return_sentinel"))return a;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=me("pointer-events-none absolute inset-0 overflow-hidden text-transparent",bt),e[4]=d):d=e[4];let i;return e[5]!==r||e[6]!==o?(i=(0,c.jsx)("div",{"aria-hidden":"true",className:d,"data-testid":"sql-diagnostics-overlay",ref:o,children:r}),e[5]=r,e[6]=o,e[7]=i):i=e[7],i},"zn"),zn={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},Un=l(s=>{let e=(0,G.c)(10),{diagnostics:n,onSelect:t}=s,o=ce();if(n.length===0)return null;let r;e[0]!==o?(r=o("SQL problems"),e[0]=o,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==t){let i;e[5]!==t?(i=l((u,p)=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{className:"flex w-full items-start gap-2 px-3 py-1 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-problem",onClick:l(()=>{t(u)},"onClick"),type:"button",children:[(0,c.jsx)("span",{className:me("mt-px shrink-0 rounded px-1 font-mono text-[10px] uppercase",u.severity==="error"?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600"),children:zn[u.source]}),(0,c.jsx)("span",{className:"min-w-0 text-muted-foreground",children:u.message})]})},`${u.source}-${(u.offset??p).toString()}-${p.toString()}`),"c"),e[5]=t,e[6]=i):i=e[6],a=n.map(i),e[2]=n,e[3]=t,e[4]=a}else a=e[4];let d;return e[7]!==r||e[8]!==a?(d=(0,c.jsx)("ul",{"aria-label":r,className:"max-h-24 shrink-0 overflow-y-auto border-t border-border bg-muted/30","data-testid":"sql-problems",children:a}),e[7]=r,e[8]=a,e[9]=d):d=e[9],d},"Kn"),Yn={minWidth:"2.75rem",paddingInline:"0.5rem"},Gn=l(s=>{let e=(0,G.c)(64),{assistant:n,autocomplete:t,diagnostics:o,draft:r,failed:a,handlers:d,editorRef:i,gutterRef:u,listboxId:p,onGenerated:h,onPickSuggestion:g,onRevealDiagnostic:y,overlayRef:m}=s,w=ce(),f,v,b,k,S,x,q,C;if(e[0]!==n||e[1]!==r||e[2]!==a||e[3]!==u||e[4]!==h){let j=r.split(`
|
|
8
|
+
`).length;q="flex min-h-0 min-w-0 flex-1 flex-col",e[13]!==n||e[14]!==a||e[15]!==h?(C=(0,c.jsx)(Qn,{assistant:n,failed:a,onGenerated:h}),e[13]=n,e[14]=a,e[15]=h,e[16]=C):C=e[16],x="flex min-h-0 min-w-0 flex-1",f="true",v="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",b=u,k=Yn,S=Array.from({length:j},Kn),e[0]=n,e[1]=r,e[2]=a,e[3]=u,e[4]=h,e[5]=f,e[6]=v,e[7]=b,e[8]=k,e[9]=S,e[10]=x,e[11]=q,e[12]=C}else f=e[5],v=e[6],b=e[7],k=e[8],S=e[9],x=e[10],q=e[11],C=e[12];let R;e[17]!==f||e[18]!==v||e[19]!==b||e[20]!==k||e[21]!==S?(R=(0,c.jsx)("div",{"aria-hidden":f,className:v,ref:b,style:k,children:S}),e[17]=f,e[18]=v,e[19]=b,e[20]=k,e[21]=S,e[22]=R):R=e[22];let T;e[23]!==o||e[24]!==r||e[25]!==m?(T=(0,c.jsx)(Fn,{diagnostics:o,draft:r,scrollRef:m}),e[23]=o,e[24]=r,e[25]=m,e[26]=T):T=e[26];let _;e[27]!==t||e[28]!==p?(_=t===null?void 0:`${p}-opt-${t.active.toString()}`,e[27]=t,e[28]=p,e[29]=_):_=e[29];let E=t===null?void 0:p,O=t!==null,D;e[30]!==w?(D=w("SQL query"),e[30]=w,e[31]=D):D=e[31];let L;e[32]!==r||e[33]!==i||e[34]!==d.onBlur||e[35]!==d.onChange||e[36]!==d.onKeyDown||e[37]!==d.onScroll||e[38]!==d.onSelect||e[39]!==_||e[40]!==E||e[41]!==O||e[42]!==D?(L=(0,c.jsx)("textarea",{"aria-activedescendant":_,"aria-autocomplete":"list","aria-controls":E,"aria-expanded":O,"aria-label":D,className:`relative size-full resize-none bg-transparent outline-none ${bt}`,"data-testid":"sql-input",onBlur:d.onBlur,onChange:d.onChange,onKeyDown:d.onKeyDown,onScroll:d.onScroll,onSelect:d.onSelect,placeholder:"SELECT * FROM \u2026",ref:i,role:"combobox",spellCheck:!1,value:r}),e[32]=r,e[33]=i,e[34]=d.onBlur,e[35]=d.onChange,e[36]=d.onKeyDown,e[37]=d.onScroll,e[38]=d.onSelect,e[39]=_,e[40]=E,e[41]=O,e[42]=D,e[43]=L):L=e[43];let B;e[44]!==t||e[45]!==p||e[46]!==g?(B=(0,c.jsx)(gn,{listboxId:p,onPick:g,state:t}),e[44]=t,e[45]=p,e[46]=g,e[47]=B):B=e[47];let A;e[48]!==T||e[49]!==L||e[50]!==B?(A=(0,c.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[T,L,B]}),e[48]=T,e[49]=L,e[50]=B,e[51]=A):A=e[51];let P;e[52]!==A||e[53]!==x||e[54]!==R?(P=(0,c.jsxs)("div",{className:x,children:[R,A]}),e[52]=A,e[53]=x,e[54]=R,e[55]=P):P=e[55];let M;e[56]!==o||e[57]!==y?(M=(0,c.jsx)(Un,{diagnostics:o,onSelect:y}),e[56]=o,e[57]=y,e[58]=M):M=e[58];let N;return e[59]!==P||e[60]!==M||e[61]!==q||e[62]!==C?(N=(0,c.jsxs)("div",{className:q,children:[C,P,M]}),e[59]=P,e[60]=M,e[61]=q,e[62]=C,e[63]=N):N=e[63],N},"Jn");function Kn(s,e){return(0,c.jsx)("div",{children:e+1},e)}l(Kn,"Vn");var gt=[{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;"}],Vn=l(s=>{let e=(0,G.c)(29),{active:n,onDelete:t,onSelect:o,query:r}=s,a=ce(),d;e[0]!==o||e[1]!==r.id?(d=l(()=>{o(r.id)},"i"),e[0]=o,e[1]=r.id,e[2]=d):d=e[2];let i=d,u;e[3]!==t||e[4]!==r.id?(u=l(q=>{q.stopPropagation(),t(r.id)},"a"),e[3]=t,e[4]=r.id,e[5]=u):u=e[5];let p=u,h=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",g;e[6]!==h?(g=me("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",h),e[6]=h,e[7]=g):g=e[7];let y=`sql-query-${r.id}`,m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=(0,c.jsx)("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,c.jsx)("path",{d:"M4 6h16M4 12h10M4 18h7"})}),e[8]=m):m=e[8];let w;e[9]!==r.name?(w=(0,c.jsx)("span",{className:"truncate",children:r.name}),e[9]=r.name,e[10]=w):w=e[10];let f;e[11]!==n||e[12]!==i||e[13]!==g||e[14]!==y||e[15]!==w?(f=(0,c.jsxs)("button",{"aria-pressed":n,className:g,"data-testid":y,onClick:i,type:"button",children:[m,w]}),e[11]=n,e[12]=i,e[13]=g,e[14]=y,e[15]=w,e[16]=f):f=e[16];let v;e[17]!==a?(v=a("Delete query"),e[17]=a,e[18]=v):v=e[18];let b;e[19]!==a?(b=a("Delete query"),e[19]=a,e[20]=b):b=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=(0,c.jsx)("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,c.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[21]=k):k=e[21];let S;e[22]!==p||e[23]!==b||e[24]!==v?(S=(0,c.jsx)("button",{"aria-label":v,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:p,title:b,type:"button",children:k}),e[22]=p,e[23]=b,e[24]=v,e[25]=S):S=e[25];let x;return e[26]!==S||e[27]!==f?(x=(0,c.jsxs)("li",{className:"group/q flex items-center",children:[f,S]}),e[26]=S,e[27]=f,e[28]=x):x=e[28],x},"Xn"),it="sql-history-remember",Xn=l((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"Zn"),Jn=l(s=>{let e=(0,G.c)(66),{activeId:n,history:t,listRef:o,onClearHistory:r,onDelete:a,onLoadHistory:d,onLoadTemplate:i,onNew:u,onSearchChange:p,onSelect:h,onToggleRememberHistory:g,queries:y,rememberHistory:m,search:w}=s,f=ce(),v,b,k,S,x;if(e[0]!==n||e[1]!==o||e[2]!==a||e[3]!==u||e[4]!==p||e[5]!==h||e[6]!==g||e[7]!==y||e[8]!==w||e[9]!==f){let L=Xn(y,w),B;e[15]!==g?(B=l(H=>{g(H.target.checked)},"B"),e[15]=g,e[16]=B):B=e[16],v=B,k="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar";let A;e[17]!==f?(A=f("Search queries\u2026"),e[17]=f,e[18]=A):A=e[18];let P;e[19]!==p||e[20]!==w||e[21]!==A?(P=(0,c.jsx)("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:p,placeholder:A,type:"text",value:w}),e[19]=p,e[20]=w,e[21]=A,e[22]=P):P=e[22];let M;e[23]!==f?(M=f("New query"),e[23]=f,e[24]=M):M=e[24];let N;e[25]!==f?(N=f("New query"),e[25]=f,e[26]=N):N=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j=(0,c.jsx)("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,c.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[27]=j):j=e[27];let I;e[28]!==u||e[29]!==M||e[30]!==N?(I=(0,c.jsx)("button",{"aria-label":M,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:N,type:"button",children:j}),e[28]=u,e[29]=M,e[30]=N,e[31]=I):I=e[31],e[32]!==I||e[33]!==P?(S=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[P,I]}),e[32]=I,e[33]=P,e[34]=S):S=e[34],b="flex flex-1 flex-col gap-4 overflow-y-auto p-2";let $;e[35]!==f?($=f("Private"),e[35]=f,e[36]=$):$=e[36];let F;e[37]!==$?(F=(0,c.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:$}),e[37]=$,e[38]=F):F=e[38],x=(0,c.jsxs)("div",{children:[F,L.length===0?(0,c.jsx)("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.")}):(0,c.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:o,children:L.map(H=>(0,c.jsx)(Vn,{active:n===H.id,onDelete:a,onSelect:h,query:H},H.id))})]}),e[0]=n,e[1]=o,e[2]=a,e[3]=u,e[4]=p,e[5]=h,e[6]=g,e[7]=y,e[8]=w,e[9]=f,e[10]=v,e[11]=b,e[12]=k,e[13]=S,e[14]=x}else v=e[10],b=e[11],k=e[12],S=e[13],x=e[14];let q;e[39]!==f?(q=f("Reference"),e[39]=f,e[40]=q):q=e[40];let C;e[41]!==q?(C=(0,c.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:q}),e[41]=q,e[42]=C):C=e[42];let R;e[43]!==i?(R=gt.map(L=>(0,c.jsx)("li",{children:(0,c.jsxs)("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":L.sql,onClick:i,type:"button",children:[(0,c.jsx)("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,c.jsx)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"})}),L.label]})},L.label)),e[43]=i,e[44]=R):R=e[44];let T;e[45]!==R?(T=(0,c.jsx)("ul",{className:"flex flex-col gap-px",children:R}),e[45]=R,e[46]=T):T=e[46];let _;e[47]!==C||e[48]!==T?(_=(0,c.jsxs)("div",{children:[C,T]}),e[47]=C,e[48]=T,e[49]=_):_=e[49];let E;e[50]!==t||e[51]!==r||e[52]!==d||e[53]!==v||e[54]!==m||e[55]!==f?(E=t.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,c.jsx)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")}),(0,c.jsx)("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:r,type:"button",children:f("Clear history")})]}),(0,c.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 px-1 pb-1.5 text-[11px] text-muted-foreground",htmlFor:it,children:[(0,c.jsx)("input",{checked:m,"data-testid":"sql-history-remember",id:it,onChange:v,type:"checkbox"}),f("Keep history on this browser")]}),(0,c.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(L=>(0,c.jsx)("li",{children:(0,c.jsxs)("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":L.sql,"data-testid":"sql-history-item",onClick:d,title:L.sql,type:"button",children:[(0,c.jsx)("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,c.jsx)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"})}),(0,c.jsx)("span",{className:"truncate font-mono",children:L.sql})]})},`${L.at.toString()}:${L.sql}`))})]}),e[50]=t,e[51]=r,e[52]=d,e[53]=v,e[54]=m,e[55]=f,e[56]=E):E=e[56];let O;e[57]!==b||e[58]!==E||e[59]!==x||e[60]!==_?(O=(0,c.jsxs)("div",{className:b,children:[x,_,E]}),e[57]=b,e[58]=E,e[59]=x,e[60]=_,e[61]=O):O=e[61];let D;return e[62]!==O||e[63]!==k||e[64]!==S?(D=(0,c.jsxs)("aside",{className:k,children:[S,O]}),e[62]=O,e[63]=k,e[64]=S,e[65]=D):D=e[65],D},"es"),De=l(s=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${s?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"Ie"),Zn=l(s=>{let e=(0,G.c)(96),{assistant:n,chart:t,className:o,error:r,onFormat:a,onInferChart:d,onRun:i,onSelectStatement:u,onShardKeyChange:p,onShowChart:h,onShowExplain:g,onShowResults:y,onToggleSplit:m,pane:w,result:f,running:v,script:b,shardKey:k,splitView:S}=s,x=ce(),q=w==="results",C;e[0]!==q?(C=De(q),e[0]=q,e[1]=C):C=e[1];let R;e[2]!==x?(R=x("Results"),e[2]=x,e[3]=R):R=e[3];let T;e[4]!==y||e[5]!==C||e[6]!==R?(T=(0,c.jsx)("button",{className:C,"data-testid":"sql-tab-results",onClick:y,type:"button",children:R}),e[4]=y,e[5]=C,e[6]=R,e[7]=T):T=e[7];let _=w==="chart",E;e[8]!==_?(E=De(_),e[8]=_,e[9]=E):E=e[9];let O;e[10]!==x?(O=x("Chart"),e[10]=x,e[11]=O):O=e[11];let D;e[12]!==h||e[13]!==E||e[14]!==O?(D=(0,c.jsx)("button",{className:E,"data-testid":"sql-tab-chart",onClick:h,type:"button",children:O}),e[12]=h,e[13]=E,e[14]=O,e[15]=D):D=e[15];let L;e[16]!==n||e[17]!==d||e[18]!==w||e[19]!==f||e[20]!==x?(L=!n.unavailable&&w==="chart"&&f!==null&&(0,c.jsx)("button",{className:De(!1),"data-testid":"sql-infer-chart",disabled:n.pending("chart"),onClick:d,type:"button",children:n.pending("chart")?x("Thinking\u2026"):x("Suggest chart")}),e[16]=n,e[17]=d,e[18]=w,e[19]=f,e[20]=x,e[21]=L):L=e[21];let B=w==="explain",A;e[22]!==B?(A=De(B),e[22]=B,e[23]=A):A=e[23];let P;e[24]!==x?(P=x("Explain"),e[24]=x,e[25]=P):P=e[25];let M;e[26]!==g||e[27]!==A||e[28]!==P?(M=(0,c.jsx)("button",{className:A,"data-testid":"sql-tab-explain",onClick:g,type:"button",children:P}),e[26]=g,e[27]=A,e[28]=P,e[29]=M):M=e[29];let N;e[30]!==x?(N=x("Split editor and results"),e[30]=x,e[31]=N):N=e[31];let j=`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 ${S?"bg-accent text-foreground":"text-muted-foreground"}`,I;e[32]!==x?(I=x("Split editor and results"),e[32]=x,e[33]=I):I=e[33];let $;e[34]===Symbol.for("react.memo_cache_sentinel")?($=(0,c.jsxs)("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,c.jsx)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"}),(0,c.jsx)("path",{d:"M12 4v16"})]}),e[34]=$):$=e[34];let F;e[35]!==m||e[36]!==S||e[37]!==N||e[38]!==j||e[39]!==I?(F=(0,c.jsx)("button",{"aria-label":N,"aria-pressed":S,className:j,"data-testid":"sql-split-toggle",onClick:m,title:I,type:"button",children:$}),e[35]=m,e[36]=S,e[37]=N,e[38]=j,e[39]=I,e[40]=F):F=e[40];let H;e[41]!==f?(H=f!==null&&f.columns.length>0&&(0,c.jsx)(nt,{columns:f.columns,name:"query-result",rows:f.rows}),e[41]=f,e[42]=H):H=e[42];let J;e[43]!==x?(J=x("Format"),e[43]=x,e[44]=J):J=e[44];let Z;e[45]!==a||e[46]!==v||e[47]!==J?(Z=(0,c.jsx)("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:v,onClick:a,type:"button",children:J}),e[45]=a,e[46]=v,e[47]=J,e[48]=Z):Z=e[48];let ee;e[49]!==p||e[50]!==k?(ee=(0,c.jsx)(Je,{onChange:p,testId:"sql-shard-input",value:k}),e[49]=p,e[50]=k,e[51]=ee):ee=e[51];let te;e[52]!==v||e[53]!==x?(te=x(v?"Running\u2026":"Run"),e[52]=v,e[53]=x,e[54]=te):te=e[54];let ie;e[55]===Symbol.for("react.memo_cache_sentinel")?(ie=(0,c.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[55]=ie):ie=e[55];let V;e[56]!==i||e[57]!==v||e[58]!==te?(V=(0,c.jsxs)("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:v,onClick:i,type:"button",children:[te,ie]}),e[56]=i,e[57]=v,e[58]=te,e[59]=V):V=e[59];let Q;e[60]!==F||e[61]!==H||e[62]!==Z||e[63]!==ee||e[64]!==V?(Q=(0,c.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[F,H,Z,ee,V]}),e[60]=F,e[61]=H,e[62]=Z,e[63]=ee,e[64]=V,e[65]=Q):Q=e[65];let ne;e[66]!==M||e[67]!==Q||e[68]!==T||e[69]!==D||e[70]!==L?(ne=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[T,D,L,M,Q]}),e[66]=M,e[67]=Q,e[68]=T,e[69]=D,e[70]=L,e[71]=ne):ne=e[71];let re;e[72]!==u||e[73]!==b?(re=b!==void 0&&(0,c.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-3 py-1.5","data-testid":"sql-statements",children:b.runs.map((Y,X)=>(0,c.jsx)("button",{"aria-pressed":X===b.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${X===b.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${Y.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${X.toString()}`,onClick:l(()=>{u(X)},"onClick"),title:Y.sql,type:"button",children:X+1},`${X.toString()}:${Y.sql}`))}),e[72]=u,e[73]=b,e[74]=re):re=e[74];let oe;e[75]!==r?(oe=r!==null&&(0,c.jsx)(Ze,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:r}),e[75]=r,e[76]=oe):oe=e[76];let se;e[77]!==r||e[78]!==f||e[79]!==x?(se=r===null&&f===null&&(0,c.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:x("Click Run to execute your query.")}),e[77]=r,e[78]=f,e[79]=x,e[80]=se):se=e[80];let le;e[81]!==t||e[82]!==r||e[83]!==w||e[84]!==f||e[85]!==x?(le=r===null&&f!==null&&(0,c.jsxs)("div",{"data-testid":"sql-result",children:[w==="chart"?(0,c.jsx)(rt,{axes:t,result:f}):(0,c.jsx)(ot,{result:f}),(0,c.jsx)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:f.truncated?x("Showing the first {max} of {count} rows.",{count:f.rowCount,max:f.rows.length}):x("{count} rows",{count:f.rowCount})})]}),e[81]=t,e[82]=r,e[83]=w,e[84]=f,e[85]=x,e[86]=le):le=e[86];let W;e[87]!==oe||e[88]!==se||e[89]!==le?(W=(0,c.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[oe,se,le]}),e[87]=oe,e[88]=se,e[89]=le,e[90]=W):W=e[90];let U;return e[91]!==o||e[92]!==ne||e[93]!==re||e[94]!==W?(U=(0,c.jsxs)("div",{className:o,children:[ne,re,W]}),e[91]=o,e[92]=ne,e[93]=re,e[94]=W,e[95]=U):U=e[95],U},"ts"),er=l((s,e)=>s.trim()===""?e:(s.split(`
|
|
9
|
+
`)[0]??s).slice(0,24),"ns"),tr=l(s=>{s?.focus(),s?.select()},"ss"),nr=l(s=>{let e=(0,G.c)(14),{initial:n,onCancel:t,onCommit:o,placeholder:r,testId:a}=s,d=ce(),i;e[0]!==o?(i=l(m=>{o(m.currentTarget.value.trim())},"c"),e[0]=o,e[1]=i):i=e[1];let u=i,p;e[2]!==t||e[3]!==o?(p=l(m=>{m.key==="Enter"?o(m.currentTarget.value.trim()):m.key==="Escape"&&t()},"m"),e[2]=t,e[3]=o,e[4]=p):p=e[4];let h=p,g;e[5]!==d?(g=d("Tab title"),e[5]=d,e[6]=g):g=e[6];let y;return e[7]!==n||e[8]!==u||e[9]!==h||e[10]!==r||e[11]!==g||e[12]!==a?(y=(0,c.jsx)("input",{"aria-label":g,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":a,defaultValue:n,onBlur:u,onKeyDown:h,placeholder:r,ref:tr,type:"text"}),e[7]=n,e[8]=u,e[9]=h,e[10]=r,e[11]=g,e[12]=a,e[13]=y):y=e[13],y},"os"),rr=l(s=>{let e=(0,G.c)(29),{idBase:n,onDiscard:t,onKeep:o}=s,r=ce(),a=`sql-tab-close-prompt-${n}`,d;e[0]!==r?(d=r("Discard?"),e[0]=r,e[1]=d):d=e[1];let i;e[2]!==d?(i=(0,c.jsx)("span",{className:"text-[11px] text-muted-foreground",children:d}),e[2]=d,e[3]=i):i=e[3];let u;e[4]!==r?(u=r("Discard changes"),e[4]=r,e[5]=u):u=e[5];let p=`sql-tab-close-confirm-${n}`,h;e[6]!==r?(h=r("Discard changes"),e[6]=r,e[7]=h):h=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,c.jsx)("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,c.jsx)("path",{d:"M5 13l4 4L19 7"})}),e[8]=g):g=e[8];let y;e[9]!==t||e[10]!==u||e[11]!==p||e[12]!==h?(y=(0,c.jsx)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":p,onClick:t,title:h,type:"button",children:g}),e[9]=t,e[10]=u,e[11]=p,e[12]=h,e[13]=y):y=e[13];let m;e[14]!==r?(m=r("Keep editing"),e[14]=r,e[15]=m):m=e[15];let w=`sql-tab-close-cancel-${n}`,f;e[16]!==r?(f=r("Keep editing"),e[16]=r,e[17]=f):f=e[17];let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v=(0,c.jsx)("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,c.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})}),e[18]=v):v=e[18];let b;e[19]!==o||e[20]!==w||e[21]!==f||e[22]!==m?(b=(0,c.jsx)("button",{"aria-label":m,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":w,onClick:o,title:f,type:"button",children:v}),e[19]=o,e[20]=w,e[21]=f,e[22]=m,e[23]=b):b=e[23];let k;return e[24]!==a||e[25]!==b||e[26]!==i||e[27]!==y?(k=(0,c.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":a,role:"group",children:[i,y,b]}),e[24]=a,e[25]=b,e[26]=i,e[27]=y,e[28]=k):k=e[28],k},"ls"),or=l(s=>{let e=(0,G.c)(47),{active:n,canClose:t,onClose:o,onMenu:r,onRename:a,onSelect:d,tab:i}=s,u=ce(),[p,h]=(0,z.useState)(!1),[g,y]=(0,z.useState)(!1),m;e[0]!==r||e[1]!==i.id?(m=l(H=>{r(i.id,H)},"d"),e[0]=r,e[1]=i.id,e[2]=m):m=e[2];let w=m,f;e[3]!==d||e[4]!==i.id?(f=l(()=>{d(i.id)},"u"),e[3]=d,e[4]=i.id,e[5]=f):f=e[5];let v=f,b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=l(()=>{h(!0)},"h"),e[6]=b):b=e[6];let k=b,S;e[7]!==o||e[8]!==i?(S=l(H=>{H.stopPropagation(),pt(i)?y(!0):o(i.id)},"v"),e[7]=o,e[8]=i,e[9]=S):S=e[9];let x=S,q;e[10]!==o||e[11]!==i.id?(q=l(H=>{H.stopPropagation(),y(!1),o(i.id)},"k"),e[10]=o,e[11]=i.id,e[12]=q):q=e[12];let C=q,R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=l(H=>{H.stopPropagation(),y(!1)},"L"),e[13]=R):R=e[13];let T=R,_;e[14]!==a||e[15]!==i.id?(_=l(H=>{a(i.id,H),h(!1)},"q"),e[14]=a,e[15]=i.id,e[16]=_):_=e[16];let E=_,O;e[17]===Symbol.for("react.memo_cache_sentinel")?(O=l(()=>{h(!1)},"A"),e[17]=O):O=e[17];let D=O,L;e[18]!==i.name?(L=i.name.trim(),e[18]=i.name,e[19]=L):L=e[19];let B=L,A;e[20]!==u||e[21]!==i.sql?(A=er(i.sql,u("Untitled")),e[20]=u,e[21]=i.sql,e[22]=A):A=e[22];let P=A,M=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",N;e[23]!==M?(N=me("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",M),e[23]=M,e[24]=N):N=e[24];let j=`sql-tab-${i.id}`,I;e[25]!==n||e[26]!==E||e[27]!==B||e[28]!==P||e[29]!==p||e[30]!==v||e[31]!==u||e[32]!==i.id?(I=p?(0,c.jsx)(nr,{initial:B,onCancel:D,onCommit:E,placeholder:P,testId:`sql-tab-rename-${i.id}`}):(0,c.jsx)("button",{"aria-pressed":n,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${i.id}`,onClick:v,onDoubleClick:k,title:u("Double-click to rename"),type:"button",children:B===""?P:B}),e[25]=n,e[26]=E,e[27]=B,e[28]=P,e[29]=p,e[30]=v,e[31]=u,e[32]=i.id,e[33]=I):I=e[33];let $;e[34]!==t||e[35]!==C||e[36]!==g||e[37]!==x||e[38]!==u||e[39]!==i.id?($=t&&(g?(0,c.jsx)(rr,{idBase:i.id,onDiscard:C,onKeep:T}):(0,c.jsx)("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-${i.id}`,onClick:x,title:u("Close tab"),type:"button",children:(0,c.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,c.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})),e[34]=t,e[35]=C,e[36]=g,e[37]=x,e[38]=u,e[39]=i.id,e[40]=$):$=e[40];let F;return e[41]!==w||e[42]!==N||e[43]!==j||e[44]!==I||e[45]!==$?(F=(0,c.jsxs)("div",{className:N,"data-testid":j,onContextMenu:w,children:[I,$]}),e[41]=w,e[42]=N,e[43]=j,e[44]=I,e[45]=$,e[46]=F):F=e[46],F},"rs"),sr=l(s=>{let e=(0,G.c)(43),{model:n,onSelect:t}=s,o=ce(),{activeTab:r,addEditorTab:a,cancelBulk:d,closeEditorTab:i,closeTabMenu:u,confirmBulk:p,menuStyle:h,onBackdropContextMenu:g,onCloseAll:y,onCloseOthers:m,onCloseToRight:w,openTabMenu:f,pendingBulk:v,renameTab:b,tabMenu:k,tabs:S}=n,x;if(e[0]!==r||e[1]!==i||e[2]!==t||e[3]!==f||e[4]!==b||e[5]!==S){let L;e[7]!==r||e[8]!==i||e[9]!==t||e[10]!==f||e[11]!==b||e[12]!==S.length?(L=l(B=>(0,c.jsx)(or,{active:B.id===r.id,canClose:S.length>1,onClose:i,onMenu:f,onRename:b,onSelect:t,tab:B},B.id),"I"),e[7]=r,e[8]=i,e[9]=t,e[10]=f,e[11]=b,e[12]=S.length,e[13]=L):L=e[13],x=S.map(L),e[0]=r,e[1]=i,e[2]=t,e[3]=f,e[4]=b,e[5]=S,e[6]=x}else x=e[6];let q;e[14]!==o?(q=o("New tab"),e[14]=o,e[15]=q):q=e[15];let C=S.length>=Ue,R;e[16]!==o?(R=o("New tab"),e[16]=o,e[17]=R):R=e[17];let T;e[18]===Symbol.for("react.memo_cache_sentinel")?(T=(0,c.jsx)("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,c.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[18]=T):T=e[18];let _;e[19]!==a||e[20]!==q||e[21]!==C||e[22]!==R?(_=(0,c.jsx)("button",{"aria-label":q,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:C,onClick:a,title:R,type:"button",children:T}),e[19]=a,e[20]=q,e[21]=C,e[22]=R,e[23]=_):_=e[23];let E;e[24]!==x||e[25]!==_?(E=(0,c.jsxs)("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:[x,_]}),e[24]=x,e[25]=_,e[26]=E):E=e[26];let O;e[27]!==d||e[28]!==u||e[29]!==p||e[30]!==h||e[31]!==g||e[32]!==y||e[33]!==m||e[34]!==w||e[35]!==v||e[36]!==o||e[37]!==k||e[38]!==S?(O=k!==null&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:u,onContextMenu:g,role:"presentation"}),(0,c.jsx)("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:h,children:v===null?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("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:S.length<=1,onClick:m,role:"menuitem",type:"button",children:o("Close other tabs")}),(0,c.jsx)("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:S.findIndex(L=>L.id===k.id)>=S.length-1,onClick:w,role:"menuitem",type:"button",children:o("Close tabs to the right")}),(0,c.jsx)("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:y,role:"menuitem",type:"button",children:o("Close all tabs")})]}):(0,c.jsxs)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,c.jsx)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")}),(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)("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:p,type:"button",children:o("Discard")}),(0,c.jsx)("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:d,type:"button",children:o("Cancel")})]})]})})]}),e[27]=d,e[28]=u,e[29]=p,e[30]=h,e[31]=g,e[32]=y,e[33]=m,e[34]=w,e[35]=v,e[36]=o,e[37]=k,e[38]=S,e[39]=O):O=e[39];let D;return e[40]!==E||e[41]!==O?(D=(0,c.jsxs)(c.Fragment,{children:[E,O]}),e[40]=E,e[41]=O,e[42]=D):D=e[42],D},"is"),lr=we(Ne.runSql),ar="lunora-studio-sql-split-view",ir=l(()=>Ce(gt[0]?.sql??""),"ds"),kr=l(s=>{let e=(0,G.c)(112),{initialShardKey:n}=s,t=Ee(),o=Dn(ir),{activeTab:r,output:a,patchActiveOutput:d,patchActiveTab:i,setActiveTabId:u,unlinkQuery:p}=o,h;e[0]!==d||e[1]!==i?(h=l((K,ae)=>{i({activeId:ae,sql:K}),d({chart:void 0,error:null,failed:void 0,result:null,script:void 0})},"g"),e[0]=d,e[1]=i,e[2]=h):h=e[2];let g=h,y;e[3]!==g||e[4]!==p?(y={loadIntoActiveTab:g,unlinkQuery:p},e[3]=g,e[4]=p,e[5]=y):y=e[5];let m=Wn(y),{recordHistory:w,updateQuerySql:f}=m,v=r.sql,{activeId:b}=r,{chart:k,error:S,failed:x,result:q,running:C}=a,R=a.pane,[T,_]=(0,z.useState)(n??""),[E,O]=_e(ar,!1),{probe:D,schema:L}=yn(T),B;e[6]!==b||e[7]!==i||e[8]!==f?(B=l(K=>{i({sql:K}),b!==null&&f(b,K)},"B"),e[6]=b,e[7]=i,e[8]=f,e[9]=B):B=e[9];let A=B,P=rn(v,L,T),M=tt(T),N;e[10]!==M||e[11]!==d||e[12]!==q?(N=l(()=>{q!==null&&ue((async()=>{let K=await M.inferChart({columns:q.columns,rowCount:q.rowCount,types:Object.fromEntries(q.columns.map(ae=>[ae,typeof(q.rows[0]?.[ae]??"")]))});d({chart:K})})())},"w"),e[10]=M,e[11]=d,e[12]=q,e[13]=N):N=e[13];let j=N,I;e[14]!==t||e[15]!==w||e[16]!==T?(I=l(async K=>{try{let ae=await t.query(lr,{sql:K},ke(T));return w(K),{error:null,result:ae,sql:K}}catch(ae){return{error:Ke(ae),result:null,sql:K}}},"R"),e[14]=t,e[15]=w,e[16]=T,e[17]=I):I=e[17];let $=I,F;e[18]!==v||e[19]!==d||e[20]!==$||e[21]!==T?(F=l(async K=>{if(v.trim()==="")return;d({running:!0});let ae=K==="explain"?Fe(`EXPLAIN QUERY PLAN ${v}`,0):dt(v),de=[];for(let Re of ae){let xt={error:Re.rejection?.message??"",result:null,sql:Re.sql};de.push(Re.rejection===void 0?await $(Re.sql):xt)}Xe(T);let Ye=Math.max(de.length-1,0),ye=de[Ye];d({chart:void 0,error:ye?.error??null,failed:ye?.error===null||ye===void 0?void 0:{error:ye.error,sql:ye.sql},pane:K,result:ye?.result??null,running:!1,script:de.length>1?{runs:de,selected:Ye}:void 0})},"U"),e[18]=v,e[19]=d,e[20]=$,e[21]=T,e[22]=F):F=e[22];let H=F,J;e[23]!==a.script?.runs||e[24]!==d?(J=l(K=>{let ae=a.script?.runs,de=ae?.[K];ae===void 0||de===void 0||d({chart:void 0,error:de.error,failed:de.error===null?void 0:{error:de.error,sql:de.sql},result:de.result,script:{runs:ae,selected:K}})},"X"),e[23]=a.script?.runs,e[24]=d,e[25]=J):J=e[25];let Z=J,ee;e[26]!==H?(ee=l(()=>{ue(H("results"))},"ee"),e[26]=H,e[27]=ee):ee=e[27];let te=ee,ie;e[28]!==a.pane||e[29]!==H?(ie=l(()=>{ue(H(a.pane))},"ie"),e[28]=a.pane,e[29]=H,e[30]=ie):ie=e[30];let V;e[31]!==D||e[32]!==L||e[33]!==A||e[34]!==ie?(V={onSubmit:ie,probe:D,schema:L,setDraft:A},e[31]=D,e[32]=L,e[33]=A,e[34]=ie,e[35]=V):V=e[35];let Q=kn(V),{closeAutocomplete:ne}=Q,re;e[36]!==v||e[37]!==A?(re=l(()=>{A(Tt(v))},"se"),e[36]=v,e[37]=A,e[38]=re):re=e[38];let oe=re,se;e[39]!==ne||e[40]!==u?(se=l(K=>{ne(),u(K)},"le"),e[39]=ne,e[40]=u,e[41]=se):se=e[41];let le=se,W;e[42]!==d?(W=l(()=>{d({pane:"results"})},"H"),e[42]=d,e[43]=W):W=e[43];let U=W,Y;e[44]!==H?(Y=l(()=>{ue(H("explain"))},"z"),e[44]=H,e[45]=Y):Y=e[45];let X=Y,fe;e[46]!==d?(fe=l(()=>{d({pane:"chart"})},"me"),e[46]=d,e[47]=fe):fe=e[47];let Ae=fe,Te;e[48]!==O||e[49]!==E?(Te=l(()=>{O(!E)},"ke"),e[48]=O,e[49]=E,e[50]=Te):Te=e[50];let $e=Te,Be=E?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",He=E?"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",he;e[51]!==b||e[52]!==m.clearHistory||e[53]!==m.deleteQuery||e[54]!==m.history||e[55]!==m.listRef||e[56]!==m.loadFromHistory||e[57]!==m.loadTemplate||e[58]!==m.newQuery||e[59]!==m.onSearchChange||e[60]!==m.queries||e[61]!==m.rememberHistory||e[62]!==m.search||e[63]!==m.selectQuery||e[64]!==m.setRememberHistory?(he=(0,c.jsx)(Jn,{activeId:b,history:m.history,listRef:m.listRef,onClearHistory:m.clearHistory,onDelete:m.deleteQuery,onLoadHistory:m.loadFromHistory,onLoadTemplate:m.loadTemplate,onNew:m.newQuery,onSearchChange:m.onSearchChange,onSelect:m.selectQuery,onToggleRememberHistory:m.setRememberHistory,queries:m.queries,rememberHistory:m.rememberHistory,search:m.search}),e[51]=b,e[52]=m.clearHistory,e[53]=m.deleteQuery,e[54]=m.history,e[55]=m.listRef,e[56]=m.loadFromHistory,e[57]=m.loadTemplate,e[58]=m.newQuery,e[59]=m.onSearchChange,e[60]=m.queries,e[61]=m.rememberHistory,e[62]=m.search,e[63]=m.selectQuery,e[64]=m.setRememberHistory,e[65]=he):he=e[65];let pe;e[66]!==o||e[67]!==le?(pe=(0,c.jsx)(sr,{model:o,onSelect:le}),e[66]=o,e[67]=le,e[68]=pe):pe=e[68];let be;e[69]!==M||e[70]!==P||e[71]!==v||e[72]!==x||e[73]!==A||e[74]!==Q.autocompleteState||e[75]!==Q.editorRef||e[76]!==Q.gutterRef||e[77]!==Q.handlers||e[78]!==Q.listboxId||e[79]!==Q.onPickSuggestion||e[80]!==Q.overlayRef||e[81]!==Q.revealDiagnostic?(be=(0,c.jsx)(Gn,{assistant:M,autocomplete:Q.autocompleteState,diagnostics:P,draft:v,editorRef:Q.editorRef,failed:x,gutterRef:Q.gutterRef,handlers:Q.handlers,listboxId:Q.listboxId,onGenerated:A,onPickSuggestion:Q.onPickSuggestion,onRevealDiagnostic:Q.revealDiagnostic,overlayRef:Q.overlayRef}),e[69]=M,e[70]=P,e[71]=v,e[72]=x,e[73]=A,e[74]=Q.autocompleteState,e[75]=Q.editorRef,e[76]=Q.gutterRef,e[77]=Q.handlers,e[78]=Q.listboxId,e[79]=Q.onPickSuggestion,e[80]=Q.overlayRef,e[81]=Q.revealDiagnostic,e[82]=be):be=e[82];let ge;e[83]!==M||e[84]!==S||e[85]!==oe||e[86]!==j||e[87]!==k||e[88]!==te||e[89]!==Z||e[90]!==a.script||e[91]!==q||e[92]!==He||e[93]!==C||e[94]!==T||e[95]!==Ae||e[96]!==X||e[97]!==U||e[98]!==E||e[99]!==R||e[100]!==$e?(ge=(0,c.jsx)(Zn,{assistant:M,chart:k,className:He,error:S,onFormat:oe,onInferChart:j,onRun:te,onSelectStatement:Z,onShardKeyChange:_,onShowChart:Ae,onShowExplain:X,onShowResults:U,onToggleSplit:$e,pane:R,result:q,running:C,script:a.script,shardKey:T,splitView:E}),e[83]=M,e[84]=S,e[85]=oe,e[86]=j,e[87]=k,e[88]=te,e[89]=Z,e[90]=a.script,e[91]=q,e[92]=He,e[93]=C,e[94]=T,e[95]=Ae,e[96]=X,e[97]=U,e[98]=E,e[99]=R,e[100]=$e,e[101]=ge):ge=e[101];let xe;e[102]!==be||e[103]!==ge||e[104]!==Be?(xe=(0,c.jsxs)("div",{className:Be,children:[be,ge]}),e[102]=be,e[103]=ge,e[104]=Be,e[105]=xe):xe=e[105];let ve;e[106]!==pe||e[107]!==xe?(ve=(0,c.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[pe,xe]}),e[106]=pe,e[107]=xe,e[108]=ve):ve=e[108];let Ie;return e[109]!==he||e[110]!==ve?(Ie=(0,c.jsxs)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[he,ve]}),e[109]=he,e[110]=ve,e[111]=Ie):Ie=e[111],Ie},"Rs");export{kr as SqlEditorPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as we}from"./chunk-5XMZP64Z.js";import{a as Ne}from"./chunk-CAOUXOL7.js";import{b as ve,c as ye}from"./chunk-INBA3473.js";import{a as ge}from"./chunk-NIX2QSSN.js";import{a as xe}from"./chunk-E6P2ERQV.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as fe}from"./chunk-CKTKI4IY.js";import{a as he}from"./chunk-HLEXBOCL.js";import{b as pe}from"./chunk-P52BY657.js";import"./chunk-VNTEQQPP.js";import{P as me}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as oe}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as be}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as ce}from"./chunk-VDW32UET.js";import{c as ie}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ue}from"./chunk-UANVABQG.js";import{d as U,s as de}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as m,d as le,e as $e,f as Ce,g as Le,i as te}from"./chunk-R5ZTCHCE.js";var B=le(Ce(),1),O=le($e(),1);var s=le(Le(),1);var Te=.5,Me=4,Ie=m(n=>Math.min(100,Math.max(0,n)),"ce"),Pe=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Ie(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Te,Math.min(Ie(a),100-t));return{leftPercent:t,widthPercent:l}},"Le"),Ke=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ce"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),De=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Me},(e,t)=>{let a=(t+1)/Me;return{label:G(n*a),percent:a*100}}),"Ee"),Se=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,B.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),Fe=m(n=>{let e=(0,B.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(je)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Pe");function je(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:Se(t)},e)}m(je,"Fe");function Ee(n){let[e,t]=n;return`${e}=${Se(t)}`}m(Ee,"Ke");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ee).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,ke="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=m(n=>{let e=(0,B.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=De(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(ke,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(ze)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"Re"),We=m(n=>{let e=(0,B.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,O.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Pe(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=Ne(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Je)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(ke,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let R=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==R?(L=te("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(Fe,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),qe=m(n=>{let e=(0,B.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(We,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function ze(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(ze,"je");function Je(n){return!n}m(Je,"We");var Ue=m(n=>Array.isArray(n?.traces)?n.traces:[],"Ue"),Ge=m(n=>{let e=(0,B.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Qe),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"qe"),He=m(n=>{let e=(0,B.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(qe,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(Ge,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"ze"),ft=m(n=>{let e=(0,B.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,O.useState)(ve),{queryShardKey:r,setShardKey:o,shardKey:d}=fe(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,O.useState)(l?.traceId??""),[c,v]=(0,O.useState)(!1),[$,_]=(0,O.useState)(Ae),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,O.useEffect)(Ve,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&pe(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,O.useEffect)(f,N);let R;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ue(p),E=p?.total??L.length,W=E>L.length,D=Ke(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Xe),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_(_e=>{let ne=new Set(_e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(he,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let A;e[34]!==i||e[35]!==H||e[36]!==Q?(A=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=A):A=e[37];let V;e[38]!==c?(V=(0,s.jsx)(ge,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=V):V=e[39];let X;e[40]!==a?(X=a("Errors only"),e[40]=a,e[41]=X):X=e[41];let Y;e[42]!==V||e[43]!==X?(Y=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[V,X]}),e[42]=V,e[43]=X,e[44]=Y):Y=e[44];let Z;e[45]!==S?(Z=(0,s.jsx)(xe,{message:S,prefix:"tr"}),e[45]=S,e[46]=Z):Z=e[46];let re;e[47]!==K||e[48]!==A||e[49]!==Y||e[50]!==Z?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,A,Y,Z]}),e[47]=K,e[48]=A,e[49]=Y,e[50]=Z,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(be,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(He,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=R}else R=e[24];return R},"gt");function Qe(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(we,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Qe,"Ge");function Ae(){return new Set}m(Ae,"He");function Ve(){ye()}m(Ve,"Je");function Xe(n){return n.traceId}m(Xe,"Qe");export{ft as default};
|
|
1
|
+
import{b as we}from"./chunk-5XMZP64Z.js";import{a as Ne}from"./chunk-CAOUXOL7.js";import{b as ve,c as ye}from"./chunk-2SFSTQS4.js";import{a as ge}from"./chunk-NIX2QSSN.js";import{a as xe}from"./chunk-E6P2ERQV.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as fe}from"./chunk-CKTKI4IY.js";import{a as he}from"./chunk-6UN4V2HB.js";import{b as pe}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as me}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as oe}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as be}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as ce}from"./chunk-VDW32UET.js";import{c as ie}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ue}from"./chunk-UANVABQG.js";import{d as U,s as de}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as m,d as le,e as $e,f as Ce,g as Le,i as te}from"./chunk-R5ZTCHCE.js";var B=le(Ce(),1),O=le($e(),1);var s=le(Le(),1);var Te=.5,Me=4,Ie=m(n=>Math.min(100,Math.max(0,n)),"ce"),Pe=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Ie(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Te,Math.min(Ie(a),100-t));return{leftPercent:t,widthPercent:l}},"Le"),Ke=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ce"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),De=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Me},(e,t)=>{let a=(t+1)/Me;return{label:G(n*a),percent:a*100}}),"Ee"),Se=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,B.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),Fe=m(n=>{let e=(0,B.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(je)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Pe");function je(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:Se(t)},e)}m(je,"Fe");function Ee(n){let[e,t]=n;return`${e}=${Se(t)}`}m(Ee,"Ke");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ee).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,ke="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=m(n=>{let e=(0,B.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=De(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(ke,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(ze)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"Re"),We=m(n=>{let e=(0,B.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,O.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Pe(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=Ne(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Je)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(ke,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let R=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==R?(L=te("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(Fe,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),qe=m(n=>{let e=(0,B.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(Re,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(We,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function ze(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(ze,"je");function Je(n){return!n}m(Je,"We");var Ue=m(n=>Array.isArray(n?.traces)?n.traces:[],"Ue"),Ge=m(n=>{let e=(0,B.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Qe),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"qe"),He=m(n=>{let e=(0,B.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(qe,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(Ge,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"ze"),ft=m(n=>{let e=(0,B.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,O.useState)(ve),{queryShardKey:r,setShardKey:o,shardKey:d}=fe(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,O.useState)(l?.traceId??""),[c,v]=(0,O.useState)(!1),[$,_]=(0,O.useState)(Ae),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,O.useEffect)(Ve,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&pe(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,O.useEffect)(f,N);let R;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ue(p),E=p?.total??L.length,W=E>L.length,D=Ke(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Xe),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_(_e=>{let ne=new Set(_e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(he,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let A;e[34]!==i||e[35]!==H||e[36]!==Q?(A=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=A):A=e[37];let V;e[38]!==c?(V=(0,s.jsx)(ge,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=V):V=e[39];let X;e[40]!==a?(X=a("Errors only"),e[40]=a,e[41]=X):X=e[41];let Y;e[42]!==V||e[43]!==X?(Y=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[V,X]}),e[42]=V,e[43]=X,e[44]=Y):Y=e[44];let Z;e[45]!==S?(Z=(0,s.jsx)(xe,{message:S,prefix:"tr"}),e[45]=S,e[46]=Z):Z=e[46];let re;e[47]!==K||e[48]!==A||e[49]!==Y||e[50]!==Z?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,A,Y,Z]}),e[47]=K,e[48]=A,e[49]=Y,e[50]=Z,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(be,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(He,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=R}else R=e[24];return R},"gt");function Qe(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(we,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Qe,"Ge");function Ae(){return new Set}m(Ae,"He");function Ve(){ye()}m(Ve,"Je");function Xe(n){return n.traceId}m(Xe,"Qe");export{ft as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as we}from"./chunk-METRMDIQ.js";import{a as ye}from"./chunk-2EJQ7SPV.js";import{a as Ne}from"./chunk-6UN4V2HB.js";import{b as pe}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as he}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as H}from"./chunk-VDW32UET.js";import{d as ge}from"./chunk-2UWKGSEA.js";import{f as xe}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ne,e as ie}from"./chunk-IYWVSMAY.js";import{d as be,f as ce,g as de,h as ee,o as me}from"./chunk-BKM6PMSO.js";import{c as se}from"./chunk-VYW2PAWC.js";import{a as s,d as ae,e as ve,f as je,g as Ce}from"./chunk-R5ZTCHCE.js";var Se=ae(je(),1);var g=ae(ve(),1);var r=ae(Ce(),1);var Ee=ce(H.exportShard),Te=ce(H.importShard),Oe=s(x=>x.map(e=>JSON.stringify(e)).join(`
|
|
2
|
+
`),"je"),Ae=s(x=>{let e=[],te=x.split(`
|
|
3
|
+
`);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=JSON.parse(t);if(typeof o!="object"||o===null)throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"ve"),Ue=s(x=>{let e=(0,Se.c)(94),{initialShardKey:te}=x,n=xe(),N=ge(),t=be(),[o,b]=(0,g.useState)(te??""),[l,ue]=(0,g.useState)(""),[d,M]=(0,g.useState)(!1),[Q,U]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[y,fe]=(0,g.useState)(null),V;e[0]!==n||e[1]!==o?(V=s(async()=>{M(!0),U(null),re(null);try{let c=await n.query(Ee,{},de(o));pe(o),ue(Oe(c.rows)),fe(c.rows.length)}catch(c){U(ee(c))}M(!1)},"Q"),e[0]=n,e[1]=o,e[2]=V):V=e[2];let z=V,W;e[3]!==n||e[4]!==N||e[5]!==l||e[6]!==o||e[7]!==t?(W=s(async()=>{M(!0),U(null),re(null),fe(null);let c;try{c=Ae(l)}catch(a){U(t("Invalid NDJSON: {message}",{message:ee(a)})),M(!1);return}try{let a=await n.query(Te,{rows:c},de(o));pe(o),re(a),N(H.readTablePage),N(H.listTables)}catch(a){U(ee(a))}M(!1)},"V"),e[3]=n,e[4]=N,e[5]=l,e[6]=o,e[7]=t,e[8]=W):W=e[8];let G=W,w,S,I,m,v,p,u,j,C,f,E;if(e[9]!==d||e[10]!==y||e[11]!==z||e[12]!==i||e[13]!==G||e[14]!==l||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(Le,0),a;e[28]!==z?(a=s(()=>{me(z())},"o"),e[28]=z,e[29]=a):a=e[29];let oe=a,Y;e[30]!==G?(Y=s(()=>{me(G())},"Y"),e[30]=G,e[31]=Y):Y=e[31];let le=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=s(h=>{ue(h.target.value)},"Z"),e[32]=Z):Z=e[32];let Ie=Z;E="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(Ne,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(he,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==y||e[49]!==t?(q=y!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:y})}),e[48]=y,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="gap-0 py-0 rounded-xl border border-border bg-card shadow-xs";let F;e[57]!==t?(F=t("Import"),e[57]=t,e[58]=F):F=e[58],e[59]!==F?(f=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:F})}),e[59]=F,e[60]=f):f=e[60],w=ie,v="flex flex-col gap-3 p-4",e[61]!==l?(p=(0,r.jsx)(we,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:Ie,placeholder:'{"table":"messages","doc":{\u2026}}',value:l}),e[61]=l,e[62]=p):p=e[62];let P;e[63]!==t?(P=t("Import (writes rows)?"),e[63]=t,e[64]=P):P=e[64];let R;e[65]!==d||e[66]!==l?(R=d||l.trim()==="",e[65]=d,e[66]=l,e[67]=R):R=e[67];let K;e[68]!==t?(K=t("Import"),e[68]=t,e[69]=K):K=e[69],e[70]!==le||e[71]!==P||e[72]!==R||e[73]!==K?(u=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(ye,{confirmLabel:P,disabled:R,onConfirm:le,testId:"ei-import",children:K})}),e[70]=le,e[71]=P,e[72]=R,e[73]=K,e[74]=u):u=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=y,e[11]=z,e[12]=i,e[13]=G,e[14]=l,e[15]=o,e[16]=t,e[17]=w,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=u,e[24]=j,e[25]=C,e[26]=f,e[27]=E}else w=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],u=e[23],j=e[24],C=e[25],f=e[26],E=e[27];let T;e[75]!==w||e[76]!==v||e[77]!==p||e[78]!==u||e[79]!==j?(T=(0,r.jsxs)(w,{className:v,children:[p,u,j]}),e[75]=w,e[76]=v,e[77]=p,e[78]=u,e[79]=j,e[80]=T):T=e[80];let O;e[81]!==S||e[82]!==T||e[83]!==C||e[84]!==f?(O=(0,r.jsxs)(S,{className:C,children:[f,T]}),e[81]=S,e[82]=T,e[83]=C,e[84]=f,e[85]=O):O=e[85];let A;e[86]!==Q?(A=Q!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:Q}),e[86]=Q,e[87]=A):A=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==O||e[91]!==A||e[92]!==E?(X=(0,r.jsxs)("div",{className:E,"data-testid":I,children:[m,O,A]}),e[88]=I,e[89]=m,e[90]=O,e[91]=A,e[92]=E,e[93]=X):X=e[93],X},"Fe");function Le(x,e){return x+e}s(Le,"Ce");export{Ue as ExportImportPanel};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as D,b as V,c as J,d as q,e as B,f as E,g as _,h as K}from"./chunk-O2VDNK4B.js";import{a as z}from"./chunk-5JLIP2HH.js";import{a as W}from"./chunk-2EJQ7SPV.js";import{d as $,m as F,n as G,o as H,q as Q,r as A}from"./chunk-BKM6PMSO.js";import{a as m,d as I,e as Y,f as Z,g as ee}from"./chunk-R5ZTCHCE.js";var R=I(Z(),1),L=I(Y(),1);var r=I(ee(),1);var O="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",te=/["\n,]/u,le=/^[=+\-@\t\r]/u,P=m(n=>{if(n==null)return"";let e;return typeof n=="string"?e=le.test(n)?` ${n}`:n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?e=String(n):e=JSON.stringify(n),te.test(e)?`"${e.replaceAll('"','""')}"`:e},"V"),ne=m((n,e)=>{let l=n.map(t=>P(t)).join(","),a=e.map(t=>n.map(o=>P(t[o])).join(","));return[l,...a].join(`
|
|
2
|
+
`)},"ee"),oe=m(n=>JSON.stringify(n,G,2),"te"),X=500,ae=m(n=>n==null?"NULL":typeof n=="number"?Number.isFinite(n)?String(n):"NULL":typeof n=="bigint"?String(n):typeof n=="boolean"?n?"1":"0":`'${(typeof n=="string"?n:JSON.stringify(n)).replaceAll("'","''")}'`,"le"),se=m((n,e,l)=>{if(e.length===0||l.length===0)return"";let a=e.map(o=>A(o)).join(", "),t=[];for(let o=0;o<l.length;o+=X){let i=l.slice(o,o+X).map(s=>` (${e.map(d=>ae(s[d])).join(", ")})`).join(`,
|
|
3
|
+
`);t.push(`INSERT INTO ${A(n)} (${a}) VALUES
|
|
4
|
+
${i};`)}return t.join(`
|
|
5
|
+
|
|
6
|
+
`)},"ne"),M=m((n,e,l)=>{if(!("document"in globalThis))return;let a=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:l})),t=globalThis.document.createElement("a");t.href=a,t.download=n,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(a)},"D"),re=m(n=>{let e=(0,R.c)(36),{columns:l,name:a,rows:t}=n,o=$(),i;e[0]!==l||e[1]!==a||e[2]!==t?(i=m(()=>{M(`${a}.csv`,ne(l,t),"text/csv;charset=utf-8")},"r"),e[0]=l,e[1]=a,e[2]=t,e[3]=i):i=e[3];let s=i,d;e[4]!==a||e[5]!==t?(d=m(()=>{M(`${a}.json`,oe(t),"application/json")},"a"),e[4]=a,e[5]=t,e[6]=d):d=e[6];let p=d,u;e[7]!==l||e[8]!==a||e[9]!==t?(u=m(()=>{M(`${a}.sql`,se(a,l,t),"application/sql;charset=utf-8")},"f"),e[7]=l,e[8]=a,e[9]=t,e[10]=u):u=e[10];let c=u,C=t.length===0,b;e[11]!==C?(b=(0,r.jsx)(V,{className:O,"data-testid":"grid-export",disabled:C,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=C,e[12]=b):b=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=(0,r.jsx)(B,{children:"Export loaded rows"}),e[13]=h):h=e[13];let g;e[14]!==o?(g=o("CSV"),e[14]=o,e[15]=g):g=e[15];let x;e[16]!==s||e[17]!==g?(x=(0,r.jsx)(E,{"data-testid":"grid-export-csv",onClick:s,children:g}),e[16]=s,e[17]=g,e[18]=x):x=e[18];let w;e[19]!==o?(w=o("JSON"),e[19]=o,e[20]=w):w=e[20];let k;e[21]!==p||e[22]!==w?(k=(0,r.jsx)(E,{"data-testid":"grid-export-json",onClick:p,children:w}),e[21]=p,e[22]=w,e[23]=k):k=e[23];let N;e[24]!==o?(N=o("SQL"),e[24]=o,e[25]=N):N=e[25];let f;e[26]!==c||e[27]!==N?(f=(0,r.jsx)(E,{"data-testid":"grid-export-sql",onClick:c,children:N}),e[26]=c,e[27]=N,e[28]=f):f=e[28];let y;e[29]!==k||e[30]!==f||e[31]!==x?(y=(0,r.jsxs)(J,{align:"end",children:[h,x,k,f]}),e[29]=k,e[30]=f,e[31]=x,e[32]=y):y=e[32];let v;return e[33]!==y||e[34]!==b?(v=(0,r.jsxs)(D,{children:[b,y]}),e[33]=y,e[34]=b,e[35]=v):v=e[35],v},"oe"),ie=m(n=>{let e=(0,R.c)(9),{column:l}=n,a;e[0]!==l?(a=m(()=>{l.toggleVisibility()},"s"),e[0]=l,e[1]=a):a=e[1];let t=a,o;e[2]!==l?(o=l.getIsVisible(),e[2]=l,e[3]=o):o=e[3];let i=`grid-column-${l.id}`,s;return e[4]!==l.id||e[5]!==t||e[6]!==o||e[7]!==i?(s=(0,r.jsx)(_,{checked:o,closeOnClick:!1,"data-testid":i,onCheckedChange:t,children:l.id}),e[4]=l.id,e[5]=t,e[6]=o,e[7]=i,e[8]=s):s=e[8],s},"se"),ce=[],de=m(({backRelations:n=ce,enabledBackRelations:e,onToggleBackRelation:l,table:a})=>{let t=$(),o=a.getIsAllColumnsVisible(),i=m(()=>{a.toggleAllColumnsVisible(!o)},"r");return(0,r.jsxs)(D,{children:[(0,r.jsx)(V,{className:O,"data-testid":"grid-columns",children:t("Columns")}),(0,r.jsxs)(J,{align:"end",className:"max-h-80 overflow-y-auto",children:[(0,r.jsxs)(q,{children:[(0,r.jsx)(B,{children:t("Columns")}),(0,r.jsx)(_,{checked:o,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:t(o?"Hide all":"Show all")}),(0,r.jsx)(K,{}),a.getAllLeafColumns().filter(s=>!s.id.startsWith("__back__:")).map(s=>(0,r.jsx)(ie,{column:s},s.id))]}),n.length>0&&l!==void 0&&(0,r.jsxs)(q,{children:[(0,r.jsx)(K,{}),(0,r.jsx)(B,{children:t("Related")}),n.map(s=>{let d=`${s.table}.${s.column}`;return(0,r.jsx)(_,{checked:e?.has(d)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${d}`,onCheckedChange:m(()=>{l(d)},"onCheckedChange"),children:`\u2190 ${s.table}.${s.column}`},d)})]})]})]})},"re"),me=m(n=>{let e=(0,R.c)(19),{count:l,editable:a,onClear:t,onDelete:o}=n,i=$(),s;e[0]!==l||e[1]!==i?(s=i("{count} selected",{count:l}),e[0]=l,e[1]=i,e[2]=s):s=e[2];let d;e[3]!==s?(d=(0,r.jsx)("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:s}),e[3]=s,e[4]=d):d=e[4];let p;e[5]!==i?(p=i("Clear"),e[5]=i,e[6]=p):p=e[6];let u;e[7]!==t||e[8]!==p?(u=(0,r.jsx)("button",{className:O,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:p}),e[7]=t,e[8]=p,e[9]=u):u=e[9];let c;e[10]!==l||e[11]!==a||e[12]!==o||e[13]!==i?(c=a&&(0,r.jsx)(W,{confirmLabel:i("Delete {count} rows?",{count:l}),onConfirm:o,testId:"grid-selection-delete",children:i("Delete {count}",{count:l})}),e[10]=l,e[11]=a,e[12]=o,e[13]=i,e[14]=c):c=e[14];let C;return e[15]!==d||e[16]!==u||e[17]!==c?(C=(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[d,u,c]}),e[15]=d,e[16]=u,e[17]=c,e[18]=C):C=e[18],C},"ce"),ue=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,ge=m(n=>{let e=(0,R.c)(9),{bucket:l,objectKey:a,resolveUrl:t}=n,[o,i]=(0,L.useState)(null),[s,d]=(0,L.useState)(!1),p,u;e[0]!==l||e[1]!==a||e[2]!==t?(p=m(()=>{let h={cancelled:!1};return H((async()=>{try{let g=await t(a,l);h.cancelled||i(g)}catch{h.cancelled||d(!0)}})()),()=>{h.cancelled=!0}},"u"),u=[l,a,t],e[0]=l,e[1]=a,e[2]=t,e[3]=p,e[4]=u):(p=e[3],u=e[4]),(0,L.useEffect)(p,u);let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=m(()=>{d(!0)},"c"),e[5]=c):c=e[5];let C=c;if(o===null||s)return null;let b;return e[6]!==a||e[7]!==o?(b=(0,r.jsx)("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:(0,r.jsx)("img",{alt:a,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:C,src:o})}),e[6]=a,e[7]=o,e[8]=b):b=e[8],b},"de"),xe=m(n=>{let e=(0,R.c)(37),{bucket:l,column:a,onClose:t,resolveUrl:o,value:i}=n,s=$(),[d,p]=(0,L.useState)(!1),u;e[0]!==i?(u=F(i),e[0]=i,e[1]=u):u=e[1];let c=u,C;e[2]!==c?(C=m(()=>{Q(c)&&p(!0)},"C"),e[2]=c,e[3]=C):C=e[3];let b=C,h;e[4]!==s?(h=s("Cell value"),e[4]=s,e[5]=h):h=e[5];let g;e[6]!==a?(g=(0,r.jsx)("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:a}),e[6]=a,e[7]=g):g=e[7];let x;e[8]!==d||e[9]!==s?(x=s(d?"Copied":"Copy"),e[8]=d,e[9]=s,e[10]=x):x=e[10];let w;e[11]!==b||e[12]!==x?(w=(0,r.jsx)("button",{className:O,"data-testid":"grid-cell-copy",onClick:b,type:"button",children:x}),e[11]=b,e[12]=x,e[13]=w):w=e[13];let k;e[14]!==s?(k=s("Close"),e[14]=s,e[15]=k):k=e[15];let N;e[16]!==t||e[17]!==k?(N=(0,r.jsx)("button",{className:O,"data-testid":"grid-cell-close",onClick:t,type:"button",children:k}),e[16]=t,e[17]=k,e[18]=N):N=e[18];let f;e[19]!==w||e[20]!==N?(f=(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[w,N]}),e[19]=w,e[20]=N,e[21]=f):f=e[21];let y;e[22]!==g||e[23]!==f?(y=(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[g,f]}),e[22]=g,e[23]=f,e[24]=y):y=e[24];let v;e[25]!==l||e[26]!==o||e[27]!==i?(v=o!==void 0&&typeof i=="string"&&ue.test(i)&&(0,r.jsx)(ge,{bucket:l,objectKey:i,resolveUrl:o}),e[25]=l,e[26]=o,e[27]=i,e[28]=v):v=e[28];let S;e[29]!==c?(S=(0,r.jsx)("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:c}),e[29]=c,e[30]=S):S=e[30];let j;return e[31]!==t||e[32]!==y||e[33]!==v||e[34]!==S||e[35]!==h?(j=(0,r.jsxs)(z,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:h,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[y,v,S]}),e[31]=t,e[32]=y,e[33]=v,e[34]=S,e[35]=h,e[36]=j):j=e[36],j},"ye"),ke=m(n=>{let e=(0,R.c)(36),{backRelations:l,enabledBackRelations:a,onToggleBackRelation:t,columns:o,editable:i,name:s,onBulkDelete:d,onToggleTranspose:p,rows:u,table:c,transposed:C}=n,b=$(),h;e[0]!==c?(h=c.getSelectedRowModel(),e[0]=c,e[1]=h):h=e[1];let g=h.rows,x;e[2]!==c?(x=m(()=>{c.resetRowSelection()},"x"),e[2]=c,e[3]=x):x=e[3];let w=x,k;e[4]!==d||e[5]!==g||e[6]!==c?(k=m(()=>{d(g.map(be)),c.resetRowSelection()},"y"),e[4]=d,e[5]=g,e[6]=c,e[7]=k):k=e[7];let N=k,f;e[8]!==o||e[9]!==s||e[10]!==u?(f=(0,r.jsx)(re,{columns:o,name:s,rows:u}),e[8]=o,e[9]=s,e[10]=u,e[11]=f):f=e[11];let y;e[12]!==l||e[13]!==a||e[14]!==t||e[15]!==c?(y=(0,r.jsx)(de,{backRelations:l,enabledBackRelations:a,onToggleBackRelation:t,table:c}),e[12]=l,e[13]=a,e[14]=t,e[15]=c,e[16]=y):y=e[16];let v;e[17]!==b?(v=b("Swap rows and columns"),e[17]=b,e[18]=v):v=e[18];let S;e[19]!==b?(S=b("Transpose"),e[19]=b,e[20]=S):S=e[20];let j;e[21]!==p||e[22]!==v||e[23]!==S||e[24]!==C?(j=(0,r.jsx)("button",{"aria-pressed":C,className:O,"data-testid":"grid-transpose",onClick:p,title:v,type:"button",children:S}),e[21]=p,e[22]=v,e[23]=S,e[24]=C,e[25]=j):j=e[25];let T;e[26]!==i||e[27]!==w||e[28]!==N||e[29]!==g.length?(T=g.length>0&&(0,r.jsx)(me,{count:g.length,editable:i,onClear:w,onDelete:N}),e[26]=i,e[27]=w,e[28]=N,e[29]=g.length,e[30]=T):T=e[30];let U;return e[31]!==f||e[32]!==y||e[33]!==j||e[34]!==T?(U=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[f,y,j,T]}),e[31]=f,e[32]=y,e[33]=j,e[34]=T,e[35]=U):U=e[35],U},"we");function be(n){return n.id}m(be,"fe");export{re as a,me as b,xe as c,ke as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Qe}from"./chunk-OTZRXUHF.js";import{a as Me,b as Re}from"./chunk-7SROZWKL.js";import"./chunk-AECDJKXB.js";import"./chunk-CN2AINNY.js";import"./chunk-CP4ZFBVW.js";import{a as we}from"./chunk-NXXGISFB.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-JV7KTJPY.js";import{a as He}from"./chunk-CKTKI4IY.js";import{a as Xe}from"./chunk-HLEXBOCL.js";import{b as Je}from"./chunk-P52BY657.js";import{e as Ue}from"./chunk-4YTSKL4R.js";import"./chunk-VNTEQQPP.js";import{P as Ae}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as me}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ze}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as je}from"./chunk-VDW32UET.js";import{f as Ve}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as We}from"./chunk-UANVABQG.js";import{a as qe,b as Pe,c as Ge,d as Ke,e as Le}from"./chunk-IYWVSMAY.js";import{d as Fe,f as Ee,g as $e,h as Oe,o as ue}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as r,d as Be,e as at,f as nt,g as st,i as De}from"./chunk-R5ZTCHCE.js";var Ce=Be(nt(),1);var x=Be(at(),1);var t=Be(st(),1);var rt=Ee(je.listTables),ot=Ee(je.listTableIndexes),it=Ee(je.readTablePage),dt=Ee(je.describeTables),ct={},Ye=[],mt=r(s=>{let e=(0,Ce.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ve(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:g}=He(u),[o,p]=(0,x.useState)(""),[i,v]=(0,x.useState)(null),[b,P]=(0,x.useState)(null),_;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={},e[0]=_):_=e[0];let[L,y]=(0,x.useState)(_),G;e[1]===Symbol.for("react.memo_cache_sentinel")?(G={},e[1]=G):G=e[1];let[E,M]=(0,x.useState)(G),[S,C]=(0,x.useState)(null),F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={},e[2]=F):F=e[2];let[$,he]=(0,x.useState)(F),Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q={},e[3]=Q):Q=e[3];let[I,K]=(0,x.useState)(Q),[k,pe]=(0,x.useState)(null),[B,oe]=(0,x.useState)(null),Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y={},e[4]=Y):Y=e[4];let[W,xe]=(0,x.useState)(Y),[J,ie]=(0,x.useState)(null),ve;e[5]!==l?(ve=r(async h=>{P(null);try{let w=await l.query(rt,{},$e(h));Je(h),v(w),y({}),M({}),C(null),he(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h}))),K(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h})))}catch(w){let N=w;v(null),P(Oe(N))}},"ve"),e[5]=l,e[6]=ve):ve=e[6];let O=ve,Z;e[7]!==l?(Z=r(async()=>{oe(null);try{pe(await l.listGlobalTables())}catch(h){let w=h;pe(null),oe(Oe(w))}},"Z"),e[7]=l,e[8]=Z):Z=e[8];let ee=Z,de,D;e[9]!==c||e[10]!==O||e[11]!==ee?(de=r(()=>{ue(O(c)),ue(ee())},"de"),D=[O,ee,c],e[9]=c,e[10]=O,e[11]=ee,e[12]=de,e[13]=D):(de=e[12],D=e[13]),(0,x.useEffect)(de,D);let te;e[14]!==l||e[15]!==L||e[16]!==S||e[17]!==c?(te=r(async h=>{if(S===h){C(null);return}C(h);let w=`${c}:${h}`;if(L[w]!==void 0)return;let[N,q]=await Promise.allSettled([l.query(it,{limit:1,offset:0,table:h},$e(c)),l.query(ot,{table:h},$e(c))]);N.status==="fulfilled"?y(A=>({...A,[w]:N.value.columns})):P(Oe(N.reason)),q.status==="fulfilled"&&M(A=>({...A,[w]:q.value.indexes}))},"te"),e[14]=l,e[15]=L,e[16]=S,e[17]=c,e[18]=te):te=e[18];let j=te,ye;e[19]!==l||e[20]!==W||e[21]!==J?(ye=r(async h=>{if(J===h){ie(null);return}if(ie(h),W[h]===void 0)try{let w=await l.readGlobalTablePage({limit:1,offset:0,table:h});xe(N=>({...N,[h]:w.columns}))}catch(w){oe(Oe(w))}},"ye"),e[19]=l,e[20]=W,e[21]=J,e[22]=ye):ye=e[22];let ce=ye,be=(0,x.useRef)(void 0),R,X;e[23]!==n||e[24]!==i||e[25]!==j?(R=r(()=>{n===void 0||i===null||be.current===n||i.some(h=>h.name===n)&&(be.current=n,ue(j(n)))},"K"),X=[n,i,j],e[23]=n,e[24]=i,e[25]=j,e[26]=R,e[27]=X):(R=e[26],X=e[27]),(0,x.useEffect)(R,X);let V;e[28]!==l?(V=r(async(h,w,N)=>{let[q,A]=await Promise.all([Promise.allSettled([l.query(dt,{tables:[...w,...N]},$e(h))]),Promise.all(N.map(async T=>{let ge=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:T})]),Ie=ge[0].status==="fulfilled"?ge[0].value:void 0;return{columns:Ie?.columns??[],refs:Ie?.refs??{},table:T}}))]),Te=q[0].status==="fulfilled"?q[0].value?.columnsByTable??{}:{},Se=q[0].status==="rejected",_e=new Map(A.map(ut)),ke=[...w,...N].map(T=>{let ge=Te[T]??[];return[T,ge.length>0?ge:_e.get(T)??[]]});he(T=>({...T,[h]:Object.fromEntries(ke)})),K(T=>({...T,[h]:Se}))},"U"),e[28]=l,e[29]=V):V=e[29];let le=V,U,ae;e[30]!==B||e[31]!==k||e[32]!==le||e[33]!==c||e[34]!==$||e[35]!==i||e[36]!==a?(U=r(()=>{a!=="graph"||i===null||k===null&&B===null||$[c]!==void 0||ue(le(c,i.map(ht),(k??[]).map(pt)))},"V"),ae=[a,i,k,B,c,$,le],e[30]=B,e[31]=k,e[32]=le,e[33]=c,e[34]=$,e[35]=i,e[36]=a,e[37]=U,e[38]=ae):(U=e[37],ae=e[38]),(0,x.useEffect)(U,ae);let z=$[c]??ct,ne;if(e[39]!==z||e[40]!==k||e[41]!==i){let h;e[43]!==z?(h=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"shard"}),"u"),e[43]=z,e[44]=h):h=e[44];let w=(i??[]).map(h),N;e[45]!==z?(N=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"global"}),"x"),e[45]=z,e[46]=N):N=e[46];let q=(k??[]).map(N);ne=[...w,...q],e[39]=z,e[40]=k,e[41]=i,e[42]=ne}else ne=e[42];let se=ne,f;if(e[47]!==o||e[48]!==i){let h=o.trim().toLowerCase();f=(i??[]).filter(w=>w.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=f}else f=e[49];let re=f,H;if(e[50]!==k||e[51]!==o){let h=o.trim().toLowerCase();H=(k??[]).filter(w=>w.name.toLowerCase().includes(h)),e[50]=k,e[51]=o,e[52]=H}else H=e[52];let Ne=H,fe;return e[53]!==L||e[54]!==se||e[55]!==b||e[56]!==S||e[57]!==Ne||e[58]!==re||e[59]!==W||e[60]!==B||e[61]!==J||e[62]!==k||e[63]!==E||e[64]!==O||e[65]!==d||e[66]!==I||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==j||e[71]!==ce||e[72]!==a?(fe={columns:L,diagramTables:se,error:b,expanded:S,filteredGlobalTables:Ne,filteredTables:re,globalColumns:W,globalError:B,globalExpanded:J,globalTables:k,indexes:E,refresh:O,setShardKey:d,setTableFilter:p,setView:m,shardColumnsError:I,shardKey:g,tableFilter:o,tables:i,toggle:j,toggleGlobal:ce,view:a},e[53]=L,e[54]=se,e[55]=b,e[56]=S,e[57]=Ne,e[58]=re,e[59]=W,e[60]=B,e[61]=J,e[62]=k,e[63]=E,e[64]=O,e[65]=d,e[66]=I,e[67]=g,e[68]=o,e[69]=i,e[70]=j,e[71]=ce,e[72]=a,e[73]=fe):fe=e[73],fe},"ct");function ut(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ut,"mt");function ht(s){return s.name}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"pt"),gt=r(s=>{let e=(0,Ce.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=Fe(),g=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let p;e[2]!==m||e[3]!==g||e[4]!==o?(p=(0,t.jsx)(me,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:g,children:o}),e[2]=m,e[3]=g,e[4]=o,e[5]=p):p=e[5];let i=!u,v=n==="addColumn"?"default":"outline",b;e[6]!==d?(b=d("Add column"),e[6]=d,e[7]=b):b=e[7];let P;e[8]!==l||e[9]!==i||e[10]!==v||e[11]!==b?(P=(0,t.jsx)(me,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:v,children:b}),e[8]=l,e[9]=i,e[10]=v,e[11]=b,e[12]=P):P=e[12];let _=!u,L=n==="addIndex"?"default":"outline",y;e[13]!==d?(y=d("Add index"),e[13]=d,e[14]=y):y=e[14];let G;e[15]!==a||e[16]!==y||e[17]!==_||e[18]!==L?(G=(0,t.jsx)(me,{"data-testid":"sc-editor-add-index",disabled:_,onClick:a,size:"xs",type:"button",variant:L,children:y}),e[15]=a,e[16]=y,e[17]=_,e[18]=L,e[19]=G):G=e[19];let E=!u,M=n==="destructive"?"default":"ghost",S;e[20]!==d?(S=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=S):S=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==M||e[25]!==S?(C=(0,t.jsx)(me,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:M,children:S}),e[22]=c,e[23]=E,e[24]=M,e[25]=S,e[26]=C):C=e[26];let F;return e[27]!==G||e[28]!==C||e[29]!==p||e[30]!==P?(F=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[p,P,G,C]}),e[27]=G,e[28]=C,e[29]=p,e[30]=P,e[31]=F):F=e[31],F},"gt"),xt=r(s=>{let e=(0,Ce.c)(28),{onOpenMigrations:u,result:n}=s,l=Fe();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let p;e[6]!==o?(p=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=p):p=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let v;e[10]!==u||e[11]!==i?(v=(0,t.jsx)(me,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=v):v=e[12];let b;return e[13]!==p||e[14]!==v?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[p,v]}),e[13]=p,e[14]=v,e[15]=b):b=e[15],b}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(vt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let g;return e[25]!==m||e[26]!==d?(g=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=g):g=e[27],g},"bt");function vt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(vt,"xt");var yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Nt="v.string()",Ct=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Ct"),wt=r(s=>{let e=(0,Ce.c)(83),{onApplied:u,tableNames:n}=s,l=Fe(),a=Ue(),[m,c]=(0,x.useState)(null),[d,g]=(0,x.useState)(!1),[o,p]=(0,x.useState)(null),[i,v]=(0,x.useState)(""),[b,P]=(0,x.useState)(""),[_,L]=(0,x.useState)(Nt),[y,G]=(0,x.useState)(n[0]??""),[E,M]=(0,x.useState)(""),[S,C]=(0,x.useState)(""),[F,$]=(0,x.useState)(!1),he;e[0]===Symbol.for("react.memo_cache_sentinel")?(he=r(()=>{c(null),v(""),P(""),M(""),C(""),$(!1)},"me"),e[0]=he):he=e[0];let Q=he,I;e[1]!==u?(I=r(async T=>{g(!0),p(null);try{let ge=await ft(T);p(ge),ge.kind==="ok"&&(u(ge.tables),Q())}catch(ge){let Ie=ge;p({kind:"error",message:Ie instanceof Error?Ie.message:String(Ie)})}g(!1)},"I"),e[1]=u,e[2]=I):I=e[2];let K=I,k;e[3]!==K||e[4]!==i?(k=r(()=>{ue(K({kind:"addTable",table:i.trim()}))},"_"),e[3]=K,e[4]=i,e[5]=k):k=e[5];let pe=k,B;e[6]!==b||e[7]!==K||e[8]!==y||e[9]!==_?(B=r(()=>{ue(K({column:b.trim(),kind:"addOptionalColumn",table:y,validator:_}))},"j"),e[6]=b,e[7]=K,e[8]=y,e[9]=_,e[10]=B):B=e[10];let oe=B,Y;e[11]!==S||e[12]!==E||e[13]!==K||e[14]!==y||e[15]!==F?(Y=r(()=>{ue(K({fields:Ct(S),kind:"addIndex",name:E.trim(),table:y,unique:F}))},"Q"),e[11]=S,e[12]=E,e[13]=K,e[14]=y,e[15]=F,e[16]=Y):Y=e[16];let W=Y,xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=r(()=>{p(null),c("addTable")},"xe"),e[17]=xe):xe=e[17];let J=xe,ie;e[18]===Symbol.for("react.memo_cache_sentinel")?(ie=r(()=>{p(null),c("addColumn")},"re"),e[18]=ie):ie=e[18];let ve=ie,O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=r(()=>{p(null),c("addIndex")},"O"),e[19]=O):O=e[19];let Z=O,ee;e[20]!==l?(ee=r(()=>{c("destructive"),p({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"ee"),e[20]=l,e[21]=ee):ee=e[21];let de=ee,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(T=>{v(T.target.value)},"R"),e[22]=D):D=e[22];let te=D,j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=r(T=>{P(T.target.value)},"M"),e[23]=j):j=e[23];let ye=j,ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=r(T=>{L(T.target.value)},"ce"),e[24]=ce):ce=e[24];let be=ce,R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=r(T=>{G(T.target.value)},"K"),e[25]=R):R=e[25];let X=R,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(T=>{M(T.target.value)},"U"),e[26]=V):V=e[26];let le=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(T=>{C(T.target.value)},"V"),e[27]=U):U=e[27];let ae=U,z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=r(T=>{$(T.target.checked)},"$"),e[28]=z):z=e[28];let ne=z,se;e[29]!==a?(se=r(()=>{ue(a({to:"/migrations"}))},"ne"),e[29]=a,e[30]=se):se=e[30];let f=se,re;e[31]!==l?(re=l("Edit schema"),e[31]=l,e[32]=re):re=e[32];let H;e[33]!==re?(H=(0,t.jsx)(Ge,{children:re}),e[33]=re,e[34]=H):H=e[34];let Ne;e[35]!==l?(Ne=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=Ne):Ne=e[36];let fe;e[37]!==Ne?(fe=(0,t.jsx)(Ke,{children:Ne}),e[37]=Ne,e[38]=fe):fe=e[38];let h;e[39]!==H||e[40]!==fe?(h=(0,t.jsxs)(Pe,{children:[H,fe]}),e[39]=H,e[40]=fe,e[41]=h):h=e[41];let w=n.length>0,N;e[42]!==m||e[43]!==de||e[44]!==w?(N=(0,t.jsx)(gt,{hasTables:w,mode:m,onAddColumn:ve,onAddIndex:Z,onAddTable:J,onDestructive:de}),e[42]=m,e[43]=de,e[44]=w,e[45]=N):N=e[45];let q;e[46]!==d||e[47]!==m||e[48]!==pe||e[49]!==l||e[50]!==i?(q=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:i})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:pe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=pe,e[49]=l,e[50]=i,e[51]=q):q=e[51];let A;e[52]!==d||e[53]!==b||e[54]!==m||e[55]!==oe||e[56]!==l||e[57]!==n||e[58]!==y||e[59]!==_?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:X,value:y,children:n.map(Tt)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:b})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:be,value:_,children:yt.map(St)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(me,{"data-testid":"sc-editor-column-apply",disabled:d||b.trim()===""||y==="",onClick:oe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=b,e[54]=m,e[55]=oe,e[56]=l,e[57]=n,e[58]=y,e[59]=_,e[60]=A):A=e[60];let Te;e[61]!==d||e[62]!==S||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==y||e[69]!==F?(Te=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:X,value:y,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ae,value:S})]}),(0,t.jsxs)(we,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:F,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ne,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||S.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=S,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=y,e[69]=F,e[70]=Te):Te=e[70];let Se;e[71]!==f||e[72]!==o?(Se=(0,t.jsx)(xt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=Se):Se=e[73];let _e;e[74]!==N||e[75]!==q||e[76]!==A||e[77]!==Te||e[78]!==Se?(_e=(0,t.jsxs)(Le,{children:[N,q,A,Te,Se]}),e[74]=N,e[75]=q,e[76]=A,e[77]=Te,e[78]=Se,e[79]=_e):_e=e[79];let ke;return e[80]!==h||e[81]!==_e?(ke=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[h,_e]}),e[80]=h,e[81]=_e,e[82]=ke):ke=e[82],ke},"Nt");function Tt(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(Tt,"Tt");function St(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(St,"St");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"wt");var Ze=[],kt=r(s=>{let e=(0,Ce.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"_t"),et=r(s=>{let e=(0,Ce.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,g;e[0]!==n?(g=(0,t.jsx)(kt,{open:n}),e[0]=n,e[1]=g):g=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let p;e[4]!==m?(p=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=p):p=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==g||e[9]!==o||e[10]!==p||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[g,o," ",p]}),e[6]=n,e[7]=a,e[8]=g,e[9]=o,e[10]=p,e[11]=d,e[12]=i):i=e[12];let v;e[13]!==u||e[14]!==n?(v=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==i||e[18]!==v?(b=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,v]}),e[16]=c,e[17]=i,e[18]=v,e[19]=b):b=e[19],b},"Ye"),tt=r(s=>{let e=(0,Ce.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(At),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"He"),It=r(s=>{let e=(0,Ce.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Ft),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"Et"),lt=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,Ce.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=Fe(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:g,expanded:o,filteredGlobalTables:p,filteredTables:i,globalColumns:v,globalError:b,globalExpanded:P,globalTables:_,indexes:L,refresh:y,setShardKey:G,setTableFilter:E,setView:M,shardColumnsError:S,shardKey:C,tableFilter:F,tables:$,toggle:he,toggleGlobal:Q,view:I}=mt(m),K;e[3]!==M?(K=r(()=>{M("list")},"q"),e[3]=M,e[4]=K):K=e[4];let k=K,pe;e[5]!==M?(pe=r(()=>{M("graph")},"ue"),e[5]=M,e[6]=pe):pe=e[6];let B=pe,oe;e[7]!==E?(oe=r(f=>{E(f.target.value)},"ie"),e[7]=E,e[8]=oe):oe=e[8];let Y=oe,W;e[9]!==y||e[10]!==C?(W=r(f=>{ue(y(C))},"Y"),e[9]=y,e[10]=C,e[11]=W):W=e[11];let xe=W,J;e[12]!==$?(J=$??[],e[12]=$,e[13]=J):J=e[13];let ie;e[14]!==J?(ie=J.map(zt),e[14]=J,e[15]=ie):ie=e[15];let ve=ie,O;e[16]!==G||e[17]!==C?(O=(0,t.jsx)(Xe,{onChange:G,testId:"sc-shard-input",value:C}),e[16]=G,e[17]=C,e[18]=O):O=e[18];let Z;e[19]!==a?(Z=a("Schema view"),e[19]=a,e[20]=Z):Z=e[20];let ee=I==="graph",de=I==="graph",D;e[21]!==de?(D=lt(de),e[21]=de,e[22]=D):D=e[22];let te;e[23]!==a?(te=a("Graph"),e[23]=a,e[24]=te):te=e[24];let j;e[25]!==B||e[26]!==ee||e[27]!==D||e[28]!==te?(j=(0,t.jsx)("button",{"aria-selected":ee,className:D,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:te}),e[25]=B,e[26]=ee,e[27]=D,e[28]=te,e[29]=j):j=e[29];let ye=I==="list",ce=I==="list",be;e[30]!==ce?(be=lt(ce),e[30]=ce,e[31]=be):be=e[31];let R;e[32]!==a?(R=a("Table list"),e[32]=a,e[33]=R):R=e[33];let X;e[34]!==k||e[35]!==ye||e[36]!==be||e[37]!==R?(X=(0,t.jsx)("button",{"aria-selected":ye,className:be,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:R}),e[34]=k,e[35]=ye,e[36]=be,e[37]=R,e[38]=X):X=e[38];let V;e[39]!==j||e[40]!==X||e[41]!==Z?(V=(0,t.jsxs)("div",{"aria-label":Z,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[j,X]}),e[39]=j,e[40]=X,e[41]=Z,e[42]=V):V=e[42];let le;e[43]!==V||e[44]!==O?(le=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[O,V]}),e[43]=V,e[44]=O,e[45]=le):le=e[45];let U;e[46]!==xe||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ae;e[50]!==Y||e[51]!==a||e[52]!==F||e[53]!==I?(ae=I==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:Y,placeholder:a("Filter tables"),value:F}),e[50]=Y,e[51]=a,e[52]=F,e[53]=I,e[54]=ae):ae=e[54];let z;e[55]!==d||e[56]!==g||e[57]!==b||e[58]!==S||e[59]!==C||e[60]!==I?(z=I==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),(0,t.jsx)(Qe,{columnsError:S[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=g,e[57]=b,e[58]=S,e[59]=C,e[60]=I,e[61]=z):z=e[61];let ne;e[62]!==c||e[63]!==g||e[64]!==o||e[65]!==p||e[66]!==i||e[67]!==v||e[68]!==b||e[69]!==P||e[70]!==_||e[71]!==L||e[72]!==C||e[73]!==a||e[74]!==$||e[75]!==he||e[76]!==Q||e[77]!==I?(ne=I==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ge,{children:a("Shard tables")}),$!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Ke,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),$!==null&&$.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),$!==null&&$.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let re=`${C}:${f.name}`,H=L[re]??[];return(0,t.jsxs)(et,{expanded:o===f.name,name:f.name,onToggle:r(()=>{ue(he(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(tt,{columns:c[re]??Ze,testId:`sc-columns-${f.name}`}),H.length>0&&(0,t.jsx)(It,{heading:a("Indexes"),indexes:H,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ge,{children:a("Global tables (D1)")}),_!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:p.length})]}),(0,t.jsx)(Ke,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),_!==null&&_.length===0&&(0,t.jsx)(We,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),_!==null&&_.length>0&&p.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),p.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:p.map(f=>(0,t.jsx)(et,{expanded:P===f.name,name:f.name,onToggle:r(()=>{ue(Q(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(tt,{columns:v[f.name]??Ze,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=g,e[64]=o,e[65]=p,e[66]=i,e[67]=v,e[68]=b,e[69]=P,e[70]=_,e[71]=L,e[72]=C,e[73]=a,e[74]=$,e[75]=he,e[76]=Q,e[77]=I,e[78]=ne):ne=e[78];let se;return e[79]!==le||e[80]!==U||e[81]!==ae||e[82]!==z||e[83]!==ne?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,U,ae,z,ne]}),e[79]=le,e[80]=U,e[81]=ae,e[82]=z,e[83]=ne,e[84]=se):se=e[84],se},"Wt");function At(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(At,"It");function Ft(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(ze,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(ze,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Ft,"kt");function zt(s){return s.name}r(zt,"At");export{Xt as SchemaViewer};
|
|
1
|
+
import{a as Qe}from"./chunk-TYOIBCR6.js";import{a as Me,b as Re}from"./chunk-7SROZWKL.js";import"./chunk-O2VDNK4B.js";import"./chunk-CN2AINNY.js";import"./chunk-CP4ZFBVW.js";import{a as we}from"./chunk-NXXGISFB.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-JV7KTJPY.js";import{a as He}from"./chunk-CKTKI4IY.js";import{a as Xe}from"./chunk-6UN4V2HB.js";import{b as Je}from"./chunk-KVSQKUWD.js";import{e as Ue}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import{P as Ae}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as me}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ze}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as je}from"./chunk-VDW32UET.js";import{f as Ve}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as We}from"./chunk-UANVABQG.js";import{a as qe,b as Pe,c as Ge,d as Ke,e as Le}from"./chunk-IYWVSMAY.js";import{d as Fe,f as Ee,g as $e,h as Oe,o as ue}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as r,d as Be,e as at,f as nt,g as st,i as De}from"./chunk-R5ZTCHCE.js";var Ce=Be(nt(),1);var x=Be(at(),1);var t=Be(st(),1);var rt=Ee(je.listTables),ot=Ee(je.listTableIndexes),it=Ee(je.readTablePage),dt=Ee(je.describeTables),ct={},Ye=[],mt=r(s=>{let e=(0,Ce.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ve(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:g}=He(u),[o,p]=(0,x.useState)(""),[i,v]=(0,x.useState)(null),[b,P]=(0,x.useState)(null),_;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={},e[0]=_):_=e[0];let[L,y]=(0,x.useState)(_),G;e[1]===Symbol.for("react.memo_cache_sentinel")?(G={},e[1]=G):G=e[1];let[E,M]=(0,x.useState)(G),[S,C]=(0,x.useState)(null),F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={},e[2]=F):F=e[2];let[$,he]=(0,x.useState)(F),Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q={},e[3]=Q):Q=e[3];let[I,K]=(0,x.useState)(Q),[k,pe]=(0,x.useState)(null),[B,oe]=(0,x.useState)(null),Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y={},e[4]=Y):Y=e[4];let[W,xe]=(0,x.useState)(Y),[J,ie]=(0,x.useState)(null),ve;e[5]!==l?(ve=r(async h=>{P(null);try{let w=await l.query(rt,{},$e(h));Je(h),v(w),y({}),M({}),C(null),he(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h}))),K(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h})))}catch(w){let N=w;v(null),P(Oe(N))}},"ve"),e[5]=l,e[6]=ve):ve=e[6];let O=ve,Z;e[7]!==l?(Z=r(async()=>{oe(null);try{pe(await l.listGlobalTables())}catch(h){let w=h;pe(null),oe(Oe(w))}},"Z"),e[7]=l,e[8]=Z):Z=e[8];let ee=Z,de,D;e[9]!==c||e[10]!==O||e[11]!==ee?(de=r(()=>{ue(O(c)),ue(ee())},"de"),D=[O,ee,c],e[9]=c,e[10]=O,e[11]=ee,e[12]=de,e[13]=D):(de=e[12],D=e[13]),(0,x.useEffect)(de,D);let te;e[14]!==l||e[15]!==L||e[16]!==S||e[17]!==c?(te=r(async h=>{if(S===h){C(null);return}C(h);let w=`${c}:${h}`;if(L[w]!==void 0)return;let[N,q]=await Promise.allSettled([l.query(it,{limit:1,offset:0,table:h},$e(c)),l.query(ot,{table:h},$e(c))]);N.status==="fulfilled"?y(A=>({...A,[w]:N.value.columns})):P(Oe(N.reason)),q.status==="fulfilled"&&M(A=>({...A,[w]:q.value.indexes}))},"te"),e[14]=l,e[15]=L,e[16]=S,e[17]=c,e[18]=te):te=e[18];let j=te,ye;e[19]!==l||e[20]!==W||e[21]!==J?(ye=r(async h=>{if(J===h){ie(null);return}if(ie(h),W[h]===void 0)try{let w=await l.readGlobalTablePage({limit:1,offset:0,table:h});xe(N=>({...N,[h]:w.columns}))}catch(w){oe(Oe(w))}},"ye"),e[19]=l,e[20]=W,e[21]=J,e[22]=ye):ye=e[22];let ce=ye,be=(0,x.useRef)(void 0),R,X;e[23]!==n||e[24]!==i||e[25]!==j?(R=r(()=>{n===void 0||i===null||be.current===n||i.some(h=>h.name===n)&&(be.current=n,ue(j(n)))},"K"),X=[n,i,j],e[23]=n,e[24]=i,e[25]=j,e[26]=R,e[27]=X):(R=e[26],X=e[27]),(0,x.useEffect)(R,X);let V;e[28]!==l?(V=r(async(h,w,N)=>{let[q,A]=await Promise.all([Promise.allSettled([l.query(dt,{tables:[...w,...N]},$e(h))]),Promise.all(N.map(async T=>{let ge=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:T})]),Ie=ge[0].status==="fulfilled"?ge[0].value:void 0;return{columns:Ie?.columns??[],refs:Ie?.refs??{},table:T}}))]),Te=q[0].status==="fulfilled"?q[0].value?.columnsByTable??{}:{},Se=q[0].status==="rejected",_e=new Map(A.map(ut)),ke=[...w,...N].map(T=>{let ge=Te[T]??[];return[T,ge.length>0?ge:_e.get(T)??[]]});he(T=>({...T,[h]:Object.fromEntries(ke)})),K(T=>({...T,[h]:Se}))},"U"),e[28]=l,e[29]=V):V=e[29];let le=V,U,ae;e[30]!==B||e[31]!==k||e[32]!==le||e[33]!==c||e[34]!==$||e[35]!==i||e[36]!==a?(U=r(()=>{a!=="graph"||i===null||k===null&&B===null||$[c]!==void 0||ue(le(c,i.map(ht),(k??[]).map(pt)))},"V"),ae=[a,i,k,B,c,$,le],e[30]=B,e[31]=k,e[32]=le,e[33]=c,e[34]=$,e[35]=i,e[36]=a,e[37]=U,e[38]=ae):(U=e[37],ae=e[38]),(0,x.useEffect)(U,ae);let z=$[c]??ct,ne;if(e[39]!==z||e[40]!==k||e[41]!==i){let h;e[43]!==z?(h=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"shard"}),"u"),e[43]=z,e[44]=h):h=e[44];let w=(i??[]).map(h),N;e[45]!==z?(N=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"global"}),"x"),e[45]=z,e[46]=N):N=e[46];let q=(k??[]).map(N);ne=[...w,...q],e[39]=z,e[40]=k,e[41]=i,e[42]=ne}else ne=e[42];let se=ne,f;if(e[47]!==o||e[48]!==i){let h=o.trim().toLowerCase();f=(i??[]).filter(w=>w.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=f}else f=e[49];let re=f,H;if(e[50]!==k||e[51]!==o){let h=o.trim().toLowerCase();H=(k??[]).filter(w=>w.name.toLowerCase().includes(h)),e[50]=k,e[51]=o,e[52]=H}else H=e[52];let Ne=H,fe;return e[53]!==L||e[54]!==se||e[55]!==b||e[56]!==S||e[57]!==Ne||e[58]!==re||e[59]!==W||e[60]!==B||e[61]!==J||e[62]!==k||e[63]!==E||e[64]!==O||e[65]!==d||e[66]!==I||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==j||e[71]!==ce||e[72]!==a?(fe={columns:L,diagramTables:se,error:b,expanded:S,filteredGlobalTables:Ne,filteredTables:re,globalColumns:W,globalError:B,globalExpanded:J,globalTables:k,indexes:E,refresh:O,setShardKey:d,setTableFilter:p,setView:m,shardColumnsError:I,shardKey:g,tableFilter:o,tables:i,toggle:j,toggleGlobal:ce,view:a},e[53]=L,e[54]=se,e[55]=b,e[56]=S,e[57]=Ne,e[58]=re,e[59]=W,e[60]=B,e[61]=J,e[62]=k,e[63]=E,e[64]=O,e[65]=d,e[66]=I,e[67]=g,e[68]=o,e[69]=i,e[70]=j,e[71]=ce,e[72]=a,e[73]=fe):fe=e[73],fe},"ct");function ut(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ut,"mt");function ht(s){return s.name}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"pt"),gt=r(s=>{let e=(0,Ce.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=Fe(),g=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let p;e[2]!==m||e[3]!==g||e[4]!==o?(p=(0,t.jsx)(me,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:g,children:o}),e[2]=m,e[3]=g,e[4]=o,e[5]=p):p=e[5];let i=!u,v=n==="addColumn"?"default":"outline",b;e[6]!==d?(b=d("Add column"),e[6]=d,e[7]=b):b=e[7];let P;e[8]!==l||e[9]!==i||e[10]!==v||e[11]!==b?(P=(0,t.jsx)(me,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:v,children:b}),e[8]=l,e[9]=i,e[10]=v,e[11]=b,e[12]=P):P=e[12];let _=!u,L=n==="addIndex"?"default":"outline",y;e[13]!==d?(y=d("Add index"),e[13]=d,e[14]=y):y=e[14];let G;e[15]!==a||e[16]!==y||e[17]!==_||e[18]!==L?(G=(0,t.jsx)(me,{"data-testid":"sc-editor-add-index",disabled:_,onClick:a,size:"xs",type:"button",variant:L,children:y}),e[15]=a,e[16]=y,e[17]=_,e[18]=L,e[19]=G):G=e[19];let E=!u,M=n==="destructive"?"default":"ghost",S;e[20]!==d?(S=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=S):S=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==M||e[25]!==S?(C=(0,t.jsx)(me,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:M,children:S}),e[22]=c,e[23]=E,e[24]=M,e[25]=S,e[26]=C):C=e[26];let F;return e[27]!==G||e[28]!==C||e[29]!==p||e[30]!==P?(F=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[p,P,G,C]}),e[27]=G,e[28]=C,e[29]=p,e[30]=P,e[31]=F):F=e[31],F},"gt"),xt=r(s=>{let e=(0,Ce.c)(28),{onOpenMigrations:u,result:n}=s,l=Fe();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let p;e[6]!==o?(p=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=p):p=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let v;e[10]!==u||e[11]!==i?(v=(0,t.jsx)(me,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=v):v=e[12];let b;return e[13]!==p||e[14]!==v?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[p,v]}),e[13]=p,e[14]=v,e[15]=b):b=e[15],b}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(vt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let g;return e[25]!==m||e[26]!==d?(g=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=g):g=e[27],g},"bt");function vt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(vt,"xt");var yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Nt="v.string()",Ct=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Ct"),wt=r(s=>{let e=(0,Ce.c)(83),{onApplied:u,tableNames:n}=s,l=Fe(),a=Ue(),[m,c]=(0,x.useState)(null),[d,g]=(0,x.useState)(!1),[o,p]=(0,x.useState)(null),[i,v]=(0,x.useState)(""),[b,P]=(0,x.useState)(""),[_,L]=(0,x.useState)(Nt),[y,G]=(0,x.useState)(n[0]??""),[E,M]=(0,x.useState)(""),[S,C]=(0,x.useState)(""),[F,$]=(0,x.useState)(!1),he;e[0]===Symbol.for("react.memo_cache_sentinel")?(he=r(()=>{c(null),v(""),P(""),M(""),C(""),$(!1)},"me"),e[0]=he):he=e[0];let Q=he,I;e[1]!==u?(I=r(async T=>{g(!0),p(null);try{let ge=await ft(T);p(ge),ge.kind==="ok"&&(u(ge.tables),Q())}catch(ge){let Ie=ge;p({kind:"error",message:Ie instanceof Error?Ie.message:String(Ie)})}g(!1)},"I"),e[1]=u,e[2]=I):I=e[2];let K=I,k;e[3]!==K||e[4]!==i?(k=r(()=>{ue(K({kind:"addTable",table:i.trim()}))},"_"),e[3]=K,e[4]=i,e[5]=k):k=e[5];let pe=k,B;e[6]!==b||e[7]!==K||e[8]!==y||e[9]!==_?(B=r(()=>{ue(K({column:b.trim(),kind:"addOptionalColumn",table:y,validator:_}))},"j"),e[6]=b,e[7]=K,e[8]=y,e[9]=_,e[10]=B):B=e[10];let oe=B,Y;e[11]!==S||e[12]!==E||e[13]!==K||e[14]!==y||e[15]!==F?(Y=r(()=>{ue(K({fields:Ct(S),kind:"addIndex",name:E.trim(),table:y,unique:F}))},"Q"),e[11]=S,e[12]=E,e[13]=K,e[14]=y,e[15]=F,e[16]=Y):Y=e[16];let W=Y,xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=r(()=>{p(null),c("addTable")},"xe"),e[17]=xe):xe=e[17];let J=xe,ie;e[18]===Symbol.for("react.memo_cache_sentinel")?(ie=r(()=>{p(null),c("addColumn")},"re"),e[18]=ie):ie=e[18];let ve=ie,O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=r(()=>{p(null),c("addIndex")},"O"),e[19]=O):O=e[19];let Z=O,ee;e[20]!==l?(ee=r(()=>{c("destructive"),p({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"ee"),e[20]=l,e[21]=ee):ee=e[21];let de=ee,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(T=>{v(T.target.value)},"R"),e[22]=D):D=e[22];let te=D,j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=r(T=>{P(T.target.value)},"M"),e[23]=j):j=e[23];let ye=j,ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=r(T=>{L(T.target.value)},"ce"),e[24]=ce):ce=e[24];let be=ce,R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=r(T=>{G(T.target.value)},"K"),e[25]=R):R=e[25];let X=R,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(T=>{M(T.target.value)},"U"),e[26]=V):V=e[26];let le=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(T=>{C(T.target.value)},"V"),e[27]=U):U=e[27];let ae=U,z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=r(T=>{$(T.target.checked)},"$"),e[28]=z):z=e[28];let ne=z,se;e[29]!==a?(se=r(()=>{ue(a({to:"/migrations"}))},"ne"),e[29]=a,e[30]=se):se=e[30];let f=se,re;e[31]!==l?(re=l("Edit schema"),e[31]=l,e[32]=re):re=e[32];let H;e[33]!==re?(H=(0,t.jsx)(Ge,{children:re}),e[33]=re,e[34]=H):H=e[34];let Ne;e[35]!==l?(Ne=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=Ne):Ne=e[36];let fe;e[37]!==Ne?(fe=(0,t.jsx)(Ke,{children:Ne}),e[37]=Ne,e[38]=fe):fe=e[38];let h;e[39]!==H||e[40]!==fe?(h=(0,t.jsxs)(Pe,{children:[H,fe]}),e[39]=H,e[40]=fe,e[41]=h):h=e[41];let w=n.length>0,N;e[42]!==m||e[43]!==de||e[44]!==w?(N=(0,t.jsx)(gt,{hasTables:w,mode:m,onAddColumn:ve,onAddIndex:Z,onAddTable:J,onDestructive:de}),e[42]=m,e[43]=de,e[44]=w,e[45]=N):N=e[45];let q;e[46]!==d||e[47]!==m||e[48]!==pe||e[49]!==l||e[50]!==i?(q=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:i})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:pe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=pe,e[49]=l,e[50]=i,e[51]=q):q=e[51];let A;e[52]!==d||e[53]!==b||e[54]!==m||e[55]!==oe||e[56]!==l||e[57]!==n||e[58]!==y||e[59]!==_?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:X,value:y,children:n.map(Tt)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:b})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:be,value:_,children:yt.map(St)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(me,{"data-testid":"sc-editor-column-apply",disabled:d||b.trim()===""||y==="",onClick:oe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=b,e[54]=m,e[55]=oe,e[56]=l,e[57]=n,e[58]=y,e[59]=_,e[60]=A):A=e[60];let Te;e[61]!==d||e[62]!==S||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==y||e[69]!==F?(Te=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:X,value:y,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ae,value:S})]}),(0,t.jsxs)(we,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:F,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ne,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||S.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=S,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=y,e[69]=F,e[70]=Te):Te=e[70];let Se;e[71]!==f||e[72]!==o?(Se=(0,t.jsx)(xt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=Se):Se=e[73];let _e;e[74]!==N||e[75]!==q||e[76]!==A||e[77]!==Te||e[78]!==Se?(_e=(0,t.jsxs)(Le,{children:[N,q,A,Te,Se]}),e[74]=N,e[75]=q,e[76]=A,e[77]=Te,e[78]=Se,e[79]=_e):_e=e[79];let ke;return e[80]!==h||e[81]!==_e?(ke=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[h,_e]}),e[80]=h,e[81]=_e,e[82]=ke):ke=e[82],ke},"Nt");function Tt(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(Tt,"Tt");function St(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(St,"St");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"wt");var Ze=[],kt=r(s=>{let e=(0,Ce.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"_t"),et=r(s=>{let e=(0,Ce.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,g;e[0]!==n?(g=(0,t.jsx)(kt,{open:n}),e[0]=n,e[1]=g):g=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let p;e[4]!==m?(p=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=p):p=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==g||e[9]!==o||e[10]!==p||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[g,o," ",p]}),e[6]=n,e[7]=a,e[8]=g,e[9]=o,e[10]=p,e[11]=d,e[12]=i):i=e[12];let v;e[13]!==u||e[14]!==n?(v=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==i||e[18]!==v?(b=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,v]}),e[16]=c,e[17]=i,e[18]=v,e[19]=b):b=e[19],b},"Ye"),tt=r(s=>{let e=(0,Ce.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(At),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"He"),It=r(s=>{let e=(0,Ce.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Ft),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"Et"),lt=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,Ce.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=Fe(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:g,expanded:o,filteredGlobalTables:p,filteredTables:i,globalColumns:v,globalError:b,globalExpanded:P,globalTables:_,indexes:L,refresh:y,setShardKey:G,setTableFilter:E,setView:M,shardColumnsError:S,shardKey:C,tableFilter:F,tables:$,toggle:he,toggleGlobal:Q,view:I}=mt(m),K;e[3]!==M?(K=r(()=>{M("list")},"q"),e[3]=M,e[4]=K):K=e[4];let k=K,pe;e[5]!==M?(pe=r(()=>{M("graph")},"ue"),e[5]=M,e[6]=pe):pe=e[6];let B=pe,oe;e[7]!==E?(oe=r(f=>{E(f.target.value)},"ie"),e[7]=E,e[8]=oe):oe=e[8];let Y=oe,W;e[9]!==y||e[10]!==C?(W=r(f=>{ue(y(C))},"Y"),e[9]=y,e[10]=C,e[11]=W):W=e[11];let xe=W,J;e[12]!==$?(J=$??[],e[12]=$,e[13]=J):J=e[13];let ie;e[14]!==J?(ie=J.map(zt),e[14]=J,e[15]=ie):ie=e[15];let ve=ie,O;e[16]!==G||e[17]!==C?(O=(0,t.jsx)(Xe,{onChange:G,testId:"sc-shard-input",value:C}),e[16]=G,e[17]=C,e[18]=O):O=e[18];let Z;e[19]!==a?(Z=a("Schema view"),e[19]=a,e[20]=Z):Z=e[20];let ee=I==="graph",de=I==="graph",D;e[21]!==de?(D=lt(de),e[21]=de,e[22]=D):D=e[22];let te;e[23]!==a?(te=a("Graph"),e[23]=a,e[24]=te):te=e[24];let j;e[25]!==B||e[26]!==ee||e[27]!==D||e[28]!==te?(j=(0,t.jsx)("button",{"aria-selected":ee,className:D,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:te}),e[25]=B,e[26]=ee,e[27]=D,e[28]=te,e[29]=j):j=e[29];let ye=I==="list",ce=I==="list",be;e[30]!==ce?(be=lt(ce),e[30]=ce,e[31]=be):be=e[31];let R;e[32]!==a?(R=a("Table list"),e[32]=a,e[33]=R):R=e[33];let X;e[34]!==k||e[35]!==ye||e[36]!==be||e[37]!==R?(X=(0,t.jsx)("button",{"aria-selected":ye,className:be,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:R}),e[34]=k,e[35]=ye,e[36]=be,e[37]=R,e[38]=X):X=e[38];let V;e[39]!==j||e[40]!==X||e[41]!==Z?(V=(0,t.jsxs)("div",{"aria-label":Z,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[j,X]}),e[39]=j,e[40]=X,e[41]=Z,e[42]=V):V=e[42];let le;e[43]!==V||e[44]!==O?(le=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[O,V]}),e[43]=V,e[44]=O,e[45]=le):le=e[45];let U;e[46]!==xe||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ae;e[50]!==Y||e[51]!==a||e[52]!==F||e[53]!==I?(ae=I==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:Y,placeholder:a("Filter tables"),value:F}),e[50]=Y,e[51]=a,e[52]=F,e[53]=I,e[54]=ae):ae=e[54];let z;e[55]!==d||e[56]!==g||e[57]!==b||e[58]!==S||e[59]!==C||e[60]!==I?(z=I==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),(0,t.jsx)(Qe,{columnsError:S[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=g,e[57]=b,e[58]=S,e[59]=C,e[60]=I,e[61]=z):z=e[61];let ne;e[62]!==c||e[63]!==g||e[64]!==o||e[65]!==p||e[66]!==i||e[67]!==v||e[68]!==b||e[69]!==P||e[70]!==_||e[71]!==L||e[72]!==C||e[73]!==a||e[74]!==$||e[75]!==he||e[76]!==Q||e[77]!==I?(ne=I==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ge,{children:a("Shard tables")}),$!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Ke,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),$!==null&&$.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),$!==null&&$.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let re=`${C}:${f.name}`,H=L[re]??[];return(0,t.jsxs)(et,{expanded:o===f.name,name:f.name,onToggle:r(()=>{ue(he(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(tt,{columns:c[re]??Ze,testId:`sc-columns-${f.name}`}),H.length>0&&(0,t.jsx)(It,{heading:a("Indexes"),indexes:H,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ge,{children:a("Global tables (D1)")}),_!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:p.length})]}),(0,t.jsx)(Ke,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),_!==null&&_.length===0&&(0,t.jsx)(We,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),_!==null&&_.length>0&&p.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),p.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:p.map(f=>(0,t.jsx)(et,{expanded:P===f.name,name:f.name,onToggle:r(()=>{ue(Q(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(tt,{columns:v[f.name]??Ze,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=g,e[64]=o,e[65]=p,e[66]=i,e[67]=v,e[68]=b,e[69]=P,e[70]=_,e[71]=L,e[72]=C,e[73]=a,e[74]=$,e[75]=he,e[76]=Q,e[77]=I,e[78]=ne):ne=e[78];let se;return e[79]!==le||e[80]!==U||e[81]!==ae||e[82]!==z||e[83]!==ne?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,U,ae,z,ne]}),e[79]=le,e[80]=U,e[81]=ae,e[82]=z,e[83]=ne,e[84]=se):se=e[84],se},"Wt");function At(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(At,"It");function Ft(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(ze,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(ze,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Ft,"kt");function zt(s){return s.name}r(zt,"At");export{Xt as SchemaViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-6UN4V2HB.js";import{b as M}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ee}from"./chunk-MCLM2QJI.js";import{b as Z}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{d as se,f as X}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as re}from"./chunk-UANVABQG.js";import{a as O}from"./chunk-IYWVSMAY.js";import{d as le,s as ne}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as k,d as ae,f as ce,g as me,i as Y}from"./chunk-R5ZTCHCE.js";var te=ae(ce(),1);var a=ae(me(),1);var pe="/_lunora/health",he="/_lunora/health/ready",ue=k((r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,"me"),fe=k(()=>{let r=X();return async e=>{let w=e==="ready"?he:pe,t=r.getAuthToken(),y=ue(r.url,w);try{let i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),p=null;try{p=await i.json()}catch{p=null}return{body:p,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},"pe"),ge={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ye=k(r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok","fe"),ie=k(r=>{let e=(0,te.c)(13),{label:w,level:t,testId:y,value:i}=r,p=ge[t],d;e[0]!==p?(d=Y("size-1.5 shrink-0 rounded-full",p),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==d?(o=(0,a.jsx)("span",{"aria-hidden":"true",className:d}),e[2]=d,e[3]=o):o=e[3];let c;e[4]!==w||e[5]!==o?(c=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[o,w]}),e[4]=w,e[5]=o,e[6]=c):c=e[6];let h;e[7]!==y||e[8]!==i?(h=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=h):h=e[9];let C;return e[10]!==c||e[11]!==h?(C=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[c,h]})}),e[10]=c,e[11]=h,e[12]=C):C=e[12],C},"Z"),Pe=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=le(),y=X(),i=fe(),p=w??i,d;e[0]!==p?(d=k(async()=>{let[s,n]=await Promise.all([p("live"),p("ready")]);return{live:s,ready:n}},"o"),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==y?(o=y.clientIdentifier(),e[2]=y,e[3]=o):o=e[3];let c;e[4]!==o?(c=["deployment-health",o],e[4]=o,e[5]=c):c=e[5];let h;e[6]!==d||e[7]!==c?(h={queryFn:d,queryKey:c},e[6]=d,e[7]=c,e[8]=h):h=e[8];let{data:C,isPending:de}=se(h),Q=C?.live??null,oe=C?.ready??null;if(de){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(ee,{className:"h-16 w-full"}),(0,a.jsx)(ee,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}let l=Q?.body??null;if(l===null){let s=Q?.status===403,n;e[10]!==s||e[11]!==Q?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:Q?.error??t("no response")}),e[10]=s,e[11]=Q?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let f;return e[16]!==n||e[17]!==m?(f=(0,a.jsx)(re,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=f):f=e[18],f}let J;e[19]!==l.status?(J=ye(l.status),e[19]=l.status,e[20]=J):J=e[20];let W=J,u;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],u=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],u=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],u=s}let j=oe?.ok??!1,G=j?"ok":"crit",H,I,P,x,N,v,S,V,b,_;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==W||e[32]!==G||e[33]!==j||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);I="flex flex-col gap-6",P="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(x=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=x):x=e[49];let m;e[50]!==u?(m=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:u}),e[50]=u,e[51]=m):m=e[51];let f;e[52]!==l.appName||e[53]!==l.appVersion?(f=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," \xB7 ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=f):f=e[54];let D;e[55]!==m||e[56]!==f?(D=(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"grid leading-tight",children:[m,f]})}),e[55]=m,e[56]=f,e[57]=D):D=e[57];let L;e[58]!==t?(L=t("Checked"),e[58]=t,e[59]=L):L=e[59];let T;e[60]!==L?(T=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:L}),e[60]=L,e[61]=T):T=e[61];let $;e[62]!==l.timestamp?($=ne(l.timestamp),e[62]=l.timestamp,e[63]=$):$=e[63];let q;e[64]!==$?(q=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:$}),e[64]=$,e[65]=q):q=e[65];let B;e[66]!==T||e[67]!==q?(B=(0,a.jsxs)("div",{className:"text-end",children:[T,q]}),e[66]=T,e[67]=q,e[68]=B):B=e[68],e[69]!==D||e[70]!==B?(N=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[D,B]})}),e[69]=D,e[70]=B,e[71]=N):N=e[71];let E;e[72]!==t?(E=t("Liveness"),e[72]=t,e[73]=E):E=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==E?(R=(0,a.jsx)(ie,{label:E,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=E,e[77]=R):R=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let A;e[80]!==j||e[81]!==t?(A=t(j?"Ready":"Not ready"),e[80]=j,e[81]=t,e[82]=A):A=e[82];let F;e[83]!==G||e[84]!==U||e[85]!==A?(F=(0,a.jsx)(ie,{label:U,level:G,testId:"dh-readiness",value:A}),e[83]=G,e[84]=U,e[85]=A,e[86]=F):F=e[86],e[87]!==R||e[88]!==F?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[R,F]}),e[87]=R,e[88]=F,e[89]=v):v=e[89],H=O,S="gap-0 py-0",V="dh-checks";let K;e[90]!==t?(K=t("Subsystem checks"),e[90]=t,e[91]=K):K=e[91],e[92]!==K?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K})}),e[92]=K,e[93]=b):b=e[93],_=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(g=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${g.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Y("size-1.5 shrink-0 rounded-full",g.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:g.name}),g.critical&&(0,a.jsx)(Z,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[g.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:g.message}),(0,a.jsx)(Z,{"data-testid":`dh-check-status-${g.name}`,variant:g.status==="up"?"secondary":"destructive",children:g.status==="up"?t("Up"):t("Down")})]})]},g.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=W,e[32]=G,e[33]=j,e[34]=u,e[35]=t,e[36]=H,e[37]=I,e[38]=P,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=_}else H=e[36],I=e[37],P=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],_=e[45];let z;e[94]!==H||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==_?(z=(0,a.jsxs)(H,{className:S,"data-testid":V,children:[b,_]}),e[94]=H,e[95]=S,e[96]=V,e[97]=b,e[98]=_,e[99]=z):z=e[99];let M;return e[100]!==I||e[101]!==P||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:I,"data-testid":P,children:[x,N,v,z]}),e[100]=I,e[101]=P,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"Pe");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Pe as DeploymentHealthPanel};
|