@malloy-publisher/server 0.0.74 → 0.0.75
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/app/assets/{RenderedResult-DXlUZo0k-DlCXl_SI.js → RenderedResult-DXlUZo0k-lc5JU6CQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,i as y,j as b}from"./index-
|
|
1
|
+
import{r,i as y,j as b}from"./index--hbjs-yl.js";function w({result:o,height:E,isFillElement:c,onSizeChange:f,onDrill:p}){const e=r.useRef(null),[d,h]=r.useState(!1),[m,x]=r.useState(!1),[g,v]=r.useState(!1),n=r.useRef(null),t=r.useRef(null);if(r.useLayoutEffect(()=>{if(e.current&&o&&!m){x(!0),n.current||(n.current=new Promise(s=>{t.current=s}));const u=new y.MalloyRenderer({onClick:p}).createViz();for(;e.current.firstChild;)e.current.removeChild(e.current.firstChild);const l=new MutationObserver(s=>{for(const i of s)if(i.type==="childList"&&i.addedNodes.length>0&&Array.from(i.addedNodes).some(a=>a.nodeType===Node.ELEMENT_NODE)){l.disconnect(),setTimeout(()=>{h(!0),t.current&&(t.current(),t.current=null,n.current=null)},50);break}});if(e.current){l.observe(e.current,{childList:!0,subtree:!0,characterData:!0});try{u.setResult(JSON.parse(o)),u.render(e.current)}catch(s){console.error("Error rendering visualization:",s),l.disconnect(),h(!0),t.current&&(t.current(),t.current=null,n.current=null)}}}},[o,p,m]),r.useEffect(()=>{h(!1),x(!1),n.current=null,t.current=null},[o]),m&&!d&&n.current)throw n.current;return r.useEffect(()=>{if(!e.current||!d)return;const u=e.current,l=()=>{if(u){const a=u.offsetHeight;a>0?f&&f(a):c&&u.firstChild&&(u.firstChild.offsetHeight==0?c(!0):c(!1))}},s=setTimeout(l,100);let i=null;return g||(i=new MutationObserver(l),i.observe(u,{childList:!0,subtree:!0,attributes:!0})),()=>{clearTimeout(s),i?.disconnect()}},[f,o,c,d]),b.jsx("div",{ref:e,style:{width:"100%",height:E?`${E}px`:"100%"}})}export{w as default};
|
|
@@ -3308,14 +3308,14 @@ export default theme;`}function vCe(t={},...o){const{breakpoints:s,mixins:u={},s
|
|
|
3308
3308
|
\f\r "&'<=>\``.split("")],[`\0
|
|
3309
3309
|
\f\r "&'<=>\``.split(""),`\0
|
|
3310
3310
|
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function XSr(t,o,s,u){const d=u.schema,f=d.space==="svg"?!1:u.settings.omitOptionalTags;let h=d.space==="svg"?u.settings.closeEmptyElements:u.settings.voids.includes(t.tagName.toLowerCase());const g=[];let y;d.space==="html"&&t.tagName==="svg"&&(u.schema=DCt);const b=ZSr(u,t.properties),x=u.all(d.space==="html"&&t.tagName==="template"?t.content:t);return u.schema=d,x&&(h=!1),(b||!f||!GSr(t,o,s))&&(g.push("<",t.tagName,b?" "+b:""),h&&(d.space==="svg"||u.settings.closeSelfClosing)&&(y=b.charAt(b.length-1),(!u.settings.tightSelfClosing||y==="/"||y&&y!=='"'&&y!=="'")&&g.push(" "),g.push("/")),g.push(">")),g.push(x),!h&&(!f||!Z6e(t,o,s))&&g.push("</"+t.tagName+">"),g.join("")}function ZSr(t,o){const s=[];let u=-1,d;if(o){for(d in o)if(o[d]!==null&&o[d]!==void 0){const f=JSr(t,d,o[d]);f&&s.push(f)}}for(;++u<s.length;){const f=t.settings.tightAttributes?s[u].charAt(s[u].length-1):void 0;u!==s.length-1&&f!=='"'&&f!=="'"&&(s[u]+=" ")}return s.join("")}function JSr(t,o,s){const u=nSr(t.schema,o),d=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,f=t.settings.allowDangerousCharacters?0:1;let h=t.quote,g;if(u.overloadedBoolean&&(s===u.attribute||s==="")?s=!0:(u.boolean||u.overloadedBoolean)&&(typeof s!="string"||s===u.attribute||s==="")&&(s=!!s),s==null||s===!1||typeof s=="number"&&Number.isNaN(s))return"";const y=tI(u.attribute,Object.assign({},t.settings.characterReferences,{subset:zne.name[d][f]}));return s===!0||(s=Array.isArray(s)?(u.commaSeparated?RSr:OSr)(s,{padLeft:!t.settings.tightCommaSeparatedLists}):String(s),t.settings.collapseEmptyAttributes&&!s)?y:(t.settings.preferUnquoted&&(g=tI(s,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:zne.unquoted[d][f]}))),g!==s&&(t.settings.quoteSmart&&ngt(s,h)>ngt(s,t.alternative)&&(h=t.alternative),g=h+tI(s,Object.assign({},t.settings.characterReferences,{subset:(h==="'"?zne.single:zne.double)[d][f],attribute:!0}))+h),y+(g&&"="+g))}const e_r=["<","&"];function FCt(t,o,s,u){return s&&s.type==="element"&&(s.tagName==="script"||s.tagName==="style")?t.value:tI(t.value,Object.assign({},u.settings.characterReferences,{subset:e_r}))}function t_r(t,o,s,u){return u.settings.allowDangerousHtml?t.value:FCt(t,o,s,u)}function n_r(t,o,s,u){return u.all(t)}const r_r=aSr("type",{invalid:i_r,unknown:o_r,handlers:{comment:CSr,doctype:wSr,element:XSr,raw:t_r,root:n_r,text:FCt}});function i_r(t){throw new Error("Expected node, not `"+t+"`")}function o_r(t){const o=t;throw new Error("Cannot compile unknown node `"+o.type+"`")}const a_r={},s_r={},l_r=[];function u_r(t,o){const s=a_r,u=s.quote||'"',d=u==='"'?"'":'"';if(u!=='"'&&u!=="'")throw new Error("Invalid quote `"+u+"`, expected `'` or `\"`");return{one:c_r,all:d_r,settings:{omitOptionalTags:s.omitOptionalTags||!1,allowParseErrors:s.allowParseErrors||!1,allowDangerousCharacters:s.allowDangerousCharacters||!1,quoteSmart:s.quoteSmart||!1,preferUnquoted:s.preferUnquoted||!1,tightAttributes:s.tightAttributes||!1,upperDoctype:s.upperDoctype||!1,tightDoctype:s.tightDoctype||!1,bogusComments:s.bogusComments||!1,tightCommaSeparatedLists:s.tightCommaSeparatedLists||!1,tightSelfClosing:s.tightSelfClosing||!1,collapseEmptyAttributes:s.collapseEmptyAttributes||!1,allowDangerousHtml:s.allowDangerousHtml||!1,voids:s.voids||K2r,characterReferences:s.characterReferences||s_r,closeSelfClosing:s.closeSelfClosing||!1,closeEmptyElements:s.closeEmptyElements||!1},schema:s.space==="svg"?DCt:oSr,quote:u,alternative:d}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function c_r(t,o,s){return r_r(t,o,s,this)}function d_r(t){const o=[],s=t&&t.children||l_r;let u=-1;for(;++u<s.length;)o[u]=this.one(s[u],u,t);return o.join("")}function f_r(t){return Array.isArray(t)?t:[t]}function vle(t,o=!1){const s=t.split(/(\r?\n)/g);let u=0;const d=[];for(let f=0;f<s.length;f+=2){const h=o?s[f]+(s[f+1]||""):s[f];d.push([h,u]),u+=s[f].length,u+=s[f+1]?.length||0}return d}function J6e(t){return!t||["plaintext","txt","text","plain"].includes(t)}function BCt(t){return t==="ansi"||J6e(t)}function eIe(t){return t==="none"}function jCt(t){return eIe(t)}function $Ct(t,o){if(!o)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const s=Array.isArray(o)?o:o.split(/\s+/g);for(const u of s)u&&!t.properties.class.includes(u)&&t.properties.class.push(u);return t}function p_r(t,o){let s=0;const u=[];for(const d of o)d>s&&u.push({...t,content:t.content.slice(s,d),offset:t.offset+s}),s=d;return s<t.content.length&&u.push({...t,content:t.content.slice(s),offset:t.offset+s}),u}function h_r(t,o){const s=Array.from(o instanceof Set?o:new Set(o)).sort((u,d)=>u-d);return s.length?t.map(u=>u.flatMap(d=>{const f=s.filter(h=>d.offset<h&&h<d.offset+d.content.length).map(h=>h-d.offset).sort((h,g)=>h-g);return f.length?p_r(d,f):d})):t}async function UCt(t){return Promise.resolve(typeof t=="function"?t():t).then(o=>o.default||o)}function Eoe(t,o){const s=typeof t=="string"?{}:{...t.colorReplacements},u=typeof t=="string"?t:t.name;for(const[d,f]of Object.entries(o?.colorReplacements||{}))typeof f=="string"?s[d]=f:d===u&&Object.assign(s,f);return s}function yO(t,o){return t&&(o?.[t?.toLowerCase()]||t)}function qCt(t){const o={};return t.color&&(o.color=t.color),t.bgColor&&(o["background-color"]=t.bgColor),t.fontStyle&&(t.fontStyle&y2.Italic&&(o["font-style"]="italic"),t.fontStyle&y2.Bold&&(o["font-weight"]="bold"),t.fontStyle&y2.Underline&&(o["text-decoration"]="underline")),o}function m_r(t){return typeof t=="string"?t:Object.entries(t).map(([o,s])=>`${o}:${s}`).join(";")}function g_r(t){const o=vle(t,!0).map(([d])=>d);function s(d){if(d===t.length)return{line:o.length-1,character:o[o.length-1].length};let f=d,h=0;for(const g of o){if(f<g.length)break;f-=g.length,h++}return{line:h,character:f}}function u(d,f){let h=0;for(let g=0;g<d;g++)h+=o[g].length;return h+=f,h}return{lines:o,indexToPos:s,posToIndex:u}}class gf extends Error{constructor(o){super(o),this.name="ShikiError"}}const zCt=new WeakMap;function Ele(t,o){zCt.set(t,o)}function Jq(t){return zCt.get(t)}class PL{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(o,s){return new PL(Object.fromEntries(f_r(s).map(u=>[u,OCe])),o)}constructor(...o){if(o.length===2){const[s,u]=o;this.lang=u,this._stacks=s}else{const[s,u,d]=o;this.lang=u,this._stacks={[d]:s}}}getInternalStack(o=this.theme){return this._stacks[o]}get scopes(){return agt(this._stacks[this.theme])}getScopes(o=this.theme){return agt(this._stacks[o])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function agt(t){const o=[],s=new Set;function u(d){if(s.has(d))return;s.add(d);const f=d?.nameScopesList?.scopeName;f&&o.push(f),d.parent&&u(d.parent)}return u(t),o}function y_r(t,o){if(!(t instanceof PL))throw new gf("Invalid grammar state");return t.getInternalStack(o)}function x_r(){const t=new WeakMap;function o(s){if(!t.has(s.meta)){let u=function(h){if(typeof h=="number"){if(h<0||h>s.source.length)throw new gf(`Invalid decoration offset: ${h}. Code length: ${s.source.length}`);return{...d.indexToPos(h),offset:h}}else{const g=d.lines[h.line];if(g===void 0)throw new gf(`Invalid decoration position ${JSON.stringify(h)}. Lines length: ${d.lines.length}`);if(h.character<0||h.character>g.length)throw new gf(`Invalid decoration position ${JSON.stringify(h)}. Line ${h.line} length: ${g.length}`);return{...h,offset:d.posToIndex(h.line,h.character)}}};const d=g_r(s.source),f=(s.options.decorations||[]).map(h=>({...h,start:u(h.start),end:u(h.end)}));b_r(f),t.set(s.meta,{decorations:f,converter:d,source:s.source})}return t.get(s.meta)}return{name:"shiki:decorations",tokens(s){if(!this.options.decorations?.length)return;const u=o(this).decorations.flatMap(d=>[d.start.offset,d.end.offset]);return h_r(s,u)},code(s){if(!this.options.decorations?.length)return;const u=o(this),d=Array.from(s.children).filter(x=>x.type==="element"&&x.tagName==="span");if(d.length!==u.converter.lines.length)throw new gf(`Number of lines in code element (${d.length}) does not match the number of lines in the source (${u.converter.lines.length}). Failed to apply decorations.`);function f(x,S,T,w){const k=d[x];let P="",I=-1,F=-1;if(S===0&&(I=0),T===0&&(F=0),T===Number.POSITIVE_INFINITY&&(F=k.children.length),I===-1||F===-1)for(let q=0;q<k.children.length;q++)P+=HCt(k.children[q]),I===-1&&P.length===S&&(I=q+1),F===-1&&P.length===T&&(F=q+1);if(I===-1)throw new gf(`Failed to find start index for decoration ${JSON.stringify(w.start)}`);if(F===-1)throw new gf(`Failed to find end index for decoration ${JSON.stringify(w.end)}`);const U=k.children.slice(I,F);if(!w.alwaysWrap&&U.length===k.children.length)g(k,w,"line");else if(!w.alwaysWrap&&U.length===1&&U[0].type==="element")g(U[0],w,"token");else{const q={type:"element",tagName:"span",properties:{},children:U};g(q,w,"wrapper"),k.children.splice(I,U.length,q)}}function h(x,S){d[x]=g(d[x],S,"line")}function g(x,S,T){const w=S.properties||{},k=S.transform||(P=>P);return x.tagName=S.tagName||"span",x.properties={...x.properties,...w,class:x.properties.class},S.properties?.class&&$Ct(x,S.properties.class),x=k(x,T)||x,x}const y=[],b=u.decorations.sort((x,S)=>S.start.offset-x.start.offset);for(const x of b){const{start:S,end:T}=x;if(S.line===T.line)f(S.line,S.character,T.character,x);else if(S.line<T.line){f(S.line,S.character,Number.POSITIVE_INFINITY,x);for(let w=S.line+1;w<T.line;w++)y.unshift(()=>h(w,x));f(T.line,0,T.character,x)}}y.forEach(x=>x())}}}function b_r(t){for(let o=0;o<t.length;o++){const s=t[o];if(s.start.offset>s.end.offset)throw new gf(`Invalid decoration range: ${JSON.stringify(s.start)} - ${JSON.stringify(s.end)}`);for(let u=o+1;u<t.length;u++){const d=t[u],f=s.start.offset<d.start.offset&&d.start.offset<s.end.offset,h=s.start.offset<d.end.offset&&d.end.offset<s.end.offset,g=d.start.offset<s.start.offset&&s.start.offset<d.end.offset,y=d.start.offset<s.end.offset&&s.end.offset<d.end.offset;if(f||h||g||y){if(h&&h||g&&y)continue;throw new gf(`Decorations ${JSON.stringify(s.start)} and ${JSON.stringify(d.start)} intersect.`)}}}}function HCt(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(HCt).join(""):""}const v_r=[x_r()];function Soe(t){return[...t.transformers||[],...v_r]}var xO=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],$Te={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function E_r(t,o){const s=t.indexOf("\x1B[",o);if(s!==-1){const u=t.indexOf("m",s);return{sequence:t.substring(s+2,u).split(";"),startPosition:s,position:u+1}}return{position:t.length}}function sgt(t,o){let s=1;const u=t[o+s++];let d;if(u==="2"){const f=[t[o+s++],t[o+s++],t[o+s]].map(h=>Number.parseInt(h));f.length===3&&!f.some(h=>Number.isNaN(h))&&(d={type:"rgb",rgb:f})}else if(u==="5"){const f=Number.parseInt(t[o+s]);Number.isNaN(f)||(d={type:"table",index:Number(f)})}return[s,d]}function S_r(t){const o=[];for(let s=0;s<t.length;s++){const u=t[s],d=Number.parseInt(u);if(!Number.isNaN(d))if(d===0)o.push({type:"resetAll"});else if(d<=9)$Te[d]&&o.push({type:"setDecoration",value:$Te[d]});else if(d<=29){const f=$Te[d-20];f&&o.push({type:"resetDecoration",value:f})}else if(d<=37)o.push({type:"setForegroundColor",value:{type:"named",name:xO[d-30]}});else if(d===38){const[f,h]=sgt(t,s);h&&o.push({type:"setForegroundColor",value:h}),s+=f}else if(d===39)o.push({type:"resetForegroundColor"});else if(d<=47)o.push({type:"setBackgroundColor",value:{type:"named",name:xO[d-40]}});else if(d===48){const[f,h]=sgt(t,s);h&&o.push({type:"setBackgroundColor",value:h}),s+=f}else d===49?o.push({type:"resetBackgroundColor"}):d>=90&&d<=97?o.push({type:"setForegroundColor",value:{type:"named",name:xO[d-90+8]}}):d>=100&&d<=107&&o.push({type:"setBackgroundColor",value:{type:"named",name:xO[d-100+8]}})}return o}function __r(){let t=null,o=null,s=new Set;return{parse(u){const d=[];let f=0;do{const h=E_r(u,f),g=h.sequence?u.substring(f,h.startPosition):u.substring(f);if(g.length>0&&d.push({value:g,foreground:t,background:o,decorations:new Set(s)}),h.sequence){const y=S_r(h.sequence);for(const b of y)b.type==="resetAll"?(t=null,o=null,s.clear()):b.type==="resetForegroundColor"?t=null:b.type==="resetBackgroundColor"?o=null:b.type==="resetDecoration"&&s.delete(b.value);for(const b of y)b.type==="setForegroundColor"?t=b.value:b.type==="setBackgroundColor"?o=b.value:b.type==="setDecoration"&&s.add(b.value)}f=h.position}while(f<u.length);return d}}}var T_r={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function A_r(t=T_r){function o(g){return t[g]}function s(g){return`#${g.map(y=>Math.max(0,Math.min(y,255)).toString(16).padStart(2,"0")).join("")}`}let u;function d(){if(u)return u;u=[];for(let b=0;b<xO.length;b++)u.push(o(xO[b]));let g=[0,95,135,175,215,255];for(let b=0;b<6;b++)for(let x=0;x<6;x++)for(let S=0;S<6;S++)u.push(s([g[b],g[x],g[S]]));let y=8;for(let b=0;b<24;b++,y+=10)u.push(s([y,y,y]));return u}function f(g){return d()[g]}function h(g){switch(g.type){case"named":return o(g.name);case"rgb":return s(g.rgb);case"table":return f(g.index)}}return{value:h}}function C_r(t,o,s){const u=Eoe(t,s),d=vle(o),f=A_r(Object.fromEntries(xO.map(g=>[g,t.colors?.[`terminal.ansi${g[0].toUpperCase()}${g.substring(1)}`]]))),h=__r();return d.map(g=>h.parse(g[0]).map(y=>{let b,x;y.decorations.has("reverse")?(b=y.background?f.value(y.background):t.bg,x=y.foreground?f.value(y.foreground):t.fg):(b=y.foreground?f.value(y.foreground):t.fg,x=y.background?f.value(y.background):void 0),b=yO(b,u),x=yO(x,u),y.decorations.has("dim")&&(b=w_r(b));let S=y2.None;return y.decorations.has("bold")&&(S|=y2.Bold),y.decorations.has("italic")&&(S|=y2.Italic),y.decorations.has("underline")&&(S|=y2.Underline),{content:y.value,offset:g[1],color:b,bgColor:x,fontStyle:S}}))}function w_r(t){const o=t.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(o)if(o[3]){const u=Math.round(Number.parseInt(o[3],16)/2).toString(16).padStart(2,"0");return`#${o[1]}${o[2]}${u}`}else return o[2]?`#${o[1]}${o[2]}80`:`#${Array.from(o[1]).map(u=>`${u}${u}`).join("")}80`;const s=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return s?`var(${s[1]}-dim)`:t}function tIe(t,o,s={}){const{lang:u="text",theme:d=t.getLoadedThemes()[0]}=s;if(J6e(u)||eIe(d))return vle(o).map(y=>[{content:y[0],offset:y[1]}]);const{theme:f,colorMap:h}=t.setTheme(d);if(u==="ansi")return C_r(f,o,s);const g=t.getLanguage(u);if(s.grammarState){if(s.grammarState.lang!==g.name)throw new T2(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${g.name}"`);if(!s.grammarState.themes.includes(f.name))throw new T2(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${f.name}"`)}return O_r(o,g,f,h,s)}function R_r(...t){if(t.length===2)return Jq(t[1]);const[o,s,u={}]=t,{lang:d="text",theme:f=o.getLoadedThemes()[0]}=u;if(J6e(d)||eIe(f))throw new T2("Plain language does not have grammar state");if(d==="ansi")throw new T2("ANSI language does not have grammar state");const{theme:h,colorMap:g}=o.setTheme(f),y=o.getLanguage(d);return new PL(_oe(s,y,h,g,u).stateStack,y.name,h.name)}function O_r(t,o,s,u,d){const f=_oe(t,o,s,u,d),h=new PL(_oe(t,o,s,u,d).stateStack,o.name,s.name);return Ele(f.tokens,h),f.tokens}function _oe(t,o,s,u,d){const f=Eoe(s,d),{tokenizeMaxLineLength:h=0,tokenizeTimeLimit:g=500}=d,y=vle(t);let b=d.grammarState?y_r(d.grammarState,s.name)??OCe:d.grammarContextCode!=null?_oe(d.grammarContextCode,o,s,u,{...d,grammarState:void 0,grammarContextCode:void 0}).stateStack:OCe,x=[];const S=[];for(let T=0,w=y.length;T<w;T++){const[k,P]=y[T];if(k===""){x=[],S.push([]);continue}if(h>0&&k.length>=h){x=[],S.push([{content:k,offset:P,color:"",fontStyle:0}]);continue}let I,F,U;d.includeExplanation&&(I=o.tokenizeLine(k,b),F=I.tokens,U=0);const q=o.tokenizeLine2(k,b,g),G=q.tokens.length/2;for(let Q=0;Q<G;Q++){const K=q.tokens[2*Q],te=Q+1<G?q.tokens[2*Q+2]:k.length;if(K===te)continue;const oe=q.tokens[2*Q+1],fe=yO(u[RI.getForeground(oe)],f),X=RI.getFontStyle(oe),le={content:k.substring(K,te),offset:P+K,color:fe,fontStyle:X};if(d.includeExplanation){const me=[];if(d.includeExplanation!=="scopeName")for(const we of s.settings){let xe;switch(typeof we.scope){case"string":xe=we.scope.split(/,/).map(ve=>ve.trim());break;case"object":xe=we.scope;break;default:continue}me.push({settings:we,selectors:xe.map(ve=>ve.split(/ /))})}le.explanation=[];let Ee=0;for(;K+Ee<te;){const we=F[U],xe=k.substring(we.startIndex,we.endIndex);Ee+=xe.length,le.explanation.push({content:xe,scopes:d.includeExplanation==="scopeName"?N_r(we.scopes):k_r(me,we.scopes)}),U+=1}}x.push(le)}S.push(x),x=[],b=q.ruleStack}return{tokens:S,stateStack:b}}function N_r(t){return t.map(o=>({scopeName:o}))}function k_r(t,o){const s=[];for(let u=0,d=o.length;u<d;u++){const f=o[u];s[u]={scopeName:f,themeMatches:I_r(t,f,o.slice(0,u))}}return s}function lgt(t,o){return t===o||o.substring(0,t.length)===t&&o[t.length]==="."}function D_r(t,o,s){if(!lgt(t[t.length-1],o))return!1;let u=t.length-2,d=s.length-1;for(;u>=0&&d>=0;)lgt(t[u],s[d])&&(u-=1),d-=1;return u===-1}function I_r(t,o,s){const u=[];for(const{selectors:d,settings:f}of t)for(const h of d)if(D_r(h,o,s)){u.push(f);break}return u}function GCt(t,o,s){const u=Object.entries(s.themes).filter(y=>y[1]).map(y=>({color:y[0],theme:y[1]})),d=u.map(y=>{const b=tIe(t,o,{...s,theme:y.theme}),x=Jq(b),S=typeof y.theme=="string"?y.theme:y.theme.name;return{tokens:b,state:x,theme:S}}),f=L_r(...d.map(y=>y.tokens)),h=f[0].map((y,b)=>y.map((x,S)=>{const T={content:x.content,variants:{},offset:x.offset};return"includeExplanation"in s&&s.includeExplanation&&(T.explanation=x.explanation),f.forEach((w,k)=>{const{content:P,explanation:I,offset:F,...U}=w[b][S];T.variants[u[k].color]=U}),T})),g=d[0].state?new PL(Object.fromEntries(d.map(y=>[y.theme,y.state?.getInternalStack(y.theme)])),d[0].state.lang):void 0;return g&&Ele(h,g),h}function L_r(...t){const o=t.map(()=>[]),s=t.length;for(let u=0;u<t[0].length;u++){const d=t.map(y=>y[u]),f=o.map(()=>[]);o.forEach((y,b)=>y.push(f[b]));const h=d.map(()=>0),g=d.map(y=>y[0]);for(;g.every(y=>y);){const y=Math.min(...g.map(b=>b.content.length));for(let b=0;b<s;b++){const x=g[b];x.content.length===y?(f[b].push(x),h[b]+=1,g[b]=d[b][h[b]]):(f[b].push({...x,content:x.content.slice(0,y)}),g[b]={...x,content:x.content.slice(y),offset:x.offset+y})}}}return o}function Toe(t,o,s){let u,d,f,h,g,y;if("themes"in s){const{defaultColor:b="light",cssVariablePrefix:x="--shiki-"}=s,S=Object.entries(s.themes).filter(I=>I[1]).map(I=>({color:I[0],theme:I[1]})).sort((I,F)=>I.color===b?-1:F.color===b?1:0);if(S.length===0)throw new T2("`themes` option must not be empty");const T=GCt(t,o,s);if(y=Jq(T),b&&!S.find(I=>I.color===b))throw new T2(`\`themes\` option must contain the defaultColor key \`${b}\``);const w=S.map(I=>t.getTheme(I.theme)),k=S.map(I=>I.color);f=T.map(I=>I.map(F=>P_r(F,k,x,b))),y&&Ele(f,y);const P=S.map(I=>Eoe(I.theme,s));d=S.map((I,F)=>(F===0&&b?"":`${x+I.color}:`)+(yO(w[F].fg,P[F])||"inherit")).join(";"),u=S.map((I,F)=>(F===0&&b?"":`${x+I.color}-bg:`)+(yO(w[F].bg,P[F])||"inherit")).join(";"),h=`shiki-themes ${w.map(I=>I.name).join(" ")}`,g=b?void 0:[d,u].join(";")}else if("theme"in s){const b=Eoe(s.theme,s);f=tIe(t,o,s);const x=t.getTheme(s.theme);u=yO(x.bg,b),d=yO(x.fg,b),h=x.name,y=Jq(f)}else throw new T2("Invalid options, either `theme` or `themes` must be provided");return{tokens:f,fg:d,bg:u,themeName:h,rootStyle:g,grammarState:y}}function P_r(t,o,s,u){const d={content:t.content,explanation:t.explanation,offset:t.offset},f=o.map(y=>qCt(t.variants[y])),h=new Set(f.flatMap(y=>Object.keys(y))),g={};return f.forEach((y,b)=>{for(const x of h){const S=y[x]||"inherit";if(b===0&&u)g[x]=S;else{const T=x==="color"?"":x==="background-color"?"-bg":`-${x}`,w=s+o[b]+(x==="color"?"":T);g[w]=S}}}),d.htmlStyle=g,d}function Aoe(t,o,s,u={meta:{},options:s,codeToHast:(d,f)=>Aoe(t,d,f),codeToTokens:(d,f)=>Toe(t,d,f)}){let d=o;for(const w of Soe(s))d=w.preprocess?.call(u,d,s)||d;let{tokens:f,fg:h,bg:g,themeName:y,rootStyle:b,grammarState:x}=Toe(t,d,s);const{mergeWhitespaces:S=!0}=s;S===!0?f=F_r(f):S==="never"&&(f=B_r(f));const T={...u,get source(){return d}};for(const w of Soe(s))f=w.tokens?.call(T,f)||f;return M_r(f,{...s,fg:h,bg:g,themeName:y,rootStyle:b},T,x)}function M_r(t,o,s,u=Jq(t)){const d=Soe(o),f=[],h={type:"root",children:[]},{structure:g="classic",tabindex:y="0"}=o;let b={type:"element",tagName:"pre",properties:{class:`shiki ${o.themeName||""}`,style:o.rootStyle||`background-color:${o.bg};color:${o.fg}`,...y!==!1&&y!=null?{tabindex:y.toString()}:{},...Object.fromEntries(Array.from(Object.entries(o.meta||{})).filter(([k])=>!k.startsWith("_")))},children:[]},x={type:"element",tagName:"code",properties:{},children:f};const S=[],T={...s,structure:g,addClassToHast:$Ct,get source(){return s.source},get tokens(){return t},get options(){return o},get root(){return h},get pre(){return b},get code(){return x},get lines(){return S}};if(t.forEach((k,P)=>{P&&(g==="inline"?h.children.push({type:"element",tagName:"br",properties:{},children:[]}):g==="classic"&&f.push({type:"text",value:`
|
|
3311
|
-
`}));let I={type:"element",tagName:"span",properties:{class:"line"},children:[]},F=0;for(const U of k){let q={type:"element",tagName:"span",properties:{...U.htmlAttrs},children:[{type:"text",value:U.content}]};U.htmlStyle;const G=m_r(U.htmlStyle||qCt(U));G&&(q.properties.style=G);for(const Q of d)q=Q?.span?.call(T,q,P+1,F,I,U)||q;g==="inline"?h.children.push(q):g==="classic"&&I.children.push(q),F+=U.content.length}if(g==="classic"){for(const U of d)I=U?.line?.call(T,I,P+1)||I;S.push(I),f.push(I)}}),g==="classic"){for(const k of d)x=k?.code?.call(T,x)||x;b.children.push(x);for(const k of d)b=k?.pre?.call(T,b)||b;h.children.push(b)}let w=h;for(const k of d)w=k?.root?.call(T,w)||w;return u&&Ele(w,u),w}function F_r(t){return t.map(o=>{const s=[];let u="",d=0;return o.forEach((f,h)=>{const g=!(f.fontStyle&&f.fontStyle&y2.Underline);g&&f.content.match(/^\s+$/)&&o[h+1]?(d||(d=f.offset),u+=f.content):u?(g?s.push({...f,offset:d,content:u+f.content}):s.push({content:u,offset:d},f),d=0,u=""):s.push(f)}),s})}function B_r(t){return t.map(o=>o.flatMap(s=>{if(s.content.match(/^\s+$/))return s;const u=s.content.match(/^(\s*)(.*?)(\s*)$/);if(!u)return s;const[,d,f,h]=u;if(!d&&!h)return s;const g=[{...s,offset:s.offset+d.length,content:f}];return d&&g.unshift({content:d,offset:s.offset}),h&&g.push({content:h,offset:s.offset+d.length+f.length}),g}))}function j_r(t,o,s){const u={meta:{},options:s,codeToHast:(f,h)=>Aoe(t,f,h),codeToTokens:(f,h)=>Toe(t,f,h)};let d=u_r(Aoe(t,o,s,u));for(const f of Soe(s))d=f.postprocess?.call(u,d,s)||d;return d}const ugt={light:"#333333",dark:"#bbbbbb"},cgt={light:"#fffffe",dark:"#1e1e1e"},dgt="__shiki_resolved";function nIe(t){if(t?.[dgt])return t;const o={...t};o.tokenColors&&!o.settings&&(o.settings=o.tokenColors,delete o.tokenColors),o.type||="dark",o.colorReplacements={...o.colorReplacements},o.settings||=[];let{bg:s,fg:u}=o;if(!s||!u){const g=o.settings?o.settings.find(y=>!y.name&&!y.scope):void 0;g?.settings?.foreground&&(u=g.settings.foreground),g?.settings?.background&&(s=g.settings.background),!u&&o?.colors?.["editor.foreground"]&&(u=o.colors["editor.foreground"]),!s&&o?.colors?.["editor.background"]&&(s=o.colors["editor.background"]),u||(u=o.type==="light"?ugt.light:ugt.dark),s||(s=o.type==="light"?cgt.light:cgt.dark),o.fg=u,o.bg=s}o.settings[0]&&o.settings[0].settings&&!o.settings[0].scope||o.settings.unshift({settings:{foreground:o.fg,background:o.bg}});let d=0;const f=new Map;function h(g){if(f.has(g))return f.get(g);d+=1;const y=`#${d.toString(16).padStart(8,"0").toLowerCase()}`;return o.colorReplacements?.[`#${y}`]?h(g):(f.set(g,y),y)}o.settings=o.settings.map(g=>{const y=g.settings?.foreground&&!g.settings.foreground.startsWith("#"),b=g.settings?.background&&!g.settings.background.startsWith("#");if(!y&&!b)return g;const x={...g,settings:{...g.settings}};if(y){const S=h(g.settings.foreground);o.colorReplacements[S]=g.settings.foreground,x.settings.foreground=S}if(b){const S=h(g.settings.background);o.colorReplacements[S]=g.settings.background,x.settings.background=S}return x});for(const g of Object.keys(o.colors||{}))if((g==="editor.foreground"||g==="editor.background"||g.startsWith("terminal.ansi"))&&!o.colors[g]?.startsWith("#")){const y=h(o.colors[g]);o.colorReplacements[y]=o.colors[g],o.colors[g]=y}return Object.defineProperty(o,dgt,{enumerable:!1,writable:!1,value:!0}),o}async function VCt(t){return Array.from(new Set((await Promise.all(t.filter(o=>!BCt(o)).map(async o=>await UCt(o).then(s=>Array.isArray(s)?s:[s])))).flat()))}async function WCt(t){return(await Promise.all(t.map(async o=>jCt(o)?null:nIe(await UCt(o))))).filter(o=>!!o)}class $_r extends Q2r{constructor(o,s,u,d={}){super(o),this._resolver=o,this._themes=s,this._langs=u,this._alias=d,this._themes.map(f=>this.loadTheme(f)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(o){return typeof o=="string"?this._resolvedThemes.get(o):this.loadTheme(o)}loadTheme(o){const s=nIe(o);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(o){let s=this._textmateThemeCache.get(o);s||(s=goe.createFromRawTheme(o),this._textmateThemeCache.set(o,s)),this._syncRegistry.setTheme(s)}getGrammar(o){if(this._alias[o]){const s=new Set([o]);for(;this._alias[o];){if(o=this._alias[o],s.has(o))throw new gf(`Circular alias \`${Array.from(s).join(" -> ")} -> ${o}\``);s.add(o)}}return this._resolvedGrammars.get(o)}loadLanguage(o){if(this.getGrammar(o.name))return;const s=new Set([...this._langMap.values()].filter(f=>f.embeddedLangsLazy?.includes(o.name)));this._resolver.addLanguage(o);const u={balancedBracketSelectors:o.balancedBracketSelectors||["*"],unbalancedBracketSelectors:o.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(o.scopeName,o);const d=this.loadGrammarWithConfiguration(o.scopeName,1,u);if(d.name=o.name,this._resolvedGrammars.set(o.name,d),o.aliases&&o.aliases.forEach(f=>{this._alias[f]=o.name}),this._loadedLanguagesCache=null,s.size)for(const f of s)this._resolvedGrammars.delete(f.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(f.scopeName),this._syncRegistry?._grammars?.delete(f.scopeName),this.loadLanguage(this._langMap.get(f.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(o){for(const d of o)this.resolveEmbeddedLanguages(d);const s=Array.from(this._langGraph.entries()),u=s.filter(([d,f])=>!f);if(u.length){const d=s.filter(([f,h])=>h&&h.embeddedLangs?.some(g=>u.map(([y])=>y).includes(g))).filter(f=>!u.includes(f));throw new gf(`Missing languages ${u.map(([f])=>`\`${f}\``).join(", ")}, required by ${d.map(([f])=>`\`${f}\``).join(", ")}`)}for(const[d,f]of s)this._resolver.addLanguage(f);for(const[d,f]of s)this.loadLanguage(f)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(o){if(this._langMap.set(o.name,o),this._langGraph.set(o.name,o),o.embeddedLangs)for(const s of o.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class U_r{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(o,s){this._onigLib={createOnigScanner:u=>o.createScanner(u),createOnigString:u=>o.createString(u)},s.forEach(u=>this.addLanguage(u))}get onigLib(){return this._onigLib}getLangRegistration(o){return this._langs.get(o)}loadGrammar(o){return this._scopeToLang.get(o)}addLanguage(o){this._langs.set(o.name,o),o.aliases&&o.aliases.forEach(s=>{this._langs.set(s,o)}),this._scopeToLang.set(o.scopeName,o),o.injectTo&&o.injectTo.forEach(s=>{this._injections.get(s)||this._injections.set(s,[]),this._injections.get(s).push(o.scopeName)})}getInjections(o){const s=o.split(".");let u=[];for(let d=1;d<=s.length;d++){const f=s.slice(0,d).join(".");u=[...u,...this._injections.get(f)||[]]}return u}}let U$=0;function q_r(t){U$+=1,t.warnings!==!1&&U$>=10&&U$%10===0&&console.warn(`[Shiki] ${U$} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let o=!1;if(!t.engine)throw new gf("`engine` option is required for synchronous mode");const s=(t.langs||[]).flat(1),u=(t.themes||[]).flat(1).map(nIe),d=new U_r(t.engine,s),f=new $_r(d,u,s,t.langAlias);let h;function g(U){I();const q=f.getGrammar(typeof U=="string"?U:U.name);if(!q)throw new gf(`Language \`${U}\` not found, you may need to load it first`);return q}function y(U){if(U==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};I();const q=f.getTheme(U);if(!q)throw new gf(`Theme \`${U}\` not found, you may need to load it first`);return q}function b(U){I();const q=y(U);h!==U&&(f.setTheme(q),h=U);const G=f.getColorMap();return{theme:q,colorMap:G}}function x(){return I(),f.getLoadedThemes()}function S(){return I(),f.getLoadedLanguages()}function T(...U){I(),f.loadLanguages(U.flat(1))}async function w(...U){return T(await VCt(U))}function k(...U){I();for(const q of U.flat(1))f.loadTheme(q)}async function P(...U){return I(),k(await WCt(U))}function I(){if(o)throw new gf("Shiki instance has been disposed")}function F(){o||(o=!0,f.dispose(),U$-=1)}return{setTheme:b,getTheme:y,getLanguage:g,getLoadedThemes:x,getLoadedLanguages:S,loadLanguage:w,loadLanguageSync:T,loadTheme:P,loadThemeSync:k,dispose:F,[Symbol.dispose]:F}}async function z_r(t={}){t.loadWasm;const[o,s,u]=await Promise.all([WCt(t.themes||[]),VCt(t.langs||[]),t.engine||lCt(t.loadWasm||u2r())]);return q_r({...t,themes:o,langs:s,engine:u})}async function H_r(t={}){const o=await z_r(t);return{getLastGrammarState:(...s)=>R_r(o,...s),codeToTokensBase:(s,u)=>tIe(o,s,u),codeToTokensWithThemes:(s,u)=>GCt(o,s,u),codeToTokens:(s,u)=>Toe(o,s,u),codeToHast:(s,u)=>Aoe(o,s,u),codeToHtml:(s,u)=>j_r(o,s,u),...o,getInternalContext:()=>o}}function G_r(t,o,s){let u,d,f;{const g=t;u=g.langs,d=g.themes,f=g.engine}async function h(g){function y(w){if(typeof w=="string"){if(BCt(w))return[];const k=u[w];if(!k)throw new T2(`Language \`${w}\` is not included in this bundle. You may want to load it from external source.`);return k}return w}function b(w){if(jCt(w))return"none";if(typeof w=="string"){const k=d[w];if(!k)throw new T2(`Theme \`${w}\` is not included in this bundle. You may want to load it from external source.`);return k}return w}const x=(g.themes??[]).map(w=>b(w)),S=(g.langs??[]).map(w=>y(w)),T=await H_r({engine:g.engine??f(),...g,themes:x,langs:S});return{...T,loadLanguage(...w){return T.loadLanguage(...w.map(y))},loadTheme(...w){return T.loadTheme(...w.map(b))}}}return h}const V_r=G_r({langs:zEr,themes:GEr,engine:()=>lCt(ut(()=>import("./wasm-DQxwEHae-CG6Dc4jp.js"),[]))}),UTe={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},W_r={...UTe,patterns:[...UTe.patterns,{include:"#docvar"}],repository:{...UTe.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Y_r={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},YCt="catppuccin-latte",Q_r=V_r({themes:[YCt],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...W_r},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Y_r}]});async function HO(t,o){return(await Q_r).codeToHtml(t,{lang:o,theme:YCt})}const fu=Ln(S6)({display:"flex",flexDirection:"column",height:"100%"}),$h=Ln(_6)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),Sle=Ln(GDn)({padding:"10px"}),K_r=Ln("div")({display:"flex",flexDirection:"column",height:"100%"});Ln("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const X_r=Ln("div")({display:"flex",height:"75vh",width:"100%",overflowY:"auto"});Ln("div")({position:"relative",height:"100%",flex:"0 0 auto"});const Z_r=os([M.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V5h14z"},"0"),M.jsx("path",{d:"M7 12h2v5H7zm8-5h2v10h-2zm-4 7h2v3h-2zm0-4h2v2h-2z"},"1")]),QCt=z.createContext(void 0),Coe=({projectName:t,packageName:o,versionId:s,children:u})=>M.jsx(QCt.Provider,{value:{projectName:t,packageName:o,versionId:s},children:u});function Eg(){const t=z.useContext(QCt);if(!t)throw new Error("usePackage must be used within a PackageProvider");return t}function zh({error:t,context:o}){const s=t.data?.message||"Unknown Error";return M.jsxs(M.Fragment,{children:[o&&M.jsx(dr,{variant:"body2",sx:{p:"10px",m:"auto"},children:o}),M.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:s})]})}function Sg({text:t,size:o=20,color:s="primary",thickness:u=3.6,centered:d=!0,spacing:f=2,textVariant:h="body2"}){const g=M.jsxs(Eo,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:f},children:[M.jsx(Ewe,{size:o,color:s,thickness:u}),t&&M.jsx(dr,{variant:h,color:"text.secondary",children:t})]});return d?M.jsx(Eo,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:g}):g}const KCt=new sPn({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),rIe=async(t,o)=>{const s=o?await o():void 0;return{baseURL:t,withCredentials:!s,headers:{Authorization:s&&`Bearer ${s}`}}};function Hh(t){const{server:o,getAccessToken:s}=pIe(),u={...t,queryKey:[...t.queryKey,o],queryFn:async()=>{try{const d=await rIe(o,s);return await t.queryFn(d)}catch(d){if(d&&typeof d=="object"&&"response"in d){const f=d;if(f.response?.data){const h=new Error(f.response.data.message||f.message);throw h.status=f.response.status,h.data=f.response.data,h}}throw d}},retry:!1,throwOnError:!1};return TPn(u,KCt)}function J_r(t){const{server:o,getAccessToken:s}=pIe(),u={...t,mutationFn:async d=>{try{const f=await rIe(o,s);return await t.mutationFn(d,f)}catch(f){if(f&&typeof f=="object"&&"response"in f){const h=f;if(h.response?.data){const g=new Error(h.response.data.message||h.message);throw g.status=h.response.status,g.data=h.response.data,g}}throw f}},retry:!1,throwOnError:!1};return APn(u,KCt)}const eTr=z.lazy(()=>ut(()=>import("./RenderedResult-DXlUZo0k-DlCXl_SI.js"),[])),tTr=new aCt(new Pd);function nTr({modelPath:t,query:o,sourceName:s,queryName:u}){const{projectName:d,packageName:f,versionId:h}=Eg(),{data:g,isSuccess:y,isError:b,error:x}=Hh({queryKey:["queryResult",d,f,t,h,o,s,u],queryFn:S=>tTr.executeQuery(d,f,t,o,s,u,h,S)});return M.jsxs(M.Fragment,{children:[!y&&!b&&M.jsx(Sg,{text:"Fetching Query Results..."}),y&&M.jsx(z.Suspense,{fallback:M.jsx("div",{children:"Loading..."}),children:M.jsx(eTr,{result:g.data.result})}),b&&M.jsx(zh,{context:`${d} > ${f} > ${t}`,error:x})]})}const rTr=Ln(S6)({display:"flex",flexDirection:"column",height:"100%"});function iTr({modelPath:t,sourceName:o,queryName:s,expandResult:u,hideResultIcon:d,expandEmbedding:f,hideEmbeddingIcon:h,noView:g,annotations:y}){const[b,x]=Dn.useState(u),[S,T]=Dn.useState(f),[w,k]=Dn.useState(),[P,I]=Dn.useState(),F=oTr(o,s);return z.useEffect(()=>{HO(F,"typescript").then(U=>{k(U)})},[S,F]),z.useEffect(()=>{if(y&&y.length>0){const U=y.map(q=>`// ${q}`).join(`
|
|
3311
|
+
`}));let I={type:"element",tagName:"span",properties:{class:"line"},children:[]},F=0;for(const U of k){let q={type:"element",tagName:"span",properties:{...U.htmlAttrs},children:[{type:"text",value:U.content}]};U.htmlStyle;const G=m_r(U.htmlStyle||qCt(U));G&&(q.properties.style=G);for(const Q of d)q=Q?.span?.call(T,q,P+1,F,I,U)||q;g==="inline"?h.children.push(q):g==="classic"&&I.children.push(q),F+=U.content.length}if(g==="classic"){for(const U of d)I=U?.line?.call(T,I,P+1)||I;S.push(I),f.push(I)}}),g==="classic"){for(const k of d)x=k?.code?.call(T,x)||x;b.children.push(x);for(const k of d)b=k?.pre?.call(T,b)||b;h.children.push(b)}let w=h;for(const k of d)w=k?.root?.call(T,w)||w;return u&&Ele(w,u),w}function F_r(t){return t.map(o=>{const s=[];let u="",d=0;return o.forEach((f,h)=>{const g=!(f.fontStyle&&f.fontStyle&y2.Underline);g&&f.content.match(/^\s+$/)&&o[h+1]?(d||(d=f.offset),u+=f.content):u?(g?s.push({...f,offset:d,content:u+f.content}):s.push({content:u,offset:d},f),d=0,u=""):s.push(f)}),s})}function B_r(t){return t.map(o=>o.flatMap(s=>{if(s.content.match(/^\s+$/))return s;const u=s.content.match(/^(\s*)(.*?)(\s*)$/);if(!u)return s;const[,d,f,h]=u;if(!d&&!h)return s;const g=[{...s,offset:s.offset+d.length,content:f}];return d&&g.unshift({content:d,offset:s.offset}),h&&g.push({content:h,offset:s.offset+d.length+f.length}),g}))}function j_r(t,o,s){const u={meta:{},options:s,codeToHast:(f,h)=>Aoe(t,f,h),codeToTokens:(f,h)=>Toe(t,f,h)};let d=u_r(Aoe(t,o,s,u));for(const f of Soe(s))d=f.postprocess?.call(u,d,s)||d;return d}const ugt={light:"#333333",dark:"#bbbbbb"},cgt={light:"#fffffe",dark:"#1e1e1e"},dgt="__shiki_resolved";function nIe(t){if(t?.[dgt])return t;const o={...t};o.tokenColors&&!o.settings&&(o.settings=o.tokenColors,delete o.tokenColors),o.type||="dark",o.colorReplacements={...o.colorReplacements},o.settings||=[];let{bg:s,fg:u}=o;if(!s||!u){const g=o.settings?o.settings.find(y=>!y.name&&!y.scope):void 0;g?.settings?.foreground&&(u=g.settings.foreground),g?.settings?.background&&(s=g.settings.background),!u&&o?.colors?.["editor.foreground"]&&(u=o.colors["editor.foreground"]),!s&&o?.colors?.["editor.background"]&&(s=o.colors["editor.background"]),u||(u=o.type==="light"?ugt.light:ugt.dark),s||(s=o.type==="light"?cgt.light:cgt.dark),o.fg=u,o.bg=s}o.settings[0]&&o.settings[0].settings&&!o.settings[0].scope||o.settings.unshift({settings:{foreground:o.fg,background:o.bg}});let d=0;const f=new Map;function h(g){if(f.has(g))return f.get(g);d+=1;const y=`#${d.toString(16).padStart(8,"0").toLowerCase()}`;return o.colorReplacements?.[`#${y}`]?h(g):(f.set(g,y),y)}o.settings=o.settings.map(g=>{const y=g.settings?.foreground&&!g.settings.foreground.startsWith("#"),b=g.settings?.background&&!g.settings.background.startsWith("#");if(!y&&!b)return g;const x={...g,settings:{...g.settings}};if(y){const S=h(g.settings.foreground);o.colorReplacements[S]=g.settings.foreground,x.settings.foreground=S}if(b){const S=h(g.settings.background);o.colorReplacements[S]=g.settings.background,x.settings.background=S}return x});for(const g of Object.keys(o.colors||{}))if((g==="editor.foreground"||g==="editor.background"||g.startsWith("terminal.ansi"))&&!o.colors[g]?.startsWith("#")){const y=h(o.colors[g]);o.colorReplacements[y]=o.colors[g],o.colors[g]=y}return Object.defineProperty(o,dgt,{enumerable:!1,writable:!1,value:!0}),o}async function VCt(t){return Array.from(new Set((await Promise.all(t.filter(o=>!BCt(o)).map(async o=>await UCt(o).then(s=>Array.isArray(s)?s:[s])))).flat()))}async function WCt(t){return(await Promise.all(t.map(async o=>jCt(o)?null:nIe(await UCt(o))))).filter(o=>!!o)}class $_r extends Q2r{constructor(o,s,u,d={}){super(o),this._resolver=o,this._themes=s,this._langs=u,this._alias=d,this._themes.map(f=>this.loadTheme(f)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(o){return typeof o=="string"?this._resolvedThemes.get(o):this.loadTheme(o)}loadTheme(o){const s=nIe(o);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(o){let s=this._textmateThemeCache.get(o);s||(s=goe.createFromRawTheme(o),this._textmateThemeCache.set(o,s)),this._syncRegistry.setTheme(s)}getGrammar(o){if(this._alias[o]){const s=new Set([o]);for(;this._alias[o];){if(o=this._alias[o],s.has(o))throw new gf(`Circular alias \`${Array.from(s).join(" -> ")} -> ${o}\``);s.add(o)}}return this._resolvedGrammars.get(o)}loadLanguage(o){if(this.getGrammar(o.name))return;const s=new Set([...this._langMap.values()].filter(f=>f.embeddedLangsLazy?.includes(o.name)));this._resolver.addLanguage(o);const u={balancedBracketSelectors:o.balancedBracketSelectors||["*"],unbalancedBracketSelectors:o.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(o.scopeName,o);const d=this.loadGrammarWithConfiguration(o.scopeName,1,u);if(d.name=o.name,this._resolvedGrammars.set(o.name,d),o.aliases&&o.aliases.forEach(f=>{this._alias[f]=o.name}),this._loadedLanguagesCache=null,s.size)for(const f of s)this._resolvedGrammars.delete(f.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(f.scopeName),this._syncRegistry?._grammars?.delete(f.scopeName),this.loadLanguage(this._langMap.get(f.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(o){for(const d of o)this.resolveEmbeddedLanguages(d);const s=Array.from(this._langGraph.entries()),u=s.filter(([d,f])=>!f);if(u.length){const d=s.filter(([f,h])=>h&&h.embeddedLangs?.some(g=>u.map(([y])=>y).includes(g))).filter(f=>!u.includes(f));throw new gf(`Missing languages ${u.map(([f])=>`\`${f}\``).join(", ")}, required by ${d.map(([f])=>`\`${f}\``).join(", ")}`)}for(const[d,f]of s)this._resolver.addLanguage(f);for(const[d,f]of s)this.loadLanguage(f)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(o){if(this._langMap.set(o.name,o),this._langGraph.set(o.name,o),o.embeddedLangs)for(const s of o.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class U_r{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(o,s){this._onigLib={createOnigScanner:u=>o.createScanner(u),createOnigString:u=>o.createString(u)},s.forEach(u=>this.addLanguage(u))}get onigLib(){return this._onigLib}getLangRegistration(o){return this._langs.get(o)}loadGrammar(o){return this._scopeToLang.get(o)}addLanguage(o){this._langs.set(o.name,o),o.aliases&&o.aliases.forEach(s=>{this._langs.set(s,o)}),this._scopeToLang.set(o.scopeName,o),o.injectTo&&o.injectTo.forEach(s=>{this._injections.get(s)||this._injections.set(s,[]),this._injections.get(s).push(o.scopeName)})}getInjections(o){const s=o.split(".");let u=[];for(let d=1;d<=s.length;d++){const f=s.slice(0,d).join(".");u=[...u,...this._injections.get(f)||[]]}return u}}let U$=0;function q_r(t){U$+=1,t.warnings!==!1&&U$>=10&&U$%10===0&&console.warn(`[Shiki] ${U$} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let o=!1;if(!t.engine)throw new gf("`engine` option is required for synchronous mode");const s=(t.langs||[]).flat(1),u=(t.themes||[]).flat(1).map(nIe),d=new U_r(t.engine,s),f=new $_r(d,u,s,t.langAlias);let h;function g(U){I();const q=f.getGrammar(typeof U=="string"?U:U.name);if(!q)throw new gf(`Language \`${U}\` not found, you may need to load it first`);return q}function y(U){if(U==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};I();const q=f.getTheme(U);if(!q)throw new gf(`Theme \`${U}\` not found, you may need to load it first`);return q}function b(U){I();const q=y(U);h!==U&&(f.setTheme(q),h=U);const G=f.getColorMap();return{theme:q,colorMap:G}}function x(){return I(),f.getLoadedThemes()}function S(){return I(),f.getLoadedLanguages()}function T(...U){I(),f.loadLanguages(U.flat(1))}async function w(...U){return T(await VCt(U))}function k(...U){I();for(const q of U.flat(1))f.loadTheme(q)}async function P(...U){return I(),k(await WCt(U))}function I(){if(o)throw new gf("Shiki instance has been disposed")}function F(){o||(o=!0,f.dispose(),U$-=1)}return{setTheme:b,getTheme:y,getLanguage:g,getLoadedThemes:x,getLoadedLanguages:S,loadLanguage:w,loadLanguageSync:T,loadTheme:P,loadThemeSync:k,dispose:F,[Symbol.dispose]:F}}async function z_r(t={}){t.loadWasm;const[o,s,u]=await Promise.all([WCt(t.themes||[]),VCt(t.langs||[]),t.engine||lCt(t.loadWasm||u2r())]);return q_r({...t,themes:o,langs:s,engine:u})}async function H_r(t={}){const o=await z_r(t);return{getLastGrammarState:(...s)=>R_r(o,...s),codeToTokensBase:(s,u)=>tIe(o,s,u),codeToTokensWithThemes:(s,u)=>GCt(o,s,u),codeToTokens:(s,u)=>Toe(o,s,u),codeToHast:(s,u)=>Aoe(o,s,u),codeToHtml:(s,u)=>j_r(o,s,u),...o,getInternalContext:()=>o}}function G_r(t,o,s){let u,d,f;{const g=t;u=g.langs,d=g.themes,f=g.engine}async function h(g){function y(w){if(typeof w=="string"){if(BCt(w))return[];const k=u[w];if(!k)throw new T2(`Language \`${w}\` is not included in this bundle. You may want to load it from external source.`);return k}return w}function b(w){if(jCt(w))return"none";if(typeof w=="string"){const k=d[w];if(!k)throw new T2(`Theme \`${w}\` is not included in this bundle. You may want to load it from external source.`);return k}return w}const x=(g.themes??[]).map(w=>b(w)),S=(g.langs??[]).map(w=>y(w)),T=await H_r({engine:g.engine??f(),...g,themes:x,langs:S});return{...T,loadLanguage(...w){return T.loadLanguage(...w.map(y))},loadTheme(...w){return T.loadTheme(...w.map(b))}}}return h}const V_r=G_r({langs:zEr,themes:GEr,engine:()=>lCt(ut(()=>import("./wasm-DQxwEHae-CG6Dc4jp.js"),[]))}),UTe={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},W_r={...UTe,patterns:[...UTe.patterns,{include:"#docvar"}],repository:{...UTe.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Y_r={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},YCt="catppuccin-latte",Q_r=V_r({themes:[YCt],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...W_r},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Y_r}]});async function HO(t,o){return(await Q_r).codeToHtml(t,{lang:o,theme:YCt})}const fu=Ln(S6)({display:"flex",flexDirection:"column",height:"100%"}),$h=Ln(_6)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),Sle=Ln(GDn)({padding:"10px"}),K_r=Ln("div")({display:"flex",flexDirection:"column",height:"100%"});Ln("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const X_r=Ln("div")({display:"flex",height:"75vh",width:"100%",overflowY:"auto"});Ln("div")({position:"relative",height:"100%",flex:"0 0 auto"});const Z_r=os([M.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V5h14z"},"0"),M.jsx("path",{d:"M7 12h2v5H7zm8-5h2v10h-2zm-4 7h2v3h-2zm0-4h2v2h-2z"},"1")]),QCt=z.createContext(void 0),Coe=({projectName:t,packageName:o,versionId:s,children:u})=>M.jsx(QCt.Provider,{value:{projectName:t,packageName:o,versionId:s},children:u});function Eg(){const t=z.useContext(QCt);if(!t)throw new Error("usePackage must be used within a PackageProvider");return t}function zh({error:t,context:o}){const s=t.data?.message||"Unknown Error";return M.jsxs(M.Fragment,{children:[o&&M.jsx(dr,{variant:"body2",sx:{p:"10px",m:"auto"},children:o}),M.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:s})]})}function Sg({text:t,size:o=20,color:s="primary",thickness:u=3.6,centered:d=!0,spacing:f=2,textVariant:h="body2"}){const g=M.jsxs(Eo,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:f},children:[M.jsx(Ewe,{size:o,color:s,thickness:u}),t&&M.jsx(dr,{variant:h,color:"text.secondary",children:t})]});return d?M.jsx(Eo,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:g}):g}const KCt=new sPn({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),rIe=async(t,o)=>{const s=o?await o():void 0;return{baseURL:t,withCredentials:!s,headers:{Authorization:s&&`Bearer ${s}`}}};function Hh(t){const{server:o,getAccessToken:s}=pIe(),u={...t,queryKey:[...t.queryKey,o],queryFn:async()=>{try{const d=await rIe(o,s);return await t.queryFn(d)}catch(d){if(d&&typeof d=="object"&&"response"in d){const f=d;if(f.response?.data){const h=new Error(f.response.data.message||f.message);throw h.status=f.response.status,h.data=f.response.data,h}}throw d}},retry:!1,throwOnError:!1};return TPn(u,KCt)}function J_r(t){const{server:o,getAccessToken:s}=pIe(),u={...t,mutationFn:async d=>{try{const f=await rIe(o,s);return await t.mutationFn(d,f)}catch(f){if(f&&typeof f=="object"&&"response"in f){const h=f;if(h.response?.data){const g=new Error(h.response.data.message||h.message);throw g.status=h.response.status,g.data=h.response.data,g}}throw f}},retry:!1,throwOnError:!1};return APn(u,KCt)}const eTr=z.lazy(()=>ut(()=>import("./RenderedResult-DXlUZo0k-lc5JU6CQ.js"),[])),tTr=new aCt(new Pd);function nTr({modelPath:t,query:o,sourceName:s,queryName:u}){const{projectName:d,packageName:f,versionId:h}=Eg(),{data:g,isSuccess:y,isError:b,error:x}=Hh({queryKey:["queryResult",d,f,t,h,o,s,u],queryFn:S=>tTr.executeQuery(d,f,t,o,s,u,h,S)});return M.jsxs(M.Fragment,{children:[!y&&!b&&M.jsx(Sg,{text:"Fetching Query Results..."}),y&&M.jsx(z.Suspense,{fallback:M.jsx("div",{children:"Loading..."}),children:M.jsx(eTr,{result:g.data.result})}),b&&M.jsx(zh,{context:`${d} > ${f} > ${t}`,error:x})]})}const rTr=Ln(S6)({display:"flex",flexDirection:"column",height:"100%"});function iTr({modelPath:t,sourceName:o,queryName:s,expandResult:u,hideResultIcon:d,expandEmbedding:f,hideEmbeddingIcon:h,noView:g,annotations:y}){const[b,x]=Dn.useState(u),[S,T]=Dn.useState(f),[w,k]=Dn.useState(),[P,I]=Dn.useState(),F=oTr(o,s);return z.useEffect(()=>{HO(F,"typescript").then(U=>{k(U)})},[S,F]),z.useEffect(()=>{if(y&&y.length>0){const U=y.map(q=>`// ${q}`).join(`
|
|
3312
3312
|
`);HO(U,"typescript").then(q=>{I(q)})}},[y]),M.jsx(M.Fragment,{children:M.jsxs(rTr,{variant:"outlined",sx:{padding:"0px 10px 0px 10px",borderRadius:"0px"},children:[M.jsxs(ma,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"},children:[M.jsx(dr,{variant:"subtitle2",sx:{mt:"auto",mb:"auto"},children:`${g?"":"View >"} ${s}`}),M.jsxs(tae,{sx:{padding:"0px"},children:[!d&&M.jsx(dl,{title:b?"Hide Results":"Show Results",children:M.jsx(cl,{size:"small",onClick:()=>{x(!b)},children:M.jsx(Z_r,{})})}),!h&&M.jsx(dl,{title:S?"Hide Sharing":"Show Sharing",children:M.jsx(cl,{size:"small",onClick:()=>{T(!S)},children:M.jsx(CH,{})})})]})]}),M.jsxs(ay,{in:S,timeout:"auto",unmountOnExit:!0,children:[M.jsx(wc,{}),M.jsxs(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[M.jsx(dr,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:M.jsx("div",{dangerouslySetInnerHTML:{__html:w}})}),M.jsx(dl,{title:"Copy Embeddable Code",children:M.jsx(cl,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(F)},children:M.jsx(yle,{})})})]})]}),M.jsxs(ay,{in:b,timeout:"auto",unmountOnExit:!0,children:[M.jsx(wc,{sx:{mb:"4px"}}),P&&M.jsxs(M.Fragment,{children:[M.jsx(ma,{sx:{borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:M.jsx(dr,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:M.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:P}})})}),M.jsx(wc,{sx:{mb:"4px"}})]}),M.jsx(_6,{children:M.jsx(nTr,{modelPath:t,sourceName:o,queryName:s})})]})]})})}function oTr(t,o){return`<QueryResult
|
|
3313
3313
|
sourceName="${t}"
|
|
3314
3314
|
queryName="${o}"
|
|
3315
3315
|
/>`}function aTr(t){const{theme:o,name:s,props:u}=t;return!o||!o.components||!o.components[s]||!o.components[s].defaultProps?u:hoe(o.components[s].defaultProps,u)}const sTr=z6e();function lTr(t=sTr){return Avr(t)}function uTr({props:t,name:o,defaultTheme:s,themeId:u}){let d=lTr(s);return d=d[u]||d,aTr({theme:d,name:o,props:t})}function cTr({props:t,name:o}){return uTr({props:t,name:o,defaultTheme:H6e,themeId:G6e})}const dTr=new aCt(new Pd),fTr=hs(E0t)(({theme:t})=>({display:"flex",flexWrap:"wrap",gap:t.spacing(.5),borderBottom:`1px solid ${t.palette.divider}`,minHeight:36})),pTr=hs(Cc)(({theme:t,selected:o})=>({minHeight:36,padding:t.spacing(.5,2),borderRadius:t.shape.borderRadius,background:o?t.palette.action.selected:"none",color:o?t.palette.primary.main:t.palette.text.primary,fontWeight:o?600:400,border:o?`1px solid ${t.palette.primary.main}`:"1px solid transparent",boxShadow:o?t.shadows[1]:"none",textTransform:"uppercase","&:hover":{background:t.palette.action.hover,border:`1px solid ${t.palette.primary.light}`}}));function XCt({sourceAndPaths:t,existingQuery:o,existingSourceName:s,onQueryChange:u,onSourceChange:d}){const[f,h]=Dn.useState(s?t.findIndex(b=>b.sourceInfo.name===s):0),[g,y]=Dn.useState(o||KU());return Dn.useEffect(()=>{d&&d(f)},[f,d]),M.jsxs(fu,{variant:"outlined",children:[M.jsx($h,{children:M.jsx(Oit,{sx:{flexDirection:"row",justifyContent:"space-between"},children:t.length>0&&M.jsx(fTr,{children:t.map((b,x)=>M.jsx(pTr,{selected:f===x,onClick:()=>h(x),children:b.sourceInfo.name||`Source ${x+1}`},b.sourceInfo.name||x))})})}),M.jsx(Sle,{children:M.jsxs(Oit,{spacing:2,component:"section",children:[M.jsx(ZCt,{sourceAndPath:t[f],existingQuery:g,onChange:b=>{y(b),u&&u(b)}}),M.jsx(E0t,{height:"5px"})]})})]})}function KU(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function ZCt({sourceAndPath:t,onChange:o,existingQuery:s}){const[u,d]=Dn.useState(s||KU()),[f,h]=Dn.useState([]);Dn.useEffect(()=>{o&&o(u)},[o,u]);const{projectName:g,packageName:y,versionId:b}=Eg(),x=J_r({mutationFn:(k,P)=>{const I=new yi.ASTQuery({source:t.sourceInfo,query:u?.malloyQuery}).toMalloy();return d({...u,query:I}),dTr.executeQuery(g,y,t.modelPath,I,void 0,void 0,b,P)},onSuccess:k=>{if(k){const P=JSON.parse(k.data.result);d({...u,malloyResult:P})}}}),[S,T]=Dn.useState(t.sourceInfo.name);Dn.useEffect(()=>{S!==t.sourceInfo.name&&(T(t.sourceInfo.name),d(KU()))},[t,S]);const w=Dn.useCallback(k=>{d({...u,malloyQuery:k})},[u]);return S!==t.sourceInfo.name?M.jsx("div",{children:"Loading..."}):M.jsx(K_r,{children:M.jsx(X_r,{children:M.jsx(ijn,{source:t.sourceInfo,query:u?.malloyQuery,onQueryChange:w,focusedNestViewPath:f,onFocusedNestViewPathChange:h,onDrill:k=>{console.info(k)},children:M.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:M.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[M.jsx(Xft,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:t.sourceInfo.name,children:M.jsx(Yrr,{onRefresh:()=>d(KU())})}),M.jsx(Xft,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:M.jsx(mrr,{runQuery:()=>{x.mutate()}})}),M.jsx(Frr,{source:t.sourceInfo,draftQuery:u?.malloyQuery,setDraftQuery:k=>d({...u,malloyQuery:k}),submittedQuery:u?.malloyQuery?{executionState:x.isPending?"running":"finished",response:{result:u.malloyResult},query:u.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:x.reset}:void 0,options:{showRawQuery:!0}})]})})})})},t.sourceInfo.name)}const hTr=new xle(new Pd);function mTr({modelPath:t,expandResults:o,hideResultIcons:s,expandEmbeddings:u,hideEmbeddingIcons:d}){const[f,h]=Dn.useState(!1),[g,y]=Dn.useState(),[b,x]=Dn.useState(0),{projectName:S,packageName:T,versionId:w}=Eg(),k=gTr(t);z.useEffect(()=>{HO(k,"typescript").then(q=>{y(q)})},[f,k]);const{data:P,isError:I,isLoading:F,error:U}=Hh({queryKey:["package",S,T,t,w],queryFn:async q=>(await hTr.getModel(S,T,t,w,q)).data});return F?M.jsx(Sg,{text:"Fetching Model..."}):I?(console.log("error",U),M.jsx(zh,{error:U,context:`${T} > ${t}`})):M.jsxs(fu,{variant:"outlined",children:[M.jsxs($h,{children:[M.jsxs(ma,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[Array.isArray(P.sourceInfos)&&P.sourceInfos.length>0&&M.jsx(c7n,{value:b,onChange:(q,G)=>x(G),variant:"scrollable",scrollButtons:"auto",sx:{borderBottom:1,borderColor:"divider",minHeight:36},children:P.sourceInfos.map((q,G)=>{let Q;try{Q=JSON.parse(q)}catch{Q={name:String(G)}}return M.jsx(vLn,{label:Q.name||`Source ${G+1}`,sx:{minHeight:36}},Q.name||G)})}),!d&&M.jsx(tae,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:M.jsx(dl,{title:f?"Hide Embedding":"View Embedding",children:M.jsx(cl,{size:"small",onClick:()=>{h(!f)},children:M.jsx(CH,{})})})})]}),M.jsxs(ay,{in:f,timeout:"auto",unmountOnExit:!0,children:[M.jsx(wc,{}),M.jsxs(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[M.jsx(dr,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:M.jsx("div",{dangerouslySetInnerHTML:{__html:g}})}),M.jsx(dl,{title:"Copy Embeddable Code",children:M.jsx(cl,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(k)},children:M.jsx(yle,{})})})]})]}),M.jsx(wc,{})]}),M.jsx(Sle,{children:M.jsxs(ma,{spacing:2,component:"section",children:[Array.isArray(P.sourceInfos)&&P.sourceInfos.length>0&&M.jsx(ZCt,{sourceAndPath:{modelPath:t,sourceInfo:JSON.parse(P.sourceInfos[b])}}),P.queries?.length>0&&M.jsxs(fu,{variant:"outlined",sx:{padding:"0px 10px 0px 10px"},children:[M.jsx($h,{sx:{p:"10px"},children:M.jsx(dr,{variant:"subtitle1",children:"Named Queries"})}),M.jsx(ma,{spacing:1,component:"section",children:P.queries.map(q=>M.jsx(iTr,{modelPath:t,queryName:q.name,expandResult:o,hideResultIcon:s,expandEmbedding:u,hideEmbeddingIcon:d,noView:!0,annotations:q.annotations},q.name))}),M.jsx(Eo,{height:"10px"})]}),M.jsx(Eo,{height:"5px"})]})})]})}function gTr(t){return`<Model
|
|
3316
3316
|
modelPath="${t}"
|
|
3317
3317
|
accessToken={accessToken}
|
|
3318
|
-
/>`}const JCt=os(M.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),yTr=z.lazy(()=>ut(()=>import("./RenderedResult-DXlUZo0k-
|
|
3318
|
+
/>`}const JCt=os(M.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),yTr=z.lazy(()=>ut(()=>import("./RenderedResult-DXlUZo0k-lc5JU6CQ.js"),[]));function ewt({result:t,minHeight:o,maxHeight:s}){const[u,d]=z.useState(!1),[f,h]=z.useState(0),[g,y]=z.useState(!1),b=z.useRef(null),x=z.useRef(null),[S,T]=z.useState(void 0),[w,k]=z.useState(!1),P=z.useCallback(()=>{const G=u;d(!u),G&&x.current&&setTimeout(()=>{x.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)},[u]),I=z.useCallback(G=>{h(G)},[]);if(z.useEffect(()=>{if(w){y(!0);return}if(f===0){y(!1);return}const G=o-20,Q=f>G;f<G&&T(f+20),y(Q)},[f,w,o]),!t)return null;const F=M.jsx(Sg,{text:"Loading...",centered:!0,size:32}),U=w?u?s-40:o-40:void 0,q=S?{minHeight:`${S}px`,height:"100%"}:{height:"100%"};return M.jsx(M.Fragment,{children:M.jsxs(Eo,{ref:x,sx:{position:"relative",minHeight:`${o}px`,maxHeight:`${u?s:o}px`,border:"0px",borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",...q},children:[M.jsx(Eo,{ref:b,sx:{flex:1,overflow:u?"auto":"hidden",p:0,pb:g?"40px":1},children:t&&M.jsx(z.Suspense,{fallback:F,children:M.jsx(yTr,{result:t,height:U,isFillElement:G=>{k(G)},onSizeChange:I})})||F}),g&&M.jsx(Eo,{sx:{position:"absolute",bottom:0,left:0,right:0,height:"32px",backgroundColor:"rgba(255,255,255,0.75)",display:"flex",alignItems:"center",justifyContent:"center"},children:M.jsx(cl,{size:"small",onClick:P,sx:{color:"text.secondary","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},title:u?"Collapse to original size":"Expand to full size",children:u?M.jsx(oor,{sx:{fontSize:30}}):M.jsx(aor,{sx:{fontSize:30}})})})]})})}const xTr=`
|
|
3319
3319
|
.code-display pre {
|
|
3320
3320
|
margin: 0;
|
|
3321
3321
|
padding: 0;
|
|
@@ -3411,4 +3411,4 @@ import {${o.sourceName}}" from '${o.modelPath}'"
|
|
|
3411
3411
|
`));s(w=>{const k=w.items.itemMetaMap[S];return k.label!==T?$r({},w,{items:$r({},w.items,{itemMetaMap:$r({},w.items.itemMetaMap,{[S]:$r({},k,{label:T})})})}):w}),u.onItemLabelChange&&u.onItemLabelChange(S,T)};return{instance:{setEditedItemId:h,isItemBeingEdited:g,updateItemLabel:x,isItemEditable:b,isTreeViewEditable:y,isItemBeingEditedRef:f},publicAPI:{updateItemLabel:x}}};ug.itemPlugin=IAr;ug.getDefaultizedParams=({params:t,experimentalFeatures:o})=>{const s=o?.labelEditing;return $r({},t,{isItemEditable:s?t.isItemEditable??!1:!1})};ug.getInitialState=()=>({editedItemId:null});ug.params={onItemLabelChange:!0,isItemEditable:!0};const OO=(t,o)=>t.getAvailablePlugins().has(o),fwt=t=>Array.isArray(t)?t.length>0&&t.some(fwt):!!t,LAr=({itemId:t,children:o})=>{const{instance:s,selection:{multiSelect:u},publicAPI:d}=pN(),f={expandable:fwt(o),expanded:s.isItemExpanded(t),focused:s.isItemFocused(t),selected:s.isItemSelected(t),disabled:s.isItemDisabled(t),editing:s?.isItemBeingEdited?s?.isItemBeingEdited(t):!1,editable:s.isItemEditable?s.isItemEditable(t):!1},h=x=>{if(f.disabled)return;f.focused||s.focusItem(x,t);const S=u&&(x.shiftKey||x.ctrlKey||x.metaKey);f.expandable&&!(S&&s.isItemExpanded(t))&&s.toggleItemExpansion(x,t)},g=x=>{f.disabled||(f.focused||s.focusItem(x,t),u&&(x.shiftKey||x.ctrlKey||x.metaKey)?x.shiftKey?s.expandSelectionRange(x,t):s.selectItem({event:x,itemId:t,keepExistingSelection:!0}):s.selectItem({event:x,itemId:t,shouldBeSelected:!0}))},y=x=>{const S=x.nativeEvent.shiftKey;u&&S?s.expandSelectionRange(x,t):s.selectItem({event:x,itemId:t,keepExistingSelection:u,shouldBeSelected:x.target.checked})},b=()=>{OO(s,ug)&&s.isItemEditable(t)&&(s.isItemBeingEdited(t)?s.setEditedItemId(null):s.setEditedItemId(t))};return{interactions:{handleExpansion:h,handleSelection:g,handleCheckboxSelection:y,toggleItemEditing:b,handleSaveItemLabel:(x,S)=>{OO(s,ug)&&s.isItemBeingEditedRef(t)&&(s.updateItemLabel(t,S),b(),s.focusItem(x,t))},handleCancelItemLabelEditing:x=>{OO(s,ug)&&s.isItemBeingEditedRef(t)&&(b(),s.focusItem(x,t))}},status:f,publicAPI:d}},sIe=z.createContext(()=>-1),pwt=(t,o)=>{let s=o.length-1;for(;s>=0&&!t.isItemNavigable(o[s]);)s-=1;if(s!==-1)return o[s]},hwt=(t,o)=>{const s=t.getItemMeta(o),u=t.getItemOrderedChildrenIds(s.parentId),d=t.getItemIndex(o);if(d===0)return s.parentId;let f=d-1;for(;!t.isItemNavigable(u[f])&&f>=0;)f-=1;if(f===-1)return s.parentId==null?null:hwt(t,s.parentId);let h=u[f],g=pwt(t,t.getItemOrderedChildrenIds(h));for(;t.isItemExpanded(h)&&g!=null;)h=g,g=t.getItemOrderedChildrenIds(h).find(t.isItemNavigable);return h},Hre=(t,o)=>{if(t.isItemExpanded(o)){const u=t.getItemOrderedChildrenIds(o).find(t.isItemNavigable);if(u!=null)return u}let s=t.getItemMeta(o);for(;s!=null;){const u=t.getItemOrderedChildrenIds(s.parentId),d=t.getItemIndex(s.id);if(d<u.length-1){let f=d+1;for(;!t.isItemNavigable(u[f])&&f<u.length-1;)f+=1;if(t.isItemNavigable(u[f]))return u[f]}s=t.getItemMeta(s.parentId)}return null},mwt=t=>{let o=null;for(;o==null||t.isItemExpanded(o);){const s=t.getItemOrderedChildrenIds(o),u=pwt(t,s);if(u==null)return o;o=u}return o},tz=t=>t.getItemOrderedChildrenIds(null).find(t.isItemNavigable),gwt=(t,o,s)=>{if(o===s)return[o,s];const u=t.getItemMeta(o),d=t.getItemMeta(s);if(u.parentId===d.id||d.parentId===u.id)return d.parentId===u.id?[u.id,d.id]:[d.id,u.id];const f=[u.id],h=[d.id];let g=u.parentId,y=d.parentId,b=h.indexOf(g)!==-1,x=f.indexOf(y)!==-1,S=!0,T=!0;for(;!x&&!b;)S&&(f.push(g),b=h.indexOf(g)!==-1,S=g!==null,!b&&S&&(g=t.getItemMeta(g).parentId)),T&&!b&&(h.push(y),x=f.indexOf(y)!==-1,T=y!==null,!x&&T&&(y=t.getItemMeta(y).parentId));const w=b?g:y,k=t.getItemOrderedChildrenIds(w),P=f[f.indexOf(w)-1],I=h[h.indexOf(w)-1];return k.indexOf(P)<k.indexOf(I)?[o,s]:[s,o]},PAr=(t,o,s)=>{const u=y=>{if(t.isItemExpandable(y)&&t.isItemExpanded(y))return t.getItemOrderedChildrenIds(y)[0];let b=t.getItemMeta(y);for(;b!=null;){const x=t.getItemOrderedChildrenIds(b.parentId),S=t.getItemIndex(b.id);if(S<x.length-1)return x[S+1];b=t.getItemMeta(b.parentId)}throw new Error("Invalid range")},[d,f]=gwt(t,o,s),h=[d];let g=d;for(;g!==f;)g=u(g),t.isItemDisabled(g)||h.push(g);return h},MAr=t=>{let o=tz(t);const s=[];for(;o!=null;)s.push(o),o=Hre(t,o);return s},nz=(t,o)=>o!==t.closest('*[role="treeitem"]');let bgt=0;const FAr=()=>(bgt+=1,`mui-tree-view-${bgt}`),lIe=({id:t,treeId:o="",itemId:s})=>t??`${o}-${s}`,BAr=t=>{const{runItemPlugins:o,items:{onItemClick:s,disabledItemsFocusable:u,indentationAtItemLevel:d},selection:{disableSelection:f,checkboxSelection:h},expansion:{expansionTrigger:g},treeId:y,instance:b,publicAPI:x}=pN(),S=z.useContext(sIe),{id:T,itemId:w,label:k,children:P,rootRef:I}=t,{rootRef:F,contentRef:U,propsEnhancers:q}=o(t),{interactions:G,status:Q}=LAr({itemId:w,children:P}),K=z.useRef(null),te=z.useRef(null),oe=OI(I,F,K),fe=OI(U,te),X=z.useRef(null),le=lIe({itemId:w,treeId:y,id:T}),me=b.canItemBeTabbed(w)?0:-1,Ee={rootRefObject:K,contentRefObject:te,interactions:G},we=Ke=>ie=>{if(Ke.onFocus?.(ie),ie.defaultMuiPrevented)return;const pe=!Q.disabled||u;!Q.focused&&pe&&ie.currentTarget===ie.target&&b.focusItem(ie,w)},xe=Ke=>ie=>{if(Ke.onBlur?.(ie),ie.defaultMuiPrevented)return;const pe=b.getItemDOMElement(w);Q.editing||ie.relatedTarget&&nz(ie.relatedTarget,pe)&&(ie.target&&ie.target?.dataset?.element==="labelInput"&&nz(ie.target,pe)||ie.relatedTarget?.dataset?.element==="labelInput")||b.removeFocusedItem()},ve=Ke=>ie=>{Ke.onKeyDown?.(ie),!(ie.defaultMuiPrevented||ie.target?.dataset?.element==="labelInput")&&b.handleItemKeyDown(ie,w)},Be=Ke=>ie=>{Ke.onDoubleClick?.(ie),!ie.defaultMuiPrevented&&G.toggleItemEditing()},Qe=Ke=>ie=>{Ke.onClick?.(ie),s?.(ie,w),!(ie.defaultMuiPrevented||X.current?.contains(ie.target))&&(g==="content"&&G.handleExpansion(ie),h||G.handleSelection(ie))},Me=Ke=>ie=>{Ke.onMouseDown?.(ie),!ie.defaultMuiPrevented&&(ie.shiftKey||ie.ctrlKey||ie.metaKey||Q.disabled)&&ie.preventDefault()},ce=Ke=>ie=>{Ke.onChange?.(ie),!ie.defaultMuiPrevented&&(f||Q.disabled||G.handleCheckboxSelection(ie))},Ue=Ke=>ie=>{Ke.onClick?.(ie),!ie.defaultMuiPrevented&&g==="iconContainer"&&G.handleExpansion(ie)};return{getRootProps:(Ke={})=>{const ie=$r({},Hm(t),Hm(Ke));let pe;Q.selected?pe=!0:f||Q.disabled?pe=void 0:pe=!1;const be=$r({},ie,{ref:oe,role:"treeitem",tabIndex:me,id:le,"aria-expanded":Q.expandable?Q.expanded:void 0,"aria-selected":pe,"aria-disabled":Q.disabled||void 0},Ke,{onFocus:we(ie),onBlur:xe(ie),onKeyDown:ve(ie)});d&&(be.style={"--TreeView-itemDepth":typeof S=="function"?S(w):S});const Se=q.root?.($r({},Ee,{externalEventHandlers:ie}))??{};return $r({},be,Se)},getContentProps:(Ke={})=>{const ie=Hm(Ke),pe=$r({},ie,Ke,{ref:fe,onClick:Qe(ie),onMouseDown:Me(ie),status:Q});d&&(pe.indentationAtItemLevel=!0);const be=q.content?.($r({},Ee,{externalEventHandlers:ie}))??{};return $r({},pe,be)},getGroupTransitionProps:(Ke={})=>{const ie=Hm(Ke),pe=$r({},ie,{unmountOnExit:!0,component:"ul",role:"group",in:Q.expanded,children:P},Ke);return d&&(pe.indentationAtItemLevel=!0),pe},getIconContainerProps:(Ke={})=>{const ie=Hm(Ke);return $r({},ie,Ke,{onClick:Ue(ie)})},getCheckboxProps:(Ke={})=>{const ie=Hm(Ke);return $r({},ie,{visible:h,ref:X,checked:Q.selected,disabled:f||Q.disabled,tabIndex:-1},Ke,{onChange:ce(ie)})},getLabelProps:(Ke={})=>{const ie=$r({},Hm(Ke)),pe=$r({},ie,{children:k},Ke,{onDoubleClick:Be(ie)});return b.isTreeViewEditable&&(pe.editable=Q.editable),pe},getLabelInputProps:(Ke={})=>{const ie=Hm(Ke),pe=q.labelInput?.({rootRefObject:K,contentRefObject:te,externalEventHandlers:ie,interactions:G})??{};return $r({},Ke,pe)},getDragAndDropOverlayProps:(Ke={})=>{const ie=Hm(Ke),pe=q.dragAndDropOverlay?.($r({},Ee,{externalEventHandlers:ie}))??{};return $r({},Ke,pe)},rootRef:oe,status:Q,publicAPI:x}},jAr=BAr;function ywt(t){const{instance:o,items:{onItemClick:s},selection:{multiSelect:u,checkboxSelection:d,disableSelection:f},expansion:{expansionTrigger:h}}=pN(),g=o.isItemExpandable(t),y=o.isItemExpanded(t),b=o.isItemFocused(t),x=o.isItemSelected(t),S=o.isItemDisabled(t),T=o?.isItemBeingEdited?o?.isItemBeingEdited(t):!1,w=o.isItemEditable?o.isItemEditable(t):!1,k=q=>{if(!S){b||o.focusItem(q,t);const G=u&&(q.shiftKey||q.ctrlKey||q.metaKey);g&&!(G&&o.isItemExpanded(t))&&o.toggleItemExpansion(q,t)}},P=q=>{S||(b||o.focusItem(q,t),u&&(q.shiftKey||q.ctrlKey||q.metaKey)?q.shiftKey?o.expandSelectionRange(q,t):o.selectItem({event:q,itemId:t,keepExistingSelection:!0}):o.selectItem({event:q,itemId:t,shouldBeSelected:!0}))},I=q=>{if(f||S)return;const G=q.nativeEvent.shiftKey;u&&G?o.expandSelectionRange(q,t):o.selectItem({event:q,itemId:t,keepExistingSelection:u,shouldBeSelected:q.target.checked})},F=q=>{(q.shiftKey||q.ctrlKey||q.metaKey||S)&&q.preventDefault()},U=()=>{OO(o,ug)&&o.isItemEditable(t)&&(o.isItemBeingEdited(t)?o.setEditedItemId(null):o.setEditedItemId(t))};return{disabled:S,expanded:y,selected:x,focused:b,editable:w,editing:T,disableSelection:f,checkboxSelection:d,handleExpansion:k,handleSelection:P,handleCheckboxSelection:I,handleContentClick:s,preventSelection:F,expansionTrigger:h,toggleItemEditing:U,handleSaveItemLabel:(q,G)=>{OO(o,ug)&&o.isItemBeingEditedRef(t)&&(o.updateItemLabel(t,G),U(),o.focusItem(q,t))},handleCancelItemLabelEditing:q=>{OO(o,ug)&&o.isItemBeingEditedRef(t)&&(U(),o.focusItem(q,t))}}}const $Ar=hs("div",{name:"MuiTreeItem2DragAndDropOverlay",slot:"Root",overridesResolver:(t,o)=>o.root,shouldForwardProp:t=>Xne(t)&&t!=="action"})(({theme:t})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:t.shape.borderRadius,backgroundColor:t.vars?`rgba(${t.vars.palette.primary.darkChannel} / ${t.vars.palette.action.focusOpacity})`:Vi(t.palette.primary.dark,t.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(t.vars||t).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(t.vars||t).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(t.vars||t).palette.action.active}`}}]}));function UAr(t){return t.action==null?null:M.jsx($Ar,$r({},t))}const qAr=hs("input",{name:"MuiTreeItem2",slot:"LabelInput",overridesResolver:(t,o)=>o.labelInput})(({theme:t})=>$r({},t.typography.body1,{width:"100%",backgroundColor:t.palette.background.paper,borderRadius:t.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${t.palette.primary.main}`}})),zAr=["classes","className","displayIcon","expansionIcon","icon","label","itemId","onClick","onMouseDown","dragAndDropOverlayProps","labelInputProps"],xwt=z.forwardRef(function(t,o){const{classes:s,className:u,displayIcon:d,expansionIcon:f,icon:h,label:g,itemId:y,onClick:b,onMouseDown:x,dragAndDropOverlayProps:S,labelInputProps:T}=t,w=x2(t,zAr),{disabled:k,expanded:P,selected:I,focused:F,editing:U,editable:q,disableSelection:G,checkboxSelection:Q,handleExpansion:K,handleSelection:te,handleCheckboxSelection:oe,handleContentClick:fe,preventSelection:X,expansionTrigger:le,toggleItemEditing:me}=ywt(y),Ee=h||f||d,we=z.useRef(null),xe=Qe=>{X(Qe),x&&x(Qe)},ve=Qe=>{fe?.(Qe,y),!we.current?.contains(Qe.target)&&(le==="content"&&K(Qe),Q||te(Qe),b&&b(Qe))},Be=Qe=>{Qe.defaultMuiPrevented||me()};return M.jsxs("div",$r({},w,{className:hl(s.root,u,P&&s.expanded,I&&s.selected,F&&s.focused,k&&s.disabled,U&&s.editing,q&&s.editable),onClick:ve,onMouseDown:xe,ref:o,children:[M.jsx("div",{className:s.iconContainer,children:Ee}),Q&&M.jsx(lwt,{className:s.checkbox,checked:I,onChange:oe,disabled:k||G,ref:we,tabIndex:-1}),U?M.jsx(qAr,$r({},T,{className:s.labelInput})):M.jsx("div",$r({className:s.label},q&&{onDoubleClick:Be},{children:g})),S&&M.jsx(UAr,$r({},S))]}))}),vgt=t=>t,HAr=()=>{let t=vgt;return{configure(o){t=o},generate(o){return t(o)},reset(){t=vgt}}},GAr=HAr(),VAr={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function uIe(t,o,s="Mui"){const u=VAr[o];return u?`${s}-${u}`:`${GAr.generate(t)}-${o}`}function bwt(t,o,s="Mui"){const u={};return o.forEach(d=>{u[d]=uIe(t,d,s)}),u}function WAr(t){return uIe("MuiTreeItem",t)}const i2=bwt("MuiTreeItem",["root","groupTransition","content","expanded","selected","focused","disabled","iconContainer","label","checkbox","labelInput","editable","editing","dragAndDropOverlay"]),vwt=os(M.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Ewt=os(M.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function cIe(t){const{children:o,itemId:s}=t,{wrapItem:u,instance:d}=pN();return u({children:o,itemId:s,instance:d})}cIe.propTypes={children:Smt.node,itemId:Smt.string.isRequired};const YAr=["children","className","slots","slotProps","ContentComponent","ContentProps","itemId","id","label","onClick","onMouseDown","onFocus","onBlur","onKeyDown"],QAr=["ownerState"],KAr=["ownerState"],XAr=["ownerState"],ZAr=cwt(),JAr=t=>{const{classes:o}=t;return uwt({root:["root"],content:["content"],expanded:["expanded"],selected:["selected"],focused:["focused"],disabled:["disabled"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],labelInput:["labelInput"],editing:["editing"],editable:["editable"],groupTransition:["groupTransition"]},WAr,o)},e3r=hs("li",{name:"MuiTreeItem",slot:"Root",overridesResolver:(t,o)=>o.root})({listStyle:"none",margin:0,padding:0,outline:0}),t3r=hs(xwt,{name:"MuiTreeItem",slot:"Content",overridesResolver:(t,o)=>[o.content,o.iconContainer&&{[`& .${i2.iconContainer}`]:o.iconContainer},o.label&&{[`& .${i2.label}`]:o.label}],shouldForwardProp:t=>QT(t)&&t!=="indentationAtItemLevel"})(({theme:t})=>({padding:t.spacing(.5,1),borderRadius:t.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:t.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(t.vars||t).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${i2.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity,backgroundColor:"transparent"},[`&.${i2.focused}`]:{backgroundColor:(t.vars||t).palette.action.focus},[`&.${i2.selected}`]:{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity),"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity)}},[`&.${i2.focused}`]:{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.focusOpacity}))`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.focusOpacity)}},[`& .${i2.iconContainer}`]:{width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}},[`& .${i2.label}`]:$r({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative"},t.typography.body1),[`& .${i2.checkbox}`]:{padding:0},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${t.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}}]})),n3r=hs(ez,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(t,o)=>o.groupTransition,shouldForwardProp:t=>QT(t)&&t!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]}),r3r=z.forwardRef(function(t,o){const{icons:s,runItemPlugins:u,items:{disabledItemsFocusable:d,indentationAtItemLevel:f},selection:{disableSelection:h},expansion:{expansionTrigger:g},treeId:y,instance:b}=pN(),x=z.useContext(sIe),S=ZAr({props:t,name:"MuiTreeItem"}),{children:T,className:w,slots:k,slotProps:P,ContentComponent:I=xwt,ContentProps:F,itemId:U,id:q,label:G,onClick:Q,onMouseDown:K,onBlur:te,onKeyDown:oe}=S,fe=x2(S,YAr),{expanded:X,focused:le,selected:me,disabled:Ee,editing:we,handleExpansion:xe,handleCancelItemLabelEditing:ve,handleSaveItemLabel:Be}=ywt(U),{contentRef:Qe,rootRef:Me,propsEnhancers:ce}=u(S),Ue=z.useRef(null),Ke=z.useRef(null),ie=OI(o,Me,Ue),pe=OI(F?.ref,Qe,Ke),be={expandIcon:k?.expandIcon??s.slots.expandIcon??vwt,collapseIcon:k?.collapseIcon??s.slots.collapseIcon??Ewt,endIcon:k?.endIcon??s.slots.endIcon,icon:k?.icon,groupTransition:k?.groupTransition},Se=ge=>Array.isArray(ge)?ge.length>0&&ge.some(Se):!!ge,Le=Se(T),ye=$r({},S,{expanded:X,focused:le,selected:me,disabled:Ee,indentationAtItemLevel:f}),Ne=JAr(ye),$e=be.groupTransition??void 0,Ve=vO({elementType:$e,ownerState:{},externalSlotProps:P?.groupTransition,additionalProps:$r({unmountOnExit:!0,in:X,component:"ul",role:"group"},f?{indentationAtItemLevel:!0}:{}),className:Ne.groupTransition}),it=ge=>{g==="iconContainer"&&xe(ge)},Je=X?be.collapseIcon:be.expandIcon,Ye=vO({elementType:Je,ownerState:{},externalSlotProps:ge=>X?$r({},u2(s.slotProps.collapseIcon,ge),u2(P?.collapseIcon,ge)):$r({},u2(s.slotProps.expandIcon,ge),u2(P?.expandIcon,ge)),additionalProps:{onClick:it}}),vt=x2(Ye,QAr),It=Le&&Je?M.jsx(Je,$r({},vt)):null,Ot=Le?void 0:be.endIcon,Yt=vO({elementType:Ot,ownerState:{},externalSlotProps:ge=>Le?{}:$r({},u2(s.slotProps.endIcon,ge),u2(P?.endIcon,ge))}),ht=x2(Yt,KAr),Bt=Ot?M.jsx(Ot,$r({},ht)):null,Gt=be.icon,an=vO({elementType:Gt,ownerState:{},externalSlotProps:P?.icon}),sr=x2(an,XAr),mt=Gt?M.jsx(Gt,$r({},sr)):null;let Mt;me?Mt=!0:h||Ee?Mt=void 0:Mt=!1;function gt(ge){!le&&(!Ee||d)&&ge.currentTarget===ge.target&&b.focusItem(ge,U)}function Nt(ge){te?.(ge),!(we||ge.relatedTarget&&nz(ge.relatedTarget,Ue.current)&&(ge.target&&ge.target?.dataset?.element==="labelInput"&&nz(ge.target,Ue.current)||ge.relatedTarget?.dataset?.element==="labelInput"))&&b.removeFocusedItem()}const Xt=ge=>{oe?.(ge),ge.target?.dataset?.element!=="labelInput"&&b.handleItemKeyDown(ge,U)},fn=lIe({itemId:U,treeId:y,id:q}),Pn=b.canItemBeTabbed(U)?0:-1,Cn={rootRefObject:Ue,contentRefObject:Ke,interactions:{handleSaveItemLabel:Be,handleCancelItemLabelEditing:ve}},mr=ce.root?.($r({},Cn,{externalEventHandlers:Hm(fe)}))??{},Or=ce.content?.($r({},Cn,{externalEventHandlers:Hm(F)}))??{},He=ce.dragAndDropOverlay?.($r({},Cn,{externalEventHandlers:{}}))??{},Z=ce.labelInput?.($r({},Cn,{externalEventHandlers:{}}))??{};return M.jsx(cIe,{itemId:U,children:M.jsxs(e3r,$r({className:hl(Ne.root,w),role:"treeitem","aria-expanded":Le?X:void 0,"aria-selected":Mt,"aria-disabled":Ee||void 0,id:fn,tabIndex:Pn},fe,{ownerState:ye,onFocus:gt,onBlur:Nt,onKeyDown:Xt,ref:ie,style:f?$r({},fe.style,{"--TreeView-itemDepth":typeof x=="function"?x(U):x}):fe.style},mr,{children:[M.jsx(t3r,$r({as:I,classes:{root:Ne.content,expanded:Ne.expanded,selected:Ne.selected,focused:Ne.focused,disabled:Ne.disabled,editable:Ne.editable,editing:Ne.editing,iconContainer:Ne.iconContainer,label:Ne.label,labelInput:Ne.labelInput,checkbox:Ne.checkbox},label:G,itemId:U,onClick:Q,onMouseDown:K,icon:mt,expansionIcon:It,displayIcon:Bt,ownerState:ye},F,Or,He.action==null?{}:{dragAndDropOverlayProps:He},Z.value==null?{}:{labelInputProps:Z},{ref:pe})),T&&M.jsx(n3r,$r({as:$e},Ve,{children:T}))]}))})});function i3r(t){const{slots:o,slotProps:s,status:u}=t,d=pN(),f=$r({},d.icons.slots,{expandIcon:d.icons.slots.expandIcon??vwt,collapseIcon:d.icons.slots.collapseIcon??Ewt}),h=d.icons.slotProps;let g;o?.icon?g="icon":u.expandable?u.expanded?g="collapseIcon":g="expandIcon":g="endIcon";const y=o?.[g]??f[g],b=vO({elementType:y,externalSlotProps:x=>$r({},u2(h[g],x),u2(s?.[g],x)),ownerState:{}});return y?M.jsx(y,$r({},b)):null}const o3r=["visible"],a3r=hs("li",{name:"MuiTreeItem2",slot:"Root",overridesResolver:(t,o)=>o.root})({listStyle:"none",margin:0,padding:0,outline:0}),s3r=hs("div",{name:"MuiTreeItem2",slot:"Content",overridesResolver:(t,o)=>o.content,shouldForwardProp:t=>QT(t)&&t!=="status"&&t!=="indentationAtItemLevel"})(({theme:t})=>({padding:t.spacing(.5,1),borderRadius:t.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:t.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(t.vars||t).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${t.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}},{props:({status:o})=>o.disabled,style:{opacity:(t.vars||t).palette.action.disabledOpacity,backgroundColor:"transparent"}},{props:({status:o})=>o.focused,style:{backgroundColor:(t.vars||t).palette.action.focus}},{props:({status:o})=>o.selected,style:{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity),"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity)}}}},{props:({status:o})=>o.selected&&o.focused,style:{backgroundColor:t.vars?`rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.focusOpacity}))`:Vi(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.focusOpacity)}}]})),l3r=hs("div",{name:"MuiTreeItem2",slot:"Label",overridesResolver:(t,o)=>o.label,shouldForwardProp:t=>QT(t)&&t!=="editable"})(({theme:t})=>$r({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},t.typography.body1,{variants:[{props:({editable:o})=>o,style:{paddingLeft:"2px"}}]})),u3r=hs("div",{name:"MuiTreeItem2",slot:"IconContainer",overridesResolver:(t,o)=>o.iconContainer})({width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}});hs(ez,{name:"MuiTreeItem2",slot:"GroupTransition",overridesResolver:(t,o)=>o.groupTransition,shouldForwardProp:t=>QT(t)&&t!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]});hs(z.forwardRef((t,o)=>{const{visible:s}=t,u=x2(t,o3r);return s?M.jsx(lwt,$r({},u,{ref:o})):null}),{name:"MuiTreeItem2",slot:"Checkbox",overridesResolver:(t,o)=>o.checkbox})({padding:0});function c3r(t){return uIe("MuiRichTreeView",t)}bwt("MuiRichTreeView",["root"]);const d3r=(t,o)=>{const s=z.useRef({}),[u,d]=z.useState(()=>{const f={};return t.forEach(h=>{h.models&&Object.entries(h.models).forEach(([g,y])=>{s.current[g]={isControlled:o[g]!==void 0,getDefaultValue:y.getDefaultValue},f[g]=y.getDefaultValue(o)})}),f});return Object.fromEntries(Object.entries(s.current).map(([f,h])=>{const g=o[f]??u[f];return[f,{value:g,setControlledValue:y=>{h.isControlled||d(b=>$r({},b,{[f]:y}))}}]}))};class f3r{constructor(){this.maxListeners=20,this.warnOnce=!1,this.events={}}on(o,s,u={}){let d=this.events[o];d||(d={highPriority:new Map,regular:new Map},this.events[o]=d),u.isFirst?d.highPriority.set(s,!0):d.regular.set(s,!0)}removeListener(o,s){this.events[o]&&(this.events[o].regular.delete(s),this.events[o].highPriority.delete(s))}removeAllListeners(){this.events={}}emit(o,...s){const u=this.events[o];if(!u)return;const d=Array.from(u.highPriority.keys()),f=Array.from(u.regular.keys());for(let h=d.length-1;h>=0;h-=1){const g=d[h];u.highPriority.has(g)&&g.apply(this,s)}for(let h=0;h<f.length;h+=1){const g=f[h];u.regular.has(g)&&g.apply(this,s)}}once(o,s){const u=this;this.on(o,function d(...f){u.removeListener(o,d),s.apply(u,f)})}}const p3r=t=>t.isPropagationStopped!==void 0,Swt=()=>{const[t]=z.useState(()=>new f3r),o=z.useCallback((...u)=>{const[d,f,h={}]=u;h.defaultMuiPrevented=!1,!(p3r(h)&&h.isPropagationStopped())&&t.emit(d,f,h)},[t]),s=z.useCallback((u,d)=>(t.on(u,d),()=>{t.removeListener(u,d)}),[t]);return{instance:{$$publishEvent:o,$$subscribeEvent:s}}};Swt.params={};const _wt=({plugins:t})=>{const o=new Set(t);return{instance:{getAvailablePlugins:()=>o}}};_wt.params={};const dIe=({params:t,state:o,setState:s})=>{z.useEffect(()=>{s(d=>d.id.treeId===t.id&&d.id.treeId!==void 0?d:$r({},d,{id:$r({},d.id,{treeId:t.id??FAr()})}))},[s,t.id]);const u=t.id??o.id.treeId;return{getRootProps:()=>({id:u}),contextValue:{treeId:u}}};dIe.params={id:!0};dIe.getInitialState=({id:t})=>({id:{treeId:t??void 0}});const h3r=[Swt,_wt,dIe],m3r=["slots","slotProps","apiRef","experimentalFeatures"],g3r=t=>{let{props:{slots:o,slotProps:s,apiRef:u,experimentalFeatures:d},plugins:f}=t,h=x2(t.props,m3r);const g={};f.forEach(T=>{Object.assign(g,T.params)});const y={},b={};Object.keys(h).forEach(T=>{const w=h[T];g[T]?y[T]=w:b[T]=w});const x=d??{},S=f.reduce((T,w)=>w.getDefaultizedParams?w.getDefaultizedParams({params:T,experimentalFeatures:x}):T,y);return{apiRef:u,forwardedProps:b,pluginParams:S,slots:o??{},slotProps:s??{},experimentalFeatures:x}},y3r=({plugins:t,instance:o,publicAPI:s,rootRef:u})=>({runItemPlugins:d=>{let f=null,h=null;const g=[],y={};t.forEach(S=>{if(!S.itemPlugin)return;const T=S.itemPlugin({props:d,rootRef:f,contentRef:h});T?.rootRef&&(f=T.rootRef),T?.contentRef&&(h=T.contentRef),T?.propsEnhancers&&(g.push(T.propsEnhancers),Object.keys(T.propsEnhancers).forEach(w=>{y[w]=!0}))});const b=S=>T=>{const w={};return g.forEach(k=>{const P=k[S];P!=null&&Object.assign(w,P(T))}),w},x=Object.fromEntries(Object.keys(y).map(S=>[S,b(S)]));return{contentRef:h,rootRef:f,propsEnhancers:x}},wrapItem:({itemId:d,children:f})=>{let h=f;for(let g=t.length-1;g>=0;g-=1){const y=t[g];y.wrapItem&&(h=y.wrapItem({itemId:d,children:h,instance:o}))}return h},wrapRoot:({children:d})=>{let f=d;for(let h=t.length-1;h>=0;h-=1){const g=t[h];g.wrapRoot&&(f=g.wrapRoot({children:f,instance:o}))}return f},instance:o,rootRef:u,publicAPI:s});function x3r(t){const o=z.useRef({});return t?(t.current==null&&(t.current={}),t.current):o.current}const b3r=({plugins:t,rootRef:o,props:s})=>{const u=[...h3r,...t],{pluginParams:d,forwardedProps:f,apiRef:h,experimentalFeatures:g,slots:y,slotProps:b}=g3r({plugins:u,props:s}),x=d3r(u,d),S=z.useRef({}).current,T=x3r(h),w=z.useRef(null),k=OI(w,o),P=y3r({plugins:u,instance:S,publicAPI:T,rootRef:w}),[I,F]=z.useState(()=>{const G={};return u.forEach(Q=>{Q.getInitialState&&Object.assign(G,Q.getInitialState(d))}),G}),U=[],q=G=>{const Q=G({instance:S,params:d,slots:y,slotProps:b,experimentalFeatures:g,state:I,setState:F,rootRef:w,models:x,plugins:u});Q.getRootProps&&U.push(Q.getRootProps),Q.publicAPI&&Object.assign(T,Q.publicAPI),Q.instance&&Object.assign(S,Q.instance),Q.contextValue&&Object.assign(P,Q.contextValue)};return u.forEach(q),{getRootProps:(G={})=>{const Q=$r({role:"tree"},f,G,{ref:k});return U.forEach(K=>{Object.assign(Q,K(G))}),Q},rootRef:k,contextValue:P,instance:S}},v3r=(t,o,s)=>{t.$$publishEvent(o,s)},k6="__TREE_VIEW_ROOT_PARENT_ID__",E3r=t=>{const o={};return t.forEach((s,u)=>{o[s]=u}),o},S3r=["children"],Twt=({items:t,isItemDisabled:o,getItemLabel:s,getItemId:u})=>{const d={},f={},h={[k6]:[]},g=(b,x,S)=>{const T=u?u(b):b.id;if(T==null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.","An item was provided without id in the `items` prop:",JSON.stringify(b)].join(`
|
|
3412
3412
|
`));if(d[T]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${T}"`].join(`
|
|
3413
3413
|
`));const w=s?s(b):b.label;if(w==null)throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.","Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.","An item was provided without label in the `items` prop:",JSON.stringify(b)].join(`
|
|
3414
|
-
`));d[T]={id:T,label:w,parentId:S,idAttribute:void 0,expandable:!!b.children?.length,disabled:o?o(b):!1,depth:x},f[T]=b;const k=S??k6;h[k]||(h[k]=[]),h[k].push(T),b.children?.forEach(P=>g(P,x+1,T))};t.forEach(b=>g(b,0,null));const y={};return Object.keys(h).forEach(b=>{y[b]=E3r(h[b])}),{itemMetaMap:d,itemMap:f,itemOrderedChildrenIds:h,itemChildrenIndexes:y}},NH=({instance:t,params:o,state:s,setState:u,experimentalFeatures:d})=>{const f=z.useCallback(I=>s.items.itemMetaMap[I],[s.items.itemMetaMap]),h=z.useCallback(I=>s.items.itemMap[I],[s.items.itemMap]),g=z.useCallback(()=>{const I=F=>{const U=s.items.itemMap[F],q=x2(U,S3r),G=s.items.itemOrderedChildrenIds[F];return G&&(q.children=G.map(I)),q};return s.items.itemOrderedChildrenIds[k6].map(I)},[s.items.itemMap,s.items.itemOrderedChildrenIds]),y=z.useCallback(I=>{if(I==null)return!1;let F=t.getItemMeta(I);if(!F)return!1;if(F.disabled)return!0;for(;F.parentId!=null;)if(F=t.getItemMeta(F.parentId),F.disabled)return!0;return!1},[t]),b=z.useCallback(I=>{const F=t.getItemMeta(I).parentId??k6;return s.items.itemChildrenIndexes[F][I]},[t,s.items.itemChildrenIndexes]),x=z.useCallback(I=>s.items.itemOrderedChildrenIds[I??k6]??[],[s.items.itemOrderedChildrenIds]),S=I=>{const F=t.getItemMeta(I);return F==null?null:document.getElementById(lIe({treeId:s.id.treeId,itemId:I,id:F.idAttribute}))},T=I=>o.disabledItemsFocusable?!0:!t.isItemDisabled(I),w=z.useRef(!1),k=z.useCallback(()=>{w.current=!0},[]),P=z.useCallback(()=>w.current,[]);return z.useEffect(()=>{t.areItemUpdatesPrevented()||u(I=>{const F=Twt({items:o.items,isItemDisabled:o.isItemDisabled,getItemId:o.getItemId,getItemLabel:o.getItemLabel});return Object.values(I.items.itemMetaMap).forEach(U=>{F.itemMetaMap[U.id]||v3r(t,"removeItem",{id:U.id})}),$r({},I,{items:F})})},[t,u,o.items,o.isItemDisabled,o.getItemId,o.getItemLabel]),{getRootProps:()=>({style:{"--TreeView-itemChildrenIndentation":typeof o.itemChildrenIndentation=="number"?`${o.itemChildrenIndentation}px`:o.itemChildrenIndentation}}),publicAPI:{getItem:h,getItemDOMElement:S,getItemTree:g,getItemOrderedChildrenIds:x},instance:{getItemMeta:f,getItem:h,getItemTree:g,getItemsToRender:()=>{const I=F=>{const U=s.items.itemMetaMap[F];return{label:U.label,itemId:U.id,id:U.idAttribute,children:s.items.itemOrderedChildrenIds[F]?.map(I)}};return s.items.itemOrderedChildrenIds[k6].map(I)},getItemIndex:b,getItemDOMElement:S,getItemOrderedChildrenIds:x,isItemDisabled:y,isItemNavigable:T,preventItemUpdates:k,areItemUpdatesPrevented:P},contextValue:{items:{onItemClick:o.onItemClick,disabledItemsFocusable:o.disabledItemsFocusable,indentationAtItemLevel:d.indentationAtItemLevel??!1}}}};NH.getInitialState=t=>({items:Twt({items:t.items,isItemDisabled:t.isItemDisabled,getItemId:t.getItemId,getItemLabel:t.getItemLabel})});NH.getDefaultizedParams=({params:t})=>$r({},t,{disabledItemsFocusable:t.disabledItemsFocusable??!1,itemChildrenIndentation:t.itemChildrenIndentation??"12px"});NH.wrapRoot=({children:t,instance:o})=>M.jsx(sIe.Provider,{value:s=>o.getItemMeta(s)?.depth??0,children:t});NH.params={disabledItemsFocusable:!0,items:!0,isItemDisabled:!0,getItemLabel:!0,getItemId:!0,onItemClick:!0,itemChildrenIndentation:!0};const _3r=typeof window<"u"?z.useLayoutEffect:z.useEffect;function nI(t){const o=z.useRef(t);return _3r(()=>{o.current=t}),z.useRef((...s)=>(0,o.current)(...s)).current}const _le=({instance:t,params:o,models:s})=>{const u=z.useMemo(()=>{const S=new Map;return s.expandedItems.value.forEach(T=>{S.set(T,!0)}),S},[s.expandedItems.value]),d=(S,T)=>{o.onExpandedItemsChange?.(S,T),s.expandedItems.setControlledValue(T)},f=z.useCallback(S=>u.has(S),[u]),h=z.useCallback(S=>!!t.getItemMeta(S)?.expandable,[t]),g=nI((S,T)=>{const w=t.isItemExpanded(T);t.setItemExpansion(S,T,!w)}),y=nI((S,T,w)=>{if(t.isItemExpanded(T)===w)return;let k;w?k=[T].concat(s.expandedItems.value):k=s.expandedItems.value.filter(P=>P!==T),o.onItemExpansionToggle&&o.onItemExpansionToggle(S,T,w),d(S,k)}),b=(S,T)=>{const w=t.getItemMeta(T),k=t.getItemOrderedChildrenIds(w.parentId).filter(I=>t.isItemExpandable(I)&&!t.isItemExpanded(I)),P=s.expandedItems.value.concat(k);k.length>0&&(o.onItemExpansionToggle&&k.forEach(I=>{o.onItemExpansionToggle(S,I,!0)}),d(S,P))},x=z.useMemo(()=>o.expansionTrigger?o.expansionTrigger:t.isTreeViewEditable?"iconContainer":"content",[o.expansionTrigger,t.isTreeViewEditable]);return{publicAPI:{setItemExpansion:y},instance:{isItemExpanded:f,isItemExpandable:h,setItemExpansion:y,toggleItemExpansion:g,expandAllSiblings:b},contextValue:{expansion:{expansionTrigger:x}}}};_le.models={expandedItems:{getDefaultValue:t=>t.defaultExpandedItems}};const T3r=[];_le.getDefaultizedParams=({params:t})=>$r({},t,{defaultExpandedItems:t.defaultExpandedItems??T3r});_le.params={expandedItems:!0,defaultExpandedItems:!0,onExpandedItemsChange:!0,onItemExpansionToggle:!0,expansionTrigger:!0};const Gre=t=>Array.isArray(t)?t:t!=null?[t]:[],zTe=t=>{const o={};return t.forEach(s=>{o[s]=!0}),o},Tle=({instance:t,params:o,models:s})=>{const u=z.useRef(null),d=z.useRef({}),f=z.useMemo(()=>{const x=new Map;return Array.isArray(s.selectedItems.value)?s.selectedItems.value.forEach(S=>{x.set(S,!0)}):s.selectedItems.value!=null&&x.set(s.selectedItems.value,!0),x},[s.selectedItems.value]),h=(x,S)=>{if(o.onItemSelectionToggle)if(o.multiSelect){const T=S.filter(k=>!t.isItemSelected(k)),w=s.selectedItems.value.filter(k=>!S.includes(k));T.forEach(k=>{o.onItemSelectionToggle(x,k,!0)}),w.forEach(k=>{o.onItemSelectionToggle(x,k,!1)})}else S!==s.selectedItems.value&&(s.selectedItems.value!=null&&o.onItemSelectionToggle(x,s.selectedItems.value,!1),S!=null&&o.onItemSelectionToggle(x,S,!0));o.onSelectedItemsChange&&o.onSelectedItemsChange(x,S),s.selectedItems.setControlledValue(S)},g=x=>f.has(x),y=({event:x,itemId:S,keepExistingSelection:T=!1,shouldBeSelected:w})=>{if(o.disableSelection)return;let k;if(T){const P=Gre(s.selectedItems.value),I=t.isItemSelected(S);I&&(w===!1||w==null)?k=P.filter(F=>F!==S):!I&&(w===!0||w==null)?k=[S].concat(P):k=P}else w===!1||w==null&&t.isItemSelected(S)?k=o.multiSelect?[]:null:k=o.multiSelect?[S]:S;h(x,k),u.current=S,d.current={}},b=(x,[S,T])=>{if(o.disableSelection||!o.multiSelect)return;let w=Gre(s.selectedItems.value).slice();Object.keys(d.current).length>0&&(w=w.filter(F=>!d.current[F]));const k=zTe(w),P=PAr(t,S,T),I=P.filter(F=>!k[F]);w=w.concat(I),h(x,w),d.current=zTe(P)};return{getRootProps:()=>({"aria-multiselectable":o.multiSelect}),publicAPI:{selectItem:y},instance:{isItemSelected:g,selectItem:y,selectAllNavigableItems:x=>{if(o.disableSelection||!o.multiSelect)return;const S=MAr(t);h(x,S),d.current=zTe(S)},expandSelectionRange:(x,S)=>{if(u.current!=null){const[T,w]=gwt(t,S,u.current);b(x,[T,w])}},selectRangeFromStartToItem:(x,S)=>{b(x,[tz(t),S])},selectRangeFromItemToEnd:(x,S)=>{b(x,[S,mwt(t)])},selectItemFromArrowNavigation:(x,S,T)=>{if(o.disableSelection||!o.multiSelect)return;let w=Gre(s.selectedItems.value).slice();Object.keys(d.current).length===0?(w.push(T),d.current={[S]:!0,[T]:!0}):(d.current[S]||(d.current={}),d.current[T]?(w=w.filter(k=>k!==S),delete d.current[S]):(w.push(T),d.current[T]=!0)),h(x,w)}},contextValue:{selection:{multiSelect:o.multiSelect,checkboxSelection:o.checkboxSelection,disableSelection:o.disableSelection}}}};Tle.models={selectedItems:{getDefaultValue:t=>t.defaultSelectedItems}};const A3r=[];Tle.getDefaultizedParams=({params:t})=>$r({},t,{disableSelection:t.disableSelection??!1,multiSelect:t.multiSelect??!1,checkboxSelection:t.checkboxSelection??!1,defaultSelectedItems:t.defaultSelectedItems??(t.multiSelect?A3r:null)});Tle.params={disableSelection:!0,multiSelect:!0,checkboxSelection:!0,defaultSelectedItems:!0,selectedItems:!0,onSelectedItemsChange:!0,onItemSelectionToggle:!0};function C3r(t){return t&&t.ownerDocument||document}const Egt=1e3;class w3r{constructor(o=Egt){this.timeouts=new Map,this.cleanupTimeout=Egt,this.cleanupTimeout=o}register(o,s,u){this.timeouts||(this.timeouts=new Map);const d=setTimeout(()=>{typeof s=="function"&&s(),this.timeouts.delete(u.cleanupToken)},this.cleanupTimeout);this.timeouts.set(u.cleanupToken,d)}unregister(o){const s=this.timeouts.get(o.cleanupToken);s&&(this.timeouts.delete(o.cleanupToken),clearTimeout(s))}reset(){this.timeouts&&(this.timeouts.forEach((o,s)=>{this.unregister({cleanupToken:s})}),this.timeouts=void 0)}}class R3r{constructor(){this.registry=new FinalizationRegistry(o=>{typeof o=="function"&&o()})}register(o,s,u){this.registry.register(o,s,u)}unregister(o){this.registry.unregister(o)}reset(){}}class O3r{}function N3r(t){let o=0;return function(s,u,d){t.registry===null&&(t.registry=typeof FinalizationRegistry<"u"?new R3r:new w3r);const[f]=z.useState(new O3r),h=z.useRef(null),g=z.useRef(void 0);g.current=d;const y=z.useRef(null);if(!h.current&&g.current){const b=(x,S)=>{S.defaultMuiPrevented||g.current?.(x,S)};h.current=s.$$subscribeEvent(u,b),o+=1,y.current={cleanupToken:o},t.registry.register(f,()=>{h.current?.(),h.current=null,y.current=null},y.current)}else!g.current&&h.current&&(h.current(),h.current=null,y.current&&(t.registry.unregister(y.current),y.current=null));z.useEffect(()=>{if(!h.current&&g.current){const b=(x,S)=>{S.defaultMuiPrevented||g.current?.(x,S)};h.current=s.$$subscribeEvent(u,b)}return y.current&&t.registry&&(t.registry.unregister(y.current),y.current=null),()=>{h.current?.(),h.current=null}},[s,u])}}const k3r={registry:null},D3r=N3r(k3r),Awt=(t=document)=>{const o=t.activeElement;return o?o.shadowRoot?Awt(o.shadowRoot):o:null},I3r=(t,o)=>{let s=Gre(o).find(u=>{if(!t.isItemNavigable(u))return!1;const d=t.getItemMeta(u);return d&&(d.parentId==null||t.isItemExpanded(d.parentId))});return s==null&&(s=tz(t)),s},fIe=({instance:t,params:o,state:s,setState:u,models:d,rootRef:f})=>{const h=I3r(t,d.selectedItems.value),g=nI(I=>{const F=typeof I=="function"?I(s.focusedItemId):I;s.focusedItemId!==F&&u(U=>$r({},U,{focusedItemId:F}))}),y=z.useCallback(()=>!!f.current&&f.current.contains(Awt(C3r(f.current))),[f]),b=z.useCallback(I=>s.focusedItemId===I&&y(),[s.focusedItemId,y]),x=I=>{const F=t.getItemMeta(I);return F&&(F.parentId==null||t.isItemExpanded(F.parentId))},S=(I,F)=>{const U=t.getItemDOMElement(F);U&&U.focus(),g(F),o.onItemFocus&&o.onItemFocus(I,F)},T=nI((I,F)=>{x(F)&&S(I,F)}),w=nI(()=>{if(s.focusedItemId!=null){if(t.getItemMeta(s.focusedItemId)){const I=t.getItemDOMElement(s.focusedItemId);I&&I.blur()}g(null)}}),k=I=>I===h;D3r(t,"removeItem",({id:I})=>{s.focusedItemId===I&&S(null,h)});const P=I=>F=>{I.onFocus?.(F),!F.defaultMuiPrevented&&F.target===F.currentTarget&&S(F,h)};return{getRootProps:I=>({onFocus:P(I)}),publicAPI:{focusItem:T},instance:{isItemFocused:b,canItemBeTabbed:k,focusItem:T,removeFocusedItem:w}}};fIe.getInitialState=()=>({focusedItemId:null});fIe.params={onItemFocus:!0};function L3r(t){return!!t&&t.length===1&&!!t.match(/\S/)}const Cwt=({instance:t,params:o,state:s})=>{const u=wvr(),d=z.useRef({}),f=nI(b=>{d.current=b(d.current)});z.useEffect(()=>{if(t.areItemUpdatesPrevented())return;const b={},x=S=>{b[S.id]=S.label.substring(0,1).toLowerCase()};Object.values(s.items.itemMetaMap).forEach(x),d.current=b},[s.items.itemMetaMap,o.getItemId,t]);const h=(b,x)=>{const S=x.toLowerCase(),T=I=>{const F=Hre(t,I);return F===null?tz(t):F};let w=null,k=T(b);const P={};for(;w==null&&!P[k];)d.current[k]===S?w=k:(P[k]=!0,k=T(k));return w},g=b=>!o.disableSelection&&!t.isItemDisabled(b),y=b=>!t.isItemDisabled(b)&&t.isItemExpandable(b);return{instance:{updateFirstCharMap:f,handleItemKeyDown:(b,x)=>{if(b.defaultMuiPrevented||b.altKey||nz(b.target,b.currentTarget))return;const S=b.ctrlKey||b.metaKey,T=b.key;switch(!0){case(T===" "&&g(x)):{b.preventDefault(),o.multiSelect&&b.shiftKey?t.expandSelectionRange(b,x):t.selectItem({event:b,itemId:x,keepExistingSelection:o.multiSelect,shouldBeSelected:o.multiSelect?void 0:!0});break}case T==="Enter":{OO(t,ug)&&t.isItemEditable(x)&&!t.isItemBeingEdited(x)?t.setEditedItemId(x):y(x)?(t.toggleItemExpansion(b,x),b.preventDefault()):g(x)&&(o.multiSelect?(b.preventDefault(),t.selectItem({event:b,itemId:x,keepExistingSelection:!0})):t.isItemSelected(x)||(t.selectItem({event:b,itemId:x}),b.preventDefault()));break}case T==="ArrowDown":{const w=Hre(t,x);w&&(b.preventDefault(),t.focusItem(b,w),o.multiSelect&&b.shiftKey&&g(w)&&t.selectItemFromArrowNavigation(b,x,w));break}case T==="ArrowUp":{const w=hwt(t,x);w&&(b.preventDefault(),t.focusItem(b,w),o.multiSelect&&b.shiftKey&&g(w)&&t.selectItemFromArrowNavigation(b,x,w));break}case(T==="ArrowRight"&&!u||T==="ArrowLeft"&&u):{if(S)return;if(t.isItemExpanded(x)){const w=Hre(t,x);w&&(t.focusItem(b,w),b.preventDefault())}else y(x)&&(t.toggleItemExpansion(b,x),b.preventDefault());break}case(T==="ArrowLeft"&&!u||T==="ArrowRight"&&u):{if(S)return;if(y(x)&&t.isItemExpanded(x))t.toggleItemExpansion(b,x),b.preventDefault();else{const w=t.getItemMeta(x).parentId;w&&(t.focusItem(b,w),b.preventDefault())}break}case T==="Home":{g(x)&&o.multiSelect&&S&&b.shiftKey?t.selectRangeFromStartToItem(b,x):t.focusItem(b,tz(t)),b.preventDefault();break}case T==="End":{g(x)&&o.multiSelect&&S&&b.shiftKey?t.selectRangeFromItemToEnd(b,x):t.focusItem(b,mwt(t)),b.preventDefault();break}case T==="*":{t.expandAllSiblings(b,x),b.preventDefault();break}case(String.fromCharCode(b.keyCode)==="A"&&S&&o.multiSelect&&!o.disableSelection):{t.selectAllNavigableItems(b),b.preventDefault();break}case(!S&&!b.shiftKey&&L3r(T)):{const w=h(x,T);w!=null&&(t.focusItem(b,w),b.preventDefault());break}}}}}};Cwt.params={};const wwt=({slots:t,slotProps:o})=>({contextValue:{icons:{slots:{collapseIcon:t.collapseIcon,expandIcon:t.expandIcon,endIcon:t.endIcon},slotProps:{collapseIcon:o.collapseIcon,expandIcon:o.expandIcon,endIcon:o.endIcon}}}});wwt.params={};const P3r=[NH,_le,Tle,fIe,Cwt,wwt,ug],M3r=["ownerState"];function F3r({slots:t,slotProps:o,label:s,id:u,itemId:d,itemsToRender:f}){const h=t?.item??r3r,g=vO({elementType:h,externalSlotProps:o?.item,additionalProps:{itemId:d,id:u,label:s},ownerState:{itemId:d,label:s}}),y=x2(g,M3r),b=z.useMemo(()=>f?M.jsx(Rwt,{itemsToRender:f,slots:t,slotProps:o}):null,[f,t,o]);return M.jsx(h,$r({},y,{children:b}))}function Rwt(t){const{itemsToRender:o,slots:s,slotProps:u}=t;return M.jsx(z.Fragment,{children:o.map(d=>M.jsx(F3r,{slots:s,slotProps:u,label:d.label,id:d.id,itemId:d.itemId,itemsToRender:d.children},d.itemId))})}const B3r=cwt(),j3r=t=>{const{classes:o}=t;return uwt({root:["root"]},c3r,o)},$3r=hs("ul",{name:"MuiRichTreeView",slot:"Root",overridesResolver:(t,o)=>o.root})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),U3r=z.forwardRef(function(t,o){const s=B3r({props:t,name:"MuiRichTreeView"}),{getRootProps:u,contextValue:d,instance:f}=b3r({plugins:P3r,rootRef:o,props:s}),{slots:h,slotProps:g}=s,y=j3r(s),b=h?.root??$3r,x=vO({elementType:b,externalSlotProps:g?.root,className:y.root,getSlotProps:u,ownerState:s});return M.jsx(DAr,{value:d,children:M.jsx(b,$r({},x,{children:M.jsx(Rwt,{slots:h,slotProps:g,itemsToRender:f.getItemsToRender()})}))})}),q3r=os(M.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),z3r=os([M.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),M.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),H3r=os(M.jsx("path",{d:"M19 15v4H5v-4zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5M19 5v4H5V5zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5"})),G3r=os(M.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"}));function Owt({items:t,defaultExpandedItems:o,navigate:s}){return M.jsx(U3r,{items:K3r(t,s),defaultExpandedItems:o,slots:{item:Q3r}})}const V3r=Nar(ez);function W3r(t){const o=mar({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return M.jsx(V3r,{style:o,...t})}function Y3r({item:t,...o}){const s=M.jsxs(l3r,{...o,sx:{display:"flex",alignItems:"center",color:t.error?"error.main":"grey.600"},children:[t.fileType==="directory"&&M.jsx(q3r,{})||t.fileType==="notebook"&&M.jsx(z3r,{})||t.fileType==="model"&&M.jsx(G3r,{})||t.fileType=="database"&&M.jsx(H3r,{})||M.jsx(rwt,{}),M.jsx(dr,{variant:"body2",sx:{marginLeft:"5px"},color:t.error?"error.main":t.link?"primary.main":"grey.600",children:t.label})]});return t.error?M.jsx(dl,{title:t.error,placement:"right",children:s}):s}const Q3r=z.forwardRef(function(t,o){const{id:s,itemId:u,label:d,children:f,disabled:h,...g}=t,{getRootProps:y,getContentProps:b,getLabelProps:x,getIconContainerProps:S,getGroupTransitionProps:T,status:w,publicAPI:k}=jAr({id:s,itemId:u,children:f,label:d,disabled:h,rootRef:o}),P=k.getItem(u);return w.selected=!1,w.focused=!1,M.jsx(cIe,{itemId:u,children:M.jsxs(a3r,{...y(g),children:[M.jsxs(s3r,{...b(),...P.link&&{onClick:I=>P.link(I)},sx:{pointerEvents:!P.selectable&&"none"},children:[M.jsx(u3r,{...S(),children:M.jsx(i3r,{status:w})}),M.jsx(Y3r,{...x({item:P})})]}),f&&M.jsx(W3r,{...T()})]})})});function K3r(t,o){const s=new Map;return t.map(u=>{let d=s;const f=u.path.split("/");f.forEach((h,g)=>{g===f.length-1?d.set(h,u):(d.has(h)||d.set(h,new Map),d=d.get(h))})}),Nwt(s,"",o)}function Nwt(t,o,s){const u=[];return t.forEach((d,f)=>{const h=f.endsWith(".malloy")&&"model"||f.endsWith(".malloynb")&&"notebook"||f.endsWith(".parquet")&&"database"||"unknown";if(h!=="unknown"){const g=d;u.push({id:o+f,label:f,fileType:h,link:h==="model"||h==="notebook"?y=>s(o+f,y):void 0,selectable:h==="model"||h==="notebook",error:"error"in g?g.error:void 0})}else o+=`${f}/`,u.push({id:o,label:f,fileType:"directory",selectable:!0,link:void 0,children:Nwt(d,o,s)})}),u}const X3r=new xle(new Pd),Z3r=["notebooks/","models/"];function J3r({navigate:t}){const{projectName:o,packageName:s,versionId:u}=Eg(),{data:d,isError:f,error:h,isSuccess:g}=Hh({queryKey:["models",o,s,u],queryFn:y=>X3r.listModels(o,s,u,y)});return M.jsx(fu,{variant:"outlined",sx:{width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),M.jsx(wc,{}),M.jsxs(Eo,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!g&&!f&&M.jsx(Sg,{text:"Fetching Models..."}),f&&M.jsx(zh,{error:h,context:`${o} > ${s} > Models`}),g&&d.data.length>0&&M.jsx(Owt,{items:d.data.sort((y,b)=>y.path.localeCompare(b.path)),navigate:t,defaultExpandedItems:Z3r}),g&&d.data.length===0&&M.jsx(dr,{variant:"body2",children:"No models found"})]})]})})}const eCr=new rCt(new Pd),tCr=["notebooks/"];function nCr({navigate:t}){const{projectName:o,packageName:s,versionId:u}=Eg(),{data:d,isError:f,error:h,isSuccess:g}=Hh({queryKey:["notebooks",o,s,u],queryFn:y=>eCr.listNotebooks(o,s,u,y)});return M.jsx(fu,{variant:"outlined",sx:{width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),M.jsx(wc,{}),M.jsxs(Eo,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!g&&!f&&M.jsx(Sg,{text:"Fetching Notebooks..."}),f&&M.jsx(zh,{error:h,context:`${o} > ${s} > Notebooks`}),g&&d.data.length>0&&M.jsx(Owt,{items:d.data.sort((y,b)=>y.path.localeCompare(b.path)),defaultExpandedItems:tCr,navigate:t}),g&&d.data.length===0&&M.jsx(dr,{variant:"body2",children:"No notebooks found"})]})]})})}const rCr=new $Er(new Pd);function iCr(){const{projectName:t,packageName:o,versionId:s}=Eg(),{data:u,isError:d,isLoading:f,error:h}=Hh({queryKey:["schedules",t,o,s],queryFn:g=>rCr.listSchedules(t,o,s,g)});return f?M.jsx(Sg,{text:"Fetching Schedules..."}):d?M.jsx(zh,{error:h,context:`${t} > ${o} > Schedules`}):u.data.length?M.jsx(fu,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),M.jsx(wc,{}),M.jsx(Eo,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:M.jsx(Eyt,{component:FI,children:M.jsxs(lie,{sx:{minWidth:300},size:"small",children:[M.jsx(gAe,{children:M.jsxs(FT,{children:[M.jsx(Cs,{align:"left",children:"Resource"}),M.jsx(Cs,{align:"left",children:"Schedule"}),M.jsx(Cs,{align:"left",children:"Action"}),M.jsx(Cs,{align:"left",children:"Connection"}),M.jsx(Cs,{align:"left",children:"Last Run"}),M.jsx(Cs,{align:"left",children:"Status"})]})}),M.jsx(uie,{children:u.data.map(g=>M.jsxs(FT,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[M.jsx(Cs,{align:"left",children:g.resource}),M.jsx(Cs,{align:"left",children:g.schedule}),M.jsx(Cs,{align:"left",children:g.action}),M.jsx(Cs,{align:"left",children:g.connection}),M.jsx(Cs,{align:"left",children:g.lastRunTime?new Date(g.lastRunTime).toLocaleString():"n/a"}),M.jsx(Cs,{align:"left",children:g.lastRunStatus})]},g.resource))})]})})})]})}):null}const oCr="README.malloynb";function aCr({navigate:t}){return t||(t=o=>{window.location.href=o}),M.jsxs(ou,{container:!0,spacing:2,columns:12,children:[M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(ATr,{})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(nCr,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(J3r,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:6},children:M.jsx(NTr,{})}),M.jsx(ou,{size:{xs:12,md:6},children:M.jsx(RTr,{})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(iCr,{})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(twt,{notebookPath:oCr,hideEmbeddingIcons:!0})})]})}const kwt=z.createContext(void 0),sCr=({server:t=`${window.location.protocol}//${window.location.host}/api/v0`,getAccessToken:o,children:s})=>{const u={server:t,getAccessToken:o};return M.jsx(kwt.Provider,{value:u,children:s})},pIe=()=>{const t=z.useContext(kwt);if(t===void 0)throw new Error("useServer must be used within a ServerProvider");return t},Hne=os(M.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),Sgt=os(M.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}));function lCr({cell:t,sourceAndPaths:o,onQueryChange:s,onSourceChange:u}){const d={query:t.value,malloyResult:t.result?JSON.parse(t.result):void 0,malloyQuery:t.queryInfo?JSON.parse(t.queryInfo):void 0,sourceName:t.sourceName,modelPath:t.modelPath};return M.jsx(XCt,{sourceAndPaths:o,existingQuery:d,existingSourceName:t.sourceName,onQueryChange:s,onSourceChange:u})}function uCr({cell:t,expandCodeCell:o,expandEmbedding:s,hideEmbeddingIcons:u,editingMalloy:d,editingMarkdown:f,sourceAndPaths:h,onCellChange:g,onClose:y,onEdit:b,onDelete:x,addButtonCallback:S}){const[T,w]=Dn.useState(o),[k,P]=Dn.useState(s),[I,F]=Dn.useState(),[U]=Dn.useState(),[q,G]=Dn.useState(KU()),[Q,K]=Dn.useState(!1),[te,oe]=Dn.useState(t.sourceName?h.findIndex(ie=>ie.sourceInfo.name===t.sourceName):0);z.useEffect(()=>{t.isMarkdown||HO(t.value,"malloy").then(ie=>{F(ie)})},[t]);const[fe,X]=z.useState(t.value);Dn.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const le=cCr(ie=>{g({...t,value:ie})}),[me,Ee]=z.useState(!1),we=()=>{x(),Ee(!1)},xe=h.length===0,ve=()=>{const ie=h[te],pe=ie?.modelPath||t.modelPath||"",be=ie?.sourceInfo.name||t.sourceName||"";g({...t,value:q.query,result:q.malloyResult?JSON.stringify(q.malloyResult):void 0,queryInfo:q.malloyQuery?JSON.stringify(q.malloyQuery):void 0,sourceName:be,modelPath:pe})},Be=M.jsx(dl,{title:"Delete Cell",children:M.jsx(cl,{size:"small",onClick:()=>Ee(!0),children:M.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:M.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),Qe=M.jsxs(uq,{open:me,onClose:()=>Ee(!1),children:[M.jsx(dq,{children:"Confirm Delete"}),M.jsx(cq,{children:M.jsx(dr,{children:"Are you sure you want to delete this cell?"})}),M.jsxs(fyt,{children:[M.jsx(Cc,{onClick:()=>Ee(!1),children:"Cancel"}),M.jsx(Cc,{onClick:we,color:"error",children:"Delete"})]})]}),Me=t.isMarkdown?M.jsxs(M.Fragment,{children:[f?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:y,children:M.jsx(Hne,{})})}):M.jsx(dl,{title:"Edit",children:M.jsx(cl,{size:"small",onClick:b,children:M.jsx(Sgt,{})})}),!f&&Be]}):M.jsxs(M.Fragment,{children:[!d&&M.jsx(dl,{title:T?"Hide Code":"View Code",children:M.jsx(cl,{size:"small",onClick:()=>{w(!T)},children:M.jsx(JCt,{})})}),!u&&!d&&t.result&&M.jsx(dl,{title:k?"Hide Embedding":"View Embedding",children:M.jsx(cl,{size:"small",onClick:()=>{P(!k)},children:M.jsx(CH,{})})}),d&&M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:()=>{ve(),y()},children:M.jsx(Hne,{})})}),!d&&M.jsx(dl,{title:"Edit",children:M.jsx(cl,{size:"small",onClick:b,children:M.jsx(Sgt,{})})}),!d&&Be]}),ce=d||f,Ue=f?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:y,children:M.jsx(Hne,{})})}):d?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:()=>{ve(),y()},children:M.jsx(Hne,{})})}):null,Ke=Q&&M.jsx(Eo,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!ce&&M.jsxs(M.Fragment,{children:[S(!0),S(!1),Me]})||Ue});return M.jsxs(fu,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>K(!0),onMouseLeave:()=>{K(!1)},children:[Ke,t.isMarkdown?M.jsx(M.Fragment,{children:f?M.jsx(q3t,{value:fe,preview:"edit",autoFocus:!0,onChange:ie=>{X(ie),le(ie)},onBlur:()=>{ve(),Q||y()}}):M.jsx(Eo,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:fe?M.jsx(Eo,{onClick:b,sx:{cursor:"pointer"},children:M.jsx(aNe,{children:fe})}):M.jsxs(Eo,{onClick:b,sx:{cursor:"pointer"},children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):M.jsxs(M.Fragment,{children:[M.jsx(ay,{in:k,timeout:"auto",unmountOnExit:!0,children:M.jsx(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:M.jsx(dr,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:U}})})}),M.jsx(ay,{in:T,timeout:"auto",unmountOnExit:!0,children:M.jsx(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:M.jsx(dr,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:I}})})}),d&&(xe?M.jsxs(M.Fragment,{children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):M.jsx(lCr,{sourceAndPaths:h,onQueryChange:ie=>{G(ie)},cell:t,onSourceChange:oe})),!d&&t.result&&M.jsx(fu,{variant:"outlined",sx:{borderRadius:0},children:M.jsx(ewt,{result:t.result,minHeight:300,maxHeight:800})}),!d&&!t.result&&M.jsxs(Eo,{onClick:b,sx:{cursor:"pointer"},children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),me&&Qe]})}function cCr(t,o=2e3){const s=Dn.useRef(void 0);return Dn.useCallback(u=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{t(u)},o)},[t,o])}const Dwt=z.createContext(void 0);function Iwt({children:t,userContext:o,notebookStorage:s}){const u=z.useMemo(()=>({notebookStorage:s,userContext:o}),[s,o]);return M.jsx(Dwt.Provider,{value:u,children:t})}function Lwt(){const t=z.useContext(Dwt);if(!t)throw new Error("useNotebookStorage must be used within a NotebookStorageProvider");return t}const dCr=os(M.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),fCr=os(M.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"})),pCr=new xle(new Pd);function hCr({initialSelectedModels:t,onModelChange:o}){const{projectName:s,packageName:u,versionId:d}=Eg(),{data:f,isLoading:h,isSuccess:g,isError:y,error:b}=Hh({queryKey:["models",s,u,d],queryFn:F=>pCr.listModels(s,u,d,F)}),[x,S]=Dn.useState(t||[]),[T,w]=Dn.useState(null);Dn.useEffect(()=>{S(t||[])},[t]);const k=F=>{const U=x.filter(q=>q!==F);S(U),o(U)},P=F=>{const U=[...x,F];S(U),o(U),w(null)};let I=[];return g&&f?.data&&(I=f.data.filter(F=>!x.includes(F.path)).map(F=>F.path)),y?M.jsx(zh,{error:b,context:`${s} > ${u} > Model Picker`}):M.jsxs(M.Fragment,{children:[M.jsxs(Iwe,{fullWidth:!0,children:[h&&M.jsx(dr,{children:"Loading..."}),M.jsxs(ma,{direction:"row",spacing:1,children:[x.map(F=>M.jsx(SO,{label:F,onDelete:()=>k(F),deleteIcon:M.jsx(dCr,{}),sx:{marginBottom:"5px"}},F)),M.jsx(Cc,{size:"small",startIcon:M.jsx(fCr,{}),onClick:F=>w(F.currentTarget),disabled:h||y||I.length===0,children:"Add Model"})]})]}),M.jsxs(nae,{anchorEl:T,open:!!T,onClose:()=>w(null),children:[M.jsx(dr,{variant:"subtitle2",sx:{ml:1},children:"Models"}),M.jsx(wc,{}),I.length===0?M.jsx(cI,{disabled:!0,children:"No models available"}):I.map(F=>M.jsx(cI,{onClick:()=>P(F),children:M.jsx(dr,{variant:"body2",children:F})},F))]})]})}const mCr=new xle(new Pd);function gCr({notebookPath:t,expandCodeCells:o,expandEmbeddings:s,hideEmbeddingIcons:u}){const d=ML(),{projectName:f,packageName:h,versionId:g}=Eg(),{server:y,getAccessToken:b}=pIe(),{notebookStorage:x,userContext:S}=Lwt();if(!f||!h)throw new Error("Project and package must be provided via PubliserPackageProvider");if(!x||!S)throw new Error("Notebook storage and user context must be provided via NotebookStorageProvider");const[T,w]=Dn.useState(),[k,P]=Dn.useState(),[I,F]=Dn.useState(),[U,q]=Dn.useState([]),[G,Q]=Dn.useState(null),[K,te]=Dn.useState(null),oe=!!G,fe=()=>{Q(null),te(null)},X=(ce,Ue)=>{T.insertCell(Ue,{isMarkdown:ce,value:""}),ve(),ce?F(Ue):P(Ue),fe()},[le,me]=Dn.useState(!1),Ee=()=>{me(!0)},we=ce=>{t&&x&&S&&x.deleteNotebook(S,t),me(!1),d(`/${f}/${h}`,ce)},xe=()=>{me(!1)},ve=Dn.useCallback(()=>{w(T.saveNotebook())},[T]);if(Dn.useEffect(()=>{T&&(async()=>{const ce=new Map(U.map(({modelPath:ie,sourceInfos:pe})=>[ie,pe])),Ue=[],Ke=[];for(const ie of T.getModels())ce.has(ie)?Ue.push({modelPath:ie,sourceInfos:ce.get(ie)}):(console.log("Fetching model from Publisher",ie),Ke.push(mCr.getModel(f,h,ie,g,await rIe(y,b)).then(pe=>({modelPath:ie,sourceInfos:pe.data.sourceInfos.map(be=>JSON.parse(be))}))));if(Ke.length>0){const ie=await Promise.all(Ke);q([...Ue,...ie])}else q(Ue)})()},[b,T,h,f,y,g]),Dn.useEffect(()=>{t&&w(XU.loadNotebook(x,S,t))},[t,x,S]),!T)return M.jsx("div",{children:"Loading..."});const Be=ce=>{const Ue=[];for(const Ke of ce)for(const ie of Ke.sourceInfos)Ue.push({modelPath:Ke.modelPath,sourceInfo:ie});return Ue},Qe=(ce,Ue)=>M.jsx(Cc,{size:"small",startIcon:M.jsx(_Tr,{}),onClick:()=>X(ce,Ue),variant:"contained",sx:{backgroundColor:"#fff",color:Ke=>Ke.palette.mode==="dark"?Ke.palette.grey[100]:Ke.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:Ke=>Ke.palette.mode==="dark"?Ke.palette.grey[500]:Ke.palette.grey[300],boxShadow:"none"}},children:ce?"Markdown":"Explore"}),Me=M.jsxs(Eo,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[Qe(!1,T.getCells().length),Qe(!0,T.getCells().length)]});return M.jsxs(fu,{variant:"outlined",children:[M.jsxs($h,{children:[M.jsxs(d6,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[M.jsxs(d6,{direction:"row",spacing:1,alignItems:"center",children:[M.jsx(dr,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),M.jsx(dr,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${f} > ${h} > ${t}`})]}),M.jsxs(d6,{sx:{display:"flex",flexDirection:"row",gap:1},children:[M.jsx(Eo,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:M.jsx(yCr,{notebookData:T})}),M.jsxs(Eo,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[M.jsx(Cc,{color:"error",onClick:Ee,size:"small",children:"Delete"}),M.jsxs(uq,{open:le,onClose:xe,children:[M.jsx(dq,{children:"Delete Notebook"}),M.jsx(cq,{children:M.jsxs(I6n,{children:['Are you sure you want to delete the notebook "',t,'"? This action cannot be undone.']})}),M.jsxs(fyt,{children:[M.jsx(Cc,{onClick:xe,color:"primary",size:"small",children:"Cancel"}),M.jsx(Cc,{onClick:ce=>we(ce),color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),M.jsx(wc,{}),M.jsxs(d6,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[M.jsx(Eo,{sx:{flex:1},children:M.jsx(hCr,{initialSelectedModels:T.getModels(),onModelChange:ce=>{w(T.setModels(ce)),ve()}})}),M.jsx(Eo,{sx:{flex:1}})]})]}),M.jsx(Sle,{children:M.jsxs(d6,{children:[T.getCells().length===0&&M.jsxs(M.Fragment,{children:[M.jsx(dr,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),M.jsx(dr,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),T.getCells().map((ce,Ue)=>M.jsx(Dn.Fragment,{children:M.jsx(uCr,{cell:ce,addButtonCallback:Ke=>Qe(Ke,Ue),sourceAndPaths:Be(U),expandCodeCell:o,expandEmbedding:s,hideEmbeddingIcons:u,editingMarkdown:I===Ue,editingMalloy:k===Ue,onDelete:()=>{w(T.deleteCell(Ue)),ve()},onCellChange:Ke=>{w(T.setCell(Ue,Ke)),ve()},onEdit:()=>{ce.isMarkdown?F(Ue):P(Ue)},onClose:()=>{ce.isMarkdown?F(void 0):P(void 0)}})},`${Ue}-${T.getCells().length}`)),Me,M.jsxs(nae,{anchorEl:G,open:oe,onClose:fe,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[M.jsx(cI,{onClick:()=>X(!0,K??0),children:"Add Markdown"}),M.jsx(cI,{onClick:()=>X(!1,K??0),children:"Add Malloy"})]}),M.jsx(d6,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function yCr({notebookData:t}){const[o,s]=Dn.useState(!1);return M.jsx(Cc,{color:"primary",onClick:async()=>{if(!t)return;const u=t.toMalloyNotebook();try{await navigator.clipboard.writeText(u),s(!0),setTimeout(()=>s(!1),1500)}catch{s(!1),alert("Failed to copy to clipboard")}},size:"small",children:o?"Copied!":"Export"})}function xCr({onNotebookClick:t}){const{notebookStorage:o,userContext:s}=Lwt(),[u,d]=Dn.useState([]);return Dn.useEffect(()=>{o&&s&&d(o.listNotebooks(s))},[o,s]),M.jsxs(M.Fragment,{children:[M.jsx(wc,{}),M.jsx(Eo,{sx:{maxHeight:"300px",overflow:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.2)",borderRadius:"4px"}},children:M.jsxs(Pwe,{dense:!0,children:[u.length===0&&M.jsx(T6,{children:M.jsx(_O,{primary:"No notebooks found.",sx:{textAlign:"center"}})}),u.map(f=>M.jsx(T6,{onClick:h=>t(f,h),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:M.jsx(_O,{primary:f})},f))]})})]})}const bCr=new oCt(new Pd);function vCr(){const{projectName:t}=Mwt(),{data:o,isSuccess:s,isError:u,error:d}=Hh({queryKey:["about",t],queryFn:f=>bCr.getProject(t,!1,f)});return M.jsxs(M.Fragment,{children:[!s&&!u&&M.jsx(Sg,{text:"Fetching About..."}),s&&M.jsxs(fu,{variant:"outlined",sx:{p:2},children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Readme"}),M.jsx(fu,{sx:{p:1},children:M.jsx(aNe,{children:o.data.readme})})]}),u&&M.jsx(zh,{error:d,context:`${t} > About`})]})}const ECr=new iCt(new Pd);function SCr({navigate:t}){const{projectName:o}=Mwt(),{data:s,isSuccess:u,isError:d,error:f}=Hh({queryKey:["packages",o],queryFn:h=>ECr.listPackages(o,h)});return M.jsxs(M.Fragment,{children:[!u&&!d&&M.jsx(Sg,{text:"Fetching Packages..."}),u&&M.jsxs(fu,{variant:"outlined",sx:{p:2},children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Packages"}),M.jsx(ou,{container:!0,spacing:2,columns:12,children:s.data.sort((h,g)=>h.name.localeCompare(g.name)).map(h=>M.jsx(ou,{size:{xs:12,sm:12,md:12,lg:4},children:M.jsx(fu,{variant:"outlined",sx:{cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",transform:"translateY(-2px)"}},onClick:g=>t(h.name+"/",g),children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",color:"primary.main",children:h.name}),M.jsx(Eo,{sx:{maxHeight:"120px",overflowY:"auto"},children:M.jsx(dr,{variant:"body2",children:h.description})})]})})},h.name))})]}),d&&M.jsx(zh,{error:f,context:`${o} > Packages`})]})}const Pwt=z.createContext(void 0);function Mwt(){const t=z.useContext(Pwt);if(!t)throw new Error("useProject must be used within a ProjectProvider");return t}function _Cr({children:t,projectName:o}){return M.jsx(Pwt.Provider,{value:{projectName:o},children:t})}function TCr({navigate:t}){return M.jsxs(ou,{container:!0,spacing:2,columns:12,children:[M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(SCr,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(vCr,{})})]})}const ACr=os(M.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M8 17c-.55 0-1-.45-1-1v-3c0-.55.45-1 1-1s1 .45 1 1v3c0 .55-.45 1-1 1m4 0c-.55 0-1-.45-1-1v-1c0-.55.45-1 1-1s1 .45 1 1v1c0 .55-.45 1-1 1m0-5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4 5c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1"})),CCr=os(M.jsx("path",{d:"M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42s1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1"})),_gt=os(M.jsx("path",{d:"m19.46 8 .79-1.75L22 5.46c.39-.18.39-.73 0-.91l-1.75-.79L19.46 2c-.18-.39-.73-.39-.91 0l-.79 1.75-1.76.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.74.39.92 0M11.5 9.5 9.91 6c-.35-.78-1.47-.78-1.82 0L6.5 9.5 3 11.09c-.78.36-.78 1.47 0 1.82l3.5 1.59L8.09 18c.36.78 1.47.78 1.82 0l1.59-3.5 3.5-1.59c.78-.36.78-1.47 0-1.82zm7.04 6.5-.79 1.75-1.75.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.73.39.91 0l.79-1.75 1.76-.79c.39-.18.39-.73 0-.91l-1.75-.79-.79-1.76c-.18-.39-.74-.39-.92 0"})),wCr=os(M.jsx("path",{d:"M8.7 15.9 4.8 12l3.9-3.9c.39-.39.39-1.01 0-1.4a.984.984 0 0 0-1.4 0l-4.59 4.59c-.39.39-.39 1.02 0 1.41l4.59 4.6c.39.39 1.01.39 1.4 0s.39-1.01 0-1.4m6.6 0 3.9-3.9-3.9-3.9a.984.984 0 0 1 0-1.4c.39-.39 1.01-.39 1.4 0l4.59 4.59c.39.39.39 1.02 0 1.41l-4.59 4.6c-.39.39-1.01.39-1.4 0a.984.984 0 0 1 0-1.4"})),RCr=os(M.jsx("path",{d:"M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1 1.1-.49 1.1-1.1-.49-1.1-1.1-1.1M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m2.19 12.19L6 18l3.81-8.19L18 6z"})),OCr=os([M.jsx("path",{d:"M13 8.57c-.79 0-1.43.64-1.43 1.43s.64 1.43 1.43 1.43 1.43-.64 1.43-1.43-.64-1.43-1.43-1.43"},"0"),M.jsx("path",{d:"M13.21 3c-3.84-.11-7 2.87-7.19 6.64L4.1 12.2c-.25.33-.01.8.4.8H6v3c0 1.1.9 2 2 2h1v2c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-3.68c2.44-1.16 4.1-3.68 4-6.58-.14-3.62-3.18-6.63-6.79-6.74M16 10c0 .13-.01.26-.02.39l.83.66c.08.06.1.16.05.25l-.8 1.39c-.05.09-.16.12-.24.09l-.99-.4c-.21.16-.43.29-.67.39L14 13.83c-.01.1-.1.17-.2.17h-1.6c-.1 0-.18-.07-.2-.17l-.15-1.06c-.25-.1-.47-.23-.68-.39l-.99.4c-.09.03-.2 0-.25-.09l-.8-1.39c-.05-.08-.03-.19.05-.25l.84-.66c-.01-.13-.02-.26-.02-.39s.02-.27.04-.39l-.85-.66c-.08-.06-.1-.16-.05-.26l.8-1.38c.05-.09.15-.12.24-.09l1 .4c.2-.15.43-.29.67-.39L12 6.17c.02-.1.1-.17.2-.17h1.6c.1 0 .18.07.2.17l.15 1.06c.24.1.46.23.67.39l1-.4c.09-.03.2 0 .24.09l.8 1.38c.05.09.03.2-.05.26l-.85.66c.03.12.04.25.04.39"},"1")]),Tgt=os(M.jsx("path",{d:"M4 20h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4zM2 6c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2m4 1H4V5h2zm-2 7h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4z"})),NCr=new oCt(new Pd),kCr=t=>{if(!t)return"Explore semantic models, run queries, and build dashboards";const o=t.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),s=o.split(/\n\s*\n/)[0]||o;if(s.length<=120)return s;const u=s.substring(0,120).split(" ");return u.pop(),u.join(" ")+"..."};function DCr({navigate:t}){const{data:o,isSuccess:s,isError:u,error:d}=Hh({queryKey:["projects"],queryFn:f=>NCr.listProjects(f)});return u?M.jsx(zh,{error:d,context:"Projects List"}):s?M.jsxs(kwe,{maxWidth:"lg",sx:{py:4},children:[M.jsxs(Eo,{sx:{textAlign:"center",mb:6},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(_gt,{sx:{fontSize:32,color:"primary.main"}}),M.jsx(dr,{variant:"h3",component:"h1",fontWeight:700,children:"Publisher"})]}),M.jsx(dr,{variant:"h5",color:"text.secondary",sx:{mb:3,maxWidth:600,mx:"auto"},children:"The open-source semantic model server for the Malloy data language"}),M.jsx(dr,{variant:"body1",color:"text.secondary",sx:{maxWidth:800,mx:"auto"},children:"Define semantic models once — and use them everywhere. Publisher serves Malloy models through clean APIs, enabling consistent, interpretable, and AI-ready data access for tools, applications, and agents."})]}),M.jsxs(ou,{container:!0,spacing:3,sx:{mb:6},children:[M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#ad-hoc-data-analysis","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(ACr,{sx:{color:"info.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"Ad Hoc Analysis"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Use Explorer, a visual query builder that allows analysts to browse semantic sources, build queries, and run nested logic — all without writing code."}),M.jsx(SO,{label:"No-code",size:"small",color:"primary",variant:"outlined"})]})})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#notebook-based-dashboards","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(wCr,{sx:{color:"warning.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"Notebook Dashboards"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Create shareable, code-first dashboards using Malloy notebooks. Include text, charts, and reusable views — all versioned alongside your models."}),M.jsx(SO,{label:"Versioned",size:"small",color:"warning",variant:"outlined"})]})})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#mcp-based-ai-data-agents","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(OCr,{sx:{color:"success.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"AI Data Agents"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Expose your semantic models via the Model Context Protocol (MCP), enabling AI agents to discover sources and ask well-formed questions."}),M.jsx(SO,{label:"AI-Ready",size:"small",color:"success",variant:"outlined"})]})})})]}),M.jsx(wc,{sx:{my:4}}),o.data.length>0?M.jsxs(M.Fragment,{children:[M.jsxs(Eo,{sx:{textAlign:"center",mb:4},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(Tgt,{sx:{color:"primary.main",fontSize:24}}),M.jsx(dr,{variant:"h4",fontWeight:600,children:"Select a Project"})]}),M.jsx(dr,{variant:"body1",color:"text.secondary",children:"Choose a project to explore its semantic models and start analyzing your data"})]}),M.jsx(ou,{container:!0,spacing:3,justifyContent:"center",children:o.data.map(f=>M.jsx(ou,{size:{xs:12,sm:6,md:4},children:M.jsx(S6,{variant:"outlined",sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2,borderColor:"primary.main"}},onClick:h=>t(`/${f.name}/`,h),children:M.jsxs(_6,{sx:{p:3,textAlign:"center"},children:[M.jsx(RCr,{sx:{fontSize:48,color:"primary.main",mb:2}}),M.jsx(dr,{variant:"h6",fontWeight:600,gutterBottom:!0,children:f.name}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:kCr(f.readme)}),M.jsx(Cc,{variant:"contained",color:"secondary",endIcon:M.jsx(CCr,{}),fullWidth:!0,children:"Open Project"})]})})},f.name))})]}):M.jsxs(Eo,{sx:{textAlign:"center",mb:4},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(Tgt,{sx:{color:"primary.main",fontSize:24}}),M.jsx(dr,{variant:"h4",fontWeight:600,children:"Get Started"})]}),M.jsx(dr,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"No projects found. Create your first Malloy project to start exploring semantic models and building data experiences."}),M.jsx(Cc,{variant:"contained",size:"large",color:"primary",startIcon:M.jsx(_gt,{}),href:"https://github.com/malloydata/publisher/blob/main/README.md#server-configuration",target:"_blank",rel:"noopener noreferrer",children:"Learn How to Create Models"})]}),M.jsx(Eo,{sx:{textAlign:"center",mt:6,pt:4,borderTop:1,borderColor:"divider"},children:M.jsxs(dr,{variant:"body2",color:"text.secondary",children:["Publisher is built on fully open infrastructure and designed for the AI era. Join the"," ",M.jsx("a",{href:"https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw",target:"_blank",rel:"noopener noreferrer",style:{color:"primary.main",textDecoration:"underline"},children:"Malloy Slack community"})," ","to ask questions, share ideas, and contribute to the future of data modeling."]})})]}):M.jsx(Sg,{text:"Loading projects..."})}function ICr(){const{projectName:t,packageName:o}=WO(),[s,u]=Dn.useState(""),[d,f]=Dn.useState(null),[h,g]=Dn.useState(!1),[y,b]=Dn.useState(!1),x=ML(),S=!!d,T=U=>{f(U.currentTarget)},w=()=>{f(null)},k=()=>{b(!1)},P=()=>{g(!1)},I=(U,q)=>{b(!1),x(`/${t}/${o}/scratchNotebook/${encodeURIComponent(U)}`,q)},F=U=>{g(!1),x(`/${t}/${o}/scratchNotebook/${encodeURIComponent(s)}`,U),u("")};return!t||!o?null:M.jsxs(M.Fragment,{children:[M.jsx(Cc,{"aria-controls":S?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":S?"true":void 0,onClick:T,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),M.jsxs(nae,{id:"basic-menu",anchorEl:d,open:S,onClose:w,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[M.jsxs(cI,{onClick:()=>{g(!0),w()},sx:{py:1,px:2},children:[M.jsx(mot,{children:M.jsx(ror,{fontSize:"small"})}),M.jsxs(_O,{children:[M.jsx(dr,{variant:"body2",fontWeight:500,children:"New Workbook"}),M.jsx(dr,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),M.jsxs(cI,{onClick:()=>{b(!0),w()},sx:{py:1,px:2},children:[M.jsx(mot,{children:M.jsx(sor,{fontSize:"small"})}),M.jsxs(_O,{children:[M.jsx(dr,{variant:"body2",fontWeight:500,children:"Open Workbook"}),M.jsx(dr,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),M.jsxs(uq,{open:h,onClose:P,maxWidth:"sm",fullWidth:!0,children:[M.jsxs(dq,{sx:{pb:1,pt:2,px:2},children:[M.jsx(dr,{variant:"h6",fontWeight:600,sx:{mb:.5},children:"Create New Workbook"}),M.jsx(dr,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),M.jsx(cq,{sx:{px:2,pb:2},children:M.jsxs(ma,{spacing:2,sx:{mt:1},children:[M.jsx(Iwe,{fullWidth:!0,children:M.jsx(m7n,{label:"Workbook Name",value:s,onChange:U=>u(U.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),M.jsxs(ma,{direction:"row",spacing:1,justifyContent:"flex-end",children:[M.jsx(Cc,{onClick:P,variant:"outlined",size:"small",children:"Cancel"}),M.jsx(Cc,{onClick:U=>F(U),variant:"contained",disabled:!s.trim(),size:"small",children:"Create Workbook"})]})]})})]}),M.jsxs(uq,{open:y,onClose:k,maxWidth:"md",fullWidth:!0,children:[M.jsxs(dq,{sx:{pb:1,pt:2,px:2},children:[M.jsx(dr,{variant:"h6",fontWeight:600,sx:{mb:.5},children:"Open Workbook"}),M.jsx(dr,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),M.jsx(cq,{sx:{px:2,pb:2},children:M.jsx(Iwt,{notebookStorage:new nwt,userContext:{project:t,package:o},children:M.jsx(xCr,{onNotebookClick:I})})})]})]})}new nCt(new Pd);Mi.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet";function LCr(){const t=ML();return M.jsx(DCr,{navigate:t})}function PCr(){const t=WO(),o=t["*"],s=ML();return M.jsx(Eo,{sx:{display:"flex",alignItems:"center"},children:M.jsxs(SDn,{"aria-label":"breadcrumb",separator:M.jsx(ior,{sx:{fontSize:14,color:"text.secondary"}}),sx:{"& .MuiBreadcrumbs-separator":{margin:"0 6px"}},children:[t.projectName&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/`,u),label:t.projectName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"primary.100"}}}),t.packageName&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/${t.packageName}/`,u),label:t.packageName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"secondary.100"}}}),o&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/${t.packageName}/${o}`,u),label:o,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"grey.200"}}})]})})}function MCr({logoHeader:t,endCap:o}){const s=GCe(),{projectName:u,packageName:d}=WO();return M.jsx(Rkn,{position:"sticky",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:M.jsxs(qLn,{sx:{justifyContent:"space-between"},children:[M.jsxs(ma,{direction:"row",spacing:2,alignItems:"center",children:[t||M.jsxs(Eo,{sx:{display:"flex",alignItems:"center",gap:1},children:[M.jsx(Eo,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:28,height:28}}),M.jsx(dr,{variant:"h5",sx:{color:"text.primary",fontWeight:700,letterSpacing:"-0.025em",cursor:"pointer"},onClick:()=>{s("/")},children:"Malloy Publisher"})]}),M.jsx(PCr,{})]}),M.jsxs(ma,{direction:"row",spacing:2,alignItems:"center",children:[!u||!d?!t&&M.jsxs(M.Fragment,{children:[M.jsx(Cc,{href:"https://docs.malloydata.dev/documentation/",children:"Malloy Docs"}),M.jsx(Cc,{href:"https://github.com/malloydata/publisher/blob/main/README.md",children:"Publisher Docs"}),M.jsx(Cc,{href:"/api-doc.html",children:"Publisher API"})]}):M.jsx(M.Fragment,{children:M.jsx(ICr,{})}),o]})]})})}function FCr({headerProps:t}){return M.jsxs(Eo,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[M.jsx(MCr,{...t}),M.jsx(kwe,{maxWidth:"xl",component:"main",sx:{flex:1,display:"flex",flexDirection:"column",py:2,gap:2},children:M.jsx(Eo,{sx:{flex:1},children:M.jsx(VCn,{})})})]})}function BCr(){const t=WO(),o=t["*"];return t.projectName?t.packageName?o?.endsWith(".malloy")?M.jsx(Coe,{projectName:t.projectName,packageName:t.packageName,children:M.jsx(mTr,{modelPath:o,hideEmbeddingIcons:!0})}):o?.endsWith(".malloynb")?M.jsx(Coe,{projectName:t.projectName,packageName:t.packageName,children:M.jsx(twt,{notebookPath:o,hideEmbeddingIcons:!0,expandResults:!1})}):M.jsx("div",{children:M.jsxs("h2",{children:["Unrecognized file type: ",o]})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function jCr(){const{projectName:t,packageName:o}=WO(),s=ML();return t?o?M.jsx(Coe,{projectName:t,packageName:o,children:M.jsx(aCr,{navigate:s})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function $Cr(){const t=ML(),{projectName:o}=WO();return o?M.jsx(_Cr,{projectName:o,children:M.jsx(TCr,{navigate:t})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function UCr(){const t=Hgt();return console.error(t),M.jsx(kwe,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:M.jsxs(ma,{sx:{m:"auto",flexDirection:"column"},children:[M.jsx(Eo,{sx:{height:"300px"}}),M.jsx("img",{src:"/error.png"}),M.jsx(dr,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}function qCr(){const{projectName:t,packageName:o,notebookPath:s}=WO();return t?o?M.jsx(Coe,{projectName:t,packageName:o,children:M.jsx(Iwt,{notebookStorage:new nwt,userContext:{project:t,package:o},children:M.jsx(gCr,{notebookPath:s,hideEmbeddingIcons:!0})})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}const _s={primary:{main:"#14b3cb",light:"#22d3ee",dark:"#0e7490",50:"#ecfeff",100:"#cffafe",500:"#14b3cb",600:"#0891b2",700:"#0e7490"},secondary:{main:"#fbbb04",light:"#fde047",dark:"#eab308",50:"#fefce8",100:"#fef3c7",500:"#fbbb04",600:"#eab308",700:"#ca8a04"},grey:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},success:{main:"#059669",light:"#10b981",dark:"#047857"},warning:{main:"#d97706",light:"#f59e0b",dark:"#b45309"},error:{main:"#dc2626",light:"#ef4444",dark:"#b91c1c"},info:{main:"#0891b2",light:"#06b6d4",dark:"#0e7490"}},zCr=Woe({palette:{mode:"light",primary:_s.primary,secondary:_s.secondary,grey:_s.grey,success:_s.success,warning:_s.warning,error:_s.error,info:_s.info,background:{default:"#ffffff",paper:"#ffffff"},text:{primary:_s.grey[900],secondary:_s.grey[600]},divider:_s.grey[200]},typography:{fontFamily:'"Inter", "Roboto", "Helvetica", "Arial", sans-serif',h1:{fontWeight:700,letterSpacing:"-0.025em"},h2:{fontWeight:700,letterSpacing:"-0.025em"},h3:{fontWeight:600,letterSpacing:"-0.025em"},h4:{fontWeight:600,letterSpacing:"-0.025em"},h5:{fontWeight:600,letterSpacing:"-0.025em"},h6:{fontWeight:600,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:4},components:{MuiCssBaseline:{styleOverrides:{body:{scrollbarWidth:"thin",scrollbarColor:`${_s.grey[300]} ${_s.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:_s.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:_s.grey[300],borderRadius:"4px","&:hover":{background:_s.grey[400]}},"&::-webkit-scrollbar-corner":{background:_s.grey[100]}},"*":{scrollbarWidth:"thin",scrollbarColor:`${_s.grey[300]} ${_s.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:_s.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:_s.grey[300],borderRadius:"4px","&:hover":{background:_s.grey[400]}},"&::-webkit-scrollbar-corner":{background:_s.grey[100]}}}},MuiButton:{styleOverrides:{root:{borderRadius:4,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:"rgba(0, 0, 0, 0.05)"}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"1px solid rgba(0, 0, 0, 0.05)"}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:_s.grey[400]}}}},MuiDivider:{styleOverrides:{root:{margin:"4px 0",borderColor:_s.grey[200]}},defaultProps:{sx:{my:1}}}}}),HCr=(t="/",o,s,u)=>ywn([{path:t,element:M.jsx(sCr,{server:s,getAccessToken:u,children:M.jsxs(b4n,{theme:zCr,children:[M.jsx(KDn,{}),M.jsx(FCr,{headerProps:o})]})}),errorElement:M.jsx(UCr,{}),children:[{path:"",element:M.jsx(LCr,{})},{path:":projectName",element:M.jsx($Cr,{})},{path:":projectName/:packageName",element:M.jsx(jCr,{})},{path:":projectName/:packageName/*",element:M.jsx(BCr,{})},{path:":projectName/:packageName/scratchNotebook/:notebookPath",element:M.jsx(qCr,{})}]}]),GCr=`${window.location.protocol}//${window.location.host}/api/v0`,VCr=HCr("/",void 0,GCr);S3n.createRoot(document.getElementById("root")).render(M.jsx(z.StrictMode,{children:M.jsx(Own,{router:VCr})}));export{sFn as i,M as j,z as r};
|
|
3414
|
+
`));d[T]={id:T,label:w,parentId:S,idAttribute:void 0,expandable:!!b.children?.length,disabled:o?o(b):!1,depth:x},f[T]=b;const k=S??k6;h[k]||(h[k]=[]),h[k].push(T),b.children?.forEach(P=>g(P,x+1,T))};t.forEach(b=>g(b,0,null));const y={};return Object.keys(h).forEach(b=>{y[b]=E3r(h[b])}),{itemMetaMap:d,itemMap:f,itemOrderedChildrenIds:h,itemChildrenIndexes:y}},NH=({instance:t,params:o,state:s,setState:u,experimentalFeatures:d})=>{const f=z.useCallback(I=>s.items.itemMetaMap[I],[s.items.itemMetaMap]),h=z.useCallback(I=>s.items.itemMap[I],[s.items.itemMap]),g=z.useCallback(()=>{const I=F=>{const U=s.items.itemMap[F],q=x2(U,S3r),G=s.items.itemOrderedChildrenIds[F];return G&&(q.children=G.map(I)),q};return s.items.itemOrderedChildrenIds[k6].map(I)},[s.items.itemMap,s.items.itemOrderedChildrenIds]),y=z.useCallback(I=>{if(I==null)return!1;let F=t.getItemMeta(I);if(!F)return!1;if(F.disabled)return!0;for(;F.parentId!=null;)if(F=t.getItemMeta(F.parentId),F.disabled)return!0;return!1},[t]),b=z.useCallback(I=>{const F=t.getItemMeta(I).parentId??k6;return s.items.itemChildrenIndexes[F][I]},[t,s.items.itemChildrenIndexes]),x=z.useCallback(I=>s.items.itemOrderedChildrenIds[I??k6]??[],[s.items.itemOrderedChildrenIds]),S=I=>{const F=t.getItemMeta(I);return F==null?null:document.getElementById(lIe({treeId:s.id.treeId,itemId:I,id:F.idAttribute}))},T=I=>o.disabledItemsFocusable?!0:!t.isItemDisabled(I),w=z.useRef(!1),k=z.useCallback(()=>{w.current=!0},[]),P=z.useCallback(()=>w.current,[]);return z.useEffect(()=>{t.areItemUpdatesPrevented()||u(I=>{const F=Twt({items:o.items,isItemDisabled:o.isItemDisabled,getItemId:o.getItemId,getItemLabel:o.getItemLabel});return Object.values(I.items.itemMetaMap).forEach(U=>{F.itemMetaMap[U.id]||v3r(t,"removeItem",{id:U.id})}),$r({},I,{items:F})})},[t,u,o.items,o.isItemDisabled,o.getItemId,o.getItemLabel]),{getRootProps:()=>({style:{"--TreeView-itemChildrenIndentation":typeof o.itemChildrenIndentation=="number"?`${o.itemChildrenIndentation}px`:o.itemChildrenIndentation}}),publicAPI:{getItem:h,getItemDOMElement:S,getItemTree:g,getItemOrderedChildrenIds:x},instance:{getItemMeta:f,getItem:h,getItemTree:g,getItemsToRender:()=>{const I=F=>{const U=s.items.itemMetaMap[F];return{label:U.label,itemId:U.id,id:U.idAttribute,children:s.items.itemOrderedChildrenIds[F]?.map(I)}};return s.items.itemOrderedChildrenIds[k6].map(I)},getItemIndex:b,getItemDOMElement:S,getItemOrderedChildrenIds:x,isItemDisabled:y,isItemNavigable:T,preventItemUpdates:k,areItemUpdatesPrevented:P},contextValue:{items:{onItemClick:o.onItemClick,disabledItemsFocusable:o.disabledItemsFocusable,indentationAtItemLevel:d.indentationAtItemLevel??!1}}}};NH.getInitialState=t=>({items:Twt({items:t.items,isItemDisabled:t.isItemDisabled,getItemId:t.getItemId,getItemLabel:t.getItemLabel})});NH.getDefaultizedParams=({params:t})=>$r({},t,{disabledItemsFocusable:t.disabledItemsFocusable??!1,itemChildrenIndentation:t.itemChildrenIndentation??"12px"});NH.wrapRoot=({children:t,instance:o})=>M.jsx(sIe.Provider,{value:s=>o.getItemMeta(s)?.depth??0,children:t});NH.params={disabledItemsFocusable:!0,items:!0,isItemDisabled:!0,getItemLabel:!0,getItemId:!0,onItemClick:!0,itemChildrenIndentation:!0};const _3r=typeof window<"u"?z.useLayoutEffect:z.useEffect;function nI(t){const o=z.useRef(t);return _3r(()=>{o.current=t}),z.useRef((...s)=>(0,o.current)(...s)).current}const _le=({instance:t,params:o,models:s})=>{const u=z.useMemo(()=>{const S=new Map;return s.expandedItems.value.forEach(T=>{S.set(T,!0)}),S},[s.expandedItems.value]),d=(S,T)=>{o.onExpandedItemsChange?.(S,T),s.expandedItems.setControlledValue(T)},f=z.useCallback(S=>u.has(S),[u]),h=z.useCallback(S=>!!t.getItemMeta(S)?.expandable,[t]),g=nI((S,T)=>{const w=t.isItemExpanded(T);t.setItemExpansion(S,T,!w)}),y=nI((S,T,w)=>{if(t.isItemExpanded(T)===w)return;let k;w?k=[T].concat(s.expandedItems.value):k=s.expandedItems.value.filter(P=>P!==T),o.onItemExpansionToggle&&o.onItemExpansionToggle(S,T,w),d(S,k)}),b=(S,T)=>{const w=t.getItemMeta(T),k=t.getItemOrderedChildrenIds(w.parentId).filter(I=>t.isItemExpandable(I)&&!t.isItemExpanded(I)),P=s.expandedItems.value.concat(k);k.length>0&&(o.onItemExpansionToggle&&k.forEach(I=>{o.onItemExpansionToggle(S,I,!0)}),d(S,P))},x=z.useMemo(()=>o.expansionTrigger?o.expansionTrigger:t.isTreeViewEditable?"iconContainer":"content",[o.expansionTrigger,t.isTreeViewEditable]);return{publicAPI:{setItemExpansion:y},instance:{isItemExpanded:f,isItemExpandable:h,setItemExpansion:y,toggleItemExpansion:g,expandAllSiblings:b},contextValue:{expansion:{expansionTrigger:x}}}};_le.models={expandedItems:{getDefaultValue:t=>t.defaultExpandedItems}};const T3r=[];_le.getDefaultizedParams=({params:t})=>$r({},t,{defaultExpandedItems:t.defaultExpandedItems??T3r});_le.params={expandedItems:!0,defaultExpandedItems:!0,onExpandedItemsChange:!0,onItemExpansionToggle:!0,expansionTrigger:!0};const Gre=t=>Array.isArray(t)?t:t!=null?[t]:[],zTe=t=>{const o={};return t.forEach(s=>{o[s]=!0}),o},Tle=({instance:t,params:o,models:s})=>{const u=z.useRef(null),d=z.useRef({}),f=z.useMemo(()=>{const x=new Map;return Array.isArray(s.selectedItems.value)?s.selectedItems.value.forEach(S=>{x.set(S,!0)}):s.selectedItems.value!=null&&x.set(s.selectedItems.value,!0),x},[s.selectedItems.value]),h=(x,S)=>{if(o.onItemSelectionToggle)if(o.multiSelect){const T=S.filter(k=>!t.isItemSelected(k)),w=s.selectedItems.value.filter(k=>!S.includes(k));T.forEach(k=>{o.onItemSelectionToggle(x,k,!0)}),w.forEach(k=>{o.onItemSelectionToggle(x,k,!1)})}else S!==s.selectedItems.value&&(s.selectedItems.value!=null&&o.onItemSelectionToggle(x,s.selectedItems.value,!1),S!=null&&o.onItemSelectionToggle(x,S,!0));o.onSelectedItemsChange&&o.onSelectedItemsChange(x,S),s.selectedItems.setControlledValue(S)},g=x=>f.has(x),y=({event:x,itemId:S,keepExistingSelection:T=!1,shouldBeSelected:w})=>{if(o.disableSelection)return;let k;if(T){const P=Gre(s.selectedItems.value),I=t.isItemSelected(S);I&&(w===!1||w==null)?k=P.filter(F=>F!==S):!I&&(w===!0||w==null)?k=[S].concat(P):k=P}else w===!1||w==null&&t.isItemSelected(S)?k=o.multiSelect?[]:null:k=o.multiSelect?[S]:S;h(x,k),u.current=S,d.current={}},b=(x,[S,T])=>{if(o.disableSelection||!o.multiSelect)return;let w=Gre(s.selectedItems.value).slice();Object.keys(d.current).length>0&&(w=w.filter(F=>!d.current[F]));const k=zTe(w),P=PAr(t,S,T),I=P.filter(F=>!k[F]);w=w.concat(I),h(x,w),d.current=zTe(P)};return{getRootProps:()=>({"aria-multiselectable":o.multiSelect}),publicAPI:{selectItem:y},instance:{isItemSelected:g,selectItem:y,selectAllNavigableItems:x=>{if(o.disableSelection||!o.multiSelect)return;const S=MAr(t);h(x,S),d.current=zTe(S)},expandSelectionRange:(x,S)=>{if(u.current!=null){const[T,w]=gwt(t,S,u.current);b(x,[T,w])}},selectRangeFromStartToItem:(x,S)=>{b(x,[tz(t),S])},selectRangeFromItemToEnd:(x,S)=>{b(x,[S,mwt(t)])},selectItemFromArrowNavigation:(x,S,T)=>{if(o.disableSelection||!o.multiSelect)return;let w=Gre(s.selectedItems.value).slice();Object.keys(d.current).length===0?(w.push(T),d.current={[S]:!0,[T]:!0}):(d.current[S]||(d.current={}),d.current[T]?(w=w.filter(k=>k!==S),delete d.current[S]):(w.push(T),d.current[T]=!0)),h(x,w)}},contextValue:{selection:{multiSelect:o.multiSelect,checkboxSelection:o.checkboxSelection,disableSelection:o.disableSelection}}}};Tle.models={selectedItems:{getDefaultValue:t=>t.defaultSelectedItems}};const A3r=[];Tle.getDefaultizedParams=({params:t})=>$r({},t,{disableSelection:t.disableSelection??!1,multiSelect:t.multiSelect??!1,checkboxSelection:t.checkboxSelection??!1,defaultSelectedItems:t.defaultSelectedItems??(t.multiSelect?A3r:null)});Tle.params={disableSelection:!0,multiSelect:!0,checkboxSelection:!0,defaultSelectedItems:!0,selectedItems:!0,onSelectedItemsChange:!0,onItemSelectionToggle:!0};function C3r(t){return t&&t.ownerDocument||document}const Egt=1e3;class w3r{constructor(o=Egt){this.timeouts=new Map,this.cleanupTimeout=Egt,this.cleanupTimeout=o}register(o,s,u){this.timeouts||(this.timeouts=new Map);const d=setTimeout(()=>{typeof s=="function"&&s(),this.timeouts.delete(u.cleanupToken)},this.cleanupTimeout);this.timeouts.set(u.cleanupToken,d)}unregister(o){const s=this.timeouts.get(o.cleanupToken);s&&(this.timeouts.delete(o.cleanupToken),clearTimeout(s))}reset(){this.timeouts&&(this.timeouts.forEach((o,s)=>{this.unregister({cleanupToken:s})}),this.timeouts=void 0)}}class R3r{constructor(){this.registry=new FinalizationRegistry(o=>{typeof o=="function"&&o()})}register(o,s,u){this.registry.register(o,s,u)}unregister(o){this.registry.unregister(o)}reset(){}}class O3r{}function N3r(t){let o=0;return function(s,u,d){t.registry===null&&(t.registry=typeof FinalizationRegistry<"u"?new R3r:new w3r);const[f]=z.useState(new O3r),h=z.useRef(null),g=z.useRef(void 0);g.current=d;const y=z.useRef(null);if(!h.current&&g.current){const b=(x,S)=>{S.defaultMuiPrevented||g.current?.(x,S)};h.current=s.$$subscribeEvent(u,b),o+=1,y.current={cleanupToken:o},t.registry.register(f,()=>{h.current?.(),h.current=null,y.current=null},y.current)}else!g.current&&h.current&&(h.current(),h.current=null,y.current&&(t.registry.unregister(y.current),y.current=null));z.useEffect(()=>{if(!h.current&&g.current){const b=(x,S)=>{S.defaultMuiPrevented||g.current?.(x,S)};h.current=s.$$subscribeEvent(u,b)}return y.current&&t.registry&&(t.registry.unregister(y.current),y.current=null),()=>{h.current?.(),h.current=null}},[s,u])}}const k3r={registry:null},D3r=N3r(k3r),Awt=(t=document)=>{const o=t.activeElement;return o?o.shadowRoot?Awt(o.shadowRoot):o:null},I3r=(t,o)=>{let s=Gre(o).find(u=>{if(!t.isItemNavigable(u))return!1;const d=t.getItemMeta(u);return d&&(d.parentId==null||t.isItemExpanded(d.parentId))});return s==null&&(s=tz(t)),s},fIe=({instance:t,params:o,state:s,setState:u,models:d,rootRef:f})=>{const h=I3r(t,d.selectedItems.value),g=nI(I=>{const F=typeof I=="function"?I(s.focusedItemId):I;s.focusedItemId!==F&&u(U=>$r({},U,{focusedItemId:F}))}),y=z.useCallback(()=>!!f.current&&f.current.contains(Awt(C3r(f.current))),[f]),b=z.useCallback(I=>s.focusedItemId===I&&y(),[s.focusedItemId,y]),x=I=>{const F=t.getItemMeta(I);return F&&(F.parentId==null||t.isItemExpanded(F.parentId))},S=(I,F)=>{const U=t.getItemDOMElement(F);U&&U.focus(),g(F),o.onItemFocus&&o.onItemFocus(I,F)},T=nI((I,F)=>{x(F)&&S(I,F)}),w=nI(()=>{if(s.focusedItemId!=null){if(t.getItemMeta(s.focusedItemId)){const I=t.getItemDOMElement(s.focusedItemId);I&&I.blur()}g(null)}}),k=I=>I===h;D3r(t,"removeItem",({id:I})=>{s.focusedItemId===I&&S(null,h)});const P=I=>F=>{I.onFocus?.(F),!F.defaultMuiPrevented&&F.target===F.currentTarget&&S(F,h)};return{getRootProps:I=>({onFocus:P(I)}),publicAPI:{focusItem:T},instance:{isItemFocused:b,canItemBeTabbed:k,focusItem:T,removeFocusedItem:w}}};fIe.getInitialState=()=>({focusedItemId:null});fIe.params={onItemFocus:!0};function L3r(t){return!!t&&t.length===1&&!!t.match(/\S/)}const Cwt=({instance:t,params:o,state:s})=>{const u=wvr(),d=z.useRef({}),f=nI(b=>{d.current=b(d.current)});z.useEffect(()=>{if(t.areItemUpdatesPrevented())return;const b={},x=S=>{b[S.id]=S.label.substring(0,1).toLowerCase()};Object.values(s.items.itemMetaMap).forEach(x),d.current=b},[s.items.itemMetaMap,o.getItemId,t]);const h=(b,x)=>{const S=x.toLowerCase(),T=I=>{const F=Hre(t,I);return F===null?tz(t):F};let w=null,k=T(b);const P={};for(;w==null&&!P[k];)d.current[k]===S?w=k:(P[k]=!0,k=T(k));return w},g=b=>!o.disableSelection&&!t.isItemDisabled(b),y=b=>!t.isItemDisabled(b)&&t.isItemExpandable(b);return{instance:{updateFirstCharMap:f,handleItemKeyDown:(b,x)=>{if(b.defaultMuiPrevented||b.altKey||nz(b.target,b.currentTarget))return;const S=b.ctrlKey||b.metaKey,T=b.key;switch(!0){case(T===" "&&g(x)):{b.preventDefault(),o.multiSelect&&b.shiftKey?t.expandSelectionRange(b,x):t.selectItem({event:b,itemId:x,keepExistingSelection:o.multiSelect,shouldBeSelected:o.multiSelect?void 0:!0});break}case T==="Enter":{OO(t,ug)&&t.isItemEditable(x)&&!t.isItemBeingEdited(x)?t.setEditedItemId(x):y(x)?(t.toggleItemExpansion(b,x),b.preventDefault()):g(x)&&(o.multiSelect?(b.preventDefault(),t.selectItem({event:b,itemId:x,keepExistingSelection:!0})):t.isItemSelected(x)||(t.selectItem({event:b,itemId:x}),b.preventDefault()));break}case T==="ArrowDown":{const w=Hre(t,x);w&&(b.preventDefault(),t.focusItem(b,w),o.multiSelect&&b.shiftKey&&g(w)&&t.selectItemFromArrowNavigation(b,x,w));break}case T==="ArrowUp":{const w=hwt(t,x);w&&(b.preventDefault(),t.focusItem(b,w),o.multiSelect&&b.shiftKey&&g(w)&&t.selectItemFromArrowNavigation(b,x,w));break}case(T==="ArrowRight"&&!u||T==="ArrowLeft"&&u):{if(S)return;if(t.isItemExpanded(x)){const w=Hre(t,x);w&&(t.focusItem(b,w),b.preventDefault())}else y(x)&&(t.toggleItemExpansion(b,x),b.preventDefault());break}case(T==="ArrowLeft"&&!u||T==="ArrowRight"&&u):{if(S)return;if(y(x)&&t.isItemExpanded(x))t.toggleItemExpansion(b,x),b.preventDefault();else{const w=t.getItemMeta(x).parentId;w&&(t.focusItem(b,w),b.preventDefault())}break}case T==="Home":{g(x)&&o.multiSelect&&S&&b.shiftKey?t.selectRangeFromStartToItem(b,x):t.focusItem(b,tz(t)),b.preventDefault();break}case T==="End":{g(x)&&o.multiSelect&&S&&b.shiftKey?t.selectRangeFromItemToEnd(b,x):t.focusItem(b,mwt(t)),b.preventDefault();break}case T==="*":{t.expandAllSiblings(b,x),b.preventDefault();break}case(String.fromCharCode(b.keyCode)==="A"&&S&&o.multiSelect&&!o.disableSelection):{t.selectAllNavigableItems(b),b.preventDefault();break}case(!S&&!b.shiftKey&&L3r(T)):{const w=h(x,T);w!=null&&(t.focusItem(b,w),b.preventDefault());break}}}}}};Cwt.params={};const wwt=({slots:t,slotProps:o})=>({contextValue:{icons:{slots:{collapseIcon:t.collapseIcon,expandIcon:t.expandIcon,endIcon:t.endIcon},slotProps:{collapseIcon:o.collapseIcon,expandIcon:o.expandIcon,endIcon:o.endIcon}}}});wwt.params={};const P3r=[NH,_le,Tle,fIe,Cwt,wwt,ug],M3r=["ownerState"];function F3r({slots:t,slotProps:o,label:s,id:u,itemId:d,itemsToRender:f}){const h=t?.item??r3r,g=vO({elementType:h,externalSlotProps:o?.item,additionalProps:{itemId:d,id:u,label:s},ownerState:{itemId:d,label:s}}),y=x2(g,M3r),b=z.useMemo(()=>f?M.jsx(Rwt,{itemsToRender:f,slots:t,slotProps:o}):null,[f,t,o]);return M.jsx(h,$r({},y,{children:b}))}function Rwt(t){const{itemsToRender:o,slots:s,slotProps:u}=t;return M.jsx(z.Fragment,{children:o.map(d=>M.jsx(F3r,{slots:s,slotProps:u,label:d.label,id:d.id,itemId:d.itemId,itemsToRender:d.children},d.itemId))})}const B3r=cwt(),j3r=t=>{const{classes:o}=t;return uwt({root:["root"]},c3r,o)},$3r=hs("ul",{name:"MuiRichTreeView",slot:"Root",overridesResolver:(t,o)=>o.root})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),U3r=z.forwardRef(function(t,o){const s=B3r({props:t,name:"MuiRichTreeView"}),{getRootProps:u,contextValue:d,instance:f}=b3r({plugins:P3r,rootRef:o,props:s}),{slots:h,slotProps:g}=s,y=j3r(s),b=h?.root??$3r,x=vO({elementType:b,externalSlotProps:g?.root,className:y.root,getSlotProps:u,ownerState:s});return M.jsx(DAr,{value:d,children:M.jsx(b,$r({},x,{children:M.jsx(Rwt,{slots:h,slotProps:g,itemsToRender:f.getItemsToRender()})}))})}),q3r=os(M.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),z3r=os([M.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),M.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),H3r=os(M.jsx("path",{d:"M19 15v4H5v-4zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5M19 5v4H5V5zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5"})),G3r=os(M.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"}));function Owt({items:t,defaultExpandedItems:o,navigate:s}){return M.jsx(U3r,{items:K3r(t,s),defaultExpandedItems:o,slots:{item:Q3r}})}const V3r=Nar(ez);function W3r(t){const o=mar({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return M.jsx(V3r,{style:o,...t})}function Y3r({item:t,...o}){const s=M.jsxs(l3r,{...o,sx:{display:"flex",alignItems:"center",color:t.error?"error.main":"grey.600"},children:[t.fileType==="directory"&&M.jsx(q3r,{})||t.fileType==="notebook"&&M.jsx(z3r,{})||t.fileType==="model"&&M.jsx(G3r,{})||t.fileType=="database"&&M.jsx(H3r,{})||M.jsx(rwt,{}),M.jsx(dr,{variant:"body2",sx:{marginLeft:"5px"},color:t.error?"error.main":t.link?"primary.main":"grey.600",children:t.label})]});return t.error?M.jsx(dl,{title:t.error,placement:"right",children:s}):s}const Q3r=z.forwardRef(function(t,o){const{id:s,itemId:u,label:d,children:f,disabled:h,...g}=t,{getRootProps:y,getContentProps:b,getLabelProps:x,getIconContainerProps:S,getGroupTransitionProps:T,status:w,publicAPI:k}=jAr({id:s,itemId:u,children:f,label:d,disabled:h,rootRef:o}),P=k.getItem(u);return w.selected=!1,w.focused=!1,M.jsx(cIe,{itemId:u,children:M.jsxs(a3r,{...y(g),children:[M.jsxs(s3r,{...b(),...P.link&&{onClick:I=>P.link(I)},sx:{pointerEvents:!P.selectable&&"none"},children:[M.jsx(u3r,{...S(),children:M.jsx(i3r,{status:w})}),M.jsx(Y3r,{...x({item:P})})]}),f&&M.jsx(W3r,{...T()})]})})});function K3r(t,o){const s=new Map;return t.map(u=>{let d=s;const f=u.path.split("/");f.forEach((h,g)=>{g===f.length-1?d.set(h,u):(d.has(h)||d.set(h,new Map),d=d.get(h))})}),Nwt(s,"",o)}function Nwt(t,o,s){const u=[];return t.forEach((d,f)=>{const h=f.endsWith(".malloy")&&"model"||f.endsWith(".malloynb")&&"notebook"||f.endsWith(".parquet")&&"database"||"unknown";if(h!=="unknown"){const g=d;u.push({id:o+f,label:f,fileType:h,link:h==="model"||h==="notebook"?y=>s(o+f,y):void 0,selectable:h==="model"||h==="notebook",error:"error"in g?g.error:void 0})}else o+=`${f}/`,u.push({id:o,label:f,fileType:"directory",selectable:!0,link:void 0,children:Nwt(d,o,s)})}),u}const X3r=new xle(new Pd),Z3r=["notebooks/","models/"];function J3r({navigate:t}){const{projectName:o,packageName:s,versionId:u}=Eg(),{data:d,isError:f,error:h,isSuccess:g}=Hh({queryKey:["models",o,s,u],queryFn:y=>X3r.listModels(o,s,u,y)});return M.jsx(fu,{variant:"outlined",sx:{width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),M.jsx(wc,{}),M.jsxs(Eo,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!g&&!f&&M.jsx(Sg,{text:"Fetching Models..."}),f&&M.jsx(zh,{error:h,context:`${o} > ${s} > Models`}),g&&d.data.length>0&&M.jsx(Owt,{items:d.data.sort((y,b)=>y.path.localeCompare(b.path)),navigate:t,defaultExpandedItems:Z3r}),g&&d.data.length===0&&M.jsx(dr,{variant:"body2",children:"No models found"})]})]})})}const eCr=new rCt(new Pd),tCr=["notebooks/"];function nCr({navigate:t}){const{projectName:o,packageName:s,versionId:u}=Eg(),{data:d,isError:f,error:h,isSuccess:g}=Hh({queryKey:["notebooks",o,s,u],queryFn:y=>eCr.listNotebooks(o,s,u,y)});return M.jsx(fu,{variant:"outlined",sx:{width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),M.jsx(wc,{}),M.jsxs(Eo,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!g&&!f&&M.jsx(Sg,{text:"Fetching Notebooks..."}),f&&M.jsx(zh,{error:h,context:`${o} > ${s} > Notebooks`}),g&&d.data.length>0&&M.jsx(Owt,{items:d.data.sort((y,b)=>y.path.localeCompare(b.path)),defaultExpandedItems:tCr,navigate:t}),g&&d.data.length===0&&M.jsx(dr,{variant:"body2",children:"No notebooks found"})]})]})})}const rCr=new $Er(new Pd);function iCr(){const{projectName:t,packageName:o,versionId:s}=Eg(),{data:u,isError:d,isLoading:f,error:h}=Hh({queryKey:["schedules",t,o,s],queryFn:g=>rCr.listSchedules(t,o,s,g)});return f?M.jsx(Sg,{text:"Fetching Schedules..."}):d?M.jsx(zh,{error:h,context:`${t} > ${o} > Schedules`}):u.data.length?M.jsx(fu,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),M.jsx(wc,{}),M.jsx(Eo,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:M.jsx(Eyt,{component:FI,children:M.jsxs(lie,{sx:{minWidth:300},size:"small",children:[M.jsx(gAe,{children:M.jsxs(FT,{children:[M.jsx(Cs,{align:"left",children:"Resource"}),M.jsx(Cs,{align:"left",children:"Schedule"}),M.jsx(Cs,{align:"left",children:"Action"}),M.jsx(Cs,{align:"left",children:"Connection"}),M.jsx(Cs,{align:"left",children:"Last Run"}),M.jsx(Cs,{align:"left",children:"Status"})]})}),M.jsx(uie,{children:u.data.map(g=>M.jsxs(FT,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[M.jsx(Cs,{align:"left",children:g.resource}),M.jsx(Cs,{align:"left",children:g.schedule}),M.jsx(Cs,{align:"left",children:g.action}),M.jsx(Cs,{align:"left",children:g.connection}),M.jsx(Cs,{align:"left",children:g.lastRunTime?new Date(g.lastRunTime).toLocaleString():"n/a"}),M.jsx(Cs,{align:"left",children:g.lastRunStatus})]},g.resource))})]})})})]})}):null}const oCr="README.malloynb";function aCr({navigate:t}){return t||(t=o=>{window.location.href=o}),M.jsxs(ou,{container:!0,spacing:2,columns:12,children:[M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(ATr,{})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(nCr,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(J3r,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:6},children:M.jsx(NTr,{})}),M.jsx(ou,{size:{xs:12,md:6},children:M.jsx(RTr,{})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(iCr,{})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(twt,{notebookPath:oCr,hideEmbeddingIcons:!0})})]})}const kwt=z.createContext(void 0),sCr=({server:t=`${window.location.protocol}//${window.location.host}/api/v0`,getAccessToken:o,children:s})=>{const u={server:t,getAccessToken:o};return M.jsx(kwt.Provider,{value:u,children:s})},pIe=()=>{const t=z.useContext(kwt);if(t===void 0)throw new Error("useServer must be used within a ServerProvider");return t},Hne=os(M.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),Sgt=os(M.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}));function lCr({cell:t,sourceAndPaths:o,onQueryChange:s,onSourceChange:u}){const d={query:t.value,malloyResult:t.result?JSON.parse(t.result):void 0,malloyQuery:t.queryInfo?JSON.parse(t.queryInfo):void 0,sourceName:t.sourceName,modelPath:t.modelPath};return M.jsx(XCt,{sourceAndPaths:o,existingQuery:d,existingSourceName:t.sourceName,onQueryChange:s,onSourceChange:u})}function uCr({cell:t,expandCodeCell:o,expandEmbedding:s,hideEmbeddingIcons:u,editingMalloy:d,editingMarkdown:f,sourceAndPaths:h,onCellChange:g,onClose:y,onEdit:b,onDelete:x,addButtonCallback:S}){const[T,w]=Dn.useState(o),[k,P]=Dn.useState(s),[I,F]=Dn.useState(),[U]=Dn.useState(),[q,G]=Dn.useState(KU()),[Q,K]=Dn.useState(!1),[te,oe]=Dn.useState(t.sourceName?h.findIndex(ie=>ie.sourceInfo.name===t.sourceName):0);z.useEffect(()=>{t.isMarkdown||HO(t.value,"malloy").then(ie=>{F(ie)})},[t]);const[fe,X]=z.useState(t.value);Dn.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const le=cCr(ie=>{g({...t,value:ie})}),[me,Ee]=z.useState(!1),we=()=>{x(),Ee(!1)},xe=h.length===0,ve=()=>{const ie=h[te],pe=ie?.modelPath||t.modelPath||"",be=ie?.sourceInfo.name||t.sourceName||"";g({...t,value:q.query,result:q.malloyResult?JSON.stringify(q.malloyResult):void 0,queryInfo:q.malloyQuery?JSON.stringify(q.malloyQuery):void 0,sourceName:be,modelPath:pe})},Be=M.jsx(dl,{title:"Delete Cell",children:M.jsx(cl,{size:"small",onClick:()=>Ee(!0),children:M.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:M.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),Qe=M.jsxs(uq,{open:me,onClose:()=>Ee(!1),children:[M.jsx(dq,{children:"Confirm Delete"}),M.jsx(cq,{children:M.jsx(dr,{children:"Are you sure you want to delete this cell?"})}),M.jsxs(fyt,{children:[M.jsx(Cc,{onClick:()=>Ee(!1),children:"Cancel"}),M.jsx(Cc,{onClick:we,color:"error",children:"Delete"})]})]}),Me=t.isMarkdown?M.jsxs(M.Fragment,{children:[f?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:y,children:M.jsx(Hne,{})})}):M.jsx(dl,{title:"Edit",children:M.jsx(cl,{size:"small",onClick:b,children:M.jsx(Sgt,{})})}),!f&&Be]}):M.jsxs(M.Fragment,{children:[!d&&M.jsx(dl,{title:T?"Hide Code":"View Code",children:M.jsx(cl,{size:"small",onClick:()=>{w(!T)},children:M.jsx(JCt,{})})}),!u&&!d&&t.result&&M.jsx(dl,{title:k?"Hide Embedding":"View Embedding",children:M.jsx(cl,{size:"small",onClick:()=>{P(!k)},children:M.jsx(CH,{})})}),d&&M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:()=>{ve(),y()},children:M.jsx(Hne,{})})}),!d&&M.jsx(dl,{title:"Edit",children:M.jsx(cl,{size:"small",onClick:b,children:M.jsx(Sgt,{})})}),!d&&Be]}),ce=d||f,Ue=f?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:y,children:M.jsx(Hne,{})})}):d?M.jsx(dl,{title:"Save",children:M.jsx(cl,{size:"small",onClick:()=>{ve(),y()},children:M.jsx(Hne,{})})}):null,Ke=Q&&M.jsx(Eo,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!ce&&M.jsxs(M.Fragment,{children:[S(!0),S(!1),Me]})||Ue});return M.jsxs(fu,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>K(!0),onMouseLeave:()=>{K(!1)},children:[Ke,t.isMarkdown?M.jsx(M.Fragment,{children:f?M.jsx(q3t,{value:fe,preview:"edit",autoFocus:!0,onChange:ie=>{X(ie),le(ie)},onBlur:()=>{ve(),Q||y()}}):M.jsx(Eo,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:fe?M.jsx(Eo,{onClick:b,sx:{cursor:"pointer"},children:M.jsx(aNe,{children:fe})}):M.jsxs(Eo,{onClick:b,sx:{cursor:"pointer"},children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):M.jsxs(M.Fragment,{children:[M.jsx(ay,{in:k,timeout:"auto",unmountOnExit:!0,children:M.jsx(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:M.jsx(dr,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:U}})})}),M.jsx(ay,{in:T,timeout:"auto",unmountOnExit:!0,children:M.jsx(ma,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:M.jsx(dr,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:I}})})}),d&&(xe?M.jsxs(M.Fragment,{children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):M.jsx(lCr,{sourceAndPaths:h,onQueryChange:ie=>{G(ie)},cell:t,onSourceChange:oe})),!d&&t.result&&M.jsx(fu,{variant:"outlined",sx:{borderRadius:0},children:M.jsx(ewt,{result:t.result,minHeight:300,maxHeight:800})}),!d&&!t.result&&M.jsxs(Eo,{onClick:b,sx:{cursor:"pointer"},children:[M.jsx(dr,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),M.jsx(dr,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),me&&Qe]})}function cCr(t,o=2e3){const s=Dn.useRef(void 0);return Dn.useCallback(u=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{t(u)},o)},[t,o])}const Dwt=z.createContext(void 0);function Iwt({children:t,userContext:o,notebookStorage:s}){const u=z.useMemo(()=>({notebookStorage:s,userContext:o}),[s,o]);return M.jsx(Dwt.Provider,{value:u,children:t})}function Lwt(){const t=z.useContext(Dwt);if(!t)throw new Error("useNotebookStorage must be used within a NotebookStorageProvider");return t}const dCr=os(M.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),fCr=os(M.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"})),pCr=new xle(new Pd);function hCr({initialSelectedModels:t,onModelChange:o}){const{projectName:s,packageName:u,versionId:d}=Eg(),{data:f,isLoading:h,isSuccess:g,isError:y,error:b}=Hh({queryKey:["models",s,u,d],queryFn:F=>pCr.listModels(s,u,d,F)}),[x,S]=Dn.useState(t||[]),[T,w]=Dn.useState(null);Dn.useEffect(()=>{S(t||[])},[t]);const k=F=>{const U=x.filter(q=>q!==F);S(U),o(U)},P=F=>{const U=[...x,F];S(U),o(U),w(null)};let I=[];return g&&f?.data&&(I=f.data.filter(F=>!x.includes(F.path)).map(F=>F.path)),y?M.jsx(zh,{error:b,context:`${s} > ${u} > Model Picker`}):M.jsxs(M.Fragment,{children:[M.jsxs(Iwe,{fullWidth:!0,children:[h&&M.jsx(dr,{children:"Loading..."}),M.jsxs(ma,{direction:"row",spacing:1,children:[x.map(F=>M.jsx(SO,{label:F,onDelete:()=>k(F),deleteIcon:M.jsx(dCr,{}),sx:{marginBottom:"5px"}},F)),M.jsx(Cc,{size:"small",startIcon:M.jsx(fCr,{}),onClick:F=>w(F.currentTarget),disabled:h||y||I.length===0,children:"Add Model"})]})]}),M.jsxs(nae,{anchorEl:T,open:!!T,onClose:()=>w(null),children:[M.jsx(dr,{variant:"subtitle2",sx:{ml:1},children:"Models"}),M.jsx(wc,{}),I.length===0?M.jsx(cI,{disabled:!0,children:"No models available"}):I.map(F=>M.jsx(cI,{onClick:()=>P(F),children:M.jsx(dr,{variant:"body2",children:F})},F))]})]})}const mCr=new xle(new Pd);function gCr({notebookPath:t,expandCodeCells:o,expandEmbeddings:s,hideEmbeddingIcons:u}){const d=ML(),{projectName:f,packageName:h,versionId:g}=Eg(),{server:y,getAccessToken:b}=pIe(),{notebookStorage:x,userContext:S}=Lwt();if(!f||!h)throw new Error("Project and package must be provided via PubliserPackageProvider");if(!x||!S)throw new Error("Notebook storage and user context must be provided via NotebookStorageProvider");const[T,w]=Dn.useState(),[k,P]=Dn.useState(),[I,F]=Dn.useState(),[U,q]=Dn.useState([]),[G,Q]=Dn.useState(null),[K,te]=Dn.useState(null),oe=!!G,fe=()=>{Q(null),te(null)},X=(ce,Ue)=>{T.insertCell(Ue,{isMarkdown:ce,value:""}),ve(),ce?F(Ue):P(Ue),fe()},[le,me]=Dn.useState(!1),Ee=()=>{me(!0)},we=ce=>{t&&x&&S&&x.deleteNotebook(S,t),me(!1),d(`/${f}/${h}`,ce)},xe=()=>{me(!1)},ve=Dn.useCallback(()=>{w(T.saveNotebook())},[T]);if(Dn.useEffect(()=>{T&&(async()=>{const ce=new Map(U.map(({modelPath:ie,sourceInfos:pe})=>[ie,pe])),Ue=[],Ke=[];for(const ie of T.getModels())ce.has(ie)?Ue.push({modelPath:ie,sourceInfos:ce.get(ie)}):(console.log("Fetching model from Publisher",ie),Ke.push(mCr.getModel(f,h,ie,g,await rIe(y,b)).then(pe=>({modelPath:ie,sourceInfos:pe.data.sourceInfos.map(be=>JSON.parse(be))}))));if(Ke.length>0){const ie=await Promise.all(Ke);q([...Ue,...ie])}else q(Ue)})()},[b,T,h,f,y,g]),Dn.useEffect(()=>{t&&w(XU.loadNotebook(x,S,t))},[t,x,S]),!T)return M.jsx("div",{children:"Loading..."});const Be=ce=>{const Ue=[];for(const Ke of ce)for(const ie of Ke.sourceInfos)Ue.push({modelPath:Ke.modelPath,sourceInfo:ie});return Ue},Qe=(ce,Ue)=>M.jsx(Cc,{size:"small",startIcon:M.jsx(_Tr,{}),onClick:()=>X(ce,Ue),variant:"contained",sx:{backgroundColor:"#fff",color:Ke=>Ke.palette.mode==="dark"?Ke.palette.grey[100]:Ke.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:Ke=>Ke.palette.mode==="dark"?Ke.palette.grey[500]:Ke.palette.grey[300],boxShadow:"none"}},children:ce?"Markdown":"Explore"}),Me=M.jsxs(Eo,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[Qe(!1,T.getCells().length),Qe(!0,T.getCells().length)]});return M.jsxs(fu,{variant:"outlined",children:[M.jsxs($h,{children:[M.jsxs(d6,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[M.jsxs(d6,{direction:"row",spacing:1,alignItems:"center",children:[M.jsx(dr,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),M.jsx(dr,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${f} > ${h} > ${t}`})]}),M.jsxs(d6,{sx:{display:"flex",flexDirection:"row",gap:1},children:[M.jsx(Eo,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:M.jsx(yCr,{notebookData:T})}),M.jsxs(Eo,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[M.jsx(Cc,{color:"error",onClick:Ee,size:"small",children:"Delete"}),M.jsxs(uq,{open:le,onClose:xe,children:[M.jsx(dq,{children:"Delete Notebook"}),M.jsx(cq,{children:M.jsxs(I6n,{children:['Are you sure you want to delete the notebook "',t,'"? This action cannot be undone.']})}),M.jsxs(fyt,{children:[M.jsx(Cc,{onClick:xe,color:"primary",size:"small",children:"Cancel"}),M.jsx(Cc,{onClick:ce=>we(ce),color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),M.jsx(wc,{}),M.jsxs(d6,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[M.jsx(Eo,{sx:{flex:1},children:M.jsx(hCr,{initialSelectedModels:T.getModels(),onModelChange:ce=>{w(T.setModels(ce)),ve()}})}),M.jsx(Eo,{sx:{flex:1}})]})]}),M.jsx(Sle,{children:M.jsxs(d6,{children:[T.getCells().length===0&&M.jsxs(M.Fragment,{children:[M.jsx(dr,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),M.jsx(dr,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),T.getCells().map((ce,Ue)=>M.jsx(Dn.Fragment,{children:M.jsx(uCr,{cell:ce,addButtonCallback:Ke=>Qe(Ke,Ue),sourceAndPaths:Be(U),expandCodeCell:o,expandEmbedding:s,hideEmbeddingIcons:u,editingMarkdown:I===Ue,editingMalloy:k===Ue,onDelete:()=>{w(T.deleteCell(Ue)),ve()},onCellChange:Ke=>{w(T.setCell(Ue,Ke)),ve()},onEdit:()=>{ce.isMarkdown?F(Ue):P(Ue)},onClose:()=>{ce.isMarkdown?F(void 0):P(void 0)}},`${Ue}-${ce.isMarkdown}-${t}-${f}-${h}`)},`${Ue}-${T.getCells().length}`)),Me,M.jsxs(nae,{anchorEl:G,open:oe,onClose:fe,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[M.jsx(cI,{onClick:()=>X(!0,K??0),children:"Add Markdown"}),M.jsx(cI,{onClick:()=>X(!1,K??0),children:"Add Malloy"})]}),M.jsx(d6,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function yCr({notebookData:t}){const[o,s]=Dn.useState(!1);return M.jsx(Cc,{color:"primary",onClick:async()=>{if(!t)return;const u=t.toMalloyNotebook();try{await navigator.clipboard.writeText(u),s(!0),setTimeout(()=>s(!1),1500)}catch{s(!1),alert("Failed to copy to clipboard")}},size:"small",children:o?"Copied!":"Export"})}function xCr({onNotebookClick:t}){const{notebookStorage:o,userContext:s}=Lwt(),[u,d]=Dn.useState([]);return Dn.useEffect(()=>{o&&s&&d(o.listNotebooks(s))},[o,s]),M.jsxs(M.Fragment,{children:[M.jsx(wc,{}),M.jsx(Eo,{sx:{maxHeight:"300px",overflow:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.2)",borderRadius:"4px"}},children:M.jsxs(Pwe,{dense:!0,children:[u.length===0&&M.jsx(T6,{children:M.jsx(_O,{primary:"No notebooks found.",sx:{textAlign:"center"}})}),u.map(f=>M.jsx(T6,{onClick:h=>t(f,h),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:M.jsx(_O,{primary:f})},f))]})})]})}const bCr=new oCt(new Pd);function vCr(){const{projectName:t}=Mwt(),{data:o,isSuccess:s,isError:u,error:d}=Hh({queryKey:["about",t],queryFn:f=>bCr.getProject(t,!1,f)});return M.jsxs(M.Fragment,{children:[!s&&!u&&M.jsx(Sg,{text:"Fetching About..."}),s&&M.jsxs(fu,{variant:"outlined",sx:{p:2},children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Readme"}),M.jsx(fu,{sx:{p:1},children:M.jsx(aNe,{children:o.data.readme})})]}),u&&M.jsx(zh,{error:d,context:`${t} > About`})]})}const ECr=new iCt(new Pd);function SCr({navigate:t}){const{projectName:o}=Mwt(),{data:s,isSuccess:u,isError:d,error:f}=Hh({queryKey:["packages",o],queryFn:h=>ECr.listPackages(o,h)});return M.jsxs(M.Fragment,{children:[!u&&!d&&M.jsx(Sg,{text:"Fetching Packages..."}),u&&M.jsxs(fu,{variant:"outlined",sx:{p:2},children:[M.jsx(dr,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Packages"}),M.jsx(ou,{container:!0,spacing:2,columns:12,children:s.data.sort((h,g)=>h.name.localeCompare(g.name)).map(h=>M.jsx(ou,{size:{xs:12,sm:12,md:12,lg:4},children:M.jsx(fu,{variant:"outlined",sx:{cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",transform:"translateY(-2px)"}},onClick:g=>t(h.name+"/",g),children:M.jsxs($h,{children:[M.jsx(dr,{variant:"overline",color:"primary.main",children:h.name}),M.jsx(Eo,{sx:{maxHeight:"120px",overflowY:"auto"},children:M.jsx(dr,{variant:"body2",children:h.description})})]})})},h.name))})]}),d&&M.jsx(zh,{error:f,context:`${o} > Packages`})]})}const Pwt=z.createContext(void 0);function Mwt(){const t=z.useContext(Pwt);if(!t)throw new Error("useProject must be used within a ProjectProvider");return t}function _Cr({children:t,projectName:o}){return M.jsx(Pwt.Provider,{value:{projectName:o},children:t})}function TCr({navigate:t}){return M.jsxs(ou,{container:!0,spacing:2,columns:12,children:[M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(SCr,{navigate:t})}),M.jsx(ou,{size:{xs:12,md:12},children:M.jsx(vCr,{})})]})}const ACr=os(M.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M8 17c-.55 0-1-.45-1-1v-3c0-.55.45-1 1-1s1 .45 1 1v3c0 .55-.45 1-1 1m4 0c-.55 0-1-.45-1-1v-1c0-.55.45-1 1-1s1 .45 1 1v1c0 .55-.45 1-1 1m0-5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4 5c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1"})),CCr=os(M.jsx("path",{d:"M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42s1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1"})),_gt=os(M.jsx("path",{d:"m19.46 8 .79-1.75L22 5.46c.39-.18.39-.73 0-.91l-1.75-.79L19.46 2c-.18-.39-.73-.39-.91 0l-.79 1.75-1.76.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.74.39.92 0M11.5 9.5 9.91 6c-.35-.78-1.47-.78-1.82 0L6.5 9.5 3 11.09c-.78.36-.78 1.47 0 1.82l3.5 1.59L8.09 18c.36.78 1.47.78 1.82 0l1.59-3.5 3.5-1.59c.78-.36.78-1.47 0-1.82zm7.04 6.5-.79 1.75-1.75.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.73.39.91 0l.79-1.75 1.76-.79c.39-.18.39-.73 0-.91l-1.75-.79-.79-1.76c-.18-.39-.74-.39-.92 0"})),wCr=os(M.jsx("path",{d:"M8.7 15.9 4.8 12l3.9-3.9c.39-.39.39-1.01 0-1.4a.984.984 0 0 0-1.4 0l-4.59 4.59c-.39.39-.39 1.02 0 1.41l4.59 4.6c.39.39 1.01.39 1.4 0s.39-1.01 0-1.4m6.6 0 3.9-3.9-3.9-3.9a.984.984 0 0 1 0-1.4c.39-.39 1.01-.39 1.4 0l4.59 4.59c.39.39.39 1.02 0 1.41l-4.59 4.6c-.39.39-1.01.39-1.4 0a.984.984 0 0 1 0-1.4"})),RCr=os(M.jsx("path",{d:"M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1 1.1-.49 1.1-1.1-.49-1.1-1.1-1.1M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m2.19 12.19L6 18l3.81-8.19L18 6z"})),OCr=os([M.jsx("path",{d:"M13 8.57c-.79 0-1.43.64-1.43 1.43s.64 1.43 1.43 1.43 1.43-.64 1.43-1.43-.64-1.43-1.43-1.43"},"0"),M.jsx("path",{d:"M13.21 3c-3.84-.11-7 2.87-7.19 6.64L4.1 12.2c-.25.33-.01.8.4.8H6v3c0 1.1.9 2 2 2h1v2c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-3.68c2.44-1.16 4.1-3.68 4-6.58-.14-3.62-3.18-6.63-6.79-6.74M16 10c0 .13-.01.26-.02.39l.83.66c.08.06.1.16.05.25l-.8 1.39c-.05.09-.16.12-.24.09l-.99-.4c-.21.16-.43.29-.67.39L14 13.83c-.01.1-.1.17-.2.17h-1.6c-.1 0-.18-.07-.2-.17l-.15-1.06c-.25-.1-.47-.23-.68-.39l-.99.4c-.09.03-.2 0-.25-.09l-.8-1.39c-.05-.08-.03-.19.05-.25l.84-.66c-.01-.13-.02-.26-.02-.39s.02-.27.04-.39l-.85-.66c-.08-.06-.1-.16-.05-.26l.8-1.38c.05-.09.15-.12.24-.09l1 .4c.2-.15.43-.29.67-.39L12 6.17c.02-.1.1-.17.2-.17h1.6c.1 0 .18.07.2.17l.15 1.06c.24.1.46.23.67.39l1-.4c.09-.03.2 0 .24.09l.8 1.38c.05.09.03.2-.05.26l-.85.66c.03.12.04.25.04.39"},"1")]),Tgt=os(M.jsx("path",{d:"M4 20h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4zM2 6c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2m4 1H4V5h2zm-2 7h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4z"})),NCr=new oCt(new Pd),kCr=t=>{if(!t)return"Explore semantic models, run queries, and build dashboards";const o=t.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),s=o.split(/\n\s*\n/)[0]||o;if(s.length<=120)return s;const u=s.substring(0,120).split(" ");return u.pop(),u.join(" ")+"..."};function DCr({navigate:t}){const{data:o,isSuccess:s,isError:u,error:d}=Hh({queryKey:["projects"],queryFn:f=>NCr.listProjects(f)});return u?M.jsx(zh,{error:d,context:"Projects List"}):s?M.jsxs(kwe,{maxWidth:"lg",sx:{py:4},children:[M.jsxs(Eo,{sx:{textAlign:"center",mb:6},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(_gt,{sx:{fontSize:32,color:"primary.main"}}),M.jsx(dr,{variant:"h3",component:"h1",fontWeight:700,children:"Publisher"})]}),M.jsx(dr,{variant:"h5",color:"text.secondary",sx:{mb:3,maxWidth:600,mx:"auto"},children:"The open-source semantic model server for the Malloy data language"}),M.jsx(dr,{variant:"body1",color:"text.secondary",sx:{maxWidth:800,mx:"auto"},children:"Define semantic models once — and use them everywhere. Publisher serves Malloy models through clean APIs, enabling consistent, interpretable, and AI-ready data access for tools, applications, and agents."})]}),M.jsxs(ou,{container:!0,spacing:3,sx:{mb:6},children:[M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#ad-hoc-data-analysis","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(ACr,{sx:{color:"info.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"Ad Hoc Analysis"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Use Explorer, a visual query builder that allows analysts to browse semantic sources, build queries, and run nested logic — all without writing code."}),M.jsx(SO,{label:"No-code",size:"small",color:"primary",variant:"outlined"})]})})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#notebook-based-dashboards","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(wCr,{sx:{color:"warning.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"Notebook Dashboards"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Create shareable, code-first dashboards using Malloy notebooks. Include text, charts, and reusable views — all versioned alongside your models."}),M.jsx(SO,{label:"Versioned",size:"small",color:"warning",variant:"outlined"})]})})}),M.jsx(ou,{size:{xs:12,md:4},children:M.jsx(S6,{variant:"outlined",onClick:()=>{window.open("https://github.com/malloydata/publisher/blob/main/README.md#mcp-based-ai-data-agents","_blank")},sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2}},children:M.jsxs(_6,{sx:{p:3},children:[M.jsxs(ma,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(OCr,{sx:{color:"success.main",fontSize:28}}),M.jsx(dr,{variant:"h6",fontWeight:600,children:"AI Data Agents"})]}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Expose your semantic models via the Model Context Protocol (MCP), enabling AI agents to discover sources and ask well-formed questions."}),M.jsx(SO,{label:"AI-Ready",size:"small",color:"success",variant:"outlined"})]})})})]}),M.jsx(wc,{sx:{my:4}}),o.data.length>0?M.jsxs(M.Fragment,{children:[M.jsxs(Eo,{sx:{textAlign:"center",mb:4},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(Tgt,{sx:{color:"primary.main",fontSize:24}}),M.jsx(dr,{variant:"h4",fontWeight:600,children:"Select a Project"})]}),M.jsx(dr,{variant:"body1",color:"text.secondary",children:"Choose a project to explore its semantic models and start analyzing your data"})]}),M.jsx(ou,{container:!0,spacing:3,justifyContent:"center",children:o.data.map(f=>M.jsx(ou,{size:{xs:12,sm:6,md:4},children:M.jsx(S6,{variant:"outlined",sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2,borderColor:"primary.main"}},onClick:h=>t(`/${f.name}/`,h),children:M.jsxs(_6,{sx:{p:3,textAlign:"center"},children:[M.jsx(RCr,{sx:{fontSize:48,color:"primary.main",mb:2}}),M.jsx(dr,{variant:"h6",fontWeight:600,gutterBottom:!0,children:f.name}),M.jsx(dr,{variant:"body2",color:"text.secondary",sx:{mb:2},children:kCr(f.readme)}),M.jsx(Cc,{variant:"contained",color:"secondary",endIcon:M.jsx(CCr,{}),fullWidth:!0,children:"Open Project"})]})})},f.name))})]}):M.jsxs(Eo,{sx:{textAlign:"center",mb:4},children:[M.jsxs(ma,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[M.jsx(Tgt,{sx:{color:"primary.main",fontSize:24}}),M.jsx(dr,{variant:"h4",fontWeight:600,children:"Get Started"})]}),M.jsx(dr,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"No projects found. Create your first Malloy project to start exploring semantic models and building data experiences."}),M.jsx(Cc,{variant:"contained",size:"large",color:"primary",startIcon:M.jsx(_gt,{}),href:"https://github.com/malloydata/publisher/blob/main/README.md#server-configuration",target:"_blank",rel:"noopener noreferrer",children:"Learn How to Create Models"})]}),M.jsx(Eo,{sx:{textAlign:"center",mt:6,pt:4,borderTop:1,borderColor:"divider"},children:M.jsxs(dr,{variant:"body2",color:"text.secondary",children:["Publisher is built on fully open infrastructure and designed for the AI era. Join the"," ",M.jsx("a",{href:"https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw",target:"_blank",rel:"noopener noreferrer",style:{color:"primary.main",textDecoration:"underline"},children:"Malloy Slack community"})," ","to ask questions, share ideas, and contribute to the future of data modeling."]})})]}):M.jsx(Sg,{text:"Loading projects..."})}function ICr(){const{projectName:t,packageName:o}=WO(),[s,u]=Dn.useState(""),[d,f]=Dn.useState(null),[h,g]=Dn.useState(!1),[y,b]=Dn.useState(!1),x=ML(),S=!!d,T=U=>{f(U.currentTarget)},w=()=>{f(null)},k=()=>{b(!1)},P=()=>{g(!1)},I=(U,q)=>{b(!1),x(`/${t}/${o}/scratchNotebook/${encodeURIComponent(U)}`,q)},F=U=>{g(!1),x(`/${t}/${o}/scratchNotebook/${encodeURIComponent(s)}`,U),u("")};return!t||!o?null:M.jsxs(M.Fragment,{children:[M.jsx(Cc,{"aria-controls":S?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":S?"true":void 0,onClick:T,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),M.jsxs(nae,{id:"basic-menu",anchorEl:d,open:S,onClose:w,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[M.jsxs(cI,{onClick:()=>{g(!0),w()},sx:{py:1,px:2},children:[M.jsx(mot,{children:M.jsx(ror,{fontSize:"small"})}),M.jsxs(_O,{children:[M.jsx(dr,{variant:"body2",fontWeight:500,children:"New Workbook"}),M.jsx(dr,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),M.jsxs(cI,{onClick:()=>{b(!0),w()},sx:{py:1,px:2},children:[M.jsx(mot,{children:M.jsx(sor,{fontSize:"small"})}),M.jsxs(_O,{children:[M.jsx(dr,{variant:"body2",fontWeight:500,children:"Open Workbook"}),M.jsx(dr,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),M.jsxs(uq,{open:h,onClose:P,maxWidth:"sm",fullWidth:!0,children:[M.jsxs(dq,{sx:{pb:1,pt:2,px:2},children:[M.jsx(dr,{variant:"h6",fontWeight:600,sx:{mb:.5},children:"Create New Workbook"}),M.jsx(dr,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),M.jsx(cq,{sx:{px:2,pb:2},children:M.jsxs(ma,{spacing:2,sx:{mt:1},children:[M.jsx(Iwe,{fullWidth:!0,children:M.jsx(m7n,{label:"Workbook Name",value:s,onChange:U=>u(U.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),M.jsxs(ma,{direction:"row",spacing:1,justifyContent:"flex-end",children:[M.jsx(Cc,{onClick:P,variant:"outlined",size:"small",children:"Cancel"}),M.jsx(Cc,{onClick:U=>F(U),variant:"contained",disabled:!s.trim(),size:"small",children:"Create Workbook"})]})]})})]}),M.jsxs(uq,{open:y,onClose:k,maxWidth:"md",fullWidth:!0,children:[M.jsxs(dq,{sx:{pb:1,pt:2,px:2},children:[M.jsx(dr,{variant:"h6",fontWeight:600,sx:{mb:.5},children:"Open Workbook"}),M.jsx(dr,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),M.jsx(cq,{sx:{px:2,pb:2},children:M.jsx(Iwt,{notebookStorage:new nwt,userContext:{project:t,package:o},children:M.jsx(xCr,{onNotebookClick:I})})})]})]})}new nCt(new Pd);Mi.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet";function LCr(){const t=ML();return M.jsx(DCr,{navigate:t})}function PCr(){const t=WO(),o=t["*"],s=ML();return M.jsx(Eo,{sx:{display:"flex",alignItems:"center"},children:M.jsxs(SDn,{"aria-label":"breadcrumb",separator:M.jsx(ior,{sx:{fontSize:14,color:"text.secondary"}}),sx:{"& .MuiBreadcrumbs-separator":{margin:"0 6px"}},children:[t.projectName&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/`,u),label:t.projectName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"primary.100"}}}),t.packageName&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/${t.packageName}/`,u),label:t.packageName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"secondary.100"}}}),o&&M.jsx(SO,{onClick:u=>s(`/${t.projectName}/${t.packageName}/${o}`,u),label:o,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"0.875rem",cursor:"pointer","&:hover":{backgroundColor:"grey.200"}}})]})})}function MCr({logoHeader:t,endCap:o}){const s=GCe(),{projectName:u,packageName:d}=WO();return M.jsx(Rkn,{position:"sticky",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:M.jsxs(qLn,{sx:{justifyContent:"space-between"},children:[M.jsxs(ma,{direction:"row",spacing:2,alignItems:"center",children:[t||M.jsxs(Eo,{sx:{display:"flex",alignItems:"center",gap:1},children:[M.jsx(Eo,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:28,height:28}}),M.jsx(dr,{variant:"h5",sx:{color:"text.primary",fontWeight:700,letterSpacing:"-0.025em",cursor:"pointer"},onClick:()=>{s("/")},children:"Malloy Publisher"})]}),M.jsx(PCr,{})]}),M.jsxs(ma,{direction:"row",spacing:2,alignItems:"center",children:[!u||!d?!t&&M.jsxs(M.Fragment,{children:[M.jsx(Cc,{href:"https://docs.malloydata.dev/documentation/",children:"Malloy Docs"}),M.jsx(Cc,{href:"https://github.com/malloydata/publisher/blob/main/README.md",children:"Publisher Docs"}),M.jsx(Cc,{href:"/api-doc.html",children:"Publisher API"})]}):M.jsx(M.Fragment,{children:M.jsx(ICr,{})}),o]})]})})}function FCr({headerProps:t}){return M.jsxs(Eo,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[M.jsx(MCr,{...t}),M.jsx(kwe,{maxWidth:"xl",component:"main",sx:{flex:1,display:"flex",flexDirection:"column",py:2,gap:2},children:M.jsx(Eo,{sx:{flex:1},children:M.jsx(VCn,{})})})]})}function BCr(){const t=WO(),o=t["*"];return t.projectName?t.packageName?o?.endsWith(".malloy")?M.jsx(Coe,{projectName:t.projectName,packageName:t.packageName,children:M.jsx(mTr,{modelPath:o,hideEmbeddingIcons:!0})}):o?.endsWith(".malloynb")?M.jsx(Coe,{projectName:t.projectName,packageName:t.packageName,children:M.jsx(twt,{notebookPath:o,hideEmbeddingIcons:!0,expandResults:!1})}):M.jsx("div",{children:M.jsxs("h2",{children:["Unrecognized file type: ",o]})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function jCr(){const{projectName:t,packageName:o}=WO(),s=ML();return t?o?M.jsx(Coe,{projectName:t,packageName:o,children:M.jsx(aCr,{navigate:s})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function $Cr(){const t=ML(),{projectName:o}=WO();return o?M.jsx(_Cr,{projectName:o,children:M.jsx(TCr,{navigate:t})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}function UCr(){const t=Hgt();return console.error(t),M.jsx(kwe,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:M.jsxs(ma,{sx:{m:"auto",flexDirection:"column"},children:[M.jsx(Eo,{sx:{height:"300px"}}),M.jsx("img",{src:"/error.png"}),M.jsx(dr,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}function qCr(){const{projectName:t,packageName:o,notebookPath:s}=WO();return t?o?M.jsx(Coe,{projectName:t,packageName:o,children:M.jsx(Iwt,{notebookStorage:new nwt,userContext:{project:t,package:o},children:M.jsx(gCr,{notebookPath:s,hideEmbeddingIcons:!0},`${s}-${t}-${o}`)})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing package name"})}):M.jsx("div",{children:M.jsx("h2",{children:"Missing project name"})})}const _s={primary:{main:"#14b3cb",light:"#22d3ee",dark:"#0e7490",50:"#ecfeff",100:"#cffafe",500:"#14b3cb",600:"#0891b2",700:"#0e7490"},secondary:{main:"#fbbb04",light:"#fde047",dark:"#eab308",50:"#fefce8",100:"#fef3c7",500:"#fbbb04",600:"#eab308",700:"#ca8a04"},grey:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},success:{main:"#059669",light:"#10b981",dark:"#047857"},warning:{main:"#d97706",light:"#f59e0b",dark:"#b45309"},error:{main:"#dc2626",light:"#ef4444",dark:"#b91c1c"},info:{main:"#0891b2",light:"#06b6d4",dark:"#0e7490"}},zCr=Woe({palette:{mode:"light",primary:_s.primary,secondary:_s.secondary,grey:_s.grey,success:_s.success,warning:_s.warning,error:_s.error,info:_s.info,background:{default:"#ffffff",paper:"#ffffff"},text:{primary:_s.grey[900],secondary:_s.grey[600]},divider:_s.grey[200]},typography:{fontFamily:'"Inter", "Roboto", "Helvetica", "Arial", sans-serif',h1:{fontWeight:700,letterSpacing:"-0.025em"},h2:{fontWeight:700,letterSpacing:"-0.025em"},h3:{fontWeight:600,letterSpacing:"-0.025em"},h4:{fontWeight:600,letterSpacing:"-0.025em"},h5:{fontWeight:600,letterSpacing:"-0.025em"},h6:{fontWeight:600,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:4},components:{MuiCssBaseline:{styleOverrides:{body:{scrollbarWidth:"thin",scrollbarColor:`${_s.grey[300]} ${_s.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:_s.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:_s.grey[300],borderRadius:"4px","&:hover":{background:_s.grey[400]}},"&::-webkit-scrollbar-corner":{background:_s.grey[100]}},"*":{scrollbarWidth:"thin",scrollbarColor:`${_s.grey[300]} ${_s.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:_s.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:_s.grey[300],borderRadius:"4px","&:hover":{background:_s.grey[400]}},"&::-webkit-scrollbar-corner":{background:_s.grey[100]}}}},MuiButton:{styleOverrides:{root:{borderRadius:4,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:"rgba(0, 0, 0, 0.05)"}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:"1px solid rgba(0, 0, 0, 0.05)"}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:_s.grey[400]}}}},MuiDivider:{styleOverrides:{root:{margin:"4px 0",borderColor:_s.grey[200]}},defaultProps:{sx:{my:1}}}}}),HCr=(t="/",o,s,u)=>ywn([{path:t,element:M.jsx(sCr,{server:s,getAccessToken:u,children:M.jsxs(b4n,{theme:zCr,children:[M.jsx(KDn,{}),M.jsx(FCr,{headerProps:o})]})}),errorElement:M.jsx(UCr,{}),children:[{path:"",element:M.jsx(LCr,{})},{path:":projectName",element:M.jsx($Cr,{})},{path:":projectName/:packageName",element:M.jsx(jCr,{})},{path:":projectName/:packageName/*",element:M.jsx(BCr,{})},{path:":projectName/:packageName/scratchNotebook/:notebookPath",element:M.jsx(qCr,{})}]}]),GCr=`${window.location.protocol}//${window.location.host}/api/v0`,VCr=HCr("/",void 0,GCr);S3n.createRoot(document.getElementById("root")).render(M.jsx(z.StrictMode,{children:M.jsx(Own,{router:VCr})}));export{sFn as i,M as j,z as r};
|
package/dist/app/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
|
|
13
13
|
/>
|
|
14
14
|
<title>Malloy Publisher</title>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index--hbjs-yl.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-C127D7lT.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|