import{b1 as p,j as n,h as e,S as d}from"./vendor-ClLR6ncd.js";import{q as c,b as m,M as u}from"./lodash-ZyeDnt0e.js";import{L as h}from"./index-OtVJl4GC.js";import{O as g}from"./OptionallyDenseMuiTable-D7b58l1V.js";import{B as b}from"./Box-Co2WcNPC.js";import{T as I}from"./TableContainer-CN5gAdqf.js";import{a as T,c as y,T as w,b as f}from"./TableRow-CGDSOtFZ.js";function j(o,t=[]){return m(o,(i,r)=>u(i)?j(i,t.concat(r)):{key:t.concat(r).join("."),val:i})}function x({col1:o,col2:t,firstCollSx:i}){return n.jsxs(w,{children:[n.jsx(f,{sx:i,children:o}),n.jsx(f,{children:t})]})}function S({queryInfo:o}){return n.jsx(I,{component:"div",children:n.jsxs(g,{children:[n.jsx(T,{children:n.jsx(x,{col1:"Key",col2:"Value"})}),n.jsx(y,{children:j(o).map(({key:t,val:i})=>n.jsx(x,{firstCollSx:t.startsWith("warn")?{color:"warning.light"}:void 0,col1:t,col2:i},[t,i].join(".")))})]})})}const l={pl:2,pr:2};function a({title:o}){return n.jsxs(e,{variant:"h5",sx:l,children:[o,":"]})}function s({text:o,textTitle:t,variables:i,info:r}){return n.jsxs(d,{spacing:1,children:[i?n.jsxs(n.Fragment,{children:[n.jsx(a,{title:"Variables"}),n.jsx(e,{sx:l,children:i.join(" ")||"None"})]}):null,n.jsx(a,{title:"Information"}),n.jsx(S,{queryInfo:r}),typeof t=="string"&&typeof o=="string"?n.jsxs(n.Fragment,{children:[n.jsx(a,{title:t}),n.jsx(e,{variant:"body2",sx:{whiteSpace:"pre-wrap",fontFamily:"monospace",...l},children:o.trim()})]}):null]})}function C({log:o,...t}){return n.jsx(s,{text:o,textTitle:"Log",...t})}function F({plan:o,...t}){return n.jsx(s,{text:o,textTitle:"Plan",...t})}function O({queryResult:o}){return o.queryInfo?n.jsx(s,{info:o.queryInfo}):o.log?n.jsx(C,{...c(o,["log","variables","info"])}):o.plan?n.jsx(F,{...c(o,["plan","variables","info"])}):o.info?n.jsx(s,{info:o.info}):null}const B=o=>["info","queryInfo","log","plan"].every(i=>!(o&&o[i]));function E(){const{queryResult:o,isTableFetching:t}=p();return t?n.jsx(h,{}):B(o)?n.jsx(e,{sx:{color:"text.disabled",p:2,textAlign:"center"},children:"Click on the execute button to get information on query"}):n.jsx(b,{sx:{pt:2},children:n.jsx(O,{queryResult:o})})}export{E as default};
