@malloy-publisher/app 0.0.79 → 0.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +5 -5
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -45,7 +45,7 @@ export default theme;`}function Su(e={},...t){const{breakpoints:n,mixins:r={},sp
|
|
|
45
45
|
\f\r "&'<=>\``.split("")],[`\0
|
|
46
46
|
\f\r "&'<=>\``.split(""),`\0
|
|
47
47
|
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function e2(e,t,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let a=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const s=[];let l;o.space==="html"&&e.tagName==="svg"&&(r.schema=Rr);const c=t2(r,e.properties),d=r.all(o.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=o,d&&(a=!1),(c||!i||!Yk(e,t,n))&&(s.push("<",e.tagName,c?" "+c:""),a&&(o.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(d),!a&&(!i||!Yd(e,t,n))&&s.push("</"+e.tagName+">"),s.join("")}function t2(e,t){const n=[];let r=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=n2(e,o,t[o]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function n2(e,t,n){const r=Qa(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let a=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=li(r.attribute,Object.assign({},e.settings.characterReferences,{subset:gs.name[o][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?ql:Wl)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(s=li(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:gs.unquoted[o][i]}))),s!==n&&(e.settings.quoteSmart&&al(n,a)>al(n,e.alternative)&&(a=e.alternative),s=a+li(n,Object.assign({},e.settings.characterReferences,{subset:(a==="'"?gs.single:gs.double)[o][i],attribute:!0}))+a),l+(s&&"="+s))}const r2=["<","&"];function X0(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:li(e.value,Object.assign({},r.settings.characterReferences,{subset:r2}))}function o2(e,t,n,r){return r.settings.allowDangerousHtml?e.value:X0(e,t,n,r)}function i2(e,t,n,r){return r.all(e)}const a2=Gl("type",{invalid:s2,unknown:l2,handlers:{comment:Nk,doctype:Pk,element:e2,raw:o2,root:i2,text:X0}});function s2(e){throw new Error("Expected node, not `"+e+"`")}function l2(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const c2={},u2={},d2=[];function h2(e,t){const n=c2,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:p2,all:f2,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||B0,characterReferences:n.characterReferences||u2,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Rr:vi,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function p2(e,t,n){return a2(e,t,n,this)}function f2(e){const t=[],n=e&&e.children||d2;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function m2(e){return Array.isArray(e)?e:[e]}function Vl(e,t=!1){const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let i=0;i<n.length;i+=2){const a=t?n[i]+(n[i+1]||""):n[i];o.push([a,r]),r+=n[i].length,r+=n[i+1]?.length||0}return o}function Kd(e){return!e||["plaintext","txt","text","plain"].includes(e)}function J0(e){return e==="ansi"||Kd(e)}function Qd(e){return e==="none"}function Z0(e){return Qd(e)}function ey(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const o of n)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function g2(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function y2(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,o)=>r-o);return n.length?e.map(r=>r.flatMap(o=>{const i=n.filter(a=>o.offset<a&&a<o.offset+o.content.length).map(a=>a-o.offset).sort((a,s)=>a-s);return i.length?g2(o,i):o})):e}async function ty(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function sl(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[o,i]of Object.entries(t?.colorReplacements||{}))typeof i=="string"?n[o]=i:o===r&&Object.assign(n,i);return n}function uo(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function ny(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&_r.Italic&&(t["font-style"]="italic"),e.fontStyle&_r.Bold&&(t["font-weight"]="bold"),e.fontStyle&_r.Underline&&(t["text-decoration"]="underline")),t}function b2(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function E2(e){const t=Vl(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=o,a=0;for(const s of t){if(i<s.length)break;i-=s.length,a++}return{line:a,character:i}}function r(o,i){let a=0;for(let s=0;s<o;s++)a+=t[s].length;return a+=i,a}return{lines:t,indexToPos:n,posToIndex:r}}class cn extends Error{constructor(t){super(t),this.name="ShikiError"}}const ry=new WeakMap;function Yl(e,t){ry.set(e,t)}function Pa(e){return ry.get(e)}class Si{constructor(...t){G(this,"_stacks",{});G(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,o]=t;this.lang=r,this._stacks={[o]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Si(Object.fromEntries(m2(n).map(r=>[r,Pu])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return df(this._stacks[this.theme])}getScopes(t=this.theme){return df(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function df(e){const t=[],n=new Set;function r(o){if(n.has(o))return;n.add(o);const i=o?.nameScopesList?.scopeName;i&&t.push(i),o.parent&&r(o.parent)}return r(e),t}function T2(e,t){if(!(e instanceof Si))throw new cn("Invalid grammar state");return e.getInternalStack(t)}function x2(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new cn(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...o.indexToPos(a),offset:a}}else{const s=o.lines[a.line];if(s===void 0)throw new cn(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${o.lines.length}`);if(a.character<0||a.character>s.length)throw new cn(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${s.length}`);return{...a,offset:o.posToIndex(a.line,a.character)}}};const o=E2(n.source),i=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));C2(i),e.set(n.meta,{decorations:i,converter:o,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const r=t(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return y2(n,r)},code(n){if(!this.options.decorations?.length)return;const r=t(this),o=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(o.length!==r.converter.lines.length)throw new cn(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(d,u,h,p){const g=o[d];let b="",T=-1,E=-1;if(u===0&&(T=0),h===0&&(E=0),h===Number.POSITIVE_INFINITY&&(E=g.children.length),T===-1||E===-1)for(let x=0;x<g.children.length;x++)b+=oy(g.children[x]),T===-1&&b.length===u&&(T=x+1),E===-1&&b.length===h&&(E=x+1);if(T===-1)throw new cn(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(E===-1)throw new cn(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const C=g.children.slice(T,E);if(!p.alwaysWrap&&C.length===g.children.length)s(g,p,"line");else if(!p.alwaysWrap&&C.length===1&&C[0].type==="element")s(C[0],p,"token");else{const x={type:"element",tagName:"span",properties:{},children:C};s(x,p,"wrapper"),g.children.splice(T,C.length,x)}}function a(d,u){o[d]=s(o[d],u,"line")}function s(d,u,h){const p=u.properties||{},g=u.transform||(b=>b);return d.tagName=u.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},u.properties?.class&&ey(d,u.properties.class),d=g(d,h)||d,d}const l=[],c=r.decorations.sort((d,u)=>u.start.offset-d.start.offset);for(const d of c){const{start:u,end:h}=d;if(u.line===h.line)i(u.line,u.character,h.character,d);else if(u.line<h.line){i(u.line,u.character,Number.POSITIVE_INFINITY,d);for(let p=u.line+1;p<h.line;p++)l.unshift(()=>a(p,d));i(h.line,0,h.character,d)}}l.forEach(d=>d())}}}function C2(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new cn(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const o=e[r],i=n.start.offset<o.start.offset&&o.start.offset<n.end.offset,a=n.start.offset<o.end.offset&&o.end.offset<n.end.offset,s=o.start.offset<n.start.offset&&n.start.offset<o.end.offset,l=o.start.offset<n.end.offset&&n.end.offset<o.end.offset;if(i||a||s||l){if(a&&a||s&&l)continue;throw new cn(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function oy(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(oy).join(""):""}const v2=[x2()];function ll(e){return[...e.transformers||[],...v2]}var ho=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Fc={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function S2(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const r=e.indexOf("m",n);return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function hf(e,t){let n=1;const r=e[t+n++];let o;if(r==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(a=>Number.parseInt(a));i.length===3&&!i.some(a=>Number.isNaN(a))&&(o={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(o={type:"table",index:Number(i)})}return[n,o]}function A2(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=Number.parseInt(r);if(!Number.isNaN(o))if(o===0)t.push({type:"resetAll"});else if(o<=9)Fc[o]&&t.push({type:"setDecoration",value:Fc[o]});else if(o<=29){const i=Fc[o-20];i&&t.push({type:"resetDecoration",value:i})}else if(o<=37)t.push({type:"setForegroundColor",value:{type:"named",name:ho[o-30]}});else if(o===38){const[i,a]=hf(e,n);a&&t.push({type:"setForegroundColor",value:a}),n+=i}else if(o===39)t.push({type:"resetForegroundColor"});else if(o<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:ho[o-40]}});else if(o===48){const[i,a]=hf(e,n);a&&t.push({type:"setBackgroundColor",value:a}),n+=i}else o===49?t.push({type:"resetBackgroundColor"}):o>=90&&o<=97?t.push({type:"setForegroundColor",value:{type:"named",name:ho[o-90+8]}}):o>=100&&o<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:ho[o-100+8]}})}return t}function k2(){let e=null,t=null,n=new Set;return{parse(r){const o=[];let i=0;do{const a=S2(r,i),s=a.sequence?r.substring(i,a.startPosition):r.substring(i);if(s.length>0&&o.push({value:s,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const l=A2(a.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=a.position}while(i<r.length);return o}}}var _2={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 D2(e=_2){function t(s){return e[s]}function n(s){return`#${s.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(){if(r)return r;r=[];for(let c=0;c<ho.length;c++)r.push(t(ho[c]));let s=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let u=0;u<6;u++)r.push(n([s[c],s[d],s[u]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(s){return o()[s]}function a(s){switch(s.type){case"named":return t(s.name);case"rgb":return n(s.rgb);case"table":return i(s.index)}}return{value:a}}function I2(e,t,n){const r=sl(e,n),o=Vl(t),i=D2(Object.fromEntries(ho.map(s=>[s,e.colors?.[`terminal.ansi${s[0].toUpperCase()}${s.substring(1)}`]]))),a=k2();return o.map(s=>a.parse(s[0]).map(l=>{let c,d;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,d=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,d=l.background?i.value(l.background):void 0),c=uo(c,r),d=uo(d,r),l.decorations.has("dim")&&(c=w2(c));let u=_r.None;return l.decorations.has("bold")&&(u|=_r.Bold),l.decorations.has("italic")&&(u|=_r.Italic),l.decorations.has("underline")&&(u|=_r.Underline),{content:l.value,offset:s[1],color:c,bgColor:d,fontStyle:u}}))}function w2(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const r=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${r}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(r=>`${r}${r}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Xd(e,t,n={}){const{lang:r="text",theme:o=e.getLoadedThemes()[0]}=n;if(Kd(r)||Qd(o))return Vl(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:a}=e.setTheme(o);if(r==="ansi")return I2(i,t,n);const s=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new wr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(i.name))throw new wr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return P2(t,s,i,a,n)}function N2(...e){if(e.length===2)return Pa(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:i=t.getLoadedThemes()[0]}=r;if(Kd(o)||Qd(i))throw new wr("Plain language does not have grammar state");if(o==="ansi")throw new wr("ANSI language does not have grammar state");const{theme:a,colorMap:s}=t.setTheme(i),l=t.getLanguage(o);return new Si(cl(n,l,a,s,r).stateStack,l.name,a.name)}function P2(e,t,n,r,o){const i=cl(e,t,n,r,o),a=new Si(cl(e,t,n,r,o).stateStack,t.name,n.name);return Yl(i.tokens,a),i.tokens}function cl(e,t,n,r,o){const i=sl(n,o),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:s=500}=o,l=Vl(e);let c=o.grammarState?T2(o.grammarState,n.name)??Pu:o.grammarContextCode!=null?cl(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Pu,d=[];const u=[];for(let h=0,p=l.length;h<p;h++){const[g,b]=l[h];if(g===""){d=[],u.push([]);continue}if(a>0&&g.length>=a){d=[],u.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let T,E,C;o.includeExplanation&&(T=t.tokenizeLine(g,c),E=T.tokens,C=0);const x=t.tokenizeLine2(g,c,s),k=x.tokens.length/2;for(let w=0;w<k;w++){const S=x.tokens[2*w],B=w+1<k?x.tokens[2*w+2]:g.length;if(S===B)continue;const W=x.tokens[2*w+1],U=uo(r[fi.getForeground(W)],i),y=fi.getFontStyle(W),R={content:g.substring(S,B),offset:b+S,color:U,fontStyle:y};if(o.includeExplanation){const F=[];if(o.includeExplanation!=="scopeName")for(const z of n.settings){let X;switch(typeof z.scope){case"string":X=z.scope.split(/,/).map(Z=>Z.trim());break;case"object":X=z.scope;break;default:continue}F.push({settings:z,selectors:X.map(Z=>Z.split(/ /))})}R.explanation=[];let M=0;for(;S+M<B;){const z=E[C],X=g.substring(z.startIndex,z.endIndex);M+=X.length,R.explanation.push({content:X,scopes:o.includeExplanation==="scopeName"?R2(z.scopes):L2(F,z.scopes)}),C+=1}}d.push(R)}u.push(d),d=[],c=x.ruleStack}return{tokens:u,stateStack:c}}function R2(e){return e.map(t=>({scopeName:t}))}function L2(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const i=t[r];n[r]={scopeName:i,themeMatches:M2(e,i,t.slice(0,r))}}return n}function pf(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function O2(e,t,n){if(!pf(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)pf(e[r],n[o])&&(r-=1),o-=1;return r===-1}function M2(e,t,n){const r=[];for(const{selectors:o,settings:i}of e)for(const a of o)if(O2(a,t,n)){r.push(i);break}return r}function iy(e,t,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=r.map(l=>{const c=Xd(e,t,{...n,theme:l.theme}),d=Pa(c),u=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:u}}),i=F2(...o.map(l=>l.tokens)),a=i[0].map((l,c)=>l.map((d,u)=>{const h={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=d.explanation),i.forEach((p,g)=>{const{content:b,explanation:T,offset:E,...C}=p[c][u];h.variants[r[g].color]=C}),h})),s=o[0].state?new Si(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return s&&Yl(a,s),a}function F2(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const a=o.map(()=>0),s=o.map(l=>l[0]);for(;s.every(l=>l);){const l=Math.min(...s.map(c=>c.content.length));for(let c=0;c<n;c++){const d=s[c];d.content.length===l?(i[c].push(d),a[c]+=1,s[c]=o[c][a[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),s[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function ul(e,t,n){let r,o,i,a,s,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-"}=n,u=Object.entries(n.themes).filter(T=>T[1]).map(T=>({color:T[0],theme:T[1]})).sort((T,E)=>T.color===c?-1:E.color===c?1:0);if(u.length===0)throw new wr("`themes` option must not be empty");const h=iy(e,t,n);if(l=Pa(h),c&&!u.find(T=>T.color===c))throw new wr(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=u.map(T=>e.getTheme(T.theme)),g=u.map(T=>T.color);i=h.map(T=>T.map(E=>B2(E,g,d,c))),l&&Yl(i,l);const b=u.map(T=>sl(T.theme,n));o=u.map((T,E)=>(E===0&&c?"":`${d+T.color}:`)+(uo(p[E].fg,b[E])||"inherit")).join(";"),r=u.map((T,E)=>(E===0&&c?"":`${d+T.color}-bg:`)+(uo(p[E].bg,b[E])||"inherit")).join(";"),a=`shiki-themes ${p.map(T=>T.name).join(" ")}`,s=c?void 0:[o,r].join(";")}else if("theme"in n){const c=sl(n.theme,n);i=Xd(e,t,n);const d=e.getTheme(n.theme);r=uo(d.bg,c),o=uo(d.fg,c),a=d.name,l=Pa(i)}else throw new wr("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:r,themeName:a,rootStyle:s,grammarState:l}}function B2(e,t,n,r){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>ny(e.variants[l])),a=new Set(i.flatMap(l=>Object.keys(l))),s={};return i.forEach((l,c)=>{for(const d of a){const u=l[d]||"inherit";if(c===0&&r)s[d]=u;else{const h=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[c]+(d==="color"?"":h);s[p]=u}}}),o.htmlStyle=s,o}function dl(e,t,n,r={meta:{},options:n,codeToHast:(o,i)=>dl(e,o,i),codeToTokens:(o,i)=>ul(e,o,i)}){let o=t;for(const p of ll(n))o=p.preprocess?.call(r,o,n)||o;let{tokens:i,fg:a,bg:s,themeName:l,rootStyle:c,grammarState:d}=ul(e,o,n);const{mergeWhitespaces:u=!0}=n;u===!0?i=H2(i):u==="never"&&(i=U2(i));const h={...r,get source(){return o}};for(const p of ll(n))i=p.tokens?.call(h,i)||i;return j2(i,{...n,fg:a,bg:s,themeName:l,rootStyle:c},h,d)}function j2(e,t,n,r=Pa(e)){const o=ll(t),i=[],a={type:"root",children:[]},{structure:s="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([g])=>!g.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const u=[],h={...n,structure:s,addClassToHast:ey,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return c},get code(){return d},get lines(){return u}};if(e.forEach((g,b)=>{b&&(s==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):s==="classic"&&i.push({type:"text",value:`
|
|
48
|
-
`}));let T={type:"element",tagName:"span",properties:{class:"line"},children:[]},E=0;for(const C of g){let x={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const k=b2(C.htmlStyle||ny(C));k&&(x.properties.style=k);for(const w of o)x=w?.span?.call(h,x,b+1,E,T,C)||x;s==="inline"?a.children.push(x):s==="classic"&&T.children.push(x),E+=C.content.length}if(s==="classic"){for(const C of o)T=C?.line?.call(h,T,b+1)||T;u.push(T),i.push(T)}}),s==="classic"){for(const g of o)d=g?.code?.call(h,d)||d;c.children.push(d);for(const g of o)c=g?.pre?.call(h,c)||c;a.children.push(c)}let p=a;for(const g of o)p=g?.root?.call(h,p)||p;return r&&Yl(p,r),p}function H2(e){return e.map(t=>{const n=[];let r="",o=0;return t.forEach((i,a)=>{const s=!(i.fontStyle&&i.fontStyle&_r.Underline);s&&i.content.match(/^\s+$/)&&t[a+1]?(o||(o=i.offset),r+=i.content):r?(s?n.push({...i,offset:o,content:r+i.content}):n.push({content:r,offset:o},i),o=0,r=""):n.push(i)}),n})}function U2(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,o,i,a]=r;if(!o&&!a)return n;const s=[{...n,offset:n.offset+o.length,content:i}];return o&&s.unshift({content:o,offset:n.offset}),a&&s.push({content:a,offset:n.offset+o.length+i.length}),s}))}function z2(e,t,n){const r={meta:{},options:n,codeToHast:(i,a)=>dl(e,i,a),codeToTokens:(i,a)=>ul(e,i,a)};let o=h2(dl(e,t,n,r));for(const i of ll(n))o=i.postprocess?.call(r,o,n)||o;return o}const ff={light:"#333333",dark:"#bbbbbb"},mf={light:"#fffffe",dark:"#1e1e1e"},gf="__shiki_resolved";function Jd(e){if(e?.[gf])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const s=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;s?.settings?.foreground&&(r=s.settings.foreground),s?.settings?.background&&(n=s.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?ff.light:ff.dark),n||(n=t.type==="light"?mf.light:mf.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function a(s){if(i.has(s))return i.get(s);o+=1;const l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?a(s):(i.set(s,l),l)}t.settings=t.settings.map(s=>{const l=s.settings?.foreground&&!s.settings.foreground.startsWith("#"),c=s.settings?.background&&!s.settings.background.startsWith("#");if(!l&&!c)return s;const d={...s,settings:{...s.settings}};if(l){const u=a(s.settings.foreground);t.colorReplacements[u]=s.settings.foreground,d.settings.foreground=u}if(c){const u=a(s.settings.background);t.colorReplacements[u]=s.settings.background,d.settings.background=u}return d});for(const s of Object.keys(t.colors||{}))if((s==="editor.foreground"||s==="editor.background"||s.startsWith("terminal.ansi"))&&!t.colors[s]?.startsWith("#")){const l=a(t.colors[s]);t.colorReplacements[l]=t.colors[s],t.colors[s]=l}return Object.defineProperty(t,gf,{enumerable:!1,writable:!1,value:!0}),t}async function ay(e){return Array.from(new Set((await Promise.all(e.filter(t=>!J0(t)).map(async t=>await ty(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function sy(e){return(await Promise.all(e.map(async t=>Z0(t)?null:Jd(await ty(t))))).filter(t=>!!t)}class $2 extends rk{constructor(n,r,o,i={}){super(n);G(this,"_resolvedThemes",new Map);G(this,"_resolvedGrammars",new Map);G(this,"_langMap",new Map);G(this,"_langGraph",new Map);G(this,"_textmateThemeCache",new WeakMap);G(this,"_loadedThemesCache",null);G(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=o,this._alias=i,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=Jd(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=tl.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){if(this._alias[n]){const r=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],r.has(n))throw new cn(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(a=>a.embeddedLangsLazy?.includes(n.name)));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(a=>{this._alias[a]=n.name}),this._loadedLanguagesCache=null,r.size)for(const a of r)this._resolvedGrammars.delete(a.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(a.scopeName),this._syncRegistry?._grammars?.delete(a.scopeName),this.loadLanguage(this._langMap.get(a.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),o=r.filter(([i,a])=>!a);if(o.length){const i=r.filter(([a,s])=>s&&s.embeddedLangs?.some(l=>o.map(([c])=>c).includes(l))).filter(a=>!o.includes(a));throw new cn(`Missing languages ${o.map(([a])=>`\`${a}\``).join(", ")}, required by ${i.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[i,a]of r)this._resolver.addLanguage(a);for(const[i,a]of r)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class G2{constructor(t,n){G(this,"_langs",new Map);G(this,"_scopeToLang",new Map);G(this,"_injections",new Map);G(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let $i=0;function q2(e){$i+=1,e.warnings!==!1&&$i>=10&&$i%10===0&&console.warn(`[Shiki] ${$i} 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 t=!1;if(!e.engine)throw new cn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Jd),o=new G2(e.engine,n),i=new $2(o,r,n,e.langAlias);let a;function s(C){T();const x=i.getGrammar(typeof C=="string"?C:C.name);if(!x)throw new cn(`Language \`${C}\` not found, you may need to load it first`);return x}function l(C){if(C==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};T();const x=i.getTheme(C);if(!x)throw new cn(`Theme \`${C}\` not found, you may need to load it first`);return x}function c(C){T();const x=l(C);a!==C&&(i.setTheme(x),a=C);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return T(),i.getLoadedThemes()}function u(){return T(),i.getLoadedLanguages()}function h(...C){T(),i.loadLanguages(C.flat(1))}async function p(...C){return h(await ay(C))}function g(...C){T();for(const x of C.flat(1))i.loadTheme(x)}async function b(...C){return T(),g(await sy(C))}function T(){if(t)throw new cn("Shiki instance has been disposed")}function E(){t||(t=!0,i.dispose(),$i-=1)}return{setTheme:c,getTheme:l,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:u,loadLanguage:p,loadLanguageSync:h,loadTheme:b,loadThemeSync:g,dispose:E,[Symbol.dispose]:E}}async function W2(e={}){e.loadWasm;const[t,n,r]=await Promise.all([sy(e.themes||[]),ay(e.langs||[]),e.engine||C0(e.loadWasm||yA())]);return q2({...e,themes:t,langs:n,engine:r})}async function V2(e={}){const t=await W2(e);return{getLastGrammarState:(...n)=>N2(t,...n),codeToTokensBase:(n,r)=>Xd(t,n,r),codeToTokensWithThemes:(n,r)=>iy(t,n,r),codeToTokens:(n,r)=>ul(t,n,r),codeToHast:(n,r)=>dl(t,n,r),codeToHtml:(n,r)=>z2(t,n,r),...t,getInternalContext:()=>t}}function Y2(e,t,n){let r,o,i;{const s=e;r=s.langs,o=s.themes,i=s.engine}async function a(s){function l(p){if(typeof p=="string"){if(J0(p))return[];const g=r[p];if(!g)throw new wr(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function c(p){if(Z0(p))return"none";if(typeof p=="string"){const g=o[p];if(!g)throw new wr(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(s.themes??[]).map(p=>c(p)),u=(s.langs??[]).map(p=>l(p)),h=await V2({engine:s.engine??i(),...s,themes:d,langs:u});return{...h,loadLanguage(...p){return h.loadLanguage(...p.map(l))},loadTheme(...p){return h.loadTheme(...p.map(c))}}}return a}const K2=Y2({langs:XS,themes:ZS,engine:()=>C0(Promise.resolve().then(()=>require("./wasm-DQxwEHae-Dw4u1m6u.cjs")))}),Bc={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"}]}}},Q2={...Bc,patterns:[...Bc.patterns,{include:"#docvar"}],repository:{...Bc.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},X2={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"}]}}},ly="catppuccin-latte",J2=K2({themes:[ly],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Q2},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...X2}]});async function Co(e,t){return(await J2).codeToHtml(e,{lang:t,theme:ly})}const $t=v.styled(v.Card)({display:"flex",flexDirection:"column",height:"100%"}),Dn=v.styled(v.CardContent)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),Kl=v.styled(v.CardMedia)({padding:"10px"}),cy=v.styled("div")({display:"flex",flexDirection:"column",height:"100%"});v.styled("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const uy=v.styled("div")({display:"flex",height:"75vh",width:"100%",overflowY:"auto"});v.styled("div")({position:"relative",height:"100%",flex:"0 0 auto"});const Z2=ct([f.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"),f.jsx("path",{d:"M7 12h2v5H7zm8-5h2v10h-2zm-4 7h2v3h-2zm0-4h2v2h-2z"},"1")]),dy=O.createContext(void 0),hl=({projectName:e,packageName:t,versionId:n,children:r})=>f.jsx(dy.Provider,{value:{projectName:e,packageName:t,versionId:n},children:r});function yn(e=!0){const t=O.useContext(dy);if(!t&&e)throw new Error("usePackage must be used within a PackageProvider");return t}function In({error:e,context:t}){const n=e.data?.message||"Unknown Error";return f.jsxs(f.Fragment,{children:[t&&f.jsx(v.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),f.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function Wn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:a="body2"}){const s=f.jsxs(v.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[f.jsx(v.CircularProgress,{size:t,color:n,thickness:r}),e&&f.jsx(v.Typography,{variant:a,color:"text.secondary",children:e})]});return o?f.jsx(v.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const hy=new bd.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),Zd=async(e,t)=>{const n=t?await t():void 0;return{baseURL:e,withCredentials:!n,headers:{Authorization:n&&`Bearer ${n}`}}};function wn(e){const{server:t,getAccessToken:n}=ch(),r={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{const o=await Zd(t,n);return await e.queryFn(o)}catch(o){if(o&&typeof o=="object"&&"response"in o){const i=o;if(i.response?.data){const a=new Error(i.response.data.message||i.message);throw a.status=i.response.status,a.data=i.response.data,a}}throw o}},retry:!1,throwOnError:!1};return bd.useQuery(r,hy)}function e_(e){const{server:t,getAccessToken:n}=ch(),r={...e,mutationFn:async o=>{try{const i=await Zd(t,n);return await e.mutationFn(o,i)}catch(i){if(i&&typeof i=="object"&&"response"in i){const a=i;if(a.response?.data){const s=new Error(a.response.data.message||a.message);throw s.status=a.response.status,s.data=a.response.data,s}}throw i}},retry:!1,throwOnError:!1};return bd.useMutation(r,hy)}const t_=O.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-BAZuT25g-D9KeGh71.cjs"))),n_=new Gd(new Jt);function py(e){const{optionalProjectName:t,optionalPackageName:n}=e;if(!t||!n)throw new Error("Project and Package name must be provided for query embedding.");return JSON.stringify({...e})}function r_({modelPath:e,query:t,sourceName:n,queryName:r,optionalProjectName:o,optionalPackageName:i,optionalVersionId:a}){const s=yn(!1),l=o||s?.projectName,c=i||s?.packageName,d=a||s?.versionId;if(!l||!c)throw new Error("No project or package name provided. Must be set in props or via PackageProvider");const{data:u,isSuccess:h,isError:p,error:g}=wn({queryKey:["queryResult",l,c,e,d,t,n,r],queryFn:b=>n_.executeQuery(l,c,e,t,n,r,d,b)});return f.jsxs(f.Fragment,{children:[!h&&!p&&f.jsx(Wn,{text:"Fetching Query Results..."}),h&&f.jsx(O.Suspense,{fallback:f.jsx("div",{children:"Loading..."}),children:f.jsx(t_,{result:u.data.result})}),p&&f.jsx(In,{context:`${l} > ${c} > ${e}`,error:g})]})}const fy=ct(f.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"})),o_=O.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-BAZuT25g-D9KeGh71.cjs")));function my({result:e,minHeight:t,maxHeight:n}){const[r,o]=O.useState(!1),[i,a]=O.useState(0),[s,l]=O.useState(!1),c=O.useRef(null),d=O.useRef(null),[u,h]=O.useState(void 0),[p,g]=O.useState(!1),b=O.useCallback(()=>{const k=r;o(!r),k&&d.current&&setTimeout(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)},[r]),T=O.useCallback(k=>{a(k)},[]);if(O.useEffect(()=>{if(p){l(!0);return}if(i===0){l(!1);return}const k=t-20,w=i>k;i<k&&h(i+20),l(w)},[i,p,t]),!e)return null;const E=f.jsx(Wn,{text:"Loading...",centered:!0,size:32}),C=p?r?n-40:t-40:void 0,x=u?{minHeight:`${u}px`,height:"100%"}:{height:"100%"};return f.jsx(f.Fragment,{children:f.jsxs(v.Box,{ref:d,sx:{position:"relative",minHeight:`${t}px`,maxHeight:`${r?n:t}px`,border:"0px",borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",...x},children:[f.jsx(v.Box,{ref:c,sx:{flex:1,overflow:r?"auto":"hidden",p:0,pb:s?"40px":1},children:e&&f.jsx(O.Suspense,{fallback:E,children:f.jsx(o_,{result:e,height:C,isFillElement:k=>{g(k)},onSizeChange:T})})||E}),s&&f.jsx(v.Box,{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:f.jsx(v.IconButton,{size:"small",onClick:b,sx:{color:"text.secondary","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},title:r?"Collapse to original size":"Expand to full size",children:r?f.jsx(Sa.ExpandLess,{sx:{fontSize:30}}):f.jsx(Sa.ExpandMore,{sx:{fontSize:30}})})})]})})}const i_=`
|
|
48
|
+
`}));let T={type:"element",tagName:"span",properties:{class:"line"},children:[]},E=0;for(const C of g){let x={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const k=b2(C.htmlStyle||ny(C));k&&(x.properties.style=k);for(const w of o)x=w?.span?.call(h,x,b+1,E,T,C)||x;s==="inline"?a.children.push(x):s==="classic"&&T.children.push(x),E+=C.content.length}if(s==="classic"){for(const C of o)T=C?.line?.call(h,T,b+1)||T;u.push(T),i.push(T)}}),s==="classic"){for(const g of o)d=g?.code?.call(h,d)||d;c.children.push(d);for(const g of o)c=g?.pre?.call(h,c)||c;a.children.push(c)}let p=a;for(const g of o)p=g?.root?.call(h,p)||p;return r&&Yl(p,r),p}function H2(e){return e.map(t=>{const n=[];let r="",o=0;return t.forEach((i,a)=>{const s=!(i.fontStyle&&i.fontStyle&_r.Underline);s&&i.content.match(/^\s+$/)&&t[a+1]?(o||(o=i.offset),r+=i.content):r?(s?n.push({...i,offset:o,content:r+i.content}):n.push({content:r,offset:o},i),o=0,r=""):n.push(i)}),n})}function U2(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,o,i,a]=r;if(!o&&!a)return n;const s=[{...n,offset:n.offset+o.length,content:i}];return o&&s.unshift({content:o,offset:n.offset}),a&&s.push({content:a,offset:n.offset+o.length+i.length}),s}))}function z2(e,t,n){const r={meta:{},options:n,codeToHast:(i,a)=>dl(e,i,a),codeToTokens:(i,a)=>ul(e,i,a)};let o=h2(dl(e,t,n,r));for(const i of ll(n))o=i.postprocess?.call(r,o,n)||o;return o}const ff={light:"#333333",dark:"#bbbbbb"},mf={light:"#fffffe",dark:"#1e1e1e"},gf="__shiki_resolved";function Jd(e){if(e?.[gf])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const s=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;s?.settings?.foreground&&(r=s.settings.foreground),s?.settings?.background&&(n=s.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?ff.light:ff.dark),n||(n=t.type==="light"?mf.light:mf.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function a(s){if(i.has(s))return i.get(s);o+=1;const l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?a(s):(i.set(s,l),l)}t.settings=t.settings.map(s=>{const l=s.settings?.foreground&&!s.settings.foreground.startsWith("#"),c=s.settings?.background&&!s.settings.background.startsWith("#");if(!l&&!c)return s;const d={...s,settings:{...s.settings}};if(l){const u=a(s.settings.foreground);t.colorReplacements[u]=s.settings.foreground,d.settings.foreground=u}if(c){const u=a(s.settings.background);t.colorReplacements[u]=s.settings.background,d.settings.background=u}return d});for(const s of Object.keys(t.colors||{}))if((s==="editor.foreground"||s==="editor.background"||s.startsWith("terminal.ansi"))&&!t.colors[s]?.startsWith("#")){const l=a(t.colors[s]);t.colorReplacements[l]=t.colors[s],t.colors[s]=l}return Object.defineProperty(t,gf,{enumerable:!1,writable:!1,value:!0}),t}async function ay(e){return Array.from(new Set((await Promise.all(e.filter(t=>!J0(t)).map(async t=>await ty(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function sy(e){return(await Promise.all(e.map(async t=>Z0(t)?null:Jd(await ty(t))))).filter(t=>!!t)}class $2 extends rk{constructor(n,r,o,i={}){super(n);G(this,"_resolvedThemes",new Map);G(this,"_resolvedGrammars",new Map);G(this,"_langMap",new Map);G(this,"_langGraph",new Map);G(this,"_textmateThemeCache",new WeakMap);G(this,"_loadedThemesCache",null);G(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=o,this._alias=i,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=Jd(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=tl.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){if(this._alias[n]){const r=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],r.has(n))throw new cn(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(a=>a.embeddedLangsLazy?.includes(n.name)));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(a=>{this._alias[a]=n.name}),this._loadedLanguagesCache=null,r.size)for(const a of r)this._resolvedGrammars.delete(a.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(a.scopeName),this._syncRegistry?._grammars?.delete(a.scopeName),this.loadLanguage(this._langMap.get(a.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),o=r.filter(([i,a])=>!a);if(o.length){const i=r.filter(([a,s])=>s&&s.embeddedLangs?.some(l=>o.map(([c])=>c).includes(l))).filter(a=>!o.includes(a));throw new cn(`Missing languages ${o.map(([a])=>`\`${a}\``).join(", ")}, required by ${i.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[i,a]of r)this._resolver.addLanguage(a);for(const[i,a]of r)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class G2{constructor(t,n){G(this,"_langs",new Map);G(this,"_scopeToLang",new Map);G(this,"_injections",new Map);G(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let $i=0;function q2(e){$i+=1,e.warnings!==!1&&$i>=10&&$i%10===0&&console.warn(`[Shiki] ${$i} 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 t=!1;if(!e.engine)throw new cn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Jd),o=new G2(e.engine,n),i=new $2(o,r,n,e.langAlias);let a;function s(C){T();const x=i.getGrammar(typeof C=="string"?C:C.name);if(!x)throw new cn(`Language \`${C}\` not found, you may need to load it first`);return x}function l(C){if(C==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};T();const x=i.getTheme(C);if(!x)throw new cn(`Theme \`${C}\` not found, you may need to load it first`);return x}function c(C){T();const x=l(C);a!==C&&(i.setTheme(x),a=C);const k=i.getColorMap();return{theme:x,colorMap:k}}function d(){return T(),i.getLoadedThemes()}function u(){return T(),i.getLoadedLanguages()}function h(...C){T(),i.loadLanguages(C.flat(1))}async function p(...C){return h(await ay(C))}function g(...C){T();for(const x of C.flat(1))i.loadTheme(x)}async function b(...C){return T(),g(await sy(C))}function T(){if(t)throw new cn("Shiki instance has been disposed")}function E(){t||(t=!0,i.dispose(),$i-=1)}return{setTheme:c,getTheme:l,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:u,loadLanguage:p,loadLanguageSync:h,loadTheme:b,loadThemeSync:g,dispose:E,[Symbol.dispose]:E}}async function W2(e={}){e.loadWasm;const[t,n,r]=await Promise.all([sy(e.themes||[]),ay(e.langs||[]),e.engine||C0(e.loadWasm||yA())]);return q2({...e,themes:t,langs:n,engine:r})}async function V2(e={}){const t=await W2(e);return{getLastGrammarState:(...n)=>N2(t,...n),codeToTokensBase:(n,r)=>Xd(t,n,r),codeToTokensWithThemes:(n,r)=>iy(t,n,r),codeToTokens:(n,r)=>ul(t,n,r),codeToHast:(n,r)=>dl(t,n,r),codeToHtml:(n,r)=>z2(t,n,r),...t,getInternalContext:()=>t}}function Y2(e,t,n){let r,o,i;{const s=e;r=s.langs,o=s.themes,i=s.engine}async function a(s){function l(p){if(typeof p=="string"){if(J0(p))return[];const g=r[p];if(!g)throw new wr(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function c(p){if(Z0(p))return"none";if(typeof p=="string"){const g=o[p];if(!g)throw new wr(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(s.themes??[]).map(p=>c(p)),u=(s.langs??[]).map(p=>l(p)),h=await V2({engine:s.engine??i(),...s,themes:d,langs:u});return{...h,loadLanguage(...p){return h.loadLanguage(...p.map(l))},loadTheme(...p){return h.loadTheme(...p.map(c))}}}return a}const K2=Y2({langs:XS,themes:ZS,engine:()=>C0(Promise.resolve().then(()=>require("./wasm-DQxwEHae-Dw4u1m6u.cjs")))}),Bc={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"}]}}},Q2={...Bc,patterns:[...Bc.patterns,{include:"#docvar"}],repository:{...Bc.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},X2={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"}]}}},ly="catppuccin-latte",J2=K2({themes:[ly],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Q2},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...X2}]});async function Co(e,t){return(await J2).codeToHtml(e,{lang:t,theme:ly})}const $t=v.styled(v.Card)({display:"flex",flexDirection:"column",height:"100%"}),Dn=v.styled(v.CardContent)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),Kl=v.styled(v.CardMedia)({padding:"10px"}),cy=v.styled("div")({display:"flex",flexDirection:"column",height:"100%"});v.styled("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const uy=v.styled("div")({display:"flex",height:"75vh",width:"100%",overflowY:"auto"});v.styled("div")({position:"relative",height:"100%",flex:"0 0 auto"});const Z2=ct([f.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"),f.jsx("path",{d:"M7 12h2v5H7zm8-5h2v10h-2zm-4 7h2v3h-2zm0-4h2v2h-2z"},"1")]),dy=O.createContext(void 0),hl=({projectName:e,packageName:t,versionId:n,children:r})=>f.jsx(dy.Provider,{value:{projectName:e,packageName:t,versionId:n},children:r});function yn(e=!0){const t=O.useContext(dy);if(!t&&e)throw new Error("usePackage must be used within a PackageProvider");return t}function In({error:e,context:t}){const n=e.data?.message||"Unknown Error";return f.jsxs(f.Fragment,{children:[t&&f.jsx(v.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),f.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function Wn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:a="body2"}){const s=f.jsxs(v.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[f.jsx(v.CircularProgress,{size:t,color:n,thickness:r}),e&&f.jsx(v.Typography,{variant:a,color:"text.secondary",children:e})]});return o?f.jsx(v.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const hy=new bd.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),Zd=async(e,t)=>{const n=t?await t():void 0,r=n?{Authorization:`Bearer ${n}`}:{};return{baseURL:e,withCredentials:!!n,headers:r}};function wn(e){const{server:t,getAccessToken:n}=ch(),r={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{const o=await Zd(t,n);return await e.queryFn(o)}catch(o){if(o&&typeof o=="object"&&"response"in o){const i=o;if(i.response?.data){const a=new Error(i.response.data.message||i.message);throw a.status=i.response.status,a.data=i.response.data,a}}throw o}},retry:!1,throwOnError:!1};return bd.useQuery(r,hy)}function e_(e){const{server:t,getAccessToken:n}=ch(),r={...e,mutationFn:async o=>{try{const i=await Zd(t,n);return await e.mutationFn(o,i)}catch(i){if(i&&typeof i=="object"&&"response"in i){const a=i;if(a.response?.data){const s=new Error(a.response.data.message||a.message);throw s.status=a.response.status,s.data=a.response.data,s}}throw i}},retry:!1,throwOnError:!1};return bd.useMutation(r,hy)}const t_=O.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-BAZuT25g-D9KeGh71.cjs"))),n_=new Gd(new Jt);function py(e){const{optionalProjectName:t,optionalPackageName:n}=e;if(!t||!n)throw new Error("Project and Package name must be provided for query embedding.");return JSON.stringify({...e})}function r_({modelPath:e,query:t,sourceName:n,queryName:r,optionalProjectName:o,optionalPackageName:i,optionalVersionId:a}){const s=yn(!1),l=o||s?.projectName,c=i||s?.packageName,d=a||s?.versionId;if(!l||!c)throw new Error("No project or package name provided. Must be set in props or via PackageProvider");const{data:u,isSuccess:h,isError:p,error:g}=wn({queryKey:["queryResult",l,c,e,d,t,n,r],queryFn:b=>n_.executeQuery(l,c,e,t,n,r,d,b)});return f.jsxs(f.Fragment,{children:[!h&&!p&&f.jsx(Wn,{text:"Fetching Query Results..."}),h&&f.jsx(O.Suspense,{fallback:f.jsx("div",{children:"Loading..."}),children:f.jsx(t_,{result:u.data.result})}),p&&f.jsx(In,{context:`${l} > ${c} > ${e}`,error:g})]})}const fy=ct(f.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"})),o_=O.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-BAZuT25g-D9KeGh71.cjs")));function my({result:e,minHeight:t,maxHeight:n}){const[r,o]=O.useState(!1),[i,a]=O.useState(0),[s,l]=O.useState(!1),c=O.useRef(null),d=O.useRef(null),[u,h]=O.useState(void 0),[p,g]=O.useState(!1),b=O.useCallback(()=>{const k=r;o(!r),k&&d.current&&setTimeout(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)},[r]),T=O.useCallback(k=>{a(k)},[]);if(O.useEffect(()=>{if(p){l(!0);return}if(i===0){l(!1);return}const k=t-20,w=i>k;i<k&&h(i+20),l(w)},[i,p,t]),!e)return null;const E=f.jsx(Wn,{text:"Loading...",centered:!0,size:32}),C=p?r?n-40:t-40:void 0,x=u?{minHeight:`${u}px`,height:"100%"}:{height:"100%"};return f.jsx(f.Fragment,{children:f.jsxs(v.Box,{ref:d,sx:{position:"relative",minHeight:`${t}px`,maxHeight:`${r?n:t}px`,border:"0px",borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",...x},children:[f.jsx(v.Box,{ref:c,sx:{flex:1,overflow:r?"auto":"hidden",p:0,pb:s?"40px":1},children:e&&f.jsx(O.Suspense,{fallback:E,children:f.jsx(o_,{result:e,height:C,isFillElement:k=>{g(k)},onSizeChange:T})})||E}),s&&f.jsx(v.Box,{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:f.jsx(v.IconButton,{size:"small",onClick:b,sx:{color:"text.secondary","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},title:r?"Collapse to original size":"Expand to full size",children:r?f.jsx(Sa.ExpandLess,{sx:{fontSize:30}}):f.jsx(Sa.ExpandMore,{sx:{fontSize:30}})})})]})})}const i_=`
|
|
49
49
|
.code-display pre {
|
|
50
50
|
margin: 0;
|
|
51
51
|
padding: 0;
|
package/dist/index.es.js
CHANGED
|
@@ -16512,13 +16512,13 @@ const ay = new XT({
|
|
|
16512
16512
|
}
|
|
16513
16513
|
}
|
|
16514
16514
|
}), Rp = async (e, t) => {
|
|
16515
|
-
const n = t ? await t() : void 0
|
|
16515
|
+
const n = t ? await t() : void 0, r = n ? {
|
|
16516
|
+
Authorization: `Bearer ${n}`
|
|
16517
|
+
} : {};
|
|
16516
16518
|
return {
|
|
16517
16519
|
baseURL: e,
|
|
16518
|
-
withCredentials:
|
|
16519
|
-
headers:
|
|
16520
|
-
Authorization: n && `Bearer ${n}`
|
|
16521
|
-
}
|
|
16520
|
+
withCredentials: !!n,
|
|
16521
|
+
headers: r
|
|
16522
16522
|
};
|
|
16523
16523
|
};
|
|
16524
16524
|
function $n(e) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloy-publisher/app",
|
|
3
3
|
"description": "Malloy Publisher App",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.80",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"generate-api-types": ""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@malloy-publisher/sdk": "^v0.0.
|
|
37
|
+
"@malloy-publisher/sdk": "^v0.0.80",
|
|
38
38
|
"@mui/icons-material": "^7.0.2",
|
|
39
39
|
"@mui/material": "^7.0.2",
|
|
40
40
|
"@vitejs/plugin-react": "^4.3.1",
|