@malloy-publisher/sdk 0.0.21 → 0.0.22

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.cjs.js CHANGED
@@ -2885,7 +2885,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${u.do
2885
2885
  packageName="${u}"
2886
2886
  modelPath="${d}"
2887
2887
  accessToken={accessToken}
2888
- />`}D.axios.defaults.baseURL="http://localhost:4000";const $0r=new nIe(new Oo),B0r=new D.QueryClient;function q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["package",a,u,d,f],queryFn:()=>$0r.getPackage(u,d,f,!1,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},B0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsxs(D.List,{dense:!0,disablePadding:!0,children:[D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Name",secondary:d})}),!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fethching Package Metadata..."}),x&&(g.data&&D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Description",secondary:g.data.description})})||D.jsxRuntimeExports.jsxs(D.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[D.jsxRuntimeExports.jsx(D.ErrorIcon,{sx:{color:"grey.600",mr:"10px"}}),D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"No package manifest"})]})),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})})]})})}const U0r=new Aie(new Oo),z0r=new D.QueryClient;function H0r({connectionProps:a,connection:u}){const{projectName:d}=a;return D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{cursor:"pointer",color:"primary.main"},onClick:()=>a.navigate(`/${d}/connections/${u.name}/`),children:u.name})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:u.type})})]},u.name)}function G0r(a){const{server:u,projectName:d,accessToken:f}=a,{data:m,isSuccess:g,isError:x,error:E}=D.useQuery({queryKey:["connections",u,d],queryFn:()=>U0r.listConnections(d,{baseURL:u,withCredentials:!f,headers:{Authorization:f&&`Bearer ${f}`}}),retry:!1},z0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!g&&!x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Connections..."}),g&&m.data.length>0&&D.jsxRuntimeExports.jsx(D.Table,{size:"small",children:D.jsxRuntimeExports.jsxs(D.TableBody,{children:[D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),m.data.map(v=>D.jsxRuntimeExports.jsx(H0r,{connectionProps:a,connection:v},v.name))]})}),g&&m.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Connections"}),x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} - ${E.message}`})]})]})})}const W0r=new WHt(new Oo),V0r=new D.QueryClient;function Q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["databases",a,u,d,f],queryFn:()=>W0r.listDatabases(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},V0r),_=S=>S>=1024*1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} T`:S>=1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} G`:S>=1024*1024?`${(S/(1024*1024)).toFixed(2)} M`:`${(S/1024).toFixed(2)} K`;return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Databases..."}),x&&g.data.length>0&&D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Database Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Table Rows"})})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(S=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(Y0r,{database:S})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:_(S.info.rowCount)})})]},S.path))})]})}),x&&g.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Embedded Databases"}),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})]})})}function Y0r({database:a}){const[u,d]=Pe.useState(!1);return D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{display:"flex",alignItems:"center"},onClick:()=>d(!u),style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",color:"primary",sx:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path})," ",D.jsxRuntimeExports.jsx(D.Box$1,{sx:{display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mr:1,display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsxRuntimeExports.jsx("path",{d:"M11 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M9 15L20 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M15 4H20V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),D.jsxRuntimeExports.jsx(K0r,{database:a,open:u,setClose:()=>d(!1)})]})}function K0r({database:a,open:u,setClose:d}){return D.jsxRuntimeExports.jsxs(D.Dialog,{open:u,onClose:d,maxWidth:"sm",fullWidth:!0,children:[D.jsxRuntimeExports.jsxs(D.DialogTitle,{children:["Schema:"," ",D.jsxRuntimeExports.jsx(D.Typography,{fontSize:"large",variant:"body2",fontFamily:"monospace",component:"span",children:a.path}),D.jsxRuntimeExports.jsx(D.IconButton,{"aria-label":"close",onClick:d,sx:{position:"absolute",right:8,top:8},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),D.jsxRuntimeExports.jsx(D.DialogContent,{children:D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:"NAME"}),D.jsxRuntimeExports.jsx(D.TableCell,{children:"TYPE"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:a.info.columns.map(f=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:f.name}),D.jsxRuntimeExports.jsx(D.TableCell,{children:f.type})]},f.name))})]})})})]})}function Nqe({items:a,defaultExpandedItems:u,navigate:d}){return D.jsxRuntimeExports.jsx(D.RichTreeView,{items:tgr(a,d),defaultExpandedItems:u,slots:{item:egr}})}const X0r=D.animated(D.Collapse);function J0r(a){const u=D.useSpring({to:{opacity:a.in?1:0,transform:`translate3d(0,${a.in?0:20}px,0)`}});return D.jsxRuntimeExports.jsx(X0r,{style:u,...a})}function Z0r({item:a,...u}){return D.jsxRuntimeExports.jsxs(D.TreeItem2Label,{...u,sx:{display:"flex",alignItems:"center",color:"grey.600"},children:[a.fileType==="directory"&&D.jsxRuntimeExports.jsx(D.FolderIcon,{})||a.fileType==="notebook"&&D.jsxRuntimeExports.jsx(D.ArticleIcon,{})||a.fileType==="model"&&D.jsxRuntimeExports.jsx(D.DataArrayIcon,{})||a.fileType=="database"&&D.jsxRuntimeExports.jsx(D.DnsIcon,{})||D.jsxRuntimeExports.jsx(D.ErrorIcon,{}),D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{marginLeft:"5px"},color:a.link?"primary.main":"grey.600",children:a.label})]})}const egr=Y.forwardRef(function(u,d){const{id:f,itemId:m,label:g,children:x,disabled:E,...v}=u,{getRootProps:_,getContentProps:S,getLabelProps:R,getIconContainerProps:w,getGroupTransitionProps:N,status:k,publicAPI:B}=D.unstable_useTreeItem2({id:f,itemId:m,children:x,label:g,disabled:E,rootRef:d}),P=B.getItem(m);return k.selected=!1,k.focused=!1,D.jsxRuntimeExports.jsx(D.TreeItem2Provider,{itemId:m,children:D.jsxRuntimeExports.jsxs(D.TreeItem2Root,{..._(v),children:[D.jsxRuntimeExports.jsxs(D.TreeItem2Content,{...S(),...P.link&&{onClick:()=>P.link()},sx:{pointerEvents:!P.selectable&&"none"},children:[D.jsxRuntimeExports.jsx(D.TreeItem2IconContainer,{...w(),children:D.jsxRuntimeExports.jsx(D.TreeItem2Icon,{status:k})}),D.jsxRuntimeExports.jsx(Z0r,{...R({item:P})})]}),x&&D.jsxRuntimeExports.jsx(J0r,{...N()})]})})});function tgr(a,u){const d=new Map;return a.map(f=>{let m=d;const g=f.path.split("/");g.forEach((x,E)=>{E===g.length-1?m.set(x,f):(m.has(x)||m.set(x,new Map),m=m.get(x))})}),Dqe(d,"",u)}function Dqe(a,u,d){const f=[];return a.forEach((m,g)=>{const x=g.endsWith(".malloy")&&"model"||g.endsWith(".malloynb")&&"notebook"||g.endsWith(".parquet")&&"database"||"unknown";x!=="unknown"?f.push({id:u+g,label:g,fileType:x,link:x==="model"||x==="notebook"?d.bind(null,u+g):void 0,selectable:x==="model"||x==="notebook"}):(u+=`${g}/`,f.push({id:u,label:g,fileType:"directory",selectable:!0,link:void 0,children:Dqe(m,u,d)}))}),f}D.axios.defaults.baseURL="http://localhost:4000";const rgr=new TM(new Oo),ngr=new D.QueryClient,igr=["notebooks/","models/"];function sgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isSuccess:E,isError:v,error:_}=D.useQuery({queryKey:["models",a,u,d,f],queryFn:()=>rgr.listModels(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},ngr);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!E&&!v&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Models"}),E&&x.data.length>0&&D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:igr,navigate:m}),v&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${_.message}`})]})]})})}const ogr=new rIe(new Oo),agr=new D.QueryClient,lgr=["notebooks/"];function ugr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isSuccess:E,isError:v,error:_}=D.useQuery({queryKey:["notebooks",a,u,d,f],queryFn:()=>ogr.listNotebooks(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},agr);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!E&&!v&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Notebooks"}),E&&x.data.length>0&&D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:lgr,navigate:m}),v&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${_.message}`})]})]})})}D.axios.defaults.baseURL="http://localhost:4000";const cgr=new tGt(new Oo),dgr=new D.QueryClient;function fgr({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isError:x,isLoading:E,error:v}=D.useQuery({queryKey:["schedules",a,u,d,f],queryFn:()=>cgr.listSchedules(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},dgr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Schedules..."}):x?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} > ${f} - ${v.message}`}):g.data.length?D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsx(D.TableContainer,{component:D.Paper,children:D.jsxRuntimeExports.jsxs(D.Table,{sx:{minWidth:300},size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Resource"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Schedule"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Action"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Connection"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Last Run"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Status"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(_=>D.jsxRuntimeExports.jsxs(D.TableRow,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.resource}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.schedule}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.action}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.connection}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunTime?new Date(_.lastRunTime).toLocaleString():"n/a"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunStatus})]},_.resource))})]})})})]})}):null}const hgr="README.malloynb";function pgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){return m||(m=x=>{window.location.href=x}),D.jsxRuntimeExports.jsx(FIe,{server:a,accessToken:g,projectName:u,packageName:d,versionId:f,children:D.jsxRuntimeExports.jsxs(D.Grid,{container:!0,spacing:2,columns:12,sx:{mb:x=>x.spacing(2)},children:[D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(ugr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(sgr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(Q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(G0r,{navigate:m,server:a,projectName:u,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(fgr,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(kqe,{notebookPath:hgr,expandCodeCells:!0})})]})})}const mgr=Pe.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-DjdrYRPY.cjs")));function ggr({cell:a,notebookPath:u,queryResultCodeSnippet:d,expandCodeCell:f,hideCodeCellIcon:m,expandEmbedding:g,hideEmbeddingIcon:x}){const[E,v]=Pe.useState(f||a.type==="code"&&!a.result),[_,S]=Pe.useState(g),[R,w]=Pe.useState(),[N,k]=Pe.useState(),[B,P]=Pe.useState(!1);return Pe.useEffect(()=>{a.type==="code"&&zv(a.text,"malloy").then($=>{w($)})},[a]),Pe.useEffect(()=>{zv(d,"typescript").then($=>{k($)})},[d]),a.type==="markdown"&&D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{border:0},children:D.jsxRuntimeExports.jsx(Va,{children:D.jsxRuntimeExports.jsx(D.Markdown,{children:a.text})})})||a.type==="code"&&D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[(!m||!x&&a.result)&&D.jsxRuntimeExports.jsx(D.Stack,{sx:{flexDirection:"row",justifyContent:"right"},children:D.jsxRuntimeExports.jsxs(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:[!m&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:E?"Hide Code":"View Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{v(!E)},children:D.jsxRuntimeExports.jsx(D.CodeIcon,{})})}),!x&&a.result&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:_?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{S(!_)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})}),a.newSources&&a.newSources.length>0&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Explore Data Sources",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{P(!B),S(!1),v(!1)},children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h10v2H7v-2z",fill:"currentColor"})})})})]})}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:N}}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(d)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:E,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:D.jsxRuntimeExports.jsx(D.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:R}})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:B,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px"},children:D.jsxRuntimeExports.jsx(D.Typography,{children:"Sources"})}),D.jsxRuntimeExports.jsx(Uoe,{sourceAndPaths:a.newSources.map($=>({sourceInfo:JSON.parse($),modelPath:u}))})]}),a.result&&!B&&D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx(D.Divider,{sx:{mb:"10px"}}),D.jsxRuntimeExports.jsx(D.CardContent,{sx:{maxHeight:"800px",overflow:"auto"},children:D.jsxRuntimeExports.jsx(Pe.Suspense,{fallback:"Loading malloy...",children:D.jsxRuntimeExports.jsx(mgr,{result:a.result})})})]})]})}const xgr=new rIe(new Oo),ygr=new D.QueryClient;function kqe({notebookPath:a,expandCodeCells:u,hideCodeCellIcons:d,expandEmbeddings:f,hideEmbeddingIcons:m}){const[g,x]=Pe.useState(!1),[E,v]=Pe.useState(),{server:_,projectName:S,packageName:R,accessToken:w,versionId:N}=gS(),k=bgr(_,R,a,!0);Pe.useEffect(()=>{zv(k,"typescript").then(z=>{v(z)})},[g,k]);const{data:B,isSuccess:P,isError:$,error:q}=D.useQuery({queryKey:["notebook",_,S,R,a,N],queryFn:()=>xgr.getNotebook(S,R,a,N,{baseURL:_,withCredentials:!w,headers:{Authorization:w&&`Bearer ${w}`}}),retry:!1},ygr);return D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsxs(D.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebook"}),D.jsxRuntimeExports.jsx(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:D.jsxRuntimeExports.jsx(D.Tooltip,{title:g?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{x(!g)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:D.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:E}})}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(k)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsx(D.Divider,{})]}),D.jsxRuntimeExports.jsx(mS,{children:D.jsxRuntimeExports.jsxs(D.Stack,{spacing:1,component:"section",children:[!P&&!$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebook..."}),P&&B.data.notebookCells?.map((z,W)=>D.jsxRuntimeExports.jsx(ggr,{cell:z,notebookPath:a,queryResultCodeSnippet:vgr(_,S,R,a,z.text),expandCodeCell:u,hideCodeCellIcon:d,expandEmbedding:f,hideEmbeddingIcon:m},W)),$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:q.message.includes("404")&&`${a} does not exist`||`${S} > ${R} > ${a} > ${N} - ${q.message}`})]})})]})}function vgr(a,u,d,f,m){return`<QueryResult
2888
+ />`}D.axios.defaults.baseURL="http://localhost:4000";const $0r=new nIe(new Oo),B0r=new D.QueryClient;function q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["package",a,u,d,f],queryFn:()=>$0r.getPackage(u,d,f,!1,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},B0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsxs(D.List,{dense:!0,disablePadding:!0,children:[D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Name",secondary:d})}),!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fethching Package Metadata..."}),x&&(g.data&&D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Description",secondary:g.data.description})})||D.jsxRuntimeExports.jsxs(D.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[D.jsxRuntimeExports.jsx(D.ErrorIcon,{sx:{color:"grey.600",mr:"10px"}}),D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"No package manifest"})]})),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})})]})})}const U0r=new Aie(new Oo),z0r=new D.QueryClient;function H0r({connectionProps:a,connection:u}){const{projectName:d}=a;return D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{cursor:"pointer",color:"primary.main"},onClick:()=>a.navigate(`/${d}/connections/${u.name}/`),children:u.name})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:u.type})})]},u.name)}function G0r(a){const{server:u,projectName:d,accessToken:f}=a,{data:m,isSuccess:g,isError:x,error:E}=D.useQuery({queryKey:["connections",u,d],queryFn:()=>U0r.listConnections(d,{baseURL:u,withCredentials:!f,headers:{Authorization:f&&`Bearer ${f}`}}),retry:!1},z0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!g&&!x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Connections..."}),g&&m.data.length>0&&D.jsxRuntimeExports.jsx(D.Table,{size:"small",children:D.jsxRuntimeExports.jsxs(D.TableBody,{children:[D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),m.data.map(v=>D.jsxRuntimeExports.jsx(H0r,{connectionProps:a,connection:v},v.name))]})}),g&&m.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Connections"}),x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} - ${E.message}`})]})]})})}const W0r=new WHt(new Oo),V0r=new D.QueryClient;function Q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["databases",a,u,d,f],queryFn:()=>W0r.listDatabases(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},V0r),_=S=>S>=1024*1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} T`:S>=1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} G`:S>=1024*1024?`${(S/(1024*1024)).toFixed(2)} M`:`${(S/1024).toFixed(2)} K`;return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Databases..."}),x&&g.data.length>0&&D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Database Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Table Rows"})})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(S=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(Y0r,{database:S})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:_(S.info.rowCount)})})]},S.path))})]})}),x&&g.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Embedded Databases"}),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})]})})}function Y0r({database:a}){const[u,d]=Pe.useState(!1);return D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{display:"flex",alignItems:"center"},onClick:()=>d(!u),style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",color:"primary",sx:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path})," ",D.jsxRuntimeExports.jsx(D.Box$1,{sx:{display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mr:1,display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsxRuntimeExports.jsx("path",{d:"M11 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M9 15L20 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M15 4H20V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),D.jsxRuntimeExports.jsx(K0r,{database:a,open:u,setClose:()=>d(!1)})]})}function K0r({database:a,open:u,setClose:d}){return D.jsxRuntimeExports.jsxs(D.Dialog,{open:u,onClose:d,maxWidth:"sm",fullWidth:!0,children:[D.jsxRuntimeExports.jsxs(D.DialogTitle,{children:["Schema:"," ",D.jsxRuntimeExports.jsx(D.Typography,{fontSize:"large",variant:"body2",fontFamily:"monospace",component:"span",children:a.path}),D.jsxRuntimeExports.jsx(D.IconButton,{"aria-label":"close",onClick:d,sx:{position:"absolute",right:8,top:8},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),D.jsxRuntimeExports.jsx(D.DialogContent,{children:D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:"NAME"}),D.jsxRuntimeExports.jsx(D.TableCell,{children:"TYPE"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:a.info.columns.map(f=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:f.name}),D.jsxRuntimeExports.jsx(D.TableCell,{children:f.type})]},f.name))})]})})})]})}function Nqe({items:a,defaultExpandedItems:u,navigate:d}){return D.jsxRuntimeExports.jsx(D.RichTreeView,{items:tgr(a,d),defaultExpandedItems:u,slots:{item:egr}})}const X0r=D.animated(D.Collapse);function J0r(a){const u=D.useSpring({to:{opacity:a.in?1:0,transform:`translate3d(0,${a.in?0:20}px,0)`}});return D.jsxRuntimeExports.jsx(X0r,{style:u,...a})}function Z0r({item:a,...u}){return D.jsxRuntimeExports.jsxs(D.TreeItem2Label,{...u,sx:{display:"flex",alignItems:"center",color:"grey.600"},children:[a.fileType==="directory"&&D.jsxRuntimeExports.jsx(D.FolderIcon,{})||a.fileType==="notebook"&&D.jsxRuntimeExports.jsx(D.ArticleIcon,{})||a.fileType==="model"&&D.jsxRuntimeExports.jsx(D.DataArrayIcon,{})||a.fileType=="database"&&D.jsxRuntimeExports.jsx(D.DnsIcon,{})||D.jsxRuntimeExports.jsx(D.ErrorIcon,{}),D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{marginLeft:"5px"},color:a.link?"primary.main":"grey.600",children:a.label})]})}const egr=Y.forwardRef(function(u,d){const{id:f,itemId:m,label:g,children:x,disabled:E,...v}=u,{getRootProps:_,getContentProps:S,getLabelProps:R,getIconContainerProps:w,getGroupTransitionProps:N,status:k,publicAPI:B}=D.unstable_useTreeItem2({id:f,itemId:m,children:x,label:g,disabled:E,rootRef:d}),P=B.getItem(m);return k.selected=!1,k.focused=!1,D.jsxRuntimeExports.jsx(D.TreeItem2Provider,{itemId:m,children:D.jsxRuntimeExports.jsxs(D.TreeItem2Root,{..._(v),children:[D.jsxRuntimeExports.jsxs(D.TreeItem2Content,{...S(),...P.link&&{onClick:()=>P.link()},sx:{pointerEvents:!P.selectable&&"none"},children:[D.jsxRuntimeExports.jsx(D.TreeItem2IconContainer,{...w(),children:D.jsxRuntimeExports.jsx(D.TreeItem2Icon,{status:k})}),D.jsxRuntimeExports.jsx(Z0r,{...R({item:P})})]}),x&&D.jsxRuntimeExports.jsx(J0r,{...N()})]})})});function tgr(a,u){const d=new Map;return a.map(f=>{let m=d;const g=f.path.split("/");g.forEach((x,E)=>{E===g.length-1?m.set(x,f):(m.has(x)||m.set(x,new Map),m=m.get(x))})}),Dqe(d,"",u)}function Dqe(a,u,d){const f=[];return a.forEach((m,g)=>{const x=g.endsWith(".malloy")&&"model"||g.endsWith(".malloynb")&&"notebook"||g.endsWith(".parquet")&&"database"||"unknown";x!=="unknown"?f.push({id:u+g,label:g,fileType:x,link:x==="model"||x==="notebook"?d.bind(null,u+g):void 0,selectable:x==="model"||x==="notebook"}):(u+=`${g}/`,f.push({id:u,label:g,fileType:"directory",selectable:!0,link:void 0,children:Dqe(m,u,d)}))}),f}D.axios.defaults.baseURL="http://localhost:4000";const rgr=new TM(new Oo),ngr=new D.QueryClient,igr=["notebooks/","models/"];function sgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isError:E,error:v,isLoading:_}=D.useQuery({queryKey:["models",a,u,d,f],queryFn:()=>rgr.listModels(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},ngr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`}):_?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Models..."}):D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:igr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No models found"})})]})})}const ogr=new rIe(new Oo),agr=new D.QueryClient,lgr=["notebooks/"];function ugr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isLoading:E,isError:v,error:_}=D.useQuery({queryKey:["notebooks",a,u,d,f],queryFn:()=>ogr.listNotebooks(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},agr);return v?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${_.message}`}):E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebooks..."}):D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:lgr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No notebooks found"})})]})})}D.axios.defaults.baseURL="http://localhost:4000";const cgr=new tGt(new Oo),dgr=new D.QueryClient;function fgr({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isError:x,isLoading:E,error:v}=D.useQuery({queryKey:["schedules",a,u,d,f],queryFn:()=>cgr.listSchedules(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},dgr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Schedules..."}):x?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} > ${f} - ${v.message}`}):g.data.length?D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsx(D.TableContainer,{component:D.Paper,children:D.jsxRuntimeExports.jsxs(D.Table,{sx:{minWidth:300},size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Resource"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Schedule"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Action"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Connection"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Last Run"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Status"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(_=>D.jsxRuntimeExports.jsxs(D.TableRow,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.resource}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.schedule}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.action}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.connection}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunTime?new Date(_.lastRunTime).toLocaleString():"n/a"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunStatus})]},_.resource))})]})})})]})}):null}const hgr="README.malloynb";function pgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){return m||(m=x=>{window.location.href=x}),D.jsxRuntimeExports.jsx(FIe,{server:a,accessToken:g,projectName:u,packageName:d,versionId:f,children:D.jsxRuntimeExports.jsxs(D.Grid,{container:!0,spacing:2,columns:12,sx:{mb:x=>x.spacing(2)},children:[D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(ugr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(sgr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(Q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(G0r,{navigate:m,server:a,projectName:u,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(fgr,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(kqe,{notebookPath:hgr,expandCodeCells:!0})})]})})}const mgr=Pe.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-DjdrYRPY.cjs")));function ggr({cell:a,notebookPath:u,queryResultCodeSnippet:d,expandCodeCell:f,hideCodeCellIcon:m,expandEmbedding:g,hideEmbeddingIcon:x}){const[E,v]=Pe.useState(f||a.type==="code"&&!a.result),[_,S]=Pe.useState(g),[R,w]=Pe.useState(),[N,k]=Pe.useState(),[B,P]=Pe.useState(!1);return Pe.useEffect(()=>{a.type==="code"&&zv(a.text,"malloy").then($=>{w($)})},[a]),Pe.useEffect(()=>{zv(d,"typescript").then($=>{k($)})},[d]),a.type==="markdown"&&D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{border:0},children:D.jsxRuntimeExports.jsx(Va,{children:D.jsxRuntimeExports.jsx(D.Markdown,{children:a.text})})})||a.type==="code"&&D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[(!m||!x&&a.result)&&D.jsxRuntimeExports.jsx(D.Stack,{sx:{flexDirection:"row",justifyContent:"right"},children:D.jsxRuntimeExports.jsxs(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:[!m&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:E?"Hide Code":"View Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{v(!E)},children:D.jsxRuntimeExports.jsx(D.CodeIcon,{})})}),!x&&a.result&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:_?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{S(!_)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})}),a.newSources&&a.newSources.length>0&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Explore Data Sources",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{P(!B),S(!1),v(!1)},children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h10v2H7v-2z",fill:"currentColor"})})})})]})}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:N}}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(d)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:E,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:D.jsxRuntimeExports.jsx(D.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:R}})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:B,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px"},children:D.jsxRuntimeExports.jsx(D.Typography,{children:"Sources"})}),D.jsxRuntimeExports.jsx(Uoe,{sourceAndPaths:a.newSources.map($=>({sourceInfo:JSON.parse($),modelPath:u}))})]}),a.result&&!B&&D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx(D.Divider,{sx:{mb:"10px"}}),D.jsxRuntimeExports.jsx(D.CardContent,{sx:{maxHeight:"800px",overflow:"auto"},children:D.jsxRuntimeExports.jsx(Pe.Suspense,{fallback:"Loading malloy...",children:D.jsxRuntimeExports.jsx(mgr,{result:a.result})})})]})]})}const xgr=new rIe(new Oo),ygr=new D.QueryClient;function kqe({notebookPath:a,expandCodeCells:u,hideCodeCellIcons:d,expandEmbeddings:f,hideEmbeddingIcons:m}){const[g,x]=Pe.useState(!1),[E,v]=Pe.useState(),{server:_,projectName:S,packageName:R,accessToken:w,versionId:N}=gS(),k=bgr(_,R,a,!0);Pe.useEffect(()=>{zv(k,"typescript").then(z=>{v(z)})},[g,k]);const{data:B,isSuccess:P,isError:$,error:q}=D.useQuery({queryKey:["notebook",_,S,R,a,N],queryFn:()=>xgr.getNotebook(S,R,a,N,{baseURL:_,withCredentials:!w,headers:{Authorization:w&&`Bearer ${w}`}}),retry:!1},ygr);return D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsxs(D.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebook"}),D.jsxRuntimeExports.jsx(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:D.jsxRuntimeExports.jsx(D.Tooltip,{title:g?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{x(!g)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:D.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:E}})}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(k)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsx(D.Divider,{})]}),D.jsxRuntimeExports.jsx(mS,{children:D.jsxRuntimeExports.jsxs(D.Stack,{spacing:1,component:"section",children:[!P&&!$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebook..."}),P&&B.data.notebookCells?.map((z,W)=>D.jsxRuntimeExports.jsx(ggr,{cell:z,notebookPath:a,queryResultCodeSnippet:vgr(_,S,R,a,z.text),expandCodeCell:u,hideCodeCellIcon:d,expandEmbedding:f,hideEmbeddingIcon:m},W)),$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:q.message.includes("404")&&`${a} does not exist`||`${S} > ${R} > ${a} > ${N} - ${q.message}`})]})})]})}function vgr(a,u,d,f,m){return`<QueryResult
2889
2889
  server="${a}"
2890
2890
  accessToken={accessToken}
2891
2891
  projectName="${u}"