@malloy-publisher/app 0.0.93 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js
CHANGED
|
@@ -24,7 +24,7 @@ export default theme;`}const ET=e=>{const t=Object.keys(e).map(n=>({key:n,val:e[
|
|
|
24
24
|
\f\r "&'<=>\``.split("")],[`\0
|
|
25
25
|
\f\r "&'<=>\``.split(""),`\0
|
|
26
26
|
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function eS(e,t,n,r){const o=r.schema,a=o.space==="svg"?!1:r.settings.omitOptionalTags;let i=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=tS(r,e.properties),d=r.all(o.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=o,d&&(i=!1),(c||!a||!Gv(e,t,n))&&(s.push("<",e.tagName,c?" "+c:""),i&&(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),!i&&(!a||!$d(e,t,n))&&s.push("</"+e.tagName+">"),s.join("")}function tS(e,t){const n=[];let r=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const a=nS(e,o,t[o]);a&&n.push(a)}}for(;++r<n.length;){const a=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&a!=='"'&&a!=="'"&&(n[r]+=" ")}return n.join("")}function nS(e,t,n){const r=qi(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,a=e.settings.allowDangerousCharacters?0:1;let i=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=ha(r.attribute,Object.assign({},e.settings.characterReferences,{subset:gs.name[o][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Bl:jl)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(s=ha(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:gs.unquoted[o][a]}))),s!==n&&(e.settings.quoteSmart&&ol(n,i)>ol(n,e.alternative)&&(i=e.alternative),s=i+ha(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?gs.single:gs.double)[o][a],attribute:!0}))+i),l+(s&&"="+s))}const rS=["<","&"];function h0(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:ha(e.value,Object.assign({},r.settings.characterReferences,{subset:rS}))}function oS(e,t,n,r){return r.settings.allowDangerousHtml?e.value:h0(e,t,n,r)}function aS(e,t,n,r){return r.all(e)}const iS=Fl("type",{invalid:sS,unknown:lS,handlers:{comment:Iv,doctype:_v,element:eS,raw:oS,root:aS,text:h0}});function sS(e){throw new Error("Expected node, not `"+e+"`")}function lS(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const cS={},uS={},dS=[];function hS(e,t){const n=cS,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:pS,all:fS,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||e0,characterReferences:n.characterReferences||uS,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Rr:Sa,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function pS(e,t,n){return iS(e,t,n,this)}function fS(e){const t=[],n=e&&e.children||dS;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function mS(e){return Array.isArray(e)?e:[e]}function Hl(e,t=!1){const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let a=0;a<n.length;a+=2){const i=t?n[a]+(n[a+1]||""):n[a];o.push([i,r]),r+=n[a].length,r+=n[a+1]?.length||0}return o}function Od(e){return!e||["plaintext","txt","text","plain"].includes(e)}function p0(e){return e==="ansi"||Od(e)}function Md(e){return e==="none"}function f0(e){return Md(e)}function m0(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 gS(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 yS(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 a=n.filter(i=>o.offset<i&&i<o.offset+o.content.length).map(i=>i-o.offset).sort((i,s)=>i-s);return a.length?gS(o,a):o})):e}async function g0(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function al(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[o,a]of Object.entries(t?.colorReplacements||{}))typeof a=="string"?n[o]=a:o===r&&Object.assign(n,a);return n}function po(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function y0(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Dr.Italic&&(t["font-style"]="italic"),e.fontStyle&Dr.Bold&&(t["font-weight"]="bold"),e.fontStyle&Dr.Underline&&(t["text-decoration"]="underline")),t}function bS(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function ES(e){const t=Hl(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let a=o,i=0;for(const s of t){if(a<s.length)break;a-=s.length,i++}return{line:i,character:a}}function r(o,a){let i=0;for(let s=0;s<o;s++)i+=t[s].length;return i+=a,i}return{lines:t,indexToPos:n,posToIndex:r}}let fn=class extends Error{constructor(t){super(t),this.name="ShikiError"}};const b0=new WeakMap;function Ul(e,t){b0.set(e,t)}function Ai(e){return b0.get(e)}let zl=class E0{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 E0(Object.fromEntries(mS(n).map(r=>[r,ku])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return wp(this._stacks[this.theme])}getScopes(t=this.theme){return wp(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}};function wp(e){const t=[],n=new Set;function r(o){if(n.has(o))return;n.add(o);const a=o?.nameScopesList?.scopeName;a&&t.push(a),o.parent&&r(o.parent)}return r(e),t}function TS(e,t){if(!(e instanceof zl))throw new fn("Invalid grammar state");return e.getInternalStack(t)}function xS(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new fn(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...o.indexToPos(i),offset:i}}else{const s=o.lines[i.line];if(s===void 0)throw new fn(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${o.lines.length}`);if(i.character<0||i.character>s.length)throw new fn(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${s.length}`);return{...i,offset:o.posToIndex(i.line,i.character)}}};const o=ES(n.source),a=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));CS(a),e.set(n.meta,{decorations:a,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 yS(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 fn(`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 a(d,u,p,h){const g=o[d];let b="",T=-1,E=-1;if(u===0&&(T=0),p===0&&(E=0),p===Number.POSITIVE_INFINITY&&(E=g.children.length),T===-1||E===-1)for(let C=0;C<g.children.length;C++)b+=T0(g.children[C]),T===-1&&b.length===u&&(T=C+1),E===-1&&b.length===p&&(E=C+1);if(T===-1)throw new fn(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(E===-1)throw new fn(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const v=g.children.slice(T,E);if(!h.alwaysWrap&&v.length===g.children.length)s(g,h,"line");else if(!h.alwaysWrap&&v.length===1&&v[0].type==="element")s(v[0],h,"token");else{const C={type:"element",tagName:"span",properties:{},children:v};s(C,h,"wrapper"),g.children.splice(T,v.length,C)}}function i(d,u){o[d]=s(o[d],u,"line")}function s(d,u,p){const h=u.properties||{},g=u.transform||(b=>b);return d.tagName=u.tagName||"span",d.properties={...d.properties,...h,class:d.properties.class},u.properties?.class&&m0(d,u.properties.class),d=g(d,p)||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:p}=d;if(u.line===p.line)a(u.line,u.character,p.character,d);else if(u.line<p.line){a(u.line,u.character,Number.POSITIVE_INFINITY,d);for(let h=u.line+1;h<p.line;h++)l.unshift(()=>i(h,d));a(p.line,0,p.character,d)}}l.forEach(d=>d())}}}function CS(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new fn(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const o=e[r],a=n.start.offset<o.start.offset&&o.start.offset<n.end.offset,i=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(a||i||s||l){if(i&&i||s&&l)continue;throw new fn(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function T0(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(T0).join(""):""}const vS=[xS()];function il(e){return[...e.transformers||[],...vS]}var fo=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],_c={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function SS(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 Np(e,t){let n=1;const r=e[t+n++];let o;if(r==="2"){const a=[e[t+n++],e[t+n++],e[t+n]].map(i=>Number.parseInt(i));a.length===3&&!a.some(i=>Number.isNaN(i))&&(o={type:"rgb",rgb:a})}else if(r==="5"){const a=Number.parseInt(e[t+n]);Number.isNaN(a)||(o={type:"table",index:Number(a)})}return[n,o]}function kS(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)_c[o]&&t.push({type:"setDecoration",value:_c[o]});else if(o<=29){const a=_c[o-20];a&&t.push({type:"resetDecoration",value:a})}else if(o<=37)t.push({type:"setForegroundColor",value:{type:"named",name:fo[o-30]}});else if(o===38){const[a,i]=Np(e,n);i&&t.push({type:"setForegroundColor",value:i}),n+=a}else if(o===39)t.push({type:"resetForegroundColor"});else if(o<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:fo[o-40]}});else if(o===48){const[a,i]=Np(e,n);i&&t.push({type:"setBackgroundColor",value:i}),n+=a}else o===49?t.push({type:"resetBackgroundColor"}):o>=90&&o<=97?t.push({type:"setForegroundColor",value:{type:"named",name:fo[o-90+8]}}):o>=100&&o<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:fo[o-100+8]}})}return t}function AS(){let e=null,t=null,n=new Set;return{parse(r){const o=[];let a=0;do{const i=SS(r,a),s=i.sequence?r.substring(a,i.startPosition):r.substring(a);if(s.length>0&&o.push({value:s,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const l=kS(i.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)}a=i.position}while(a<r.length);return o}}}var IS={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 _S(e=IS){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<fo.length;c++)r.push(t(fo[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 a(s){return o()[s]}function i(s){switch(s.type){case"named":return t(s.name);case"rgb":return n(s.rgb);case"table":return a(s.index)}}return{value:i}}function DS(e,t,n){const r=al(e,n),o=Hl(t),a=_S(Object.fromEntries(fo.map(s=>[s,e.colors?.[`terminal.ansi${s[0].toUpperCase()}${s.substring(1)}`]]))),i=AS();return o.map(s=>i.parse(s[0]).map(l=>{let c,d;l.decorations.has("reverse")?(c=l.background?a.value(l.background):e.bg,d=l.foreground?a.value(l.foreground):e.fg):(c=l.foreground?a.value(l.foreground):e.fg,d=l.background?a.value(l.background):void 0),c=po(c,r),d=po(d,r),l.decorations.has("dim")&&(c=wS(c));let u=Dr.None;return l.decorations.has("bold")&&(u|=Dr.Bold),l.decorations.has("italic")&&(u|=Dr.Italic),l.decorations.has("underline")&&(u|=Dr.Underline),{content:l.value,offset:s[1],color:c,bgColor:d,fontStyle:u}}))}function wS(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 Fd(e,t,n={}){const{lang:r="text",theme:o=e.getLoadedThemes()[0]}=n;if(Od(r)||Md(o))return Hl(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:a,colorMap:i}=e.setTheme(o);if(r==="ansi")return DS(a,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(a.name))throw new wr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return PS(t,s,a,i,n)}function NS(...e){if(e.length===2)return Ai(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:a=t.getLoadedThemes()[0]}=r;if(Od(o)||Md(a))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:i,colorMap:s}=t.setTheme(a),l=t.getLanguage(o);return new zl(sl(n,l,i,s,r).stateStack,l.name,i.name)}function PS(e,t,n,r,o){const a=sl(e,t,n,r,o),i=new zl(sl(e,t,n,r,o).stateStack,t.name,n.name);return Ul(a.tokens,i),a.tokens}function sl(e,t,n,r,o){const a=al(n,o),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:s=500}=o,l=Hl(e);let c=o.grammarState?TS(o.grammarState,n.name)??ku:o.grammarContextCode!=null?sl(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:ku,d=[];const u=[];for(let p=0,h=l.length;p<h;p++){const[g,b]=l[p];if(g===""){d=[],u.push([]);continue}if(i>0&&g.length>=i){d=[],u.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let T,E,v;o.includeExplanation&&(T=t.tokenizeLine(g,c),E=T.tokens,v=0);const C=t.tokenizeLine2(g,c,s),A=C.tokens.length/2;for(let N=0;N<A;N++){const S=C.tokens[2*N],M=N+1<A?C.tokens[2*N+2]:g.length;if(S===M)continue;const q=C.tokens[2*N+1],j=po(r[ba.getForeground(q)],a),y=ba.getFontStyle(q),R={content:g.substring(S,M),offset:b+S,color:j,fontStyle:y};if(o.includeExplanation){const F=[];if(o.includeExplanation!=="scopeName")for(const U of n.settings){let X;switch(typeof U.scope){case"string":X=U.scope.split(/,/).map(ne=>ne.trim());break;case"object":X=U.scope;break;default:continue}F.push({settings:U,selectors:X.map(ne=>ne.split(/ /))})}R.explanation=[];let O=0;for(;S+O<M;){const U=E[v],X=g.substring(U.startIndex,U.endIndex);O+=X.length,R.explanation.push({content:X,scopes:o.includeExplanation==="scopeName"?RS(U.scopes):LS(F,U.scopes)}),v+=1}}d.push(R)}u.push(d),d=[],c=C.ruleStack}return{tokens:u,stateStack:c}}function RS(e){return e.map(t=>({scopeName:t}))}function LS(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const a=t[r];n[r]={scopeName:a,themeMatches:OS(e,a,t.slice(0,r))}}return n}function Pp(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function $S(e,t,n){if(!Pp(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)Pp(e[r],n[o])&&(r-=1),o-=1;return r===-1}function OS(e,t,n){const r=[];for(const{selectors:o,settings:a}of e)for(const i of o)if($S(i,t,n)){r.push(a);break}return r}function x0(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=Fd(e,t,{...n,theme:l.theme}),d=Ai(c),u=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:u}}),a=MS(...o.map(l=>l.tokens)),i=a[0].map((l,c)=>l.map((d,u)=>{const p={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(p.explanation=d.explanation),a.forEach((h,g)=>{const{content:b,explanation:T,offset:E,...v}=h[c][u];p.variants[r[g].color]=v}),p})),s=o[0].state?new zl(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return s&&Ul(i,s),i}function MS(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(l=>l[r]),a=t.map(()=>[]);t.forEach((l,c)=>l.push(a[c]));const i=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?(a[c].push(d),i[c]+=1,s[c]=o[c][i[c]]):(a[c].push({...d,content:d.content.slice(0,l)}),s[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function ll(e,t,n){let r,o,a,i,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 p=x0(e,t,n);if(l=Ai(p),c&&!u.find(T=>T.color===c))throw new wr(`\`themes\` option must contain the defaultColor key \`${c}\``);const h=u.map(T=>e.getTheme(T.theme)),g=u.map(T=>T.color);a=p.map(T=>T.map(E=>FS(E,g,d,c))),l&&Ul(a,l);const b=u.map(T=>al(T.theme,n));o=u.map((T,E)=>(E===0&&c?"":`${d+T.color}:`)+(po(h[E].fg,b[E])||"inherit")).join(";"),r=u.map((T,E)=>(E===0&&c?"":`${d+T.color}-bg:`)+(po(h[E].bg,b[E])||"inherit")).join(";"),i=`shiki-themes ${h.map(T=>T.name).join(" ")}`,s=c?void 0:[o,r].join(";")}else if("theme"in n){const c=al(n.theme,n);a=Fd(e,t,n);const d=e.getTheme(n.theme);r=po(d.bg,c),o=po(d.fg,c),i=d.name,l=Ai(a)}else throw new wr("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:o,bg:r,themeName:i,rootStyle:s,grammarState:l}}function FS(e,t,n,r){const o={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(l=>y0(e.variants[l])),i=new Set(a.flatMap(l=>Object.keys(l))),s={};return a.forEach((l,c)=>{for(const d of i){const u=l[d]||"inherit";if(c===0&&r)s[d]=u;else{const p=d==="color"?"":d==="background-color"?"-bg":`-${d}`,h=n+t[c]+(d==="color"?"":p);s[h]=u}}}),o.htmlStyle=s,o}function cl(e,t,n,r={meta:{},options:n,codeToHast:(o,a)=>cl(e,o,a),codeToTokens:(o,a)=>ll(e,o,a)}){let o=t;for(const h of il(n))o=h.preprocess?.call(r,o,n)||o;let{tokens:a,fg:i,bg:s,themeName:l,rootStyle:c,grammarState:d}=ll(e,o,n);const{mergeWhitespaces:u=!0}=n;u===!0?a=jS(a):u==="never"&&(a=HS(a));const p={...r,get source(){return o}};for(const h of il(n))a=h.tokens?.call(p,a)||a;return BS(a,{...n,fg:i,bg:s,themeName:l,rootStyle:c},p,d)}function BS(e,t,n,r=Ai(e)){const o=il(t),a=[],i={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:a};const u=[],p={...n,structure:s,addClassToHast:m0,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return c},get code(){return d},get lines(){return u}};if(e.forEach((g,b)=>{b&&(s==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):s==="classic"&&a.push({type:"text",value:`
|
|
27
|
-
`}));let T={type:"element",tagName:"span",properties:{class:"line"},children:[]},E=0;for(const v of g){let C={type:"element",tagName:"span",properties:{...v.htmlAttrs},children:[{type:"text",value:v.content}]};v.htmlStyle;const A=bS(v.htmlStyle||y0(v));A&&(C.properties.style=A);for(const N of o)C=N?.span?.call(p,C,b+1,E,T,v)||C;s==="inline"?i.children.push(C):s==="classic"&&T.children.push(C),E+=v.content.length}if(s==="classic"){for(const v of o)T=v?.line?.call(p,T,b+1)||T;u.push(T),a.push(T)}}),s==="classic"){for(const g of o)d=g?.code?.call(p,d)||d;c.children.push(d);for(const g of o)c=g?.pre?.call(p,c)||c;i.children.push(c)}let h=i;for(const g of o)h=g?.root?.call(p,h)||h;return r&&Ul(h,r),h}function jS(e){return e.map(t=>{const n=[];let r="",o=0;return t.forEach((a,i)=>{const s=!(a.fontStyle&&a.fontStyle&Dr.Underline);s&&a.content.match(/^\s+$/)&&t[i+1]?(o||(o=a.offset),r+=a.content):r?(s?n.push({...a,offset:o,content:r+a.content}):n.push({content:r,offset:o},a),o=0,r=""):n.push(a)}),n})}function HS(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,a,i]=r;if(!o&&!i)return n;const s=[{...n,offset:n.offset+o.length,content:a}];return o&&s.unshift({content:o,offset:n.offset}),i&&s.push({content:i,offset:n.offset+o.length+a.length}),s}))}function US(e,t,n){const r={meta:{},options:n,codeToHast:(a,i)=>cl(e,a,i),codeToTokens:(a,i)=>ll(e,a,i)};let o=hS(cl(e,t,n,r));for(const a of il(n))o=a.postprocess?.call(r,o,n)||o;return o}const Rp={light:"#333333",dark:"#bbbbbb"},Lp={light:"#fffffe",dark:"#1e1e1e"},$p="__shiki_resolved";function Bd(e){if(e?.[$p])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"?Rp.light:Rp.dark),n||(n=t.type==="light"?Lp.light:Lp.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 a=new Map;function i(s){if(a.has(s))return a.get(s);o+=1;const l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?i(s):(a.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=i(s.settings.foreground);t.colorReplacements[u]=s.settings.foreground,d.settings.foreground=u}if(c){const u=i(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=i(t.colors[s]);t.colorReplacements[l]=t.colors[s],t.colors[s]=l}return Object.defineProperty(t,$p,{enumerable:!1,writable:!1,value:!0}),t}async function C0(e){return Array.from(new Set((await Promise.all(e.filter(t=>!p0(t)).map(async t=>await g0(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function v0(e){return(await Promise.all(e.map(async t=>f0(t)?null:Bd(await g0(t))))).filter(t=>!!t)}let zS=class extends ov{constructor(n,r,o,a={}){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=a,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=Bd(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=Zs.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 fn(`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(i=>i.embeddedLangsLazy?.includes(n.name)));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const a=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(a.name=n.name,this._resolvedGrammars.set(n.name,a),n.aliases&&n.aliases.forEach(i=>{this._alias[i]=n.name}),this._loadedLanguagesCache=null,r.size)for(const i of r)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const a of n)this.resolveEmbeddedLanguages(a);const r=Array.from(this._langGraph.entries()),o=r.filter(([a,i])=>!i);if(o.length){const a=r.filter(([i,s])=>s&&s.embeddedLangs?.some(l=>o.map(([c])=>c).includes(l))).filter(i=>!o.includes(i));throw new fn(`Missing languages ${o.map(([i])=>`\`${i}\``).join(", ")}, required by ${a.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[a,i]of r)this._resolver.addLanguage(i);for(const[a,i]of r)this.loadLanguage(i)}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))}},GS=class{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 a=n.slice(0,o).join(".");r=[...r,...this._injections.get(a)||[]]}return r}},Ma=0;function qS(e){Ma+=1,e.warnings!==!1&&Ma>=10&&Ma%10===0&&console.warn(`[Shiki] ${Ma} 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 fn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Bd),o=new GS(e.engine,n),a=new zS(o,r,n,e.langAlias);let i;function s(v){T();const C=a.getGrammar(typeof v=="string"?v:v.name);if(!C)throw new fn(`Language \`${v}\` not found, you may need to load it first`);return C}function l(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};T();const C=a.getTheme(v);if(!C)throw new fn(`Theme \`${v}\` not found, you may need to load it first`);return C}function c(v){T();const C=l(v);i!==v&&(a.setTheme(C),i=v);const A=a.getColorMap();return{theme:C,colorMap:A}}function d(){return T(),a.getLoadedThemes()}function u(){return T(),a.getLoadedLanguages()}function p(...v){T(),a.loadLanguages(v.flat(1))}async function h(...v){return p(await C0(v))}function g(...v){T();for(const C of v.flat(1))a.loadTheme(C)}async function b(...v){return T(),g(await v0(v))}function T(){if(t)throw new fn("Shiki instance has been disposed")}function E(){t||(t=!0,a.dispose(),Ma-=1)}return{setTheme:c,getTheme:l,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:u,loadLanguage:h,loadLanguageSync:p,loadTheme:b,loadThemeSync:g,dispose:E,[Symbol.dispose]:E}}async function WS(e={}){e.loadWasm;const[t,n,r]=await Promise.all([v0(e.themes||[]),C0(e.langs||[]),e.engine||Fg(e.loadWasm||bC())]);return qS({...e,themes:t,langs:n,engine:r})}async function VS(e={}){const t=await WS(e);return{getLastGrammarState:(...n)=>NS(t,...n),codeToTokensBase:(n,r)=>Fd(t,n,r),codeToTokensWithThemes:(n,r)=>x0(t,n,r),codeToTokens:(n,r)=>ll(t,n,r),codeToHast:(n,r)=>cl(t,n,r),codeToHtml:(n,r)=>US(t,n,r),...t,getInternalContext:()=>t}}function YS(e,t,n){let r,o,a;{const s=e;r=s.langs,o=s.themes,a=s.engine}async function i(s){function l(h){if(typeof h=="string"){if(p0(h))return[];const g=r[h];if(!g)throw new wr(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}function c(h){if(f0(h))return"none";if(typeof h=="string"){const g=o[h];if(!g)throw new wr(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}const d=(s.themes??[]).map(h=>c(h)),u=(s.langs??[]).map(h=>l(h)),p=await VS({engine:s.engine??a(),...s,themes:d,langs:u});return{...p,loadLanguage(...h){return p.loadLanguage(...h.map(l))},loadTheme(...h){return p.loadTheme(...h.map(c))}}}return i}const KS=YS({langs:Jx,themes:eC,engine:()=>Fg(Promise.resolve().then(()=>require("./index.es115-Dw4u1m6u.cjs")))}),Dc={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"}]}}},QS={...Dc,patterns:[...Dc.patterns,{include:"#docvar"}],repository:{...Dc.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},XS={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"}]}}},S0="catppuccin-latte",JS=KS({themes:[S0],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...QS},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...XS}]});async function _o(e,t){return(await JS).codeToHtml(e,{lang:t,theme:S0})}const Ut=x.styled(x.Card)({display:"flex",flexDirection:"column",height:"100%"}),Nn=x.styled(x.CardContent)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),jd=x.styled(x.CardMedia)({padding:"10px"}),ZS=x.styled("div")({height:"100%"});x.styled("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const k0=x.styled("div")({height:"75vh",width:"100%",overflowY:"auto"});x.styled("div")({position:"relative",height:"100%",flex:"0 0 auto"});function Xt({error:e,context:t}){const n=e.data?.message||"Unknown Error";return f.jsxs(f.Fragment,{children:[t&&f.jsx(x.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 ln({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=f.jsxs(x.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[f.jsx(x.CircularProgress,{size:t,color:n,thickness:r}),e&&f.jsx(x.Typography,{variant:i,color:"text.secondary",children:e})]});return o?f.jsx(x.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const ek=dt([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")]),Je="http://localhost/api/v0".replace(/\/+$/,"");let Zr=class{constructor(t,n=Je,r=Ye){G(this,"configuration");this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}},tk=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const at={},it="https://example.com",Ne=function(e,t,n){if(n==null)throw new tk(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Nu(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(r=>Nu(e,r,n)):Object.keys(t).forEach(r=>Nu(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const st=function(e,...t){const n=new URLSearchParams(e.search);Nu(n,t),e.search=n.toString()},Ii=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{}):e||""},lt=function(e){return e.pathname+e.search+e.hash},ct=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},nk=function(e){return{getConnection:async(t,n,r={})=>{Ne("getConnection","projectName",t),Ne("getConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},getQuerydata:async(t,n,r,o,a={})=>{Ne("getQuerydata","projectName",t),Ne("getQuerydata","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/queryData".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.sqlStatement=r),o!==void 0&&(u.options=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},getSqlsource:async(t,n,r,o={})=>{Ne("getSqlsource","projectName",t),Ne("getSqlsource","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.sqlStatement=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}},getTablesource:async(t,n,r,o,a={})=>{Ne("getTablesource","projectName",t),Ne("getTablesource","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/tableSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.tableKey=r),o!==void 0&&(u.tablePath=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},getTemporarytable:async(t,n,r,o={})=>{Ne("getTemporarytable","projectName",t),Ne("getTemporarytable","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/temporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.sqlStatement=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}},listConnections:async(t,n={})=>{Ne("listConnections","projectName",t);const r="/projects/{projectName}/connections".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},listSchemas:async(t,n,r={})=>{Ne("listSchemas","projectName",t),Ne("listSchemas","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/schemas".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},listTables:async(t,n,r,o={})=>{Ne("listTables","projectName",t),Ne("listTables","connectionName",n),Ne("listTables","schemaName",r);const a="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={};st(i,{});let d=s&&s.headers?s.headers:{};return l.headers={...c,...d,...o.headers},{url:lt(i),options:l}},testConnection:async(t,n,r={})=>{Ne("testConnection","projectName",t),Ne("testConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/test".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},testConnectionConfiguration:async(t,n={})=>{Ne("testConnectionConfiguration","connection",t);const r="/connections/test",o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",st(o,l);let c=a&&a.headers?a.headers:{};return i.headers={...s,...c,...n.headers},i.data=Ii(t,i,e),{url:lt(o),options:i}}}},or=function(e){const t=nk(e);return{async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.getConnection"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async getQuerydata(n,r,o,a,i){const s=await t.getQuerydata(n,r,o,a,i),l=e?.serverIndex??0,c=at["ConnectionsApi.getQuerydata"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async getSqlsource(n,r,o,a){const i=await t.getSqlsource(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.getSqlsource"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async getTablesource(n,r,o,a,i){const s=await t.getTablesource(n,r,o,a,i),l=e?.serverIndex??0,c=at["ConnectionsApi.getTablesource"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async getTemporarytable(n,r,o,a){const i=await t.getTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.getTemporarytable"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=at["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async listTables(n,r,o,a){const i=await t.listTables(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.listTables"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async testConnection(n,r,o){const a=await t.testConnection(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.testConnection"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async testConnectionConfiguration(n,r){const o=await t.testConnectionConfiguration(n,r),a=e?.serverIndex??0,i=at["ConnectionsApi.testConnectionConfiguration"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)}}};let A0=class extends Zr{getConnection(t,n,r){return or(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getQuerydata(t,n,r,o,a){return or(this.configuration).getQuerydata(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getSqlsource(t,n,r,o){return or(this.configuration).getSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}getTablesource(t,n,r,o,a){return or(this.configuration).getTablesource(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTemporarytable(t,n,r,o){return or(this.configuration).getTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}listConnections(t,n){return or(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return or(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listTables(t,n,r,o){return or(this.configuration).listTables(t,n,r,o).then(a=>a(this.axios,this.basePath))}testConnection(t,n,r){return or(this.configuration).testConnection(t,n,r).then(o=>o(this.axios,this.basePath))}testConnectionConfiguration(t,n){return or(this.configuration).testConnectionConfiguration(t,n).then(r=>r(this.axios,this.basePath))}};const rk=function(e){return{listDatabases:async(t,n,r,o={})=>{Ne("listDatabases","projectName",t),Ne("listDatabases","packageName",n);const a="/projects/{projectName}/packages/{packageName}/databases".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},ok=function(e){const t=rk(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=at["DatabasesApi.listDatabases"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let ak=class extends Zr{listDatabases(t,n,r,o){return ok(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ik=function(e){return{getModel:async(t,n,r,o,a={})=>{Ne("getModel","projectName",t),Ne("getModel","packageName",n),Ne("getModel","path",r);const i="/projects/{projectName}/packages/{packageName}/models/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};o!==void 0&&(u.versionId=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listModels:async(t,n,r,o={})=>{Ne("listModels","projectName",t),Ne("listModels","packageName",n);const a="/projects/{projectName}/packages/{packageName}/models".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},Op=function(e){const t=ik(e);return{async getModel(n,r,o,a,i){const s=await t.getModel(n,r,o,a,i),l=e?.serverIndex??0,c=at["ModelsApi.getModel"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listModels(n,r,o,a){const i=await t.listModels(n,r,o,a),s=e?.serverIndex??0,l=at["ModelsApi.listModels"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let Gl=class extends Zr{getModel(t,n,r,o,a){return Op(this.configuration).getModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listModels(t,n,r,o){return Op(this.configuration).listModels(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const sk=function(e){return{getNotebook:async(t,n,r,o,a={})=>{Ne("getNotebook","projectName",t),Ne("getNotebook","packageName",n),Ne("getNotebook","path",r);const i="/projects/{projectName}/packages/{packageName}/notebooks/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};o!==void 0&&(u.versionId=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listNotebooks:async(t,n,r,o={})=>{Ne("listNotebooks","projectName",t),Ne("listNotebooks","packageName",n);const a="/projects/{projectName}/packages/{packageName}/notebooks".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},Mp=function(e){const t=sk(e);return{async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),l=e?.serverIndex??0,c=at["NotebooksApi.getNotebook"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=at["NotebooksApi.listNotebooks"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let I0=class extends Zr{getNotebook(t,n,r,o,a){return Mp(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return Mp(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const lk=function(e){return{createPackage:async(t,n,r={})=>{Ne("createPackage","projectName",t),Ne("createPackage","body",n);const o="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"POST",...i,...r},l={},c={};l["Content-Type"]="application/json",st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},s.data=Ii(n,s,e),{url:lt(a),options:s}},deletePackage:async(t,n,r={})=>{Ne("deletePackage","projectName",t),Ne("deletePackage","packageName",n);const o="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ne("getPackage","projectName",t),Ne("getPackage","packageName",n);const i="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.versionId=r),o!==void 0&&(u.reload=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listPackages:async(t,n={})=>{Ne("listPackages","projectName",t);const r="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ne("updatePackage","projectName",t),Ne("updatePackage","packageName",n),Ne("updatePackage","body",r);const a="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},c={},d={};c["Content-Type"]="application/json",st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},l.data=Ii(r,l,e),{url:lt(i),options:l}}}},Fa=function(e){const t=lk(e);return{async createPackage(n,r,o){const a=await t.createPackage(n,r,o),i=e?.serverIndex??0,s=at["PackagesApi.createPackage"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=at["PackagesApi.deletePackage"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,c=at["PackagesApi.getPackage"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=at["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=at["PackagesApi.updatePackage"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let _0=class extends Zr{createPackage(t,n,r){return Fa(this.configuration).createPackage(t,n,r).then(o=>o(this.axios,this.basePath))}deletePackage(t,n,r){return Fa(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Fa(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Fa(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Fa(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ck=function(e){return{createProject:async(t,n={})=>{Ne("createProject","body",t);const r="/projects",o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",st(o,l);let c=a&&a.headers?a.headers:{};return i.headers={...s,...c,...n.headers},i.data=Ii(t,i,e),{url:lt(o),options:i}},deleteProject:async(t,n={})=>{Ne("deleteProject","projectName",t);const r="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},getProject:async(t,n,r={})=>{Ne("getProject","projectName",t);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},c={};n!==void 0&&(c.reload=n),st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},{url:lt(a),options:s}},listProjects:async(t={})=>{const n="/projects",r=new URL(n,it);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};st(r,{});let s=o&&o.headers?o.headers:{};return a.headers={...i,...s,...t.headers},{url:lt(r),options:a}},updateProject:async(t,n,r={})=>{Ne("updateProject","projectName",t),Ne("updateProject","body",n);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},c={};l["Content-Type"]="application/json",st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},s.data=Ii(n,s,e),{url:lt(a),options:s}}}},Ba=function(e){const t=ck(e);return{async createProject(n,r){const o=await t.createProject(n,r),a=e?.serverIndex??0,i=at["ProjectsApi.createProject"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async deleteProject(n,r){const o=await t.deleteProject(n,r),a=e?.serverIndex??0,i=at["ProjectsApi.deleteProject"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async getProject(n,r,o){const a=await t.getProject(n,r,o),i=e?.serverIndex??0,s=at["ProjectsApi.getProject"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async listProjects(n){const r=await t.listProjects(n),o=e?.serverIndex??0,a=at["ProjectsApi.listProjects"]?.[o]?.url;return(i,s)=>ct(r,Ye,Je,e)(i,a||s)},async updateProject(n,r,o){const a=await t.updateProject(n,r,o),i=e?.serverIndex??0,s=at["ProjectsApi.updateProject"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)}}};let D0=class extends Zr{createProject(t,n){return Ba(this.configuration).createProject(t,n).then(r=>r(this.axios,this.basePath))}deleteProject(t,n){return Ba(this.configuration).deleteProject(t,n).then(r=>r(this.axios,this.basePath))}getProject(t,n,r){return Ba(this.configuration).getProject(t,n,r).then(o=>o(this.axios,this.basePath))}listProjects(t){return Ba(this.configuration).listProjects(t).then(n=>n(this.axios,this.basePath))}updateProject(t,n,r){return Ba(this.configuration).updateProject(t,n,r).then(o=>o(this.axios,this.basePath))}};const uk=function(e){return{executeQuery:async(t,n,r,o,a,i,s,l={})=>{Ne("executeQuery","projectName",t),Ne("executeQuery","packageName",n),Ne("executeQuery","path",r);const c="/projects/{projectName}/packages/{packageName}/queryResults/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(c,it);let u;e&&(u=e.baseOptions);const p={method:"GET",...u,...l},h={},g={};o!==void 0&&(g.query=o),a!==void 0&&(g.sourceName=a),i!==void 0&&(g.queryName=i),s!==void 0&&(g.versionId=s),st(d,g);let b=u&&u.headers?u.headers:{};return p.headers={...h,...b,...l.headers},{url:lt(d),options:p}}}},dk=function(e){const t=uk(e);return{async executeQuery(n,r,o,a,i,s,l,c){const d=await t.executeQuery(n,r,o,a,i,s,l,c),u=e?.serverIndex??0,p=at["QueryresultsApi.executeQuery"]?.[u]?.url;return(h,g)=>ct(d,Ye,Je,e)(h,p||g)}}};let Hd=class extends Zr{executeQuery(t,n,r,o,a,i,s,l){return dk(this.configuration).executeQuery(t,n,r,o,a,i,s,l).then(c=>c(this.axios,this.basePath))}};const hk=function(e){return{listSchedules:async(t,n,r,o={})=>{Ne("listSchedules","projectName",t),Ne("listSchedules","packageName",n);const a="/projects/{projectName}/packages/{packageName}/schedules".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},pk=function(e){const t=hk(e);return{async listSchedules(n,r,o,a){const i=await t.listSchedules(n,r,o,a),s=e?.serverIndex??0,l=at["SchedulesApi.listSchedules"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let fk=class extends Zr{listSchedules(t,n,r,o){return pk(this.configuration).listSchedules(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Jt=class{constructor(t={}){G(this,"apiKey");G(this,"username");G(this,"password");G(this,"accessToken");G(this,"basePath");G(this,"serverIndex");G(this,"baseOptions");G(this,"formDataCtor");this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){const n=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(n.test(t)||t.toLowerCase()==="application/json-patch+json")}};const w0=$.createContext(void 0),ul=({projectName:e,packageName:t,versionId:n,children:r})=>f.jsx(w0.Provider,{value:{projectName:e,packageName:t,versionId:n},children:r});function Pn(e=!0){const t=$.useContext(w0);if(!t&&e)throw new Error("usePackage must be used within a PackageProvider");return t}const mk=new Hd(new Jt),gk=mt(ze.Box)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.5),borderBottom:`1px solid ${e.palette.divider}`,minHeight:36})),yk=mt(x.Button)(({theme:e,selected:t})=>({minHeight:36,padding:e.spacing(.5,2),borderRadius:e.shape.borderRadius,background:t?e.palette.action.selected:"none",color:t?e.palette.primary.main:e.palette.text.primary,fontWeight:t?600:400,border:t?`1px solid ${e.palette.primary.main}`:"1px solid transparent",boxShadow:t?e.shadows[1]:"none",textTransform:"uppercase","&:hover":{background:e.palette.action.hover,border:`1px solid ${e.palette.primary.light}`}}));function N0({sourceAndPaths:e,existingQuery:t,existingSourceName:n,onQueryChange:r,onSourceChange:o}){const[a,i]=$.useState(n?e.findIndex(c=>c.sourceInfo.name===n):0),[s,l]=$.useState(t||ci());return $.useEffect(()=>{o&&o(a)},[a,o]),f.jsxs(Ut,{variant:"outlined",children:[f.jsx(Nn,{children:f.jsx(ze.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:e.length>0&&f.jsx(gk,{children:e.map((c,d)=>f.jsx(yk,{selected:a===d,onClick:()=>i(d),children:c.sourceInfo.name||`Source ${d+1}`},c.sourceInfo.name||d))})})}),f.jsx(jd,{children:f.jsxs(ze.Stack,{spacing:2,component:"section",children:[f.jsx(P0,{sourceAndPath:e[a],existingQuery:s,onChange:c=>{l(c),r&&r(c)}}),f.jsx(ze.Box,{height:"5px"})]})})]})}function ci(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function bk({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o}){const[a,i]=$.useState(n||ci()),[s,l]=$.useState([]),{MalloyExplorerProvider:c,QueryPanel:d,ResizableCollapsiblePanel:u,ResultPanel:p,SourcePanel:h}=r;$.useEffect(()=>{t&&t(a)},[t,a]);const{projectName:g,packageName:b,versionId:T}=Pn(),E=fF({mutationFn:(N,S)=>{const M=new o.ASTQuery({source:e.sourceInfo,query:a?.malloyQuery}).toMalloy();return i({...a,query:M}),mk.executeQuery(g,b,e.modelPath,M,void 0,void 0,T,S)},onSuccess:N=>{if(N){const S=JSON.parse(N.data.result);i({...a,malloyResult:S})}}}),[v,C]=$.useState(e.sourceInfo.name);$.useEffect(()=>{v!==e.sourceInfo.name&&(C(e.sourceInfo.name),i(ci()))},[e,v]);const A=$.useCallback(N=>{i({...a,malloyQuery:N,malloyResult:void 0})},[a]);return v!==e.sourceInfo.name?f.jsx("div",{children:"Loading..."}):f.jsx(k0,{children:f.jsx(c,{source:e.sourceInfo,query:a?.malloyQuery,onQueryChange:A,focusedNestViewPath:s,onFocusedNestViewPathChange:l,onDrill:N=>{console.info(N)},children:f.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[f.jsx(u,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:f.jsx(h,{onRefresh:()=>i(ci())})}),f.jsx(u,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:f.jsx(d,{runQuery:()=>{E.mutate()}})}),f.jsx(p,{source:e.sourceInfo,draftQuery:a?.malloyQuery,setDraftQuery:N=>i({...a,malloyQuery:N}),submittedQuery:a?.malloyQuery?{executionState:E.isPending?"running":"finished",response:{result:a.malloyResult},query:a.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:E.reset}:void 0,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function P0(e){const[t,n]=$.useState(null),[r,o]=$.useState(null),[a,i]=$.useState(!0);return $.useEffect(()=>{let s=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,c])=>{s&&(n(l),o(c),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?f.jsx(ZS,{children:f.jsx(k0,{children:f.jsx("div",{style:{alignItems:"center",justifyContent:"center",height:"200px",color:"#666"},children:"Loading explorer..."})})}):f.jsx(bk,{...e,explorerComponents:t,QueryBuilder:r})}const Ek=new Gl(new Jt);function R0(e,t){const{projectName:n,packageName:r,versionId:o}=Pn(),a=t||o;return dn({queryKey:["package",n,r,e,a],queryFn:async i=>(await Ek.getModel(n,r,e,a,i)).data})}const L0=dt(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"})),Tk=$.lazy(()=>Promise.resolve().then(()=>require("./index.es56-D9KeGh71.cjs")));function $0({result:e,minHeight:t,maxHeight:n}){const[r,o]=$.useState(!1),[a,i]=$.useState(0),[s,l]=$.useState(!1),c=$.useRef(null),d=$.useRef(null),[u,p]=$.useState(void 0),[h,g]=$.useState(!1),b=$.useCallback(()=>{const A=r;o(!r),A&&d.current&&setTimeout(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)},[r]),T=$.useCallback(A=>{i(A)},[]);if($.useEffect(()=>{if(h){l(!0);return}if(a===0){l(!1);return}const A=t-20,N=a>A;a<A&&p(a+20),l(N)},[a,h,t]),!e)return null;const E=f.jsx(ln,{text:"Loading...",centered:!0,size:32}),v=h?r?n-40:t-40:void 0,C=u?{minHeight:`${u}px`,height:"100%"}:{height:"100%"};return f.jsx(f.Fragment,{children:f.jsxs(x.Box,{ref:d,sx:{position:"relative",minHeight:`${t}px`,maxHeight:`${r?n:t}px`,border:"0px",borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",...C},children:[f.jsx(x.Box,{ref:c,sx:{flex:1,overflow:r?"auto":"hidden",p:0,pb:s?"40px":1},children:e&&f.jsx($.Suspense,{fallback:E,children:f.jsx(Tk,{result:e,height:v,isFillElement:A=>{g(A)},onSizeChange:T})})||E}),s&&f.jsx(x.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(x.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(mu.ExpandLess,{sx:{fontSize:30}}):f.jsx(mu.ExpandMore,{sx:{fontSize:30}})})})]})})}const O0=dt(f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),xk=new _0(new Jt);function Ck(){const{projectName:e,packageName:t,versionId:n}=Pn(),{data:r,isSuccess:o,isError:a,error:i}=dn({queryKey:["package",e,t,n],queryFn:s=>xk.getPackage(e,t,n,!1,s)});return f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),f.jsx(x.Divider,{}),f.jsx(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:f.jsxs(x.List,{dense:!0,disablePadding:!0,children:[f.jsx(x.ListItem,{dense:!0,disablePadding:!0,children:f.jsx(x.ListItemText,{primary:"Name",primaryTypographyProps:{fontWeight:"500"},secondary:t})}),!o&&!a&&f.jsx(x.ListItem,{children:f.jsx(ln,{text:"Fetching Package Metadata..."})}),o&&(r.data&&f.jsx(x.ListItem,{dense:!0,disablePadding:!0,children:f.jsx(x.ListItemText,{primary:"Description",primaryTypographyProps:{fontWeight:"500"},secondary:r.data.description})})||f.jsxs(x.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[f.jsx(O0,{sx:{color:"grey.600",mr:"10px"}}),f.jsx(x.ListItemText,{primary:"No package manifest"})]})),a&&f.jsx(Xt,{error:i,context:`${e} > ${t} > ${n}`})]})})]})})}const vk=dt(f.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Sk=new D0(new Jt);function kk(){const{projectName:e}=Wi(),{data:t,isSuccess:n,isError:r,error:o}=dn({queryKey:["about",e],queryFn:a=>Sk.getProject(e,!1,a)});return f.jsxs(f.Fragment,{children:[!n&&!r&&f.jsx(ln,{text:"Fetching About..."}),n&&t.data?.readme&&f.jsxs(Ut,{variant:"outlined",sx:{p:2},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Readme"}),f.jsx(Ut,{sx:{p:1},children:f.jsx(bd,{children:t.data.readme})})]}),r&&f.jsx(Xt,{error:o,context:`${e} > About`})]})}const Ak=new _0(new Jt);function Ik({navigate:e}){const{projectName:t}=Wi(),{data:n,isSuccess:r,isError:o,error:a}=dn({queryKey:["packages",t],queryFn:i=>Ak.listPackages(t,i)});return f.jsxs(f.Fragment,{children:[!r&&!o&&f.jsx(ln,{text:"Fetching Packages..."}),r&&f.jsxs(Ut,{variant:"outlined",sx:{p:2},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Packages"}),f.jsx(x.Grid,{container:!0,spacing:2,columns:12,children:n.data.sort((i,s)=>i.name.localeCompare(s.name)).map(i=>f.jsx(x.Grid,{size:{xs:12,sm:12,md:12,lg:4},children:f.jsx(Ut,{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:s=>e(i.name,s),children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",color:"primary.main",children:i.name}),f.jsx(x.Box,{sx:{maxHeight:"120px",overflowY:"auto"},children:f.jsx(x.Typography,{variant:"body2",children:i.description})})]})})},i.name))})]}),o&&f.jsx(Xt,{error:a,context:`${t} > Packages`})]})}const M0=$.createContext(void 0);function Wi(){const e=$.useContext(M0);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function F0({children:e,projectName:t}){return f.jsx(M0.Provider,{value:{projectName:t},children:e})}function _k({navigate:e}){return f.jsxs(x.Grid,{container:!0,spacing:2,columns:12,children:[f.jsx(x.Grid,{size:{xs:12,md:12},children:f.jsx(Ik,{navigate:e})}),f.jsx(x.Grid,{size:{xs:12,md:12},children:f.jsx(kk,{})})]})}const Ud=new A0(new Jt);function Dk({connectionName:e,schema:t}){const{projectName:n}=Wi(),[r,o]=$.useState(void 0),[a,i]=$.useState(t||null),[s,l]=$.useState(!1),{data:c,isSuccess:d,isError:u,error:p,isLoading:h}=dn({queryKey:["tablePath",n,e],queryFn:g=>Ud.listSchemas(n,e,g)});return f.jsxs(x.Grid,{container:!0,spacing:1,children:[!t&&f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsxs(x.Paper,{sx:{p:1,m:0},children:[f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),f.jsx(x.FormControlLabel,{control:f.jsx(x.Switch,{checked:s,onChange:g=>l(g.target.checked)}),label:"Hidden Schemas"})]}),f.jsx(x.Divider,{sx:{mt:"2px"}}),f.jsxs(x.Box,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[h&&f.jsx(ln,{text:"Fetching Table Paths..."}),u&&f.jsx(Xt,{error:p,context:`${n} > ${e}`}),d&&c.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Schemas"}),d&&c.data.length>0&&f.jsx(x.List,{dense:!0,disablePadding:!0,children:c.data.filter(({isHidden:g})=>s||!g).sort((g,b)=>g.isDefault===b.isDefault?0:g.isDefault?-1:1).map(g=>{const b=(g.description||"").trim(),T=b!=="",E=T?b.split(/\r?\n/)[0]:void 0,v=f.jsx(x.ListItemButton,{selected:a===g.name,onClick:()=>i(g.name),children:f.jsx(x.ListItemText,{primary:g.name,secondary:E})},g.name);return T?f.jsx(x.Tooltip,{title:b,arrow:!0,children:v},g.name):v})})]})]})}),f.jsx(x.Grid,{size:{xs:12,md:t?6:4},children:a&&f.jsx(x.Paper,{sx:{p:1,m:0},children:f.jsx(Nk,{connectionName:e,schemaName:a,onTableClick:g=>{o(g)}})})}),f.jsx(x.Grid,{size:{xs:12,md:t?6:4},children:r&&a&&f.jsx(x.Paper,{sx:{p:1,m:0},children:f.jsx(wk,{connectionName:e,schemaName:a,tableName:r})})})]})}function wk({connectionName:e,schemaName:t,tableName:n}){const{projectName:r}=Wi(),{data:o,isSuccess:a,isError:i,error:s,isLoading:l}=dn({queryKey:["tablePathSchema",r,e,t,n],queryFn:c=>Ud.getTablesource(r,e,n,`${t}.${n}`,c)});return f.jsxs(f.Fragment,{children:[f.jsxs(x.Typography,{variant:"overline",fontWeight:"bold",children:["Schema: ",t,".",n]}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:[l&&f.jsx(ln,{text:"Fetching Table Details..."}),i&&f.jsx(Xt,{error:s,context:`${r} > ${e} > ${t}.${n}`}),a&&o&&f.jsx(x.TableContainer,{children:f.jsxs(x.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"NAME"}),f.jsx(x.TableCell,{children:"TYPE"})]})}),f.jsx(x.TableBody,{children:o.data.columns?.map(c=>f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:c.name}),f.jsx(x.TableCell,{children:c.type})]},c.name))})]})})]})]})}function Nk({connectionName:e,schemaName:t,onTableClick:n}){const{projectName:r}=Wi(),{data:o,isSuccess:a,isError:i,error:s,isLoading:l}=dn({queryKey:["tablesInSchema",r,e,t],queryFn:c=>Ud.listTables(r,e,t,c)});return f.jsxs(f.Fragment,{children:[f.jsxs(x.Typography,{variant:"overline",fontWeight:"bold",children:["Tables in ",t]}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[l&&f.jsx(ln,{text:"Fetching Tables..."}),i&&f.jsx(Xt,{error:s,context:`${r} > ${e} > ${t}`}),a&&o.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Tables"}),a&&o.data.length>0&&f.jsx(x.List,{dense:!0,disablePadding:!0,children:o.data.map(c=>f.jsx(x.ListItemButton,{onClick:()=>n(c),children:f.jsx(x.ListItemText,{primary:c})},c))})]})]})}const Pk=new A0(new Jt);function Rk({connection:e,onClick:t}){return f.jsxs(x.TableRow,{onClick:t,sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:[f.jsx(x.TableCell,{children:f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[f.jsx(x.Typography,{variant:"body2",children:e.name}),f.jsx(vk,{sx:{fontSize:"1rem",color:"action.active",opacity:.7}})]})}),f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"body2",children:e.type})})]},e.name)}function Lk(){const{projectName:e}=Pn(),[t,n]=$.useState(null),{data:r,isSuccess:o,isError:a,error:i}=dn({queryKey:["connections",e],queryFn:c=>Pk.listConnections(e,c)}),s=c=>{n(c)},l=()=>{n(null)};return f.jsxs(F0,{projectName:e,children:[f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!o&&!a&&f.jsx(x.Typography,{variant:"body2",sx:{m:"auto"},children:"Fetching Connections..."}),o&&r.data.length>0&&f.jsx(x.Table,{size:"small",children:f.jsxs(x.TableBody,{children:[f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),r.data.map(c=>f.jsx(Rk,{connection:c,onClick:()=>s(c.name)},c.name))]})}),o&&r.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Connections"}),a&&f.jsx(Xt,{error:i,context:`${e} > Connections`})]})]})}),f.jsxs(x.Dialog,{open:t!==null,onClose:l,maxWidth:"lg",fullWidth:!0,children:[f.jsxs(x.DialogTitle,{children:["Connection Explorer: ",t,f.jsx(x.IconButton,{"aria-label":"close",onClick:l,sx:{position:"absolute",right:8,top:8},children:f.jsx(x.Box,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),f.jsx(x.DialogContent,{children:t&&f.jsx(Dk,{connectionName:t})})]})]})}const $k=new ak(new Jt);function Ok(){const{projectName:e,packageName:t,versionId:n}=Pn(),[r,o]=$.useState(!1),[a,i]=$.useState(null),s=g=>{i(g),o(!0)},l=()=>{o(!1),i(null)},{data:c,isError:d,error:u,isSuccess:p}=dn({queryKey:["databases",e,t,n],queryFn:g=>$k.listDatabases(e,t,n,g)}),h=g=>g>=1024*1024*1024*1024?`${(g/(1024*1024*1024)).toFixed(2)} T`:g>=1024*1024*1024?`${(g/(1024*1024*1024)).toFixed(2)} G`:g>=1024*1024?`${(g/(1024*1024)).toFixed(2)} M`:`${(g/1024).toFixed(2)} K`;return f.jsxs(f.Fragment,{children:[f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!p&&!d&&f.jsx(ln,{text:"Fetching Databases..."}),d&&f.jsx(Xt,{error:u,context:`${e} > ${t} > Databases`}),p&&c.data.length>0&&f.jsxs(x.Table,{size:"small",children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"Name"}),f.jsx(x.TableCell,{align:"right",children:"Rows"})]})}),f.jsx(x.TableBody,{children:c.data.map(g=>f.jsxs(x.TableRow,{onClick:()=>s(g),sx:{cursor:"pointer"},children:[f.jsx(x.TableCell,{component:"th",scope:"row",children:g.path}),f.jsx(x.TableCell,{align:"right",children:h(g.info.rowCount)})]},g.path))})]}),p&&c.data.length===0&&f.jsx(x.Typography,{variant:"body2",sx:{m:"auto"},children:"No databases found"})]})]})}),f.jsxs(x.Dialog,{open:r,onClose:l,maxWidth:"sm",fullWidth:!0,children:[f.jsx(x.DialogTitle,{children:a?.path}),f.jsx(x.DialogContent,{children:a?.info?.columns&&f.jsx(x.TableContainer,{children:f.jsxs(x.Table,{size:"small",children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"Column"}),f.jsx(x.TableCell,{children:"Type"})]})}),f.jsx(x.TableBody,{children:a.info.columns.map(g=>f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{component:"th",scope:"row",children:g.name}),f.jsx(x.TableCell,{children:g.type})]},g.name))})]})})})]})]})}function re(){return re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},re.apply(null,arguments)}const B0=(e,t)=>{let n=t.length-1;for(;n>=0&&!e.isItemNavigable(t[n]);)n-=1;if(n!==-1)return t[n]},j0=(e,t)=>{const n=e.getItemMeta(t),r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(t);if(o===0)return n.parentId;let a=o-1;for(;!e.isItemNavigable(r[a])&&a>=0;)a-=1;if(a===-1)return n.parentId==null?null:j0(e,n.parentId);let i=r[a],s=B0(e,e.getItemOrderedChildrenIds(i));for(;e.isItemExpanded(i)&&s!=null;)i=s,s=e.getItemOrderedChildrenIds(i).find(e.isItemNavigable);return i},Ls=(e,t)=>{if(e.isItemExpanded(t)){const r=e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);if(r!=null)return r}let n=e.getItemMeta(t);for(;n!=null;){const r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(n.id);if(o<r.length-1){let a=o+1;for(;!e.isItemNavigable(r[a])&&a<r.length-1;)a+=1;if(e.isItemNavigable(r[a]))return r[a]}n=e.getItemMeta(n.parentId)}return null},H0=e=>{let t=null;for(;t==null||e.isItemExpanded(t);){const n=e.getItemOrderedChildrenIds(t),r=B0(e,n);if(r==null)return t;t=r}return t},_i=e=>e.getItemOrderedChildrenIds(null).find(e.isItemNavigable),U0=(e,t,n)=>{if(t===n)return[t,n];const r=e.getItemMeta(t),o=e.getItemMeta(n);if(r.parentId===o.id||o.parentId===r.id)return o.parentId===r.id?[r.id,o.id]:[o.id,r.id];const a=[r.id],i=[o.id];let s=r.parentId,l=o.parentId,c=i.indexOf(s)!==-1,d=a.indexOf(l)!==-1,u=!0,p=!0;for(;!d&&!c;)u&&(a.push(s),c=i.indexOf(s)!==-1,u=s!==null,!c&&u&&(s=e.getItemMeta(s).parentId)),p&&!c&&(i.push(l),d=a.indexOf(l)!==-1,p=l!==null,!d&&p&&(l=e.getItemMeta(l).parentId));const h=c?s:l,g=e.getItemOrderedChildrenIds(h),b=a[a.indexOf(h)-1],T=i[i.indexOf(h)-1];return g.indexOf(b)<g.indexOf(T)?[t,n]:[n,t]},Mk=(e,t,n)=>{const r=l=>{if(e.isItemExpandable(l)&&e.isItemExpanded(l))return e.getItemOrderedChildrenIds(l)[0];let c=e.getItemMeta(l);for(;c!=null;){const d=e.getItemOrderedChildrenIds(c.parentId),u=e.getItemIndex(c.id);if(u<d.length-1)return d[u+1];c=e.getItemMeta(c.parentId)}throw new Error("Invalid range")},[o,a]=U0(e,t,n),i=[o];let s=o;for(;s!==a;)s=r(s),e.isItemDisabled(s)||i.push(s);return i},Fk=e=>{let t=_i(e);const n=[];for(;t!=null;)n.push(t),t=Ls(e,t);return n},Di=(e,t)=>t!==e.closest('*[role="treeitem"]');let Fp=0;const Bk=()=>(Fp+=1,`mui-tree-view-${Fp}`),zd=({id:e,treeId:t="",itemId:n})=>e??`${t}-${n}`,z0=_.createContext(null),Mo=()=>{const e=_.useContext(z0);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
27
|
+
`}));let T={type:"element",tagName:"span",properties:{class:"line"},children:[]},E=0;for(const v of g){let C={type:"element",tagName:"span",properties:{...v.htmlAttrs},children:[{type:"text",value:v.content}]};v.htmlStyle;const A=bS(v.htmlStyle||y0(v));A&&(C.properties.style=A);for(const N of o)C=N?.span?.call(p,C,b+1,E,T,v)||C;s==="inline"?i.children.push(C):s==="classic"&&T.children.push(C),E+=v.content.length}if(s==="classic"){for(const v of o)T=v?.line?.call(p,T,b+1)||T;u.push(T),a.push(T)}}),s==="classic"){for(const g of o)d=g?.code?.call(p,d)||d;c.children.push(d);for(const g of o)c=g?.pre?.call(p,c)||c;i.children.push(c)}let h=i;for(const g of o)h=g?.root?.call(p,h)||h;return r&&Ul(h,r),h}function jS(e){return e.map(t=>{const n=[];let r="",o=0;return t.forEach((a,i)=>{const s=!(a.fontStyle&&a.fontStyle&Dr.Underline);s&&a.content.match(/^\s+$/)&&t[i+1]?(o||(o=a.offset),r+=a.content):r?(s?n.push({...a,offset:o,content:r+a.content}):n.push({content:r,offset:o},a),o=0,r=""):n.push(a)}),n})}function HS(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,a,i]=r;if(!o&&!i)return n;const s=[{...n,offset:n.offset+o.length,content:a}];return o&&s.unshift({content:o,offset:n.offset}),i&&s.push({content:i,offset:n.offset+o.length+a.length}),s}))}function US(e,t,n){const r={meta:{},options:n,codeToHast:(a,i)=>cl(e,a,i),codeToTokens:(a,i)=>ll(e,a,i)};let o=hS(cl(e,t,n,r));for(const a of il(n))o=a.postprocess?.call(r,o,n)||o;return o}const Rp={light:"#333333",dark:"#bbbbbb"},Lp={light:"#fffffe",dark:"#1e1e1e"},$p="__shiki_resolved";function Bd(e){if(e?.[$p])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"?Rp.light:Rp.dark),n||(n=t.type==="light"?Lp.light:Lp.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 a=new Map;function i(s){if(a.has(s))return a.get(s);o+=1;const l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?i(s):(a.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=i(s.settings.foreground);t.colorReplacements[u]=s.settings.foreground,d.settings.foreground=u}if(c){const u=i(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=i(t.colors[s]);t.colorReplacements[l]=t.colors[s],t.colors[s]=l}return Object.defineProperty(t,$p,{enumerable:!1,writable:!1,value:!0}),t}async function C0(e){return Array.from(new Set((await Promise.all(e.filter(t=>!p0(t)).map(async t=>await g0(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function v0(e){return(await Promise.all(e.map(async t=>f0(t)?null:Bd(await g0(t))))).filter(t=>!!t)}let zS=class extends ov{constructor(n,r,o,a={}){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=a,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=Bd(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=Zs.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 fn(`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(i=>i.embeddedLangsLazy?.includes(n.name)));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const a=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(a.name=n.name,this._resolvedGrammars.set(n.name,a),n.aliases&&n.aliases.forEach(i=>{this._alias[i]=n.name}),this._loadedLanguagesCache=null,r.size)for(const i of r)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const a of n)this.resolveEmbeddedLanguages(a);const r=Array.from(this._langGraph.entries()),o=r.filter(([a,i])=>!i);if(o.length){const a=r.filter(([i,s])=>s&&s.embeddedLangs?.some(l=>o.map(([c])=>c).includes(l))).filter(i=>!o.includes(i));throw new fn(`Missing languages ${o.map(([i])=>`\`${i}\``).join(", ")}, required by ${a.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[a,i]of r)this._resolver.addLanguage(i);for(const[a,i]of r)this.loadLanguage(i)}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))}},GS=class{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 a=n.slice(0,o).join(".");r=[...r,...this._injections.get(a)||[]]}return r}},Ma=0;function qS(e){Ma+=1,e.warnings!==!1&&Ma>=10&&Ma%10===0&&console.warn(`[Shiki] ${Ma} 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 fn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Bd),o=new GS(e.engine,n),a=new zS(o,r,n,e.langAlias);let i;function s(v){T();const C=a.getGrammar(typeof v=="string"?v:v.name);if(!C)throw new fn(`Language \`${v}\` not found, you may need to load it first`);return C}function l(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};T();const C=a.getTheme(v);if(!C)throw new fn(`Theme \`${v}\` not found, you may need to load it first`);return C}function c(v){T();const C=l(v);i!==v&&(a.setTheme(C),i=v);const A=a.getColorMap();return{theme:C,colorMap:A}}function d(){return T(),a.getLoadedThemes()}function u(){return T(),a.getLoadedLanguages()}function p(...v){T(),a.loadLanguages(v.flat(1))}async function h(...v){return p(await C0(v))}function g(...v){T();for(const C of v.flat(1))a.loadTheme(C)}async function b(...v){return T(),g(await v0(v))}function T(){if(t)throw new fn("Shiki instance has been disposed")}function E(){t||(t=!0,a.dispose(),Ma-=1)}return{setTheme:c,getTheme:l,getLanguage:s,getLoadedThemes:d,getLoadedLanguages:u,loadLanguage:h,loadLanguageSync:p,loadTheme:b,loadThemeSync:g,dispose:E,[Symbol.dispose]:E}}async function WS(e={}){e.loadWasm;const[t,n,r]=await Promise.all([v0(e.themes||[]),C0(e.langs||[]),e.engine||Fg(e.loadWasm||bC())]);return qS({...e,themes:t,langs:n,engine:r})}async function VS(e={}){const t=await WS(e);return{getLastGrammarState:(...n)=>NS(t,...n),codeToTokensBase:(n,r)=>Fd(t,n,r),codeToTokensWithThemes:(n,r)=>x0(t,n,r),codeToTokens:(n,r)=>ll(t,n,r),codeToHast:(n,r)=>cl(t,n,r),codeToHtml:(n,r)=>US(t,n,r),...t,getInternalContext:()=>t}}function YS(e,t,n){let r,o,a;{const s=e;r=s.langs,o=s.themes,a=s.engine}async function i(s){function l(h){if(typeof h=="string"){if(p0(h))return[];const g=r[h];if(!g)throw new wr(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}function c(h){if(f0(h))return"none";if(typeof h=="string"){const g=o[h];if(!g)throw new wr(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return g}return h}const d=(s.themes??[]).map(h=>c(h)),u=(s.langs??[]).map(h=>l(h)),p=await VS({engine:s.engine??a(),...s,themes:d,langs:u});return{...p,loadLanguage(...h){return p.loadLanguage(...h.map(l))},loadTheme(...h){return p.loadTheme(...h.map(c))}}}return i}const KS=YS({langs:Jx,themes:eC,engine:()=>Fg(Promise.resolve().then(()=>require("./index.es115-Dw4u1m6u.cjs")))}),Dc={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"}]}}},QS={...Dc,patterns:[...Dc.patterns,{include:"#docvar"}],repository:{...Dc.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},XS={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"}]}}},S0="catppuccin-latte",JS=KS({themes:[S0],langs:["sql","json","typescript",{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...QS},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...XS}]});async function _o(e,t){return(await JS).codeToHtml(e,{lang:t,theme:S0})}const Ut=x.styled(x.Card)({display:"flex",flexDirection:"column",height:"100%"}),Nn=x.styled(x.CardContent)({display:"flex",flexDirection:"column",padding:"10px",flexGrow:1}),jd=x.styled(x.CardMedia)({padding:"10px"}),ZS=x.styled("div")({height:"100%"});x.styled("div")({height:"30px",backgroundColor:"rgba(225, 240, 255, 1)",display:"flex",padding:"4px",alignItems:"center"});const k0=x.styled("div")({height:"75vh",width:"100%",overflowY:"auto"});x.styled("div")({position:"relative",height:"100%",flex:"0 0 auto"});function Xt({error:e,context:t}){const n=e.data?.message||"Unknown Error";return f.jsxs(f.Fragment,{children:[t&&f.jsx(x.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 ln({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=f.jsxs(x.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[f.jsx(x.CircularProgress,{size:t,color:n,thickness:r}),e&&f.jsx(x.Typography,{variant:i,color:"text.secondary",children:e})]});return o?f.jsx(x.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const ek=dt([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")]),Je="http://localhost/api/v0".replace(/\/+$/,"");let Zr=class{constructor(t,n=Je,r=Ye){G(this,"configuration");this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}},tk=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const at={},it="https://example.com",Ne=function(e,t,n){if(n==null)throw new tk(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Nu(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(r=>Nu(e,r,n)):Object.keys(t).forEach(r=>Nu(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const st=function(e,...t){const n=new URLSearchParams(e.search);Nu(n,t),e.search=n.toString()},Ii=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{}):e||""},lt=function(e){return e.pathname+e.search+e.hash},ct=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},nk=function(e){return{getConnection:async(t,n,r={})=>{Ne("getConnection","projectName",t),Ne("getConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},getQuerydata:async(t,n,r,o,a={})=>{Ne("getQuerydata","projectName",t),Ne("getQuerydata","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/queryData".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.sqlStatement=r),o!==void 0&&(u.options=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},getSqlsource:async(t,n,r,o={})=>{Ne("getSqlsource","projectName",t),Ne("getSqlsource","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.sqlStatement=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}},getTablesource:async(t,n,r,o,a={})=>{Ne("getTablesource","projectName",t),Ne("getTablesource","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/tableSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.tableKey=r),o!==void 0&&(u.tablePath=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},getTemporarytable:async(t,n,r,o={})=>{Ne("getTemporarytable","projectName",t),Ne("getTemporarytable","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/temporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.sqlStatement=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}},listConnections:async(t,n={})=>{Ne("listConnections","projectName",t);const r="/projects/{projectName}/connections".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},listSchemas:async(t,n,r={})=>{Ne("listSchemas","projectName",t),Ne("listSchemas","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/schemas".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},listTables:async(t,n,r,o={})=>{Ne("listTables","projectName",t),Ne("listTables","connectionName",n),Ne("listTables","schemaName",r);const a="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={};st(i,{});let d=s&&s.headers?s.headers:{};return l.headers={...c,...d,...o.headers},{url:lt(i),options:l}},testConnection:async(t,n,r={})=>{Ne("testConnection","projectName",t),Ne("testConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/test".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},testConnectionConfiguration:async(t,n={})=>{Ne("testConnectionConfiguration","connection",t);const r="/connections/test",o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",st(o,l);let c=a&&a.headers?a.headers:{};return i.headers={...s,...c,...n.headers},i.data=Ii(t,i,e),{url:lt(o),options:i}}}},or=function(e){const t=nk(e);return{async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.getConnection"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async getQuerydata(n,r,o,a,i){const s=await t.getQuerydata(n,r,o,a,i),l=e?.serverIndex??0,c=at["ConnectionsApi.getQuerydata"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async getSqlsource(n,r,o,a){const i=await t.getSqlsource(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.getSqlsource"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async getTablesource(n,r,o,a,i){const s=await t.getTablesource(n,r,o,a,i),l=e?.serverIndex??0,c=at["ConnectionsApi.getTablesource"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async getTemporarytable(n,r,o,a){const i=await t.getTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.getTemporarytable"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=at["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async listTables(n,r,o,a){const i=await t.listTables(n,r,o,a),s=e?.serverIndex??0,l=at["ConnectionsApi.listTables"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)},async testConnection(n,r,o){const a=await t.testConnection(n,r,o),i=e?.serverIndex??0,s=at["ConnectionsApi.testConnection"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async testConnectionConfiguration(n,r){const o=await t.testConnectionConfiguration(n,r),a=e?.serverIndex??0,i=at["ConnectionsApi.testConnectionConfiguration"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)}}};let A0=class extends Zr{getConnection(t,n,r){return or(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getQuerydata(t,n,r,o,a){return or(this.configuration).getQuerydata(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getSqlsource(t,n,r,o){return or(this.configuration).getSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}getTablesource(t,n,r,o,a){return or(this.configuration).getTablesource(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTemporarytable(t,n,r,o){return or(this.configuration).getTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}listConnections(t,n){return or(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return or(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listTables(t,n,r,o){return or(this.configuration).listTables(t,n,r,o).then(a=>a(this.axios,this.basePath))}testConnection(t,n,r){return or(this.configuration).testConnection(t,n,r).then(o=>o(this.axios,this.basePath))}testConnectionConfiguration(t,n){return or(this.configuration).testConnectionConfiguration(t,n).then(r=>r(this.axios,this.basePath))}};const rk=function(e){return{listDatabases:async(t,n,r,o={})=>{Ne("listDatabases","projectName",t),Ne("listDatabases","packageName",n);const a="/projects/{projectName}/packages/{packageName}/databases".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},ok=function(e){const t=rk(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=at["DatabasesApi.listDatabases"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let ak=class extends Zr{listDatabases(t,n,r,o){return ok(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ik=function(e){return{getModel:async(t,n,r,o,a={})=>{Ne("getModel","projectName",t),Ne("getModel","packageName",n),Ne("getModel","path",r);const i="/projects/{projectName}/packages/{packageName}/models/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};o!==void 0&&(u.versionId=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listModels:async(t,n,r,o={})=>{Ne("listModels","projectName",t),Ne("listModels","packageName",n);const a="/projects/{projectName}/packages/{packageName}/models".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},Op=function(e){const t=ik(e);return{async getModel(n,r,o,a,i){const s=await t.getModel(n,r,o,a,i),l=e?.serverIndex??0,c=at["ModelsApi.getModel"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listModels(n,r,o,a){const i=await t.listModels(n,r,o,a),s=e?.serverIndex??0,l=at["ModelsApi.listModels"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let Gl=class extends Zr{getModel(t,n,r,o,a){return Op(this.configuration).getModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listModels(t,n,r,o){return Op(this.configuration).listModels(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const sk=function(e){return{getNotebook:async(t,n,r,o,a={})=>{Ne("getNotebook","projectName",t),Ne("getNotebook","packageName",n),Ne("getNotebook","path",r);const i="/projects/{projectName}/packages/{packageName}/notebooks/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};o!==void 0&&(u.versionId=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listNotebooks:async(t,n,r,o={})=>{Ne("listNotebooks","projectName",t),Ne("listNotebooks","packageName",n);const a="/projects/{projectName}/packages/{packageName}/notebooks".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},Mp=function(e){const t=sk(e);return{async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),l=e?.serverIndex??0,c=at["NotebooksApi.getNotebook"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,l=at["NotebooksApi.listNotebooks"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let I0=class extends Zr{getNotebook(t,n,r,o,a){return Mp(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return Mp(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const lk=function(e){return{createPackage:async(t,n,r={})=>{Ne("createPackage","projectName",t),Ne("createPackage","body",n);const o="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"POST",...i,...r},l={},c={};l["Content-Type"]="application/json",st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},s.data=Ii(n,s,e),{url:lt(a),options:s}},deletePackage:async(t,n,r={})=>{Ne("deletePackage","projectName",t),Ne("deletePackage","packageName",n);const o="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={};st(a,{});let c=i&&i.headers?i.headers:{};return s.headers={...l,...c,...r.headers},{url:lt(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ne("getPackage","projectName",t),Ne("getPackage","packageName",n);const i="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,it);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...a},d={},u={};r!==void 0&&(u.versionId=r),o!==void 0&&(u.reload=o),st(s,u);let p=l&&l.headers?l.headers:{};return c.headers={...d,...p,...a.headers},{url:lt(s),options:c}},listPackages:async(t,n={})=>{Ne("listPackages","projectName",t);const r="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ne("updatePackage","projectName",t),Ne("updatePackage","packageName",n),Ne("updatePackage","body",r);const a="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},c={},d={};c["Content-Type"]="application/json",st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},l.data=Ii(r,l,e),{url:lt(i),options:l}}}},Fa=function(e){const t=lk(e);return{async createPackage(n,r,o){const a=await t.createPackage(n,r,o),i=e?.serverIndex??0,s=at["PackagesApi.createPackage"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=at["PackagesApi.deletePackage"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,c=at["PackagesApi.getPackage"]?.[l]?.url;return(d,u)=>ct(s,Ye,Je,e)(d,c||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=at["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=at["PackagesApi.updatePackage"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let _0=class extends Zr{createPackage(t,n,r){return Fa(this.configuration).createPackage(t,n,r).then(o=>o(this.axios,this.basePath))}deletePackage(t,n,r){return Fa(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Fa(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Fa(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Fa(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ck=function(e){return{createProject:async(t,n={})=>{Ne("createProject","body",t);const r="/projects",o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",st(o,l);let c=a&&a.headers?a.headers:{};return i.headers={...s,...c,...n.headers},i.data=Ii(t,i,e),{url:lt(o),options:i}},deleteProject:async(t,n={})=>{Ne("deleteProject","projectName",t);const r="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,it);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={};st(o,{});let l=a&&a.headers?a.headers:{};return i.headers={...s,...l,...n.headers},{url:lt(o),options:i}},getProject:async(t,n,r={})=>{Ne("getProject","projectName",t);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},c={};n!==void 0&&(c.reload=n),st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},{url:lt(a),options:s}},listProjects:async(t={})=>{const n="/projects",r=new URL(n,it);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};st(r,{});let s=o&&o.headers?o.headers:{};return a.headers={...i,...s,...t.headers},{url:lt(r),options:a}},updateProject:async(t,n,r={})=>{Ne("updateProject","projectName",t),Ne("updateProject","body",n);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,it);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},c={};l["Content-Type"]="application/json",st(a,c);let d=i&&i.headers?i.headers:{};return s.headers={...l,...d,...r.headers},s.data=Ii(n,s,e),{url:lt(a),options:s}}}},Ba=function(e){const t=ck(e);return{async createProject(n,r){const o=await t.createProject(n,r),a=e?.serverIndex??0,i=at["ProjectsApi.createProject"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async deleteProject(n,r){const o=await t.deleteProject(n,r),a=e?.serverIndex??0,i=at["ProjectsApi.deleteProject"]?.[a]?.url;return(s,l)=>ct(o,Ye,Je,e)(s,i||l)},async getProject(n,r,o){const a=await t.getProject(n,r,o),i=e?.serverIndex??0,s=at["ProjectsApi.getProject"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)},async listProjects(n){const r=await t.listProjects(n),o=e?.serverIndex??0,a=at["ProjectsApi.listProjects"]?.[o]?.url;return(i,s)=>ct(r,Ye,Je,e)(i,a||s)},async updateProject(n,r,o){const a=await t.updateProject(n,r,o),i=e?.serverIndex??0,s=at["ProjectsApi.updateProject"]?.[i]?.url;return(l,c)=>ct(a,Ye,Je,e)(l,s||c)}}};let D0=class extends Zr{createProject(t,n){return Ba(this.configuration).createProject(t,n).then(r=>r(this.axios,this.basePath))}deleteProject(t,n){return Ba(this.configuration).deleteProject(t,n).then(r=>r(this.axios,this.basePath))}getProject(t,n,r){return Ba(this.configuration).getProject(t,n,r).then(o=>o(this.axios,this.basePath))}listProjects(t){return Ba(this.configuration).listProjects(t).then(n=>n(this.axios,this.basePath))}updateProject(t,n,r){return Ba(this.configuration).updateProject(t,n,r).then(o=>o(this.axios,this.basePath))}};const uk=function(e){return{executeQuery:async(t,n,r,o,a,i,s,l={})=>{Ne("executeQuery","projectName",t),Ne("executeQuery","packageName",n),Ne("executeQuery","path",r);const c="/projects/{projectName}/packages/{packageName}/queryResults/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(c,it);let u;e&&(u=e.baseOptions);const p={method:"GET",...u,...l},h={},g={};o!==void 0&&(g.query=o),a!==void 0&&(g.sourceName=a),i!==void 0&&(g.queryName=i),s!==void 0&&(g.versionId=s),st(d,g);let b=u&&u.headers?u.headers:{};return p.headers={...h,...b,...l.headers},{url:lt(d),options:p}}}},dk=function(e){const t=uk(e);return{async executeQuery(n,r,o,a,i,s,l,c){const d=await t.executeQuery(n,r,o,a,i,s,l,c),u=e?.serverIndex??0,p=at["QueryresultsApi.executeQuery"]?.[u]?.url;return(h,g)=>ct(d,Ye,Je,e)(h,p||g)}}};let Hd=class extends Zr{executeQuery(t,n,r,o,a,i,s,l){return dk(this.configuration).executeQuery(t,n,r,o,a,i,s,l).then(c=>c(this.axios,this.basePath))}};const hk=function(e){return{listSchedules:async(t,n,r,o={})=>{Ne("listSchedules","projectName",t),Ne("listSchedules","packageName",n);const a="/projects/{projectName}/packages/{packageName}/schedules".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,it);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},c={},d={};r!==void 0&&(d.versionId=r),st(i,d);let u=s&&s.headers?s.headers:{};return l.headers={...c,...u,...o.headers},{url:lt(i),options:l}}}},pk=function(e){const t=hk(e);return{async listSchedules(n,r,o,a){const i=await t.listSchedules(n,r,o,a),s=e?.serverIndex??0,l=at["SchedulesApi.listSchedules"]?.[s]?.url;return(c,d)=>ct(i,Ye,Je,e)(c,l||d)}}};let fk=class extends Zr{listSchedules(t,n,r,o){return pk(this.configuration).listSchedules(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Jt=class{constructor(t={}){G(this,"apiKey");G(this,"username");G(this,"password");G(this,"accessToken");G(this,"basePath");G(this,"serverIndex");G(this,"baseOptions");G(this,"formDataCtor");this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){const n=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(n.test(t)||t.toLowerCase()==="application/json-patch+json")}};const w0=$.createContext(void 0),ul=({projectName:e,packageName:t,versionId:n,children:r})=>f.jsx(w0.Provider,{value:{projectName:e,packageName:t,versionId:n},children:r});function Pn(e=!0){const t=$.useContext(w0);if(!t&&e)throw new Error("usePackage must be used within a PackageProvider");return t}const mk=new Hd(new Jt),gk=mt(ze.Box)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.5),borderBottom:`1px solid ${e.palette.divider}`,minHeight:36})),yk=mt(x.Button)(({theme:e,selected:t})=>({minHeight:36,padding:e.spacing(.5,2),borderRadius:e.shape.borderRadius,background:t?e.palette.action.selected:"none",color:t?e.palette.primary.main:e.palette.text.primary,fontWeight:t?600:400,border:t?`1px solid ${e.palette.primary.main}`:"1px solid transparent",boxShadow:t?e.shadows[1]:"none",textTransform:"uppercase","&:hover":{background:e.palette.action.hover,border:`1px solid ${e.palette.primary.light}`}}));function N0({sourceAndPaths:e,existingQuery:t,existingSourceName:n,onQueryChange:r,onSourceChange:o}){const[a,i]=$.useState(n?e.findIndex(c=>c.sourceInfo.name===n):0),[s,l]=$.useState(t||ci());return $.useEffect(()=>{o&&o(a)},[a,o]),f.jsxs(Ut,{variant:"outlined",children:[f.jsx(Nn,{children:f.jsx(ze.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:e.length>0&&f.jsx(gk,{children:e.map((c,d)=>f.jsx(yk,{selected:a===d,onClick:()=>i(d),children:c.sourceInfo.name||`Source ${d+1}`},c.sourceInfo.name||d))})})}),f.jsx(jd,{children:f.jsxs(ze.Stack,{spacing:2,component:"section",children:[f.jsx(P0,{sourceAndPath:e[a],existingQuery:s,onChange:c=>{l(c),r&&r(c)}}),f.jsx(ze.Box,{height:"5px"})]})})]})}function ci(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function bk({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o}){const[a,i]=$.useState(n||ci()),[s,l]=$.useState([]),{MalloyExplorerProvider:c,QueryPanel:d,ResizableCollapsiblePanel:u,ResultPanel:p,SourcePanel:h}=r;$.useEffect(()=>{t&&t(a)},[t,a]);const{projectName:g,packageName:b,versionId:T}=Pn(),E=fF({mutationFn:(N,S)=>{const M=new o.ASTQuery({source:e.sourceInfo,query:a?.malloyQuery}).toMalloy();return i({...a,query:M}),mk.executeQuery(g,b,e.modelPath,M,void 0,void 0,T,S)},onSuccess:N=>{if(N){const S=JSON.parse(N.data.result);i({...a,malloyResult:S})}}}),[v,C]=$.useState(e.sourceInfo.name);$.useEffect(()=>{v!==e.sourceInfo.name&&(C(e.sourceInfo.name),i(ci()))},[e,v]);const A=$.useCallback(N=>{i({...a,malloyQuery:N,malloyResult:void 0})},[a]);return v!==e.sourceInfo.name?f.jsx("div",{children:"Loading..."}):f.jsx(k0,{children:f.jsx(c,{source:e.sourceInfo,query:a?.malloyQuery,onQueryChange:A,focusedNestViewPath:s,onFocusedNestViewPathChange:l,onDrill:N=>{console.info(N)},children:f.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[f.jsx(u,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:f.jsx(h,{onRefresh:()=>i(ci())})}),f.jsx(u,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:f.jsx(d,{runQuery:()=>{E.mutate()}})}),f.jsx(p,{source:e.sourceInfo,draftQuery:a?.malloyQuery,setDraftQuery:N=>i({...a,malloyQuery:N}),submittedQuery:a?.malloyQuery?{executionState:E.isPending?"running":"finished",response:{result:a.malloyResult},query:a.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:E.reset}:void 0,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function P0(e){const[t,n]=$.useState(null),[r,o]=$.useState(null),[a,i]=$.useState(!0);return $.useEffect(()=>{let s=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,c])=>{s&&(n(l),o(c),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?f.jsx(ZS,{children:f.jsx(k0,{children:f.jsx("div",{style:{alignItems:"center",justifyContent:"center",height:"200px",color:"#666"},children:"Loading explorer..."})})}):f.jsx(bk,{...e,explorerComponents:t,QueryBuilder:r})}const Ek=new Gl(new Jt);function R0(e,t){const{projectName:n,packageName:r,versionId:o}=Pn(),a=t||o;return dn({queryKey:["package",n,r,e,a],queryFn:async i=>(await Ek.getModel(n,r,e,a,i)).data})}const L0=dt(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"})),Tk=$.lazy(()=>Promise.resolve().then(()=>require("./index.es23-D9KeGh71.cjs")));function $0({result:e,minHeight:t,maxHeight:n}){const[r,o]=$.useState(!1),[a,i]=$.useState(0),[s,l]=$.useState(!1),c=$.useRef(null),d=$.useRef(null),[u,p]=$.useState(void 0),[h,g]=$.useState(!1),b=$.useCallback(()=>{const A=r;o(!r),A&&d.current&&setTimeout(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)},[r]),T=$.useCallback(A=>{i(A)},[]);if($.useEffect(()=>{if(h){l(!0);return}if(a===0){l(!1);return}const A=t-20,N=a>A;a<A&&p(a+20),l(N)},[a,h,t]),!e)return null;const E=f.jsx(ln,{text:"Loading...",centered:!0,size:32}),v=h?r?n-40:t-40:void 0,C=u?{minHeight:`${u}px`,height:"100%"}:{height:"100%"};return f.jsx(f.Fragment,{children:f.jsxs(x.Box,{ref:d,sx:{position:"relative",minHeight:`${t}px`,maxHeight:`${r?n:t}px`,border:"0px",borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",...C},children:[f.jsx(x.Box,{ref:c,sx:{flex:1,overflow:r?"auto":"hidden",p:0,pb:s?"40px":1},children:e&&f.jsx($.Suspense,{fallback:E,children:f.jsx(Tk,{result:e,height:v,isFillElement:A=>{g(A)},onSizeChange:T})})||E}),s&&f.jsx(x.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(x.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(mu.ExpandLess,{sx:{fontSize:30}}):f.jsx(mu.ExpandMore,{sx:{fontSize:30}})})})]})})}const O0=dt(f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),xk=new _0(new Jt);function Ck(){const{projectName:e,packageName:t,versionId:n}=Pn(),{data:r,isSuccess:o,isError:a,error:i}=dn({queryKey:["package",e,t,n],queryFn:s=>xk.getPackage(e,t,n,!1,s)});return f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),f.jsx(x.Divider,{}),f.jsx(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:f.jsxs(x.List,{dense:!0,disablePadding:!0,children:[f.jsx(x.ListItem,{dense:!0,disablePadding:!0,children:f.jsx(x.ListItemText,{primary:"Name",primaryTypographyProps:{fontWeight:"500"},secondary:t})}),!o&&!a&&f.jsx(x.ListItem,{children:f.jsx(ln,{text:"Fetching Package Metadata..."})}),o&&(r.data&&f.jsx(x.ListItem,{dense:!0,disablePadding:!0,children:f.jsx(x.ListItemText,{primary:"Description",primaryTypographyProps:{fontWeight:"500"},secondary:r.data.description})})||f.jsxs(x.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[f.jsx(O0,{sx:{color:"grey.600",mr:"10px"}}),f.jsx(x.ListItemText,{primary:"No package manifest"})]})),a&&f.jsx(Xt,{error:i,context:`${e} > ${t} > ${n}`})]})})]})})}const vk=dt(f.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Sk=new D0(new Jt);function kk(){const{projectName:e}=Wi(),{data:t,isSuccess:n,isError:r,error:o}=dn({queryKey:["about",e],queryFn:a=>Sk.getProject(e,!1,a)});return f.jsxs(f.Fragment,{children:[!n&&!r&&f.jsx(ln,{text:"Fetching About..."}),n&&t.data?.readme&&f.jsxs(Ut,{variant:"outlined",sx:{p:2},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Readme"}),f.jsx(Ut,{sx:{p:1},children:f.jsx(bd,{children:t.data.readme})})]}),r&&f.jsx(Xt,{error:o,context:`${e} > About`})]})}const Ak=new _0(new Jt);function Ik({navigate:e}){const{projectName:t}=Wi(),{data:n,isSuccess:r,isError:o,error:a}=dn({queryKey:["packages",t],queryFn:i=>Ak.listPackages(t,i)});return f.jsxs(f.Fragment,{children:[!r&&!o&&f.jsx(ln,{text:"Fetching Packages..."}),r&&f.jsxs(Ut,{variant:"outlined",sx:{p:2},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",sx:{mb:1},children:"Packages"}),f.jsx(x.Grid,{container:!0,spacing:2,columns:12,children:n.data.sort((i,s)=>i.name.localeCompare(s.name)).map(i=>f.jsx(x.Grid,{size:{xs:12,sm:12,md:12,lg:4},children:f.jsx(Ut,{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:s=>e(i.name,s),children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",color:"primary.main",children:i.name}),f.jsx(x.Box,{sx:{maxHeight:"120px",overflowY:"auto"},children:f.jsx(x.Typography,{variant:"body2",children:i.description})})]})})},i.name))})]}),o&&f.jsx(Xt,{error:a,context:`${t} > Packages`})]})}const M0=$.createContext(void 0);function Wi(){const e=$.useContext(M0);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function F0({children:e,projectName:t}){return f.jsx(M0.Provider,{value:{projectName:t},children:e})}function _k({navigate:e}){return f.jsxs(x.Grid,{container:!0,spacing:2,columns:12,children:[f.jsx(x.Grid,{size:{xs:12,md:12},children:f.jsx(Ik,{navigate:e})}),f.jsx(x.Grid,{size:{xs:12,md:12},children:f.jsx(kk,{})})]})}const Ud=new A0(new Jt);function Dk({connectionName:e,schema:t}){const{projectName:n}=Wi(),[r,o]=$.useState(void 0),[a,i]=$.useState(t||null),[s,l]=$.useState(!1),{data:c,isSuccess:d,isError:u,error:p,isLoading:h}=dn({queryKey:["tablePath",n,e],queryFn:g=>Ud.listSchemas(n,e,g)});return f.jsxs(x.Grid,{container:!0,spacing:1,children:[!t&&f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsxs(x.Paper,{sx:{p:1,m:0},children:[f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),f.jsx(x.FormControlLabel,{control:f.jsx(x.Switch,{checked:s,onChange:g=>l(g.target.checked)}),label:"Hidden Schemas"})]}),f.jsx(x.Divider,{sx:{mt:"2px"}}),f.jsxs(x.Box,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[h&&f.jsx(ln,{text:"Fetching Table Paths..."}),u&&f.jsx(Xt,{error:p,context:`${n} > ${e}`}),d&&c.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Schemas"}),d&&c.data.length>0&&f.jsx(x.List,{dense:!0,disablePadding:!0,children:c.data.filter(({isHidden:g})=>s||!g).sort((g,b)=>g.isDefault===b.isDefault?0:g.isDefault?-1:1).map(g=>{const b=(g.description||"").trim(),T=b!=="",E=T?b.split(/\r?\n/)[0]:void 0,v=f.jsx(x.ListItemButton,{selected:a===g.name,onClick:()=>i(g.name),children:f.jsx(x.ListItemText,{primary:g.name,secondary:E})},g.name);return T?f.jsx(x.Tooltip,{title:b,arrow:!0,children:v},g.name):v})})]})]})}),f.jsx(x.Grid,{size:{xs:12,md:t?6:4},children:a&&f.jsx(x.Paper,{sx:{p:1,m:0},children:f.jsx(Nk,{connectionName:e,schemaName:a,onTableClick:g=>{o(g)}})})}),f.jsx(x.Grid,{size:{xs:12,md:t?6:4},children:r&&a&&f.jsx(x.Paper,{sx:{p:1,m:0},children:f.jsx(wk,{connectionName:e,schemaName:a,tableName:r})})})]})}function wk({connectionName:e,schemaName:t,tableName:n}){const{projectName:r}=Wi(),{data:o,isSuccess:a,isError:i,error:s,isLoading:l}=dn({queryKey:["tablePathSchema",r,e,t,n],queryFn:c=>Ud.getTablesource(r,e,n,`${t}.${n}`,c)});return f.jsxs(f.Fragment,{children:[f.jsxs(x.Typography,{variant:"overline",fontWeight:"bold",children:["Schema: ",t,".",n]}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:[l&&f.jsx(ln,{text:"Fetching Table Details..."}),i&&f.jsx(Xt,{error:s,context:`${r} > ${e} > ${t}.${n}`}),a&&o&&f.jsx(x.TableContainer,{children:f.jsxs(x.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"NAME"}),f.jsx(x.TableCell,{children:"TYPE"})]})}),f.jsx(x.TableBody,{children:o.data.columns?.map(c=>f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:c.name}),f.jsx(x.TableCell,{children:c.type})]},c.name))})]})})]})]})}function Nk({connectionName:e,schemaName:t,onTableClick:n}){const{projectName:r}=Wi(),{data:o,isSuccess:a,isError:i,error:s,isLoading:l}=dn({queryKey:["tablesInSchema",r,e,t],queryFn:c=>Ud.listTables(r,e,t,c)});return f.jsxs(f.Fragment,{children:[f.jsxs(x.Typography,{variant:"overline",fontWeight:"bold",children:["Tables in ",t]}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[l&&f.jsx(ln,{text:"Fetching Tables..."}),i&&f.jsx(Xt,{error:s,context:`${r} > ${e} > ${t}`}),a&&o.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Tables"}),a&&o.data.length>0&&f.jsx(x.List,{dense:!0,disablePadding:!0,children:o.data.map(c=>f.jsx(x.ListItemButton,{onClick:()=>n(c),children:f.jsx(x.ListItemText,{primary:c})},c))})]})]})}const Pk=new A0(new Jt);function Rk({connection:e,onClick:t}){return f.jsxs(x.TableRow,{onClick:t,sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:[f.jsx(x.TableCell,{children:f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[f.jsx(x.Typography,{variant:"body2",children:e.name}),f.jsx(vk,{sx:{fontSize:"1rem",color:"action.active",opacity:.7}})]})}),f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"body2",children:e.type})})]},e.name)}function Lk(){const{projectName:e}=Pn(),[t,n]=$.useState(null),{data:r,isSuccess:o,isError:a,error:i}=dn({queryKey:["connections",e],queryFn:c=>Pk.listConnections(e,c)}),s=c=>{n(c)},l=()=>{n(null)};return f.jsxs(F0,{projectName:e,children:[f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!o&&!a&&f.jsx(x.Typography,{variant:"body2",sx:{m:"auto"},children:"Fetching Connections..."}),o&&r.data.length>0&&f.jsx(x.Table,{size:"small",children:f.jsxs(x.TableBody,{children:[f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),f.jsx(x.TableCell,{children:f.jsx(x.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),r.data.map(c=>f.jsx(Rk,{connection:c,onClick:()=>s(c.name)},c.name))]})}),o&&r.data.length===0&&f.jsx(x.Typography,{variant:"body2",children:"No Connections"}),a&&f.jsx(Xt,{error:i,context:`${e} > Connections`})]})]})}),f.jsxs(x.Dialog,{open:t!==null,onClose:l,maxWidth:"lg",fullWidth:!0,children:[f.jsxs(x.DialogTitle,{children:["Connection Explorer: ",t,f.jsx(x.IconButton,{"aria-label":"close",onClick:l,sx:{position:"absolute",right:8,top:8},children:f.jsx(x.Box,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),f.jsx(x.DialogContent,{children:t&&f.jsx(Dk,{connectionName:t})})]})]})}const $k=new ak(new Jt);function Ok(){const{projectName:e,packageName:t,versionId:n}=Pn(),[r,o]=$.useState(!1),[a,i]=$.useState(null),s=g=>{i(g),o(!0)},l=()=>{o(!1),i(null)},{data:c,isError:d,error:u,isSuccess:p}=dn({queryKey:["databases",e,t,n],queryFn:g=>$k.listDatabases(e,t,n,g)}),h=g=>g>=1024*1024*1024*1024?`${(g/(1024*1024*1024)).toFixed(2)} T`:g>=1024*1024*1024?`${(g/(1024*1024*1024)).toFixed(2)} G`:g>=1024*1024?`${(g/(1024*1024)).toFixed(2)} M`:`${(g/1024).toFixed(2)} K`;return f.jsxs(f.Fragment,{children:[f.jsx(Ut,{variant:"outlined",sx:{width:"100%"},children:f.jsxs(Nn,{children:[f.jsx(x.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),f.jsx(x.Divider,{}),f.jsxs(x.Box,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!p&&!d&&f.jsx(ln,{text:"Fetching Databases..."}),d&&f.jsx(Xt,{error:u,context:`${e} > ${t} > Databases`}),p&&c.data.length>0&&f.jsxs(x.Table,{size:"small",children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"Name"}),f.jsx(x.TableCell,{align:"right",children:"Rows"})]})}),f.jsx(x.TableBody,{children:c.data.map(g=>f.jsxs(x.TableRow,{onClick:()=>s(g),sx:{cursor:"pointer"},children:[f.jsx(x.TableCell,{component:"th",scope:"row",children:g.path}),f.jsx(x.TableCell,{align:"right",children:h(g.info.rowCount)})]},g.path))})]}),p&&c.data.length===0&&f.jsx(x.Typography,{variant:"body2",sx:{m:"auto"},children:"No databases found"})]})]})}),f.jsxs(x.Dialog,{open:r,onClose:l,maxWidth:"sm",fullWidth:!0,children:[f.jsx(x.DialogTitle,{children:a?.path}),f.jsx(x.DialogContent,{children:a?.info?.columns&&f.jsx(x.TableContainer,{children:f.jsxs(x.Table,{size:"small",children:[f.jsx(x.TableHead,{children:f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{children:"Column"}),f.jsx(x.TableCell,{children:"Type"})]})}),f.jsx(x.TableBody,{children:a.info.columns.map(g=>f.jsxs(x.TableRow,{children:[f.jsx(x.TableCell,{component:"th",scope:"row",children:g.name}),f.jsx(x.TableCell,{children:g.type})]},g.name))})]})})})]})]})}function re(){return re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},re.apply(null,arguments)}const B0=(e,t)=>{let n=t.length-1;for(;n>=0&&!e.isItemNavigable(t[n]);)n-=1;if(n!==-1)return t[n]},j0=(e,t)=>{const n=e.getItemMeta(t),r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(t);if(o===0)return n.parentId;let a=o-1;for(;!e.isItemNavigable(r[a])&&a>=0;)a-=1;if(a===-1)return n.parentId==null?null:j0(e,n.parentId);let i=r[a],s=B0(e,e.getItemOrderedChildrenIds(i));for(;e.isItemExpanded(i)&&s!=null;)i=s,s=e.getItemOrderedChildrenIds(i).find(e.isItemNavigable);return i},Ls=(e,t)=>{if(e.isItemExpanded(t)){const r=e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);if(r!=null)return r}let n=e.getItemMeta(t);for(;n!=null;){const r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(n.id);if(o<r.length-1){let a=o+1;for(;!e.isItemNavigable(r[a])&&a<r.length-1;)a+=1;if(e.isItemNavigable(r[a]))return r[a]}n=e.getItemMeta(n.parentId)}return null},H0=e=>{let t=null;for(;t==null||e.isItemExpanded(t);){const n=e.getItemOrderedChildrenIds(t),r=B0(e,n);if(r==null)return t;t=r}return t},_i=e=>e.getItemOrderedChildrenIds(null).find(e.isItemNavigable),U0=(e,t,n)=>{if(t===n)return[t,n];const r=e.getItemMeta(t),o=e.getItemMeta(n);if(r.parentId===o.id||o.parentId===r.id)return o.parentId===r.id?[r.id,o.id]:[o.id,r.id];const a=[r.id],i=[o.id];let s=r.parentId,l=o.parentId,c=i.indexOf(s)!==-1,d=a.indexOf(l)!==-1,u=!0,p=!0;for(;!d&&!c;)u&&(a.push(s),c=i.indexOf(s)!==-1,u=s!==null,!c&&u&&(s=e.getItemMeta(s).parentId)),p&&!c&&(i.push(l),d=a.indexOf(l)!==-1,p=l!==null,!d&&p&&(l=e.getItemMeta(l).parentId));const h=c?s:l,g=e.getItemOrderedChildrenIds(h),b=a[a.indexOf(h)-1],T=i[i.indexOf(h)-1];return g.indexOf(b)<g.indexOf(T)?[t,n]:[n,t]},Mk=(e,t,n)=>{const r=l=>{if(e.isItemExpandable(l)&&e.isItemExpanded(l))return e.getItemOrderedChildrenIds(l)[0];let c=e.getItemMeta(l);for(;c!=null;){const d=e.getItemOrderedChildrenIds(c.parentId),u=e.getItemIndex(c.id);if(u<d.length-1)return d[u+1];c=e.getItemMeta(c.parentId)}throw new Error("Invalid range")},[o,a]=U0(e,t,n),i=[o];let s=o;for(;s!==a;)s=r(s),e.isItemDisabled(s)||i.push(s);return i},Fk=e=>{let t=_i(e);const n=[];for(;t!=null;)n.push(t),t=Ls(e,t);return n},Di=(e,t)=>t!==e.closest('*[role="treeitem"]');let Fp=0;const Bk=()=>(Fp+=1,`mui-tree-view-${Fp}`),zd=({id:e,treeId:t="",itemId:n})=>e??`${t}-${n}`,z0=_.createContext(null),Mo=()=>{const e=_.useContext(z0);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
28
28
|
`));return e},Gd=_.createContext(()=>-1),Co=(e,t)=>e.getAvailablePlugins().has(t),jk=({props:e})=>{const{instance:t}=Mo(),{label:n,itemId:r}=e,[o,a]=_.useState(n),i=t.isItemBeingEdited(r);return _.useEffect(()=>{i||a(n)},[i,n]),{propsEnhancers:{labelInput:({externalEventHandlers:s,interactions:l})=>t.isItemEditable(r)?{value:o??"","data-element":"labelInput",onChange:c=>{s.onChange?.(c),a(c.target.value)},onKeyDown:c=>{if(s.onKeyDown?.(c),c.defaultMuiPrevented)return;const d=c.target;c.key==="Enter"&&d.value?l.handleSaveItemLabel(c,d.value):c.key==="Escape"&&l.handleCancelItemLabelEditing(c)},onBlur:c=>{s.onBlur?.(c),!c.defaultMuiPrevented&&c.target.value&&l.handleSaveItemLabel(c,c.target.value)},autoFocus:!0,type:"text"}:{}}}},zn=({instance:e,state:t,setState:n,params:r})=>{const o=_.useRef(t.editedItemId),a=u=>o.current===u,i=u=>{n(p=>re({},p,{editedItemId:u})),o.current=u},s=u=>u===t.editedItemId,l=!!r.isItemEditable,c=u=>{if(u==null||!l)return!1;const p=e.getItem(u);return p?typeof r.isItemEditable=="function"?r.isItemEditable(p):!!r.isItemEditable:!1},d=(u,p)=>{if(!p)throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.","The label of an item cannot be empty.",u].join(`
|
|
29
29
|
`));n(h=>{const g=h.items.itemMetaMap[u];return g.label!==p?re({},h,{items:re({},h.items,{itemMetaMap:re({},h.items.itemMetaMap,{[u]:re({},g,{label:p})})})}):h}),r.onItemLabelChange&&r.onItemLabelChange(u,p)};return{instance:{setEditedItemId:i,isItemBeingEdited:s,updateItemLabel:d,isItemEditable:c,isTreeViewEditable:l,isItemBeingEditedRef:a},publicAPI:{updateItemLabel:d}}};zn.itemPlugin=jk;zn.getDefaultizedParams=({params:e,experimentalFeatures:t})=>{const n=t?.labelEditing;return re({},e,{isItemEditable:n?e.isItemEditable??!1:!1})};zn.getInitialState=()=>({editedItemId:null});zn.params={onItemLabelChange:!0,isItemEditable:!0};const G0=e=>Array.isArray(e)?e.length>0&&e.some(G0):!!e,Hk=({itemId:e,children:t})=>{const{instance:n,selection:{multiSelect:r},publicAPI:o}=Mo(),a={expandable:G0(t),expanded:n.isItemExpanded(e),focused:n.isItemFocused(e),selected:n.isItemSelected(e),disabled:n.isItemDisabled(e),editing:n?.isItemBeingEdited?n?.isItemBeingEdited(e):!1,editable:n.isItemEditable?n.isItemEditable(e):!1},i=d=>{if(a.disabled)return;a.focused||n.focusItem(d,e);const u=r&&(d.shiftKey||d.ctrlKey||d.metaKey);a.expandable&&!(u&&n.isItemExpanded(e))&&n.toggleItemExpansion(d,e)},s=d=>{a.disabled||(!a.focused&&!a.editing&&n.focusItem(d,e),r&&(d.shiftKey||d.ctrlKey||d.metaKey)?d.shiftKey?n.expandSelectionRange(d,e):n.selectItem({event:d,itemId:e,keepExistingSelection:!0}):n.selectItem({event:d,itemId:e,shouldBeSelected:!0}))},l=d=>{const u=d.nativeEvent.shiftKey;r&&u?n.expandSelectionRange(d,e):n.selectItem({event:d,itemId:e,keepExistingSelection:r,shouldBeSelected:d.target.checked})},c=()=>{Co(n,zn)&&n.isItemEditable(e)&&(n.isItemBeingEdited(e)?n.setEditedItemId(null):n.setEditedItemId(e))};return{interactions:{handleExpansion:i,handleSelection:s,handleCheckboxSelection:l,toggleItemEditing:c,handleSaveItemLabel:(d,u)=>{Co(n,zn)&&n.isItemBeingEditedRef(e)&&(n.updateItemLabel(e,u),c(),n.focusItem(d,e))},handleCancelItemLabelEditing:d=>{Co(n,zn)&&n.isItemBeingEditedRef(e)&&(c(),n.focusItem(d,e))}},status:a,publicAPI:o}};function fr(...e){const t=_.useRef(void 0),n=_.useCallback(r=>{const o=e.map(a=>{if(a==null)return null;if(typeof a=="function"){const i=a,s=i(r);return typeof s=="function"?s:()=>{i(null)}}return a.current=r,()=>{a.current=null}});return()=>{o.forEach(a=>a?.())}},e);return _.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Ln(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}const Uk=e=>{const{runItemPlugins:t,items:{onItemClick:n,disabledItemsFocusable:r,indentationAtItemLevel:o},selection:{disableSelection:a,checkboxSelection:i},expansion:{expansionTrigger:s},treeId:l,instance:c,publicAPI:d}=Mo(),u=_.useContext(Gd),{id:p,itemId:h,label:g,children:b,rootRef:T}=e,{rootRef:E,contentRef:v,propsEnhancers:C}=t(e),{interactions:A,status:N}=Hk({itemId:h,children:b}),S=_.useRef(null),M=_.useRef(null),q=fr(T,E,S),j=fr(v,M),y=_.useRef(null),R=zd({itemId:h,treeId:l,id:p}),F=c.canItemBeTabbed(h)?0:-1,O={rootRefObject:S,contentRefObject:M,interactions:A},U=J=>k=>{if(J.onFocus?.(k),k.defaultMuiPrevented)return;const V=!N.disabled||r;!N.focused&&V&&k.currentTarget===k.target&&c.focusItem(k,h)},X=J=>k=>{if(J.onBlur?.(k),k.defaultMuiPrevented)return;const V=c.getItemDOMElement(h);N.editing||k.relatedTarget&&Di(k.relatedTarget,V)&&(k.target&&k.target?.dataset?.element==="labelInput"&&Di(k.target,V)||k.relatedTarget?.dataset?.element==="labelInput")||c.removeFocusedItem()},ne=J=>k=>{J.onKeyDown?.(k),!(k.defaultMuiPrevented||k.target?.dataset?.element==="labelInput")&&c.handleItemKeyDown(k,h)},me=J=>k=>{J.onDoubleClick?.(k),!k.defaultMuiPrevented&&A.toggleItemEditing()},se=J=>k=>{J.onClick?.(k),n?.(k,h),!(k.defaultMuiPrevented||y.current?.contains(k.target))&&(s==="content"&&A.handleExpansion(k),i||A.handleSelection(k))},Z=J=>k=>{J.onMouseDown?.(k),!k.defaultMuiPrevented&&(k.shiftKey||k.ctrlKey||k.metaKey||N.disabled)&&k.preventDefault()},D=J=>k=>{J.onChange?.(k),!k.defaultMuiPrevented&&(a||N.disabled||A.handleCheckboxSelection(k))},Ee=J=>k=>{J.onClick?.(k),!k.defaultMuiPrevented&&s==="iconContainer"&&A.handleExpansion(k)};return{getRootProps:(J={})=>{const k=re({},Ln(e),Ln(J));let V;N.selected?V=!0:a||N.disabled?V=void 0:V=!1;const he=re({},k,{ref:q,role:"treeitem",tabIndex:F,id:R,"aria-expanded":N.expandable?N.expanded:void 0,"aria-selected":V,"aria-disabled":N.disabled||void 0},J,{onFocus:U(k),onBlur:X(k),onKeyDown:ne(k)});o&&(he.style={"--TreeView-itemDepth":typeof u=="function"?u(h):u});const de=C.root?.(re({},O,{externalEventHandlers:k}))??{};return re({},he,de)},getContentProps:(J={})=>{const k=Ln(J),V=re({},k,J,{ref:j,onClick:se(k),onMouseDown:Z(k),status:N});o&&(V.indentationAtItemLevel=!0);const he=C.content?.(re({},O,{externalEventHandlers:k}))??{};return re({},V,he)},getGroupTransitionProps:(J={})=>{const k=Ln(J),V=re({},k,{unmountOnExit:!0,component:"ul",role:"group",in:N.expanded,children:b},J);return o&&(V.indentationAtItemLevel=!0),V},getIconContainerProps:(J={})=>{const k=Ln(J);return re({},k,J,{onClick:Ee(k)})},getCheckboxProps:(J={})=>{const k=Ln(J);return re({},k,{visible:i,ref:y,checked:N.selected,disabled:a||N.disabled,tabIndex:-1},J,{onChange:D(k)})},getLabelProps:(J={})=>{const k=re({},Ln(J)),V=re({},k,{children:g},J,{onDoubleClick:me(k)});return c.isTreeViewEditable&&(V.editable=N.editable),V},getLabelInputProps:(J={})=>{const k=Ln(J),V=C.labelInput?.({rootRefObject:S,contentRefObject:M,externalEventHandlers:k,interactions:A})??{};return re({},J,V)},getDragAndDropOverlayProps:(J={})=>{const k=Ln(J),V=C.dragAndDropOverlay?.(re({},O,{externalEventHandlers:k}))??{};return re({},J,V)},rootRef:q,status:N,publicAPI:d}},zk=Uk,Gk=dt(f.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"})),qk=dt([f.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"),f.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Wk=dt(f.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"})),Vk=dt(f.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"}));function Yk(){const e=ze.useTheme(Dd);return e[wd]||e}function Bp(e,t){const{timeout:n,easing:r,style:o={}}=e;return{duration:o.transitionDuration??(typeof n=="number"?n:n[t.mode]||0),easing:o.transitionTimingFunction??(typeof r=="object"?r[t.mode]:r),delay:o.transitionDelay}}function Kk(e){return Xr("MuiCollapse",e)}Jr("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);function an(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Pu(e,t){return Pu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Pu(e,t)}function q0(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Pu(e,t)}const jp={disabled:!1},dl=$.createContext(null);var Qk=function(e){return e.scrollTop},ni="unmounted",lo="exited",co="entering",aa="entered",Ru="exiting",Lr=function(e){q0(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=o,s=i&&!i.isMounting?r.enter:r.appear,l;return a.appearStatus=null,r.in?s?(l=lo,a.appearStatus=co):l=aa:r.unmountOnExit||r.mountOnEnter?l=ni:l=lo,a.state={status:l},a.nextCallback=null,a}t.getDerivedStateFromProps=function(r,o){var a=r.in;return a&&o.status===ni?{status:lo}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(r){var o=null;if(r!==this.props){var a=this.state.status;this.props.in?a!==co&&a!==aa&&(o=co):(a===co||a===aa)&&(o=Ru)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var r=this.props.timeout,o,a,i;return o=a=i=r,r!=null&&typeof r!="number"&&(o=r.exit,a=r.enter,i=r.appear!==void 0?r.appear:a),{exit:o,enter:a,appear:i}},n.updateStatus=function(r,o){if(r===void 0&&(r=!1),o!==null)if(this.cancelNextCallback(),o===co){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ja.findDOMNode(this);a&&Qk(a)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===lo&&this.setState({status:ni})},n.performEnter=function(r){var o=this,a=this.props.enter,i=this.context?this.context.isMounting:r,s=this.props.nodeRef?[i]:[Ja.findDOMNode(this),i],l=s[0],c=s[1],d=this.getTimeouts(),u=i?d.appear:d.enter;if(!r&&!a||jp.disabled){this.safeSetState({status:aa},function(){o.props.onEntered(l)});return}this.props.onEnter(l,c),this.safeSetState({status:co},function(){o.props.onEntering(l,c),o.onTransitionEnd(u,function(){o.safeSetState({status:aa},function(){o.props.onEntered(l,c)})})})},n.performExit=function(){var r=this,o=this.props.exit,a=this.getTimeouts(),i=this.props.nodeRef?void 0:Ja.findDOMNode(this);if(!o||jp.disabled){this.safeSetState({status:lo},function(){r.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:Ru},function(){r.props.onExiting(i),r.onTransitionEnd(a.exit,function(){r.safeSetState({status:lo},function(){r.props.onExited(i)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(r,o){o=this.setNextCallback(o),this.setState(r,o)},n.setNextCallback=function(r){var o=this,a=!0;return this.nextCallback=function(i){a&&(a=!1,o.nextCallback=null,r(i))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(r,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Ja.findDOMNode(this),i=r==null&&!this.props.addEndListener;if(!a||i){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var s=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],l=s[0],c=s[1];this.props.addEndListener(l,c)}r!=null&&setTimeout(this.nextCallback,r)},n.render=function(){var r=this.state.status;if(r===ni)return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var i=an(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return $.createElement(dl.Provider,{value:null},typeof a=="function"?a(r,i):$.cloneElement($.Children.only(a),i))},t}($.Component);Lr.contextType=dl;Lr.propTypes={};function Ko(){}Lr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ko,onEntering:Ko,onEntered:Ko,onExit:Ko,onExiting:Ko,onExited:Ko};Lr.UNMOUNTED=ni;Lr.EXITED=lo;Lr.ENTERING=co;Lr.ENTERED=aa;Lr.EXITING=Ru;const Hp={};function W0(e,t){const n=_.useRef(Hp);return n.current===Hp&&(n.current=e(t)),n}const Xk=[];function Jk(e){_.useEffect(e,Xk)}let Zk=class V0{constructor(){G(this,"currentId",null);G(this,"clear",()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)});G(this,"disposeEffect",()=>this.clear)}static create(){return new V0}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}};function Y0(){const e=W0(Zk.create).current;return Jk(e.disposeEffect),e}const eA=e=>{const{orientation:t,classes:n}=e,r={root:["root",`${t}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${t}`],wrapperInner:["wrapperInner",`${t}`]};return $o(r,Kk,n)},tA=mt("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.state==="entered"&&t.entered,n.state==="exited"&&!n.in&&n.collapsedSize==="0px"&&t.hidden]}})(Ed(({theme:e})=>({height:0,overflow:"hidden",transition:e.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:e.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:t})=>t.state==="exited"&&!t.in&&t.collapsedSize==="0px",style:{visibility:"hidden"}}]}))),nA=mt("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),rA=mt("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),wi=_.forwardRef(function(e,t){const n=Ca({props:e,name:"MuiCollapse"}),{addEndListener:r,children:o,className:a,collapsedSize:i="0px",component:s,easing:l,in:c,onEnter:d,onEntered:u,onEntering:p,onExit:h,onExited:g,onExiting:b,orientation:T="vertical",style:E,timeout:v=_g.standard,TransitionComponent:C=Lr,...A}=n,N={...n,orientation:T,collapsedSize:i},S=eA(N),M=Yk(),q=Y0(),j=_.useRef(null),y=_.useRef(),R=typeof i=="number"?`${i}px`:i,F=T==="horizontal",O=F?"width":"height",U=_.useRef(null),X=fr(t,U),ne=V=>he=>{if(V){const de=U.current;he===void 0?V(de):V(de,he)}},me=()=>j.current?j.current[F?"clientWidth":"clientHeight"]:0,se=ne((V,he)=>{j.current&&F&&(j.current.style.position="absolute"),V.style[O]=R,d&&d(V,he)}),Z=ne((V,he)=>{const de=me();j.current&&F&&(j.current.style.position="");const{duration:ye,easing:fe}=Bp({style:E,timeout:v,easing:l},{mode:"enter"});if(v==="auto"){const Fe=M.transitions.getAutoHeightDuration(de);V.style.transitionDuration=`${Fe}ms`,y.current=Fe}else V.style.transitionDuration=typeof ye=="string"?ye:`${ye}ms`;V.style[O]=`${de}px`,V.style.transitionTimingFunction=fe,p&&p(V,he)}),D=ne((V,he)=>{V.style[O]="auto",u&&u(V,he)}),Ee=ne(V=>{V.style[O]=`${me()}px`,h&&h(V)}),J=ne(g),k=ne(V=>{const he=me(),{duration:de,easing:ye}=Bp({style:E,timeout:v,easing:l},{mode:"exit"});if(v==="auto"){const fe=M.transitions.getAutoHeightDuration(he);V.style.transitionDuration=`${fe}ms`,y.current=fe}else V.style.transitionDuration=typeof de=="string"?de:`${de}ms`;V.style[O]=R,V.style.transitionTimingFunction=ye,b&&b(V)});return f.jsx(C,{in:c,onEnter:se,onEntered:D,onEntering:Z,onExit:Ee,onExited:J,onExiting:k,addEndListener:V=>{v==="auto"&&q.start(y.current||0,V),r&&r(U.current,V)},nodeRef:U,timeout:v==="auto"?null:v,...A,children:(V,{ownerState:he,...de})=>f.jsx(tA,{as:s,className:Mt(S.root,a,{entered:S.entered,exited:!c&&R==="0px"&&S.hidden}[V]),style:{[F?"minWidth":"minHeight"]:R,...E},ref:X,ownerState:{...N,state:V},...de,children:f.jsx(nA,{ownerState:{...N,state:V},className:S.wrapper,ref:j,children:f.jsx(rA,{ownerState:{...N,state:V},className:S.wrapperInner,children:o})})})})});wi&&(wi.muiSupportAuto=!0);function ql(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wc={exports:{}},Nc,Up;function oA(){if(Up)return Nc;Up=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Nc=e,Nc}var Pc,zp;function aA(){if(zp)return Pc;zp=1;var e=oA();function t(){}function n(){}return n.resetWarningCache=t,Pc=function(){function r(i,s,l,c,d,u){if(u!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function o(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},Pc}var Gp;function iA(){return Gp||(Gp=1,wc.exports=aA()()),wc.exports}var sA=iA();const qp=ql(sA);function qd(e){const{children:t,itemId:n}=e,{wrapItem:r,instance:o}=Mo();return r({children:t,itemId:n,instance:o})}qd.propTypes={children:qp.node,itemId:qp.string.isRequired};const lA=_.createContext(void 0);function cA(){return _.useContext(lA)}function uA(e){return Xr("PrivateSwitchBase",e)}Jr("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);function cr(e,t,n){return typeof e=="function"?e(t,n):e}function Wp(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function K0(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:a}=e;if(!t){const h=Mt(n?.className,a,o?.className,r?.className),g={...n?.style,...o?.style,...r?.style},b={...n,...o,...r};return h.length>0&&(b.className=h),Object.keys(g).length>0&&(b.style=g),{props:b,internalRef:void 0}}const i=Ln({...o,...r}),s=Wp(r),l=Wp(o),c=t(i),d=Mt(c?.className,n?.className,a,o?.className,r?.className),u={...c?.style,...n?.style,...o?.style,...r?.style},p={...c,...n,...l,...s};return d.length>0&&(p.className=d),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:c.ref}}function dA(e){return typeof e=="string"}function Q0(e,t,n){return e===void 0||dA(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Lu(e,t){const{className:n,elementType:r,ownerState:o,externalForwardedProps:a,internalForwardedProps:i,shouldForwardComponentProp:s=!1,...l}=t,{component:c,slots:d={[e]:void 0},slotProps:u={[e]:void 0},...p}=a,h=d[e]||r,g=cr(u[e],o),{props:{component:b,...T},internalRef:E}=K0({className:n,...l,externalForwardedProps:e==="root"?p:void 0,externalSlotProps:g}),v=fr(E,g?.ref,t.ref),C=e==="root"?b||c:b,A=Q0(h,{...e==="root"&&!c&&!d[e]&&i,...e!=="root"&&!d[e]&&i,...T,...C&&!s&&{as:C},...C&&s&&{component:C},ref:v},o);return[h,A]}function hA(e){const{controlled:t,default:n}=e,{current:r}=_.useRef(t!==void 0),[o,a]=_.useState(n),i=r?t:o,s=_.useCallback(l=>{r||a(l)},[]);return[i,s]}function pA(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:a,rippleSize:i,in:s,onExited:l,timeout:c}=e,[d,u]=_.useState(!1),p=Mt(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),h={width:i,height:i,top:-(i/2)+a,left:-(i/2)+o},g=Mt(n.child,d&&n.childLeaving,r&&n.childPulsate);return!s&&!d&&u(!0),_.useEffect(()=>{if(!s&&l!=null){const b=setTimeout(l,c);return()=>{clearTimeout(b)}}},[l,s,c]),f.jsx("span",{className:p,style:h,children:f.jsx("span",{className:g})})}const On=Jr("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);function fA(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wd(e,t){var n=function(o){return t&&$.isValidElement(o)?t(o):o},r=Object.create(null);return e&&$.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function mA(e,t){e=e||{},t=t||{};function n(d){return d in t?t[d]:e[d]}var r=Object.create(null),o=[];for(var a in e)a in t?o.length&&(r[a]=o,o=[]):o.push(a);var i,s={};for(var l in t){if(r[l])for(i=0;i<r[l].length;i++){var c=r[l][i];s[r[l][i]]=n(c)}s[l]=n(l)}for(i=0;i<o.length;i++)s[o[i]]=n(o[i]);return s}function mo(e,t,n){return n[t]!=null?n[t]:e.props[t]}function gA(e,t){return Wd(e.children,function(n){return $.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:mo(n,"appear",e),enter:mo(n,"enter",e),exit:mo(n,"exit",e)})})}function yA(e,t,n){var r=Wd(e.children),o=mA(t,r);return Object.keys(o).forEach(function(a){var i=o[a];if($.isValidElement(i)){var s=a in t,l=a in r,c=t[a],d=$.isValidElement(c)&&!c.props.in;l&&(!s||d)?o[a]=$.cloneElement(i,{onExited:n.bind(null,i),in:!0,exit:mo(i,"exit",e),enter:mo(i,"enter",e)}):!l&&s&&!d?o[a]=$.cloneElement(i,{in:!1}):l&&s&&$.isValidElement(c)&&(o[a]=$.cloneElement(i,{onExited:n.bind(null,i),in:c.props.in,exit:mo(i,"exit",e),enter:mo(i,"enter",e)}))}}),o}var bA=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},EA={component:"div",childFactory:function(e){return e}},Vd=function(e){q0(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=a.handleExited.bind(fA(a));return a.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},a}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(r,o){var a=o.children,i=o.handleExited,s=o.firstRender;return{children:s?gA(r,i):yA(r,a,i),firstRender:!1}},n.handleExited=function(r,o){var a=Wd(this.props.children);r.key in a||(r.props.onExited&&r.props.onExited(o),this.mounted&&this.setState(function(i){var s=re({},i.children);return delete s[r.key],{children:s}}))},n.render=function(){var r=this.props,o=r.component,a=r.childFactory,i=an(r,["component","childFactory"]),s=this.state.contextValue,l=bA(this.state.children).map(a);return delete i.appear,delete i.enter,delete i.exit,o===null?$.createElement(dl.Provider,{value:s},l):$.createElement(dl.Provider,{value:s},$.createElement(o,i,l))},t}($.Component);Vd.propTypes={};Vd.defaultProps=EA;const $u=550,TA=80,xA=ze.keyframes`
|
|
30
30
|
0% {
|
|
@@ -198,7 +198,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
|
|
|
198
198
|
*/var Nb=e=>{throw TypeError(e)},Q$=(e,t,n)=>t.has(e)||Nb("Cannot "+n),au=(e,t,n)=>(Q$(e,t,"read from private field"),n?n.call(e):t.get(e)),X$=(e,t,n)=>t.has(e)?Nb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),vm="popstate";function J$(e={}){function t(r,o){let{pathname:a,search:i,hash:s}=r.location;return Li("",{pathname:a,search:i,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Kr(o)}return eO(t,n,null,e)}function je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ft(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Z$(){return Math.random().toString(36).substring(2,10)}function Sm(e,t){return{usr:e.state,key:e.key,idx:t}}function Li(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?to(t):t,state:n,key:t&&t.key||r||Z$()}}function Kr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function to(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function eO(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:a=!1}=r,i=o.history,s="POP",l=null,c=d();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function d(){return(i.state||{idx:null}).idx}function u(){s="POP";let T=d(),E=T==null?null:T-c;c=T,l&&l({action:s,location:b.location,delta:E})}function p(T,E){s="PUSH";let v=Li(b.location,T,E);c=d()+1;let C=Sm(v,c),A=b.createHref(v);try{i.pushState(C,"",A)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;o.location.assign(A)}a&&l&&l({action:s,location:b.location,delta:1})}function h(T,E){s="REPLACE";let v=Li(b.location,T,E);c=d();let C=Sm(v,c),A=b.createHref(v);i.replaceState(C,"",A),a&&l&&l({action:s,location:b.location,delta:0})}function g(T){return Pb(T)}let b={get action(){return s},get location(){return e(o,i)},listen(T){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(vm,u),l=T,()=>{o.removeEventListener(vm,u),l=null}},createHref(T){return t(o,T)},createURL:g,encodeLocation(T){let E=g(T);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:h,go(T){return i.go(T)}};return b}function Pb(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),je(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var oi,km=class{constructor(e){if(X$(this,oi,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(au(this,oi).has(e))return au(this,oi).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){au(this,oi).set(e,t)}};oi=new WeakMap;var tO=new Set(["lazy","caseSensitive","path","id","index","children"]);function nO(e){return tO.has(e)}var rO=new Set(["lazy","caseSensitive","path","id","index","unstable_middleware","children"]);function oO(e){return rO.has(e)}function aO(e){return e.index===!0}function $i(e,t,n=[],r={},o=!1){return e.map((a,i)=>{let s=[...n,String(i)],l=typeof a.id=="string"?a.id:s.join("-");if(je(a.index!==!0||!a.children,"Cannot specify children on an index route"),je(o||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),aO(a)){let c={...a,...t(a),id:l};return r[l]=c,c}else{let c={...a,...t(a),id:l,children:void 0};return r[l]=c,a.children&&(c.children=$i(a.children,t,s,r,o)),c}})}function zr(e,t,n="/"){return Gs(e,t,n,!1)}function Gs(e,t,n,r){let o=typeof t=="string"?to(t):t,a=Gn(o.pathname||"/",n);if(a==null)return null;let i=Rb(e);sO(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let c=bO(a);s=gO(i[l],c,r)}return s}function iO(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],handle:n.handle}}function Rb(e,t=[],n=[],r=""){let o=(a,i,s)=>{let l={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:i,route:a};l.relativePath.startsWith("/")&&(je(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length));let c=pr([r,l.relativePath]),d=n.concat(l);a.children&&a.children.length>0&&(je(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),Rb(a.children,t,d,c)),!(a.path==null&&!a.index)&&t.push({path:c,score:fO(c,a.index),routesMeta:d})};return e.forEach((a,i)=>{if(a.path===""||!a.path?.includes("?"))o(a,i);else for(let s of Lb(a.path))o(a,i,s)}),t}function Lb(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let i=Lb(r.join("/")),s=[];return s.push(...i.map(l=>l===""?a:[a,l].join("/"))),o&&s.push(...i),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function sO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:mO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var lO=/^:[\w-]+$/,cO=3,uO=2,dO=1,hO=10,pO=-2,Am=e=>e==="*";function fO(e,t){let n=e.split("/"),r=n.length;return n.some(Am)&&(r+=pO),t&&(r+=uO),n.filter(o=>!Am(o)).reduce((o,a)=>o+(lO.test(a)?cO:a===""?dO:hO),r)}function mO(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function gO(e,t,n=!1){let{routesMeta:r}=e,o={},a="/",i=[];for(let s=0;s<r.length;++s){let l=r[s],c=s===r.length-1,d=a==="/"?t:t.slice(a.length)||"/",u=xl({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),p=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=xl({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!u)return null;Object.assign(o,u.params),i.push({params:o,pathname:pr([a,u.pathname]),pathnameBase:CO(pr([a,u.pathnameBase])),route:p}),u.pathnameBase!=="/"&&(a=pr([a,u.pathnameBase]))}return i}function xl(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=yO(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:u},p)=>{if(d==="*"){let g=s[p]||"";i=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const h=s[p];return u&&!h?c[d]=void 0:c[d]=(h||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:i,pattern:e}}function yO(e,t=!1,n=!0){Ft(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(r.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function bO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ft(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Gn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function EO({basename:e,pathname:t}){return t==="/"?e:pr([e,t])}function TO(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?to(e):e;return{pathname:n?n.startsWith("/")?n:xO(n,t):t,search:vO(r),hash:SO(o)}}function xO(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function iu(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $b(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Sh(e){let t=$b(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function kh(e,t,n,r=!1){let o;typeof e=="string"?o=to(e):(o={...e},je(!o.pathname||!o.pathname.includes("?"),iu("?","pathname","search",o)),je(!o.pathname||!o.pathname.includes("#"),iu("#","pathname","hash",o)),je(!o.search||!o.search.includes("#"),iu("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,s;if(i==null)s=n;else{let u=t.length-1;if(!r&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),u-=1;o.pathname=p.join("/")}s=u>=0?t[u]:"/"}let l=TO(o,s),c=i&&i!=="/"&&i.endsWith("/"),d=(a||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var pr=e=>e.join("/").replace(/\/\/+/g,"/"),CO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,SO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Cl=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Oi(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Ob=["POST","PUT","PATCH","DELETE"],kO=new Set(Ob),AO=["GET",...Ob],IO=new Set(AO),_O=new Set([301,302,303,307,308]),DO=new Set([307,308]),su={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wO={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ya={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},NO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ah=e=>NO.test(e),PO=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Mb="remix-router-transitions",Fb=Symbol("ResetLoaderData");function RO(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";je(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||PO,a={},i=$i(e.routes,o,void 0,a),s,l=e.basename||"/",c=e.dataStrategy||FO,d={unstable_middleware:!1,...e.future},u=null,p=new Set,h=null,g=null,b=null,T=e.hydrationData!=null,E=zr(i,e.history.location,l),v=!1,C=null,A;if(E==null&&!e.patchRoutesOnNavigation){let L=$n(404,{pathname:e.history.location.pathname}),{matches:B,route:z}=Fm(i);A=!0,E=B,C={[z.id]:L}}else if(E&&!e.hydrationData&&ro(E,i,e.history.location.pathname).active&&(E=null),E)if(E.some(L=>L.route.lazy))A=!1;else if(!E.some(L=>L.route.loader))A=!0;else{let L=e.hydrationData?e.hydrationData.loaderData:null,B=e.hydrationData?e.hydrationData.errors:null;if(B){let z=E.findIndex(le=>B[le.route.id]!==void 0);A=E.slice(0,z+1).every(le=>!nd(le.route,L,B))}else A=E.every(z=>!nd(z.route,L,B))}else{A=!1,E=[];let L=ro(null,i,e.history.location.pathname);L.active&&L.matches&&(v=!0,E=L.matches)}let N,S={historyAction:e.history.action,location:e.history.location,matches:E,initialized:A,navigation:su,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||C,fetchers:new Map,blockers:new Map},M="POP",q=!1,j,y=!1,R=new Map,F=null,O=!1,U=!1,X=new Set,ne=new Map,me=0,se=-1,Z=new Map,D=new Set,Ee=new Map,J=new Map,k=new Set,V=new Map,he,de=null;function ye(){if(u=e.history.listen(({action:L,location:B,delta:z})=>{if(he){he(),he=void 0;return}Ft(V.size===0||z!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Pe({currentLocation:S.location,nextLocation:B,historyAction:L});if(le&&z!=null){let pe=new Promise(Ce=>{he=Ce});e.history.go(z*-1),Me(le,{state:"blocked",location:B,proceed(){Me(le,{state:"proceeding",proceed:void 0,reset:void 0,location:B}),pe.then(()=>e.history.go(z))},reset(){let Ce=new Map(S.blockers);Ce.set(le,Ya),Oe({blockers:Ce})}});return}return be(L,B)}),n){KO(t,R);let L=()=>QO(t,R);t.addEventListener("pagehide",L),F=()=>t.removeEventListener("pagehide",L)}return S.initialized||be("POP",S.location,{initialHydration:!0}),N}function fe(){u&&u(),F&&F(),p.clear(),j&&j.abort(),S.fetchers.forEach((L,B)=>Ue(B)),S.blockers.forEach((L,B)=>te(B))}function Fe(L){return p.add(L),()=>p.delete(L)}function Oe(L,B={}){L.matches&&(L.matches=L.matches.map(pe=>{let Ce=a[pe.route.id],ve=pe.route;return ve.element!==Ce.element||ve.errorElement!==Ce.errorElement||ve.hydrateFallbackElement!==Ce.hydrateFallbackElement?{...pe,route:Ce}:pe})),S={...S,...L};let z=[],le=[];S.fetchers.forEach((pe,Ce)=>{pe.state==="idle"&&(k.has(Ce)?z.push(Ce):le.push(Ce))}),k.forEach(pe=>{!S.fetchers.has(pe)&&!ne.has(pe)&&z.push(pe)}),[...p].forEach(pe=>pe(S,{deletedFetchers:z,viewTransitionOpts:B.viewTransitionOpts,flushSync:B.flushSync===!0})),z.forEach(pe=>Ue(pe)),le.forEach(pe=>S.fetchers.delete(pe))}function xe(L,B,{flushSync:z}={}){let le=S.actionData!=null&&S.navigation.formMethod!=null&&Tn(S.navigation.formMethod)&&S.navigation.state==="loading"&&L.state?._isRedirect!==!0,pe;B.actionData?Object.keys(B.actionData).length>0?pe=B.actionData:pe=null:le?pe=S.actionData:pe=null;let Ce=B.loaderData?Om(S.loaderData,B.loaderData,B.matches||[],B.errors):S.loaderData,ve=S.blockers;ve.size>0&&(ve=new Map(ve),ve.forEach((Se,_e)=>ve.set(_e,Ya)));let Te=O?!1:yn(L,B.matches||S.matches),Ie=q===!0||S.navigation.formMethod!=null&&Tn(S.navigation.formMethod)&&L.state?._isRedirect!==!0;s&&(i=s,s=void 0),O||M==="POP"||(M==="PUSH"?e.history.push(L,L.state):M==="REPLACE"&&e.history.replace(L,L.state));let Re;if(M==="POP"){let Se=R.get(S.location.pathname);Se&&Se.has(L.pathname)?Re={currentLocation:S.location,nextLocation:L}:R.has(L.pathname)&&(Re={currentLocation:L,nextLocation:S.location})}else if(y){let Se=R.get(S.location.pathname);Se?Se.add(L.pathname):(Se=new Set([L.pathname]),R.set(S.location.pathname,Se)),Re={currentLocation:S.location,nextLocation:L}}Oe({...B,actionData:pe,loaderData:Ce,historyAction:M,location:L,initialized:!0,navigation:su,revalidation:"idle",restoreScrollPosition:Te,preventScrollReset:Ie,blockers:ve},{viewTransitionOpts:Re,flushSync:z===!0}),M="POP",q=!1,y=!1,O=!1,U=!1,de?.resolve(),de=null}async function gt(L,B){if(typeof L=="number"){e.history.go(L);return}let z=td(S.location,S.matches,l,L,B?.fromRouteId,B?.relative),{path:le,submission:pe,error:Ce}=Im(!1,z,B),ve=S.location,Te=Li(S.location,le,B&&B.state);Te={...Te,...e.history.encodeLocation(Te)};let Ie=B&&B.replace!=null?B.replace:void 0,Re="PUSH";Ie===!0?Re="REPLACE":Ie===!1||pe!=null&&Tn(pe.formMethod)&&pe.formAction===S.location.pathname+S.location.search&&(Re="REPLACE");let Se=B&&"preventScrollReset"in B?B.preventScrollReset===!0:void 0,_e=(B&&B.flushSync)===!0,qe=Pe({currentLocation:ve,nextLocation:Te,historyAction:Re});if(qe){Me(qe,{state:"blocked",location:Te,proceed(){Me(qe,{state:"proceeding",proceed:void 0,reset:void 0,location:Te}),gt(L,B)},reset(){let St=new Map(S.blockers);St.set(qe,Ya),Oe({blockers:St})}});return}await be(Re,Te,{submission:pe,pendingError:Ce,preventScrollReset:Se,replace:B&&B.replace,enableViewTransition:B&&B.viewTransition,flushSync:_e})}function Ze(){de||(de=XO()),Ve(),Oe({revalidation:"loading"});let L=de.promise;return S.navigation.state==="submitting"?L:S.navigation.state==="idle"?(be(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),L):(be(M||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:y===!0}),L)}async function be(L,B,z){j&&j.abort(),j=null,M=L,O=(z&&z.startUninterruptedRevalidation)===!0,tr(S.location,S.matches),q=(z&&z.preventScrollReset)===!0,y=(z&&z.enableViewTransition)===!0;let le=s||i,pe=z&&z.overrideNavigation,Ce=z?.initialHydration&&S.matches&&S.matches.length>0&&!v?S.matches:zr(le,B,l),ve=(z&&z.flushSync)===!0;if(Ce&&S.initialized&&!U&&GO(S.location,B)&&!(z&&z.submission&&Tn(z.submission.formMethod))){xe(B,{matches:Ce},{flushSync:ve});return}let Te=ro(Ce,le,B.pathname);if(Te.active&&Te.matches&&(Ce=Te.matches),!Ce){let{error:pn,notFoundMatches:kt,route:ft}=Gt(B.pathname);xe(B,{matches:kt,loaderData:{},errors:{[ft.id]:pn}},{flushSync:ve});return}j=new AbortController;let Ie=sa(e.history,B,j.signal,z&&z.submission),Re=new km(e.unstable_getContext?await e.unstable_getContext():void 0),Se;if(z&&z.pendingError)Se=[uo(Ce).route.id,{type:"error",error:z.pendingError}];else if(z&&z.submission&&Tn(z.submission.formMethod)){let pn=await Zt(Ie,B,z.submission,Ce,Re,Te.active,z&&z.initialHydration===!0,{replace:z.replace,flushSync:ve});if(pn.shortCircuited)return;if(pn.pendingActionResult){let[kt,ft]=pn.pendingActionResult;if(kn(ft)&&Oi(ft.error)&&ft.error.status===404){j=null,xe(B,{matches:pn.matches,loaderData:{},errors:{[kt]:ft.error}});return}}Ce=pn.matches||Ce,Se=pn.pendingActionResult,pe=lu(B,z.submission),ve=!1,Te.active=!1,Ie=sa(e.history,Ie.url,Ie.signal)}let{shortCircuited:_e,matches:qe,loaderData:St,errors:nn}=await vt(Ie,B,Ce,Re,Te.active,pe,z&&z.submission,z&&z.fetcherSubmission,z&&z.replace,z&&z.initialHydration===!0,ve,Se);_e||(j=null,xe(B,{matches:qe||Ce,...Mm(Se),loaderData:St,errors:nn}))}async function Zt(L,B,z,le,pe,Ce,ve,Te={}){Ve();let Ie=VO(B,z);if(Oe({navigation:Ie},{flushSync:Te.flushSync===!0}),Ce){let _e=await Lt(le,B.pathname,L.signal);if(_e.type==="aborted")return{shortCircuited:!0};if(_e.type==="error"){let qe=uo(_e.partialMatches).route.id;return{matches:_e.partialMatches,pendingActionResult:[qe,{type:"error",error:_e.error}]}}else if(_e.matches)le=_e.matches;else{let{notFoundMatches:qe,error:St,route:nn}=Gt(B.pathname);return{matches:qe,pendingActionResult:[nn.id,{type:"error",error:St}]}}}let Re,Se=qs(le,B);if(!Se.route.action&&!Se.route.lazy)Re={type:"error",error:$n(405,{method:L.method,pathname:B.pathname,routeId:Se.route.id})};else{let _e=ma(o,a,L,le,Se,ve?[]:r,pe),qe=await Yn(L,_e,pe,null);if(Re=qe[Se.route.id],!Re){for(let St of le)if(qe[St.route.id]){Re=qe[St.route.id];break}}if(L.signal.aborted)return{shortCircuited:!0}}if(bo(Re)){let _e;return Te&&Te.replace!=null?_e=Te.replace:_e=Rm(Re.response.headers.get("Location"),new URL(L.url),l)===S.location.pathname+S.location.search,await ge(L,Re,!0,{submission:z,replace:_e}),{shortCircuited:!0}}if(kn(Re)){let _e=uo(le,Se.route.id);return(Te&&Te.replace)!==!0&&(M="PUSH"),{matches:le,pendingActionResult:[_e.route.id,Re,Se.route.id]}}return{matches:le,pendingActionResult:[Se.route.id,Re]}}async function vt(L,B,z,le,pe,Ce,ve,Te,Ie,Re,Se,_e){let qe=Ce||lu(B,ve),St=ve||Te||jm(qe),nn=!O&&!Re;if(pe){if(nn){let rn=De(_e);Oe({navigation:qe,...rn!==void 0?{actionData:rn}:{}},{flushSync:Se})}let Ke=await Lt(z,B.pathname,L.signal);if(Ke.type==="aborted")return{shortCircuited:!0};if(Ke.type==="error"){let rn=uo(Ke.partialMatches).route.id;return{matches:Ke.partialMatches,loaderData:{},errors:{[rn]:Ke.error}}}else if(Ke.matches)z=Ke.matches;else{let{error:rn,notFoundMatches:cs,route:$a}=Gt(B.pathname);return{matches:cs,loaderData:{},errors:{[$a.id]:rn}}}}let pn=s||i,{dsMatches:kt,revalidatingFetchers:ft}=_m(L,le,o,a,e.history,S,z,St,B,Re?[]:r,Re===!0,U,X,k,Ee,D,pn,l,e.patchRoutesOnNavigation!=null,_e);if(se=++me,!e.dataStrategy&&!kt.some(Ke=>Ke.shouldLoad)&&ft.length===0){let Ke=Kt();return xe(B,{matches:z,loaderData:{},errors:_e&&kn(_e[1])?{[_e[0]]:_e[1].error}:null,...Mm(_e),...Ke?{fetchers:new Map(S.fetchers)}:{}},{flushSync:Se}),{shortCircuited:!0}}if(nn){let Ke={};if(!pe){Ke.navigation=qe;let rn=De(_e);rn!==void 0&&(Ke.actionData=rn)}ft.length>0&&(Ke.fetchers=wt(ft)),Oe(Ke,{flushSync:Se})}ft.forEach(Ke=>{et(Ke.key),Ke.controller&&ne.set(Ke.key,Ke.controller)});let ao=()=>ft.forEach(Ke=>et(Ke.key));j&&j.signal.addEventListener("abort",ao);let{loaderResults:Ra,fetcherResults:Mr}=await Or(kt,ft,L,le);if(L.signal.aborted)return{shortCircuited:!0};j&&j.signal.removeEventListener("abort",ao),ft.forEach(Ke=>ne.delete(Ke.key));let nr=As(Ra);if(nr)return await ge(L,nr.result,!0,{replace:Ie}),{shortCircuited:!0};if(nr=As(Mr),nr)return D.add(nr.key),await ge(L,nr.result,!0,{replace:Ie}),{shortCircuited:!0};let{loaderData:mc,errors:La}=$m(S,z,Ra,_e,ft,Mr);Re&&S.errors&&(La={...S.errors,...La});let io=Kt(),ss=tn(se),ls=io||ss||ft.length>0;return{matches:z,loaderData:mc,errors:La,...ls?{fetchers:new Map(S.fetchers)}:{}}}function De(L){if(L&&!kn(L[1]))return{[L[0]]:L[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function wt(L){return L.forEach(B=>{let z=S.fetchers.get(B.key),le=Ka(void 0,z?z.data:void 0);S.fetchers.set(B.key,le)}),new Map(S.fetchers)}async function yt(L,B,z,le){et(L);let pe=(le&&le.flushSync)===!0,Ce=s||i,ve=td(S.location,S.matches,l,z,B,le?.relative),Te=zr(Ce,ve,l),Ie=ro(Te,Ce,ve);if(Ie.active&&Ie.matches&&(Te=Ie.matches),!Te){oe(L,B,$n(404,{pathname:ve}),{flushSync:pe});return}let{path:Re,submission:Se,error:_e}=Im(!0,ve,le);if(_e){oe(L,B,_e,{flushSync:pe});return}let qe=new km(e.unstable_getContext?await e.unstable_getContext():void 0),St=(le&&le.preventScrollReset)===!0;if(Se&&Tn(Se.formMethod)){await bt(L,B,Re,Te,qe,Ie.active,pe,St,Se);return}Ee.set(L,{routeId:B,path:Re}),await ke(L,B,Re,Te,qe,Ie.active,pe,St,Se)}async function bt(L,B,z,le,pe,Ce,ve,Te,Ie){Ve(),Ee.delete(L);let Re=S.fetchers.get(L);Y(L,YO(Ie,Re),{flushSync:ve});let Se=new AbortController,_e=sa(e.history,z,Se.signal,Ie);if(Ce){let jt=await Lt(le,new URL(_e.url).pathname,_e.signal,L);if(jt.type==="aborted")return;if(jt.type==="error"){oe(L,B,jt.error,{flushSync:ve});return}else if(jt.matches)le=jt.matches;else{oe(L,B,$n(404,{pathname:z}),{flushSync:ve});return}}let qe=qs(le,z);if(!qe.route.action&&!qe.route.lazy){let jt=$n(405,{method:Ie.formMethod,pathname:z,routeId:B});oe(L,B,jt,{flushSync:ve});return}ne.set(L,Se);let St=me,nn=ma(o,a,_e,le,qe,r,pe),kt=(await Yn(_e,nn,pe,L))[qe.route.id];if(_e.signal.aborted){ne.get(L)===Se&&ne.delete(L);return}if(k.has(L)){if(bo(kt)||kn(kt)){Y(L,Ur(void 0));return}}else{if(bo(kt))if(ne.delete(L),se>St){Y(L,Ur(void 0));return}else return D.add(L),Y(L,Ka(Ie)),ge(_e,kt,!1,{fetcherSubmission:Ie,preventScrollReset:Te});if(kn(kt)){oe(L,B,kt.error);return}}let ft=S.navigation.location||S.location,ao=sa(e.history,ft,Se.signal),Ra=s||i,Mr=S.navigation.state!=="idle"?zr(Ra,S.navigation.location,l):S.matches;je(Mr,"Didn't find any matches after fetcher action");let nr=++me;Z.set(L,nr);let mc=Ka(Ie,kt.data);S.fetchers.set(L,mc);let{dsMatches:La,revalidatingFetchers:io}=_m(ao,pe,o,a,e.history,S,Mr,Ie,ft,r,!1,U,X,k,Ee,D,Ra,l,e.patchRoutesOnNavigation!=null,[qe.route.id,kt]);io.filter(jt=>jt.key!==L).forEach(jt=>{let us=jt.key,Kh=S.fetchers.get(us),PE=Ka(void 0,Kh?Kh.data:void 0);S.fetchers.set(us,PE),et(us),jt.controller&&ne.set(us,jt.controller)}),Oe({fetchers:new Map(S.fetchers)});let ss=()=>io.forEach(jt=>et(jt.key));Se.signal.addEventListener("abort",ss);let{loaderResults:ls,fetcherResults:Ke}=await Or(La,io,ao,pe);if(Se.signal.aborted)return;if(Se.signal.removeEventListener("abort",ss),Z.delete(L),ne.delete(L),io.forEach(jt=>ne.delete(jt.key)),S.fetchers.has(L)){let jt=Ur(kt.data);S.fetchers.set(L,jt)}let rn=As(ls);if(rn)return ge(ao,rn.result,!1,{preventScrollReset:Te});if(rn=As(Ke),rn)return D.add(rn.key),ge(ao,rn.result,!1,{preventScrollReset:Te});let{loaderData:cs,errors:$a}=$m(S,Mr,ls,void 0,io,Ke);tn(nr),S.navigation.state==="loading"&&nr>se?(je(M,"Expected pending action"),j&&j.abort(),xe(S.navigation.location,{matches:Mr,loaderData:cs,errors:$a,fetchers:new Map(S.fetchers)})):(Oe({errors:$a,loaderData:Om(S.loaderData,cs,Mr,$a),fetchers:new Map(S.fetchers)}),U=!1)}async function ke(L,B,z,le,pe,Ce,ve,Te,Ie){let Re=S.fetchers.get(L);Y(L,Ka(Ie,Re?Re.data:void 0),{flushSync:ve});let Se=new AbortController,_e=sa(e.history,z,Se.signal);if(Ce){let ft=await Lt(le,new URL(_e.url).pathname,_e.signal,L);if(ft.type==="aborted")return;if(ft.type==="error"){oe(L,B,ft.error,{flushSync:ve});return}else if(ft.matches)le=ft.matches;else{oe(L,B,$n(404,{pathname:z}),{flushSync:ve});return}}let qe=qs(le,z);ne.set(L,Se);let St=me,nn=ma(o,a,_e,le,qe,r,pe),kt=(await Yn(_e,nn,pe,L))[qe.route.id];if(ne.get(L)===Se&&ne.delete(L),!_e.signal.aborted){if(k.has(L)){Y(L,Ur(void 0));return}if(bo(kt))if(se>St){Y(L,Ur(void 0));return}else{D.add(L),await ge(_e,kt,!1,{preventScrollReset:Te});return}if(kn(kt)){oe(L,B,kt.error);return}Y(L,Ur(kt.data))}}async function ge(L,B,z,{submission:le,fetcherSubmission:pe,preventScrollReset:Ce,replace:ve}={}){B.response.headers.has("X-Remix-Revalidate")&&(U=!0);let Te=B.response.headers.get("Location");je(Te,"Expected a Location header on the redirect Response"),Te=Rm(Te,new URL(L.url),l);let Ie=Li(S.location,Te,{_isRedirect:!0});if(n){let nn=!1;if(B.response.headers.has("X-Remix-Reload-Document"))nn=!0;else if(Ah(Te)){const pn=Pb(Te,!0);nn=pn.origin!==t.location.origin||Gn(pn.pathname,l)==null}if(nn){ve?t.location.replace(Te):t.location.assign(Te);return}}j=null;let Re=ve===!0||B.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Se,formAction:_e,formEncType:qe}=S.navigation;!le&&!pe&&Se&&_e&&qe&&(le=jm(S.navigation));let St=le||pe;if(DO.has(B.response.status)&&St&&Tn(St.formMethod))await be(Re,Ie,{submission:{...St,formAction:Te},preventScrollReset:Ce||q,enableViewTransition:z?y:void 0});else{let nn=lu(Ie,le);await be(Re,Ie,{overrideNavigation:nn,fetcherSubmission:pe,preventScrollReset:Ce||q,enableViewTransition:z?y:void 0})}}async function Yn(L,B,z,le){let pe,Ce={};try{pe=await BO(c,L,B,le,z,!1)}catch(ve){return B.filter(Te=>Te.shouldLoad).forEach(Te=>{Ce[Te.route.id]={type:"error",error:ve}}),Ce}if(L.signal.aborted)return Ce;for(let[ve,Te]of Object.entries(pe))if(qO(Te)){let Ie=Te.result;Ce[ve]={type:"redirect",response:UO(Ie,L,ve,B,l)}}else Ce[ve]=await HO(Te);return Ce}async function Or(L,B,z,le){let pe=Yn(z,L,le,null),Ce=Promise.all(B.map(async Ie=>{if(Ie.matches&&Ie.match&&Ie.request&&Ie.controller){let Se=(await Yn(Ie.request,Ie.matches,le,Ie.key))[Ie.match.route.id];return{[Ie.key]:Se}}else return Promise.resolve({[Ie.key]:{type:"error",error:$n(404,{pathname:Ie.path})}})})),ve=await pe,Te=(await Ce).reduce((Ie,Re)=>Object.assign(Ie,Re),{});return{loaderResults:ve,fetcherResults:Te}}function Ve(){U=!0,Ee.forEach((L,B)=>{ne.has(B)&&X.add(B),et(B)})}function Y(L,B,z={}){S.fetchers.set(L,B),Oe({fetchers:new Map(S.fetchers)},{flushSync:(z&&z.flushSync)===!0})}function oe(L,B,z,le={}){let pe=uo(S.matches,B);Ue(L),Oe({errors:{[pe.route.id]:z},fetchers:new Map(S.fetchers)},{flushSync:(le&&le.flushSync)===!0})}function Ae(L){return J.set(L,(J.get(L)||0)+1),k.has(L)&&k.delete(L),S.fetchers.get(L)||wO}function Ue(L){let B=S.fetchers.get(L);ne.has(L)&&!(B&&B.state==="loading"&&Z.has(L))&&et(L),Ee.delete(L),Z.delete(L),D.delete(L),k.delete(L),X.delete(L),S.fetchers.delete(L)}function We(L){let B=(J.get(L)||0)-1;B<=0?(J.delete(L),k.add(L)):J.set(L,B),Oe({fetchers:new Map(S.fetchers)})}function et(L){let B=ne.get(L);B&&(B.abort(),ne.delete(L))}function en(L){for(let B of L){let z=Ae(B),le=Ur(z.data);S.fetchers.set(B,le)}}function Kt(){let L=[],B=!1;for(let z of D){let le=S.fetchers.get(z);je(le,`Expected fetcher: ${z}`),le.state==="loading"&&(D.delete(z),L.push(z),B=!0)}return en(L),B}function tn(L){let B=[];for(let[z,le]of Z)if(le<L){let pe=S.fetchers.get(z);je(pe,`Expected fetcher: ${z}`),pe.state==="loading"&&(et(z),Z.delete(z),B.push(z))}return en(B),B.length>0}function ie(L,B){let z=S.blockers.get(L)||Ya;return V.get(L)!==B&&V.set(L,B),z}function te(L){S.blockers.delete(L),V.delete(L)}function Me(L,B){let z=S.blockers.get(L)||Ya;je(z.state==="unblocked"&&B.state==="blocked"||z.state==="blocked"&&B.state==="blocked"||z.state==="blocked"&&B.state==="proceeding"||z.state==="blocked"&&B.state==="unblocked"||z.state==="proceeding"&&B.state==="unblocked",`Invalid blocker state transition: ${z.state} -> ${B.state}`);let le=new Map(S.blockers);le.set(L,B),Oe({blockers:le})}function Pe({currentLocation:L,nextLocation:B,historyAction:z}){if(V.size===0)return;V.size>1&&Ft(!1,"A router only supports one blocker at a time");let le=Array.from(V.entries()),[pe,Ce]=le[le.length-1],ve=S.blockers.get(pe);if(!(ve&&ve.state==="proceeding")&&Ce({currentLocation:L,nextLocation:B,historyAction:z}))return pe}function Gt(L){let B=$n(404,{pathname:L}),z=s||i,{matches:le,route:pe}=Fm(z);return{notFoundMatches:le,route:pe,error:B}}function er(L,B,z){if(h=L,b=B,g=z||null,!T&&S.navigation===su){T=!0;let le=yn(S.location,S.matches);le!=null&&Oe({restoreScrollPosition:le})}return()=>{h=null,b=null,g=null}}function Kn(L,B){return g&&g(L,B.map(le=>iO(le,S.loaderData)))||L.key}function tr(L,B){if(h&&b){let z=Kn(L,B);h[z]=b()}}function yn(L,B){if(h){let z=Kn(L,B),le=h[z];if(typeof le=="number")return le}return null}function ro(L,B,z){if(e.patchRoutesOnNavigation)if(L){if(Object.keys(L[0].params).length>0)return{active:!0,matches:Gs(B,z,l,!0)}}else return{active:!0,matches:Gs(B,z,l,!0)||[]};return{active:!1,matches:null}}async function Lt(L,B,z,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:L};let pe=L;for(;;){let Ce=s==null,ve=s||i,Te=a;try{await e.patchRoutesOnNavigation({signal:z,path:B,matches:pe,fetcherKey:le,patch:(Se,_e)=>{z.aborted||Dm(Se,_e,ve,Te,o,!1)}})}catch(Se){return{type:"error",error:Se,partialMatches:pe}}finally{Ce&&!z.aborted&&(i=[...i])}if(z.aborted)return{type:"aborted"};let Ie=zr(ve,B,l);if(Ie)return{type:"success",matches:Ie};let Re=Gs(ve,B,l,!0);if(!Re||pe.length===Re.length&&pe.every((Se,_e)=>Se.route.id===Re[_e].route.id))return{type:"success",matches:null};pe=Re}}function Er(L){a={},s=$i(L,o,void 0,a)}function oo(L,B,z=!1){let le=s==null;Dm(L,B,s||i,a,o,z),le&&(i=[...i],Oe({}))}return N={get basename(){return l},get future(){return d},get state(){return S},get routes(){return i},get window(){return t},initialize:ye,subscribe:Fe,enableScrollRestoration:er,navigate:gt,fetch:yt,revalidate:Ze,createHref:L=>e.history.createHref(L),encodeLocation:L=>e.history.encodeLocation(L),getFetcher:Ae,deleteFetcher:We,dispose:fe,getBlocker:ie,deleteBlocker:te,patchRoutes:oo,_internalFetchControllers:ne,_internalSetRoutes:Er,_internalSetStateDoNotUseOrYouWillBreakYourApp(L){Oe(L)}},N}function LO(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function td(e,t,n,r,o,a){let i,s;if(o){i=[];for(let c of t)if(i.push(c),c.route.id===o){s=c;break}}else i=t,s=t[t.length-1];let l=kh(r||".",Sh(i),Gn(e.pathname,n)||e.pathname,a==="path");if(r==null&&(l.search=e.search,l.hash=e.hash),(r==null||r===""||r===".")&&s){let c=Ih(l.search);if(s.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&c){let d=new URLSearchParams(l.search),u=d.getAll("index");d.delete("index"),u.filter(h=>h).forEach(h=>d.append("index",h));let p=d.toString();l.search=p?`?${p}`:""}}return n!=="/"&&(l.pathname=EO({basename:n,pathname:l.pathname})),Kr(l)}function Im(e,t,n){if(!n||!LO(n))return{path:t};if(n.formMethod&&!WO(n.formMethod))return{path:t,error:$n(405,{method:n.formMethod})};let r=()=>({path:t,error:$n(400,{type:"invalid-body"})}),a=(n.formMethod||"get").toUpperCase(),i=Gb(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Tn(a))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((p,[h,g])=>`${p}${h}=${g}
|
|
199
199
|
`,""):String(n.body);return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!Tn(a))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:a,formAction:i,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}je(typeof FormData=="function","FormData is not available in this environment");let s,l;if(n.formData)s=od(n.formData),l=n.formData;else if(n.body instanceof FormData)s=od(n.body),l=n.body;else if(n.body instanceof URLSearchParams)s=n.body,l=Lm(s);else if(n.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(n.body),l=Lm(s)}catch{return r()}let c={formMethod:a,formAction:i,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Tn(c.formMethod))return{path:t,submission:c};let d=to(t);return e&&d.search&&Ih(d.search)&&s.append("index",""),d.search=`?${s}`,{path:Kr(d),submission:c}}function _m(e,t,n,r,o,a,i,s,l,c,d,u,p,h,g,b,T,E,v,C){let A=C?kn(C[1])?C[1].error:C[1].data:void 0,N=o.createURL(a.location),S=o.createURL(l),M;if(d&&a.errors){let O=Object.keys(a.errors)[0];M=i.findIndex(U=>U.route.id===O)}else if(C&&kn(C[1])){let O=C[0];M=i.findIndex(U=>U.route.id===O)-1}let q=C?C[1].statusCode:void 0,j=q&&q>=400,y={currentUrl:N,currentParams:a.matches[0]?.params||{},nextUrl:S,nextParams:i[0].params,...s,actionResult:A,actionStatus:q},R=i.map((O,U)=>{let{route:X}=O,ne=null;if(M!=null&&U>M?ne=!1:X.lazy?ne=!0:X.loader==null?ne=!1:d?ne=nd(X,a.loaderData,a.errors):$O(a.loaderData,a.matches[U],O)&&(ne=!0),ne!==null)return rd(n,r,e,O,c,t,ne);let me=j?!1:u||N.pathname+N.search===S.pathname+S.search||N.search!==S.search||OO(a.matches[U],O),se={...y,defaultShouldRevalidate:me},Z=vl(O,se);return rd(n,r,e,O,c,t,Z,se)}),F=[];return g.forEach((O,U)=>{if(d||!i.some(J=>J.route.id===O.routeId)||h.has(U))return;let X=a.fetchers.get(U),ne=X&&X.state!=="idle"&&X.data===void 0,me=zr(T,O.path,E);if(!me){if(v&&ne)return;F.push({key:U,routeId:O.routeId,path:O.path,matches:null,match:null,request:null,controller:null});return}if(b.has(U))return;let se=qs(me,O.path),Z=new AbortController,D=sa(o,O.path,Z.signal),Ee=null;if(p.has(U))p.delete(U),Ee=ma(n,r,D,me,se,c,t);else if(ne)u&&(Ee=ma(n,r,D,me,se,c,t));else{let J={...y,defaultShouldRevalidate:j?!1:u};vl(se,J)&&(Ee=ma(n,r,D,me,se,c,t,J))}Ee&&F.push({key:U,routeId:O.routeId,path:O.path,matches:Ee,match:se,request:D,controller:Z})}),{dsMatches:R,revalidatingFetchers:F}}function nd(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;return!r&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!o}function $O(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function OO(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function vl(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Dm(e,t,n,r,o,a){let i;if(e){let c=r[e];je(c,`No route found to patch children into: routeId = ${e}`),c.children||(c.children=[]),i=c.children}else i=n;let s=[],l=[];if(t.forEach(c=>{let d=i.find(u=>Bb(c,u));d?l.push({existingRoute:d,newRoute:c}):s.push(c)}),s.length>0){let c=$i(s,o,[e||"_","patch",String(i?.length||"0")],r);i.push(...c)}if(a&&l.length>0)for(let c=0;c<l.length;c++){let{existingRoute:d,newRoute:u}=l[c],p=d,[h]=$i([u],o,[],{},!0);Object.assign(p,{element:h.element?h.element:p.element,errorElement:h.errorElement?h.errorElement:p.errorElement,hydrateFallbackElement:h.hydrateFallbackElement?h.hydrateFallbackElement:p.hydrateFallbackElement})}}function Bb(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>t.children?.some(o=>Bb(n,o))):!1}var wm=new WeakMap,jb=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(je(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let a=o.lazy[e];if(!a)return;let i=wm.get(o);i||(i={},wm.set(o,i));let s=i[e];if(s)return s;let l=(async()=>{let c=nO(e),u=o[e]!==void 0&&e!=="hasErrorBoundary";if(c)Ft(!c,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(u)Ft(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let p=await a();p!=null&&(Object.assign(o,{[e]:p}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(p=>p===void 0)&&(o.lazy=void 0))})();return i[e]=l,l},Nm=new WeakMap;function MO(e,t,n,r,o){let a=n[e.id];if(je(a,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let d=Nm.get(a);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let u=(async()=>{je(typeof e.lazy=="function","No lazy route function found");let p=await e.lazy(),h={};for(let g in p){let b=p[g];if(b===void 0)continue;let T=oO(g),v=a[g]!==void 0&&g!=="hasErrorBoundary";T?Ft(!T,"Route property "+g+" is not a supported property to be returned from a lazy route function. This property will be ignored."):v?Ft(!v,`Route "${a.id}" has a static property "${g}" defined but its lazy function is also returning a value for this property. The lazy route property "${g}" will be ignored.`):h[g]=b}Object.assign(a,h),Object.assign(a,{...r(a),lazy:void 0})})();return Nm.set(a,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let i=Object.keys(e.lazy),s=[],l;for(let d of i){if(o&&o.includes(d))continue;let u=jb({key:d,route:e,manifest:n,mapRouteProperties:r});u&&(s.push(u),d===t&&(l=u))}let c=s.length>0?Promise.all(s).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function Pm(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,a)=>{n[t[a].route.id]=o}),n}async function FO(e){return e.matches.some(t=>t.route.unstable_middleware)?Hb(e,!1,()=>Pm(e),(t,n)=>({[n]:{type:"error",result:t}})):Pm(e)}async function Hb(e,t,n,r){let{matches:o,request:a,params:i,context:s}=e,l={handlerResult:void 0};try{let c=o.flatMap(u=>u.route.unstable_middleware?u.route.unstable_middleware.map(p=>[u.route.id,p]):[]),d=await Ub({request:a,params:i,context:s},c,t,l,n);return t?d:l.handlerResult}catch(c){if(!l.middlewareError)throw c;let d=await r(l.middlewareError.error,l.middlewareError.routeId);return l.handlerResult?Object.assign(l.handlerResult,d):d}}async function Ub(e,t,n,r,o,a=0){let{request:i}=e;if(i.signal.aborted)throw i.signal.reason?i.signal.reason:new Error(`Request aborted without an \`AbortSignal.reason\`: ${i.method} ${i.url}`);let s=t[a];if(!s)return r.handlerResult=await o(),r.handlerResult;let[l,c]=s,d=!1,u,p=async()=>{if(d)throw new Error("You may only call `next()` once per middleware");d=!0,await Ub(e,t,n,r,o,a+1)};try{let h=await c({request:e.request,params:e.params,context:e.context},p);return d?h===void 0?u:h:p()}catch(h){throw r.middlewareError?r.middlewareError.error!==h&&(r.middlewareError={routeId:l,error:h}):r.middlewareError={routeId:l,error:h},h}}function zb(e,t,n,r,o){let a=jb({key:"unstable_middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=MO(r.route,Tn(n.method)?"action":"loader",t,e,o);return{middleware:a,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function rd(e,t,n,r,o,a,i,s=null){let l=!1,c=zb(e,t,n,r,o);return{...r,_lazyPromises:c,shouldLoad:i,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler(d){return l=!0,s?typeof d=="boolean"?vl(r,{...s,defaultShouldRevalidate:d}):vl(r,s):i},resolve(d){return l||i||d&&!Tn(n.method)&&(r.route.lazy||r.route.loader)?jO({request:n,match:r,lazyHandlerPromise:c?.handler,lazyRoutePromise:c?.route,handlerOverride:d,scopedContext:a}):Promise.resolve({type:"data",result:void 0})}}}function ma(e,t,n,r,o,a,i,s=null){return r.map(l=>l.route.id!==o.route.id?{...l,shouldLoad:!1,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler:()=>!1,_lazyPromises:zb(e,t,n,l,a),resolve:()=>Promise.resolve({type:"data",result:void 0})}:rd(e,t,n,l,a,i,!0,s))}async function BO(e,t,n,r,o,a){n.some(c=>c._lazyPromises?.middleware)&&await Promise.all(n.map(c=>c._lazyPromises?.middleware));let i={request:t,params:n[0].params,context:o,matches:n},l=await e({...i,fetcherKey:r,unstable_runClientMiddleware:c=>{let d=i;return Hb(d,!1,()=>c({...d,fetcherKey:r,unstable_runClientMiddleware:()=>{throw new Error("Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler")}}),(u,p)=>({[p]:{type:"error",result:u}}))}});try{await Promise.all(n.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return l}async function jO({request:e,match:t,lazyHandlerPromise:n,lazyRoutePromise:r,handlerOverride:o,scopedContext:a}){let i,s,l=Tn(e.method),c=l?"action":"loader",d=u=>{let p,h=new Promise((T,E)=>p=E);s=()=>p(),e.signal.addEventListener("abort",s);let g=T=>typeof u!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${c}" [routeId: ${t.route.id}]`)):u({request:e,params:t.params,context:a},...T!==void 0?[T]:[]),b=(async()=>{try{return{type:"data",result:await(o?o(E=>g(E)):g())}}catch(T){return{type:"error",result:T}}})();return Promise.race([b,h])};try{let u=l?t.route.action:t.route.loader;if(n||r)if(u){let p,[h]=await Promise.all([d(u).catch(g=>{p=g}),n,r]);if(p!==void 0)throw p;i=h}else{await n;let p=l?t.route.action:t.route.loader;if(p)[i]=await Promise.all([d(p),r]);else if(c==="action"){let h=new URL(e.url),g=h.pathname+h.search;throw $n(405,{method:e.method,pathname:g,routeId:t.route.id})}else return{type:"data",result:void 0}}else if(u)i=await d(u);else{let p=new URL(e.url),h=p.pathname+p.search;throw $n(404,{pathname:h})}}catch(u){return{type:"error",result:u}}finally{s&&e.signal.removeEventListener("abort",s)}return i}async function HO(e){let{result:t,type:n}=e;if(qb(t)){let r;try{let o=t.headers.get("Content-Type");o&&/\bapplication\/json\b/.test(o)?t.body==null?r=null:r=await t.json():r=await t.text()}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new Cl(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?Bm(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:new Cl(t.init?.status||500,void 0,t.data),statusCode:Oi(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Oi(t)?t.status:void 0}:Bm(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function UO(e,t,n,r,o){let a=e.headers.get("Location");if(je(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!Ah(a)){let i=r.slice(0,r.findIndex(s=>s.route.id===n)+1);a=td(new URL(t.url),i,o,a),e.headers.set("Location",a)}return e}function Rm(e,t,n){if(Ah(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),a=Gn(o.pathname,n)!=null;if(o.origin===t.origin&&a)return o.pathname+o.search+o.hash}return e}function sa(e,t,n,r){let o=e.createURL(Gb(t)).toString(),a={signal:n};if(r&&Tn(r.formMethod)){let{formMethod:i,formEncType:s}=r;a.method=i.toUpperCase(),s==="application/json"?(a.headers=new Headers({"Content-Type":s}),a.body=JSON.stringify(r.json)):s==="text/plain"?a.body=r.text:s==="application/x-www-form-urlencoded"&&r.formData?a.body=od(r.formData):a.body=r.formData}return new Request(o,a)}function od(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Lm(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function zO(e,t,n,r=!1,o=!1){let a={},i=null,s,l=!1,c={},d=n&&kn(n[1])?n[1].error:void 0;return e.forEach(u=>{if(!(u.route.id in t))return;let p=u.route.id,h=t[p];if(je(!bo(h),"Cannot handle redirect results in processLoaderData"),kn(h)){let g=h.error;if(d!==void 0&&(g=d,d=void 0),i=i||{},o)i[p]=g;else{let b=uo(e,p);i[b.route.id]==null&&(i[b.route.id]=g)}r||(a[p]=Fb),l||(l=!0,s=Oi(h.error)?h.error.status:500),h.headers&&(c[p]=h.headers)}else a[p]=h.data,h.statusCode&&h.statusCode!==200&&!l&&(s=h.statusCode),h.headers&&(c[p]=h.headers)}),d!==void 0&&n&&(i={[n[0]]:d},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:i,statusCode:s||200,loaderHeaders:c}}function $m(e,t,n,r,o,a){let{loaderData:i,errors:s}=zO(t,n,r);return o.filter(l=>!l.matches||l.matches.some(c=>c.shouldLoad)).forEach(l=>{let{key:c,match:d,controller:u}=l,p=a[c];if(je(p,"Did not find corresponding fetcher result"),!(u&&u.signal.aborted))if(kn(p)){let h=uo(e.matches,d?.route.id);s&&s[h.route.id]||(s={...s,[h.route.id]:p.error}),e.fetchers.delete(c)}else if(bo(p))je(!1,"Unhandled fetcher revalidation redirect");else{let h=Ur(p.data);e.fetchers.set(c,h)}}),{loaderData:i,errors:s}}function Om(e,t,n,r){let o=Object.entries(t).filter(([,a])=>a!==Fb).reduce((a,[i,s])=>(a[i]=s,a),{});for(let a of n){let i=a.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&a.route.loader&&(o[i]=e[i]),r&&r.hasOwnProperty(i))break}return o}function Mm(e){return e?kn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function uo(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Fm(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function $n(e,{pathname:t,routeId:n,method:r,type:o,message:a}={}){let i="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(i="Bad Request",r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(s="Unable to encode submission body")):e===403?(i="Forbidden",s=`Route "${n}" does not match URL "${t}"`):e===404?(i="Not Found",s=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Cl(e||500,i,new Error(s),!0)}function As(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(bo(o))return{key:r,result:o}}}function Gb(e){let t=typeof e=="string"?to(e):e;return Kr({...t,hash:""})}function GO(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function qO(e){return qb(e.result)&&_O.has(e.result.status)}function kn(e){return e.type==="error"}function bo(e){return(e&&e.type)==="redirect"}function Bm(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function qb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function WO(e){return IO.has(e.toUpperCase())}function Tn(e){return kO.has(e.toUpperCase())}function Ih(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function qs(e,t){let n=typeof t=="string"?to(t).search:t.search;if(e[e.length-1].route.index&&Ih(n||""))return e[e.length-1];let r=$b(e);return r[r.length-1]}function jm(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:a,json:i}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}}}function lu(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function VO(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Ka(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function YO(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Ur(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function KO(e,t){try{let n=e.sessionStorage.getItem(Mb);if(n){let r=JSON.parse(n);for(let[o,a]of Object.entries(r||{}))a&&Array.isArray(a)&&t.set(o,new Set(a||[]))}}catch{}}function QO(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(Mb,JSON.stringify(n))}catch(r){Ft(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function XO(){let e,t,n=new Promise((r,o)=>{e=async a=>{r(a);try{await n}catch{}},t=async a=>{o(a);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var jo=_.createContext(null);jo.displayName="DataRouter";var Zi=_.createContext(null);Zi.displayName="DataRouterState";_.createContext(!1);var _h=_.createContext({isTransitioning:!1});_h.displayName="ViewTransition";var Wb=_.createContext(new Map);Wb.displayName="Fetchers";var JO=_.createContext(null);JO.displayName="Await";var br=_.createContext(null);br.displayName="Navigation";var ac=_.createContext(null);ac.displayName="Location";var Zn=_.createContext({outlet:null,matches:[],isDataRoute:!1});Zn.displayName="Route";var Dh=_.createContext(null);Dh.displayName="RouteError";function ZO(e,{relative:t}={}){je(es(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=_.useContext(br),{hash:o,pathname:a,search:i}=ns(e,{relative:t}),s=a;return n!=="/"&&(s=a==="/"?n:pr([n,a])),r.createHref({pathname:s,search:i,hash:o})}function es(){return _.useContext(ac)!=null}function Ho(){return je(es(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(ac).location}var Vb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Yb(e){_.useContext(br).static||_.useLayoutEffect(e)}function wh(){let{isDataRoute:e}=_.useContext(Zn);return e?pM():eM()}function eM(){je(es(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(jo),{basename:t,navigator:n}=_.useContext(br),{matches:r}=_.useContext(Zn),{pathname:o}=Ho(),a=JSON.stringify(Sh(r)),i=_.useRef(!1);return Yb(()=>{i.current=!0}),_.useCallback((l,c={})=>{if(Ft(i.current,Vb),!i.current)return;if(typeof l=="number"){n.go(l);return}let d=kh(l,JSON.parse(a),o,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:pr([t,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,a,o,e])}var tM=_.createContext(null);function nM(e){let t=_.useContext(Zn).outlet;return t&&_.createElement(tM.Provider,{value:e},t)}function ts(){let{matches:e}=_.useContext(Zn),t=e[e.length-1];return t?t.params:{}}function ns(e,{relative:t}={}){let{matches:n}=_.useContext(Zn),{pathname:r}=Ho(),o=JSON.stringify(Sh(n));return _.useMemo(()=>kh(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function rM(e,t,n,r){je(es(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=_.useContext(br),{matches:a}=_.useContext(Zn),i=a[a.length-1],s=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",d=i&&i.route;{let E=d&&d.path||"";Qb(l,!d||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
200
200
|
|
|
201
|
-
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let u=Ho(),p;p=u;let h=p.pathname||"/",g=h;if(c!=="/"){let E=c.replace(/^\//,"").split("/");g="/"+h.replace(/^\//,"").split("/").slice(E.length).join("/")}let b=zr(e,{pathname:g});return Ft(d||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ft(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),lM(b&&b.map(E=>Object.assign({},E,{params:Object.assign({},s,E.params),pathname:pr([c,o.encodeLocation?o.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?c:pr([c,o.encodeLocation?o.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),a,n,r)}function oM(){let e=Kb(),t=Oi(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:a},"ErrorBoundary")," or"," ",_.createElement("code",{style:a},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:o},n):null,i)}var aM=_.createElement(oM,null),iM=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?_.createElement(Zn.Provider,{value:this.props.routeContext},_.createElement(Dh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function sM({routeContext:e,match:t,children:n}){let r=_.useContext(jo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Zn.Provider,{value:e},n)}function lM(e,t=[],n=null,r=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let l=o.findIndex(c=>c.route.id&&a?.[c.route.id]!==void 0);je(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,l+1))}let i=!1,s=-1;if(n)for(let l=0;l<o.length;l++){let c=o[l];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(s=l),c.route.id){let{loaderData:d,errors:u}=n,p=c.route.loader&&!d.hasOwnProperty(c.route.id)&&(!u||u[c.route.id]===void 0);if(c.route.lazy||p){i=!0,s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((l,c,d)=>{let u,p=!1,h=null,g=null;n&&(u=a&&c.route.id?a[c.route.id]:void 0,h=c.route.errorElement||aM,i&&(s<0&&d===0?(Qb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,g=null):s===d&&(p=!0,g=c.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,d+1)),T=()=>{let E;return u?E=h:p?E=g:c.route.Component?E=_.createElement(c.route.Component,null):c.route.element?E=c.route.element:E=l,_.createElement(sM,{match:c,routeContext:{outlet:l,matches:b,isDataRoute:n!=null},children:E})};return n&&(c.route.ErrorBoundary||c.route.errorElement||d===0)?_.createElement(iM,{location:n.location,revalidation:n.revalidation,component:h,error:u,children:T(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):T()},null)}function Nh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cM(e){let t=_.useContext(jo);return je(t,Nh(e)),t}function uM(e){let t=_.useContext(Zi);return je(t,Nh(e)),t}function dM(e){let t=_.useContext(Zn);return je(t,Nh(e)),t}function Ph(e){let t=dM(e),n=t.matches[t.matches.length-1];return je(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hM(){return Ph("useRouteId")}function Kb(){let e=_.useContext(Dh),t=uM("useRouteError"),n=Ph("useRouteError");return e!==void 0?e:t.errors?.[n]}function pM(){let{router:e}=cM("useNavigate"),t=Ph("useNavigate"),n=_.useRef(!1);return Yb(()=>{n.current=!0}),_.useCallback(async(o,a={})=>{Ft(n.current,Vb),n.current&&(typeof o=="number"?e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var Hm={};function Qb(e,t,n){!t&&!Hm[e]&&(Hm[e]=!0,Ft(!1,n))}var Um={};function zm(e,t){!e&&!Um[t]&&(Um[t]=!0,console.warn(t))}function fM(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Ft(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:_.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Ft(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:_.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Ft(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:_.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var mM=["HydrateFallback","hydrateFallbackElement"],gM=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function yM({router:e,flushSync:t}){let[n,r]=_.useState(e.state),[o,a]=_.useState(),[i,s]=_.useState({isTransitioning:!1}),[l,c]=_.useState(),[d,u]=_.useState(),[p,h]=_.useState(),g=_.useRef(new Map),b=_.useCallback((C,{deletedFetchers:A,flushSync:N,viewTransitionOpts:S})=>{C.fetchers.forEach((q,j)=>{q.data!==void 0&&g.current.set(j,q.data)}),A.forEach(q=>g.current.delete(q)),zm(N===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let M=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(zm(S==null||M,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!S||!M){t&&N?t(()=>r(C)):_.startTransition(()=>r(C));return}if(t&&N){t(()=>{d&&(l&&l.resolve(),d.skipTransition()),s({isTransitioning:!0,flushSync:!0,currentLocation:S.currentLocation,nextLocation:S.nextLocation})});let q=e.window.document.startViewTransition(()=>{t(()=>r(C))});q.finished.finally(()=>{t(()=>{c(void 0),u(void 0),a(void 0),s({isTransitioning:!1})})}),t(()=>u(q));return}d?(l&&l.resolve(),d.skipTransition(),h({state:C,currentLocation:S.currentLocation,nextLocation:S.nextLocation})):(a(C),s({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}))},[e.window,t,d,l]);_.useLayoutEffect(()=>e.subscribe(b),[e,b]),_.useEffect(()=>{i.isTransitioning&&!i.flushSync&&c(new gM)},[i]),_.useEffect(()=>{if(l&&o&&e.window){let C=o,A=l.promise,N=e.window.document.startViewTransition(async()=>{_.startTransition(()=>r(C)),await A});N.finished.finally(()=>{c(void 0),u(void 0),a(void 0),s({isTransitioning:!1})}),u(N)}},[o,l,e.window]),_.useEffect(()=>{l&&o&&n.location.key===o.location.key&&l.resolve()},[l,d,n.location,o]),_.useEffect(()=>{!i.isTransitioning&&p&&(a(p.state),s({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),h(void 0))},[i.isTransitioning,p]);let T=_.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:C=>e.navigate(C),push:(C,A,N)=>e.navigate(C,{state:A,preventScrollReset:N?.preventScrollReset}),replace:(C,A,N)=>e.navigate(C,{replace:!0,state:A,preventScrollReset:N?.preventScrollReset})}),[e]),E=e.basename||"/",v=_.useMemo(()=>({router:e,navigator:T,static:!1,basename:E}),[e,T,E]);return _.createElement(_.Fragment,null,_.createElement(jo.Provider,{value:v},_.createElement(Zi.Provider,{value:n},_.createElement(Wb.Provider,{value:g.current},_.createElement(_h.Provider,{value:i},_.createElement(xM,{basename:E,location:n.location,navigationType:n.historyAction,navigator:T},_.createElement(bM,{routes:e.routes,future:e.future,state:n})))))),null)}var bM=_.memo(EM);function EM({routes:e,future:t,state:n}){return rM(e,void 0,n,t)}function TM(e){return nM(e.context)}function xM({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){je(!es(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),s=_.useMemo(()=>({basename:i,navigator:o,static:a,future:{}}),[i,o,a]);typeof n=="string"&&(n=to(n));let{pathname:l="/",search:c="",hash:d="",state:u=null,key:p="default"}=n,h=_.useMemo(()=>{let g=Gn(l,i);return g==null?null:{location:{pathname:g,search:c,hash:d,state:u,key:p},navigationType:r}},[i,l,c,d,u,p,r]);return Ft(h!=null,`<Router basename="${i}"> is not able to match the URL "${l}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:_.createElement(br.Provider,{value:s},_.createElement(ac.Provider,{children:t,value:h}))}var Ws="get",Vs="application/x-www-form-urlencoded";function ic(e){return e!=null&&typeof e.tagName=="string"}function CM(e){return ic(e)&&e.tagName.toLowerCase()==="button"}function vM(e){return ic(e)&&e.tagName.toLowerCase()==="form"}function SM(e){return ic(e)&&e.tagName.toLowerCase()==="input"}function kM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function AM(e,t){return e.button===0&&(!t||t==="_self")&&!kM(e)}var Is=null;function IM(){if(Is===null)try{new FormData(document.createElement("form"),0),Is=!1}catch{Is=!0}return Is}var _M=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function cu(e){return e!=null&&!_M.has(e)?(Ft(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vs}"`),null):e}function DM(e,t){let n,r,o,a,i;if(vM(e)){let s=e.getAttribute("action");r=s?Gn(s,t):null,n=e.getAttribute("method")||Ws,o=cu(e.getAttribute("enctype"))||Vs,a=new FormData(e)}else if(CM(e)||SM(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?Gn(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Ws,o=cu(e.getAttribute("formenctype"))||cu(s.getAttribute("enctype"))||Vs,a=new FormData(s,e),!IM()){let{name:c,type:d,value:u}=e;if(d==="image"){let p=c?`${c}.`:"";a.append(`${p}x`,"0"),a.append(`${p}y`,"0")}else c&&a.append(c,u)}}else{if(ic(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ws,r=null,o=Vs,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rh(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wM(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&Gn(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function NM(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function PM(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function RM(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await NM(a,n);return i.links?i.links():[]}return[]}));return MM(r.flat(1).filter(PM).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Gm(e,t,n,r,o,a){let i=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,s=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return a==="assets"?t.filter((l,c)=>i(l,c)||s(l,c)):a==="data"?t.filter((l,c)=>{let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(i(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function LM(e,t,{includeHydrateFallback:n}={}){return $M(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function $M(e){return[...new Set(e)]}function OM(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function MM(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(OM(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function Xb(){let e=_.useContext(jo);return Rh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function FM(){let e=_.useContext(Zi);return Rh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Lh=_.createContext(void 0);Lh.displayName="FrameworkContext";function Jb(){let e=_.useContext(Lh);return Rh(e,"You must render this element inside a <HydratedRouter> element"),e}function BM(e,t){let n=_.useContext(Lh),[r,o]=_.useState(!1),[a,i]=_.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:u}=t,p=_.useRef(null);_.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let b=E=>{E.forEach(v=>{i(v.isIntersecting)})},T=new IntersectionObserver(b,{threshold:.5});return p.current&&T.observe(p.current),()=>{T.disconnect()}}},[e]),_.useEffect(()=>{if(r){let b=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(b)}}},[r]);let h=()=>{o(!0)},g=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,p,{}]:[a,p,{onFocus:Qa(s,h),onBlur:Qa(l,g),onMouseEnter:Qa(c,h),onMouseLeave:Qa(d,g),onTouchStart:Qa(u,h)}]:[!1,p,{}]}function Qa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function jM({page:e,...t}){let{router:n}=Xb(),r=_.useMemo(()=>zr(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(UM,{page:e,matches:r,...t}):null}function HM(e){let{manifest:t,routeModules:n}=Jb(),[r,o]=_.useState([]);return _.useEffect(()=>{let a=!1;return RM(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function UM({page:e,matches:t,...n}){let r=Ho(),{manifest:o,routeModules:a}=Jb(),{basename:i}=Xb(),{loaderData:s,matches:l}=FM(),c=_.useMemo(()=>Gm(e,t,l,o,r,"data"),[e,t,l,o,r]),d=_.useMemo(()=>Gm(e,t,l,o,r,"assets"),[e,t,l,o,r]),u=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let g=new Set,b=!1;if(t.forEach(E=>{let v=o.routes[E.route.id];!v||!v.hasLoader||(!c.some(C=>C.route.id===E.route.id)&&E.route.id in s&&a[E.route.id]?.shouldRevalidate||v.hasClientLoader?b=!0:g.add(E.route.id))}),g.size===0)return[];let T=wM(e,i,"data");return b&&g.size>0&&T.searchParams.set("_routes",t.filter(E=>g.has(E.route.id)).map(E=>E.route.id).join(",")),[T.pathname+T.search]},[i,s,r,o,c,t,e,a]),p=_.useMemo(()=>LM(d,o),[d,o]),h=HM(d);return _.createElement(_.Fragment,null,u.map(g=>_.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),p.map(g=>_.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),h.map(({key:g,link:b})=>_.createElement("link",{key:g,...b})))}function zM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Zb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Zb&&(window.__reactRouterVersion="7.7.1")}catch{}function GM(e,t){return RO({basename:t?.basename,unstable_getContext:t?.unstable_getContext,future:t?.future,history:J$({window:t?.window}),hydrationData:qM(),routes:e,mapRouteProperties:fM,hydrationRouteProperties:mM,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function qM(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:WM(e.errors)}),e}function WM(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Cl(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let a=new Error(o.message);a.stack="",n[r]=a}}else n[r]=o;return n}var eE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tE=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,state:s,target:l,to:c,preventScrollReset:d,viewTransition:u,...p},h){let{basename:g}=_.useContext(br),b=typeof c=="string"&&eE.test(c),T,E=!1;if(typeof c=="string"&&b&&(T=c,Zb))try{let j=new URL(window.location.href),y=c.startsWith("//")?new URL(j.protocol+c):new URL(c),R=Gn(y.pathname,g);y.origin===j.origin&&R!=null?c=R+y.search+y.hash:E=!0}catch{Ft(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=ZO(c,{relative:o}),[C,A,N]=BM(r,p),S=QM(c,{replace:i,state:s,target:l,preventScrollReset:d,relative:o,viewTransition:u});function M(j){t&&t(j),j.defaultPrevented||S(j)}let q=_.createElement("a",{...p,...N,href:T||v,onClick:E||a?t:M,ref:zM(h,A),target:l,"data-discover":!b&&n==="render"?"true":void 0});return C&&!b?_.createElement(_.Fragment,null,q,_.createElement(jM,{page:v})):q});tE.displayName="Link";var VM=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:s,children:l,...c},d){let u=ns(i,{relative:c.relative}),p=Ho(),h=_.useContext(Zi),{navigator:g,basename:b}=_.useContext(br),T=h!=null&&tF(u)&&s===!0,E=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,v=p.pathname,C=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(v=v.toLowerCase(),C=C?C.toLowerCase():null,E=E.toLowerCase()),C&&b&&(C=Gn(C,b)||C);const A=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let N=v===E||!o&&v.startsWith(E)&&v.charAt(A)==="/",S=C!=null&&(C===E||!o&&C.startsWith(E)&&C.charAt(E.length)==="/"),M={isActive:N,isPending:S,isTransitioning:T},q=N?t:void 0,j;typeof r=="function"?j=r(M):j=[r,N?"active":null,S?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let y=typeof a=="function"?a(M):a;return _.createElement(tE,{...c,"aria-current":q,className:j,ref:d,style:y,to:i,viewTransition:s},typeof l=="function"?l(M):l)});VM.displayName="NavLink";var YM=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Ws,action:s,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,...p},h)=>{let g=ZM(),b=eF(s,{relative:c}),T=i.toLowerCase()==="get"?"get":"post",E=typeof s=="string"&&eE.test(s),v=C=>{if(l&&l(C),C.defaultPrevented)return;C.preventDefault();let A=C.nativeEvent.submitter,N=A?.getAttribute("formmethod")||i;g(A||C.currentTarget,{fetcherKey:t,method:N,navigate:n,replace:o,state:a,relative:c,preventScrollReset:d,viewTransition:u})};return _.createElement("form",{ref:h,method:T,action:b,onSubmit:r?l:v,...p,"data-discover":!E&&e==="render"?"true":void 0})});YM.displayName="Form";function KM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nE(e){let t=_.useContext(jo);return je(t,KM(e)),t}function QM(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:i}={}){let s=wh(),l=Ho(),c=ns(e,{relative:a});return _.useCallback(d=>{if(AM(d,t)){d.preventDefault();let u=n!==void 0?n:Kr(l)===Kr(c);s(e,{replace:u,state:r,preventScrollReset:o,relative:a,viewTransition:i})}},[l,s,c,n,r,t,e,o,a,i])}var XM=0,JM=()=>`__${String(++XM)}__`;function ZM(){let{router:e}=nE("useSubmit"),{basename:t}=_.useContext(br),n=hM();return _.useCallback(async(r,o={})=>{let{action:a,method:i,encType:s,formData:l,body:c}=DM(r,t);if(o.navigate===!1){let d=o.fetcherKey||JM();await e.fetch(d,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||i,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||i,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function eF(e,{relative:t}={}){let{basename:n}=_.useContext(br),r=_.useContext(Zn);je(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...ns(e||".",{relative:t})},i=Ho();if(e==null){a.search=i.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(u=>u).forEach(u=>s.append("index",u));let d=s.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:pr([n,a.pathname])),Kr(a)}function tF(e,{relative:t}={}){let n=_.useContext(_h);je(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=nE("useViewTransitionState"),o=ns(e,{relative:t});if(!n.isTransitioning)return!1;let a=Gn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Gn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xl(o.pathname,i)!=null||xl(o.pathname,a)!=null}function nF(e){return _.createElement(yM,{flushSync:HE.flushSync,...e})}function rs(){const e=wh();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}const Zo=ze.createStack({createStyledComponent:mt("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Ca({props:e,name:"MuiStack"})}),rF=new Gl(new Jt);function oF({workbookPath:e,expandCodeCells:t,expandEmbeddings:n,hideEmbeddingIcons:r,defaultProjectName:o,defaultPackageName:a}){const i=rs(),{server:s,getAccessToken:l}=Qd(),{workbookStorage:c}=q$(),[d,u]=$.useState(void 0),[p,h]=$.useState(void 0);if(!c)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[g,b]=$.useState(),[T,E]=$.useState(),[v,C]=$.useState(),[A,N]=$.useState([]),[S,M]=$.useState(null),[q,j]=$.useState(null),y=!!S,R=()=>{M(null),j(null)},F=(J,k)=>{g&&(b(g.insertCell(k,{isMarkdown:J,value:""})),J?C(k):E(k),R(),console.log("handleAddCell",J,k))},[O,U]=$.useState(!1),X=()=>{U(!0)},ne=async()=>{e&&c&&await c.deleteWorkbook(e).then(()=>{h(void 0),u(void 0)}).catch(J=>{h(`Error deleting workbook: ${J.message}`),u(void 0)}),U(!1),i(`/${o}/${a}`)},me=()=>{U(!1)},se=$.useCallback(async()=>{if(!g){console.log("No workbook data ref");return}try{b(await g.saveWorkbook()),h(void 0),u("Workbook saved")}catch(J){h(`Error saving workbook: ${J.message}`),u(void 0)}},[g]);if($.useEffect(()=>{g&&(async()=>{const J=new Map(A.map(({modelPath:he,sourceInfos:de})=>[he,de])),k=[],V=[];for(const he of g.getModels())J.has(he)?k.push({modelPath:he,sourceInfos:J.get(he)}):(console.log("Fetching model from Publisher",he),V.push(rF.getModel(o,a,he,void 0,await $h(s,l)).then(de=>({modelPath:he,sourceInfos:de.data.sourceInfos.map(ye=>JSON.parse(ye))}))));if(V.length>0){const he=await Promise.all(V);N([...k,...he])}else N(k)})()},[l,g,a,o,s]),$.useEffect(()=>{e&&kI.loadWorkbook(c,e).then(J=>{b(J)})},[e,c]),!g)return f.jsx("div",{children:"Loading..."});const Z=J=>{const k=[];for(const V of J)for(const he of V.sourceInfos)k.push({modelPath:V.modelPath,sourceInfo:he});return k},D=(J,k)=>f.jsx(x.Button,{size:"small",startIcon:f.jsx(SI,{}),onClick:()=>F(J,k),variant:"contained",sx:{backgroundColor:"#fff",color:V=>V.palette.mode==="dark"?V.palette.grey[100]:V.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:V=>V.palette.mode==="dark"?V.palette.grey[500]:V.palette.grey[300],boxShadow:"none"}},children:J?"Markdown":"Explore"}),Ee=f.jsxs(x.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[D(!1,g.getCells().length),D(!0,g.getCells().length)]});return f.jsxs(Ut,{variant:"outlined",children:[f.jsxs(Nn,{children:[f.jsx(x.Box,{sx:{mb:2},children:f.jsx(x.Box,{sx:{minHeight:"24px"},children:p?f.jsx(x.Typography,{color:"error",variant:"body2",children:p}):d?f.jsx(x.Typography,{color:"success",variant:"body2",children:d}):f.jsx("span",{children:" "})})}),f.jsxs(Zo,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[f.jsxs(Zo,{direction:"row",spacing:1,alignItems:"center",children:[f.jsx(x.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),f.jsx(x.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),f.jsxs(Zo,{sx:{display:"flex",flexDirection:"row",gap:1},children:[f.jsx(x.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:f.jsx(aF,{workbookData:g})}),f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[f.jsx(x.Button,{color:"error",onClick:X,size:"small",children:"Delete"}),f.jsxs(x.Dialog,{open:O,onClose:me,children:[f.jsx(x.DialogTitle,{children:"Delete Workbook"}),f.jsx(x.DialogContent,{children:f.jsxs(x.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),f.jsxs(x.DialogActions,{children:[f.jsx(x.Button,{onClick:me,color:"primary",size:"small",children:"Cancel"}),f.jsx(x.Button,{onClick:ne,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),f.jsx(x.Divider,{}),f.jsxs(Zo,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[f.jsx(x.Box,{sx:{flex:1},children:f.jsx(K$,{initialSelectedModels:g.getModels(),onModelChange:J=>{b(g.setModels(J)),se()}})}),f.jsx(x.Box,{sx:{flex:1}})]})]}),f.jsx(jd,{children:f.jsxs(Zo,{children:[g.getCells().length===0&&f.jsxs(f.Fragment,{children:[f.jsx(x.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),f.jsx(x.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),g.getCells().map((J,k)=>f.jsx($.Fragment,{children:f.jsx(z$,{cell:J,addButtonCallback:V=>D(V,k),sourceAndPaths:Z(A),expandCodeCell:t,expandEmbedding:n,hideEmbeddingIcons:r,editingMarkdown:v===k,editingMalloy:T===k,onDelete:()=>{b(g.deleteCell(k)),se()},onCellChange:V=>{b(g.setCell(k,V))},onEdit:()=>{J.isMarkdown?C(k):E(k)},onClose:()=>{J.isMarkdown?C(void 0):E(void 0),se()}},`${k}-${J.isMarkdown}-${e.workspace}-${e.path}`)},`${k}-${g.getCells().length}`)),Ee,f.jsxs(x.Menu,{anchorEl:S,open:y,onClose:R,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[f.jsx(x.MenuItem,{onClick:()=>F(!0,q??0),children:"Add Markdown"}),f.jsx(x.MenuItem,{onClick:()=>F(!1,q??0),children:"Add Malloy"})]}),f.jsx(Zo,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function aF({workbookData:e}){const[t,n]=$.useState(!1);return f.jsx(x.Button,{color:"primary",onClick:async()=>{if(!e)return;const r=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}},size:"small",children:t?"Copied!":"Export"})}const iF=dt(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-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"})),sF=dt(f.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"})),qm=dt(f.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"})),lF=dt(f.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"})),cF=dt(f.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"})),uF=dt([f.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"),f.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")]),Wm=dt(f.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"})),dF=new D0(new Jt),hF=e=>{if(!e)return"Explore semantic models, run queries, and build dashboards";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[0]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."};function pF({navigate:e}){const{data:t,isSuccess:n,isError:r,error:o}=dn({queryKey:["projects"],queryFn:a=>dF.listProjects(a)});return r?f.jsx(Xt,{error:o,context:"Projects List"}):n?f.jsxs(x.Container,{maxWidth:"lg",sx:{py:4},children:[f.jsxs(x.Box,{sx:{textAlign:"center",mb:6},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(qm,{sx:{fontSize:32,color:"primary.main"}}),f.jsx(x.Typography,{variant:"h3",component:"h1",fontWeight:700,children:"Publisher"})]}),f.jsx(x.Typography,{variant:"h5",color:"text.secondary",sx:{mb:3,maxWidth:600,mx:"auto"},children:"The open-source semantic model server for the Malloy data language"}),f.jsx(x.Typography,{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."})]}),f.jsxs(x.Grid,{container:!0,spacing:3,sx:{mb:6},children:[f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(iF,{sx:{color:"info.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"Ad Hoc Analysis"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"No-code",size:"small",color:"primary",variant:"outlined"})]})})}),f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(lF,{sx:{color:"warning.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"Notebook Dashboards"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"Versioned",size:"small",color:"warning",variant:"outlined"})]})})}),f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(uF,{sx:{color:"success.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"AI Data Agents"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"AI-Ready",size:"small",color:"success",variant:"outlined"})]})})})]}),f.jsx(x.Divider,{sx:{my:4}}),t.data.length>0?f.jsxs(f.Fragment,{children:[f.jsxs(x.Box,{sx:{textAlign:"center",mb:4},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(Wm,{sx:{color:"primary.main",fontSize:24}}),f.jsx(x.Typography,{variant:"h4",fontWeight:600,children:"Select a Project"})]}),f.jsx(x.Typography,{variant:"body1",color:"text.secondary",children:"Choose a project to explore its semantic models and start analyzing your data"})]}),f.jsx(x.Grid,{container:!0,spacing:3,justifyContent:"center",children:t.data.map(a=>f.jsx(x.Grid,{size:{xs:12,sm:6,md:4},children:f.jsx(x.Card,{variant:"outlined",sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2,borderColor:"primary.main"}},onClick:i=>e(`/${a.name}/`,i),children:f.jsxs(x.CardContent,{sx:{p:3,textAlign:"center"},children:[f.jsx(cF,{sx:{fontSize:48,color:"primary.main",mb:2}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,gutterBottom:!0,children:a.name}),f.jsx(x.Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:hF(a.readme)}),f.jsx(x.Button,{variant:"contained",color:"secondary",endIcon:f.jsx(sF,{}),fullWidth:!0,children:"Open Project"})]})})},a.name))})]}):f.jsxs(x.Box,{sx:{textAlign:"center",mb:4},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(Wm,{sx:{color:"primary.main",fontSize:24}}),f.jsx(x.Typography,{variant:"h4",fontWeight:600,children:"Get Started"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Button,{variant:"contained",size:"large",color:"primary",startIcon:f.jsx(qm,{}),href:"https://github.com/malloydata/publisher/blob/main/README.md#server-configuration",target:"_blank",rel:"noopener noreferrer",children:"Learn How to Create Models"})]}),f.jsx(x.Box,{sx:{textAlign:"center",mt:6,pt:4,borderTop:1,borderColor:"divider"},children:f.jsxs(x.Typography,{variant:"body2",color:"text.secondary",children:["Publisher is built on fully open infrastructure and designed for the AI era. Join the"," ",f.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."]})})]}):f.jsx(ln,{text:"Loading projects..."})}const rE=new yd.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),$h=async(e,t)=>{const n=t?await t():void 0,r=n?{Authorization:`Bearer ${n}`}:{};return{baseURL:e,withCredentials:!!n,headers:r}};function dn(e){const{server:t,getAccessToken:n}=Qd(),r={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{const o=await $h(t,n);return await e.queryFn(o)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return yd.useQuery(r,rE)}function fF(e){const{server:t,getAccessToken:n}=Qd(),r={...e,mutationFn:async o=>{try{const a=await $h(t,n);return await e.mutationFn(o,a)}catch(a){if(a&&typeof a=="object"&&"response"in a){const i=a;if(i.response?.data){const s=new Error(i.response.data.message||i.message);throw s.status=i.response.status,s.data=i.response.data,s}}throw a}},retry:!1,throwOnError:!1};return yd.useMutation(r,rE)}const mF=$.lazy(()=>Promise.resolve().then(()=>require("./index.es56-D9KeGh71.cjs"))),gF=new Hd(new Jt);function oE(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 yF({modelPath:e,query:t,sourceName:n,queryName:r,optionalProjectName:o,optionalPackageName:a,optionalVersionId:i}){const s=Pn(!1),l=o||s?.projectName,c=a||s?.packageName,d=i||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:p,isError:h,error:g}=dn({queryKey:["queryResult",l,c,e,d,t,n,r],queryFn:b=>gF.executeQuery(l,c,e,t,n,r,d,b)});return f.jsxs(f.Fragment,{children:[!p&&!h&&f.jsx(ln,{text:"Fetching Query Results..."}),p&&f.jsx($.Suspense,{fallback:f.jsx("div",{children:"Loading..."}),children:f.jsx(mF,{result:u.data.result})}),h&&f.jsx(Xt,{context:`${l} > ${c} > ${e}`,error:g})]})}const bF=x.styled(x.Card)({display:"flex",flexDirection:"column",height:"100%"});function EF({modelPath:e,sourceName:t,queryName:n,expandResult:r,hideResultIcon:o,expandEmbedding:a,hideEmbeddingIcon:i,noView:s,annotations:l}){const[c,d]=$.useState(r),[u,p]=$.useState(a),[h,g]=$.useState(),[b,T]=$.useState(),{packageName:E,projectName:v}=Pn(),C=oE({modelPath:e,sourceName:t,queryName:n,optionalPackageName:E,optionalProjectName:v});return $.useEffect(()=>{_o(C,"typescript").then(A=>{g(A)})},[u,C]),$.useEffect(()=>{if(l&&l.length>0){const A=l.map(N=>`// ${N}`).join(`
|
|
201
|
+
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let u=Ho(),p;p=u;let h=p.pathname||"/",g=h;if(c!=="/"){let E=c.replace(/^\//,"").split("/");g="/"+h.replace(/^\//,"").split("/").slice(E.length).join("/")}let b=zr(e,{pathname:g});return Ft(d||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ft(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),lM(b&&b.map(E=>Object.assign({},E,{params:Object.assign({},s,E.params),pathname:pr([c,o.encodeLocation?o.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?c:pr([c,o.encodeLocation?o.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),a,n,r)}function oM(){let e=Kb(),t=Oi(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:a},"ErrorBoundary")," or"," ",_.createElement("code",{style:a},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:o},n):null,i)}var aM=_.createElement(oM,null),iM=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?_.createElement(Zn.Provider,{value:this.props.routeContext},_.createElement(Dh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function sM({routeContext:e,match:t,children:n}){let r=_.useContext(jo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Zn.Provider,{value:e},n)}function lM(e,t=[],n=null,r=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let l=o.findIndex(c=>c.route.id&&a?.[c.route.id]!==void 0);je(l>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,l+1))}let i=!1,s=-1;if(n)for(let l=0;l<o.length;l++){let c=o[l];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(s=l),c.route.id){let{loaderData:d,errors:u}=n,p=c.route.loader&&!d.hasOwnProperty(c.route.id)&&(!u||u[c.route.id]===void 0);if(c.route.lazy||p){i=!0,s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((l,c,d)=>{let u,p=!1,h=null,g=null;n&&(u=a&&c.route.id?a[c.route.id]:void 0,h=c.route.errorElement||aM,i&&(s<0&&d===0?(Qb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,g=null):s===d&&(p=!0,g=c.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,d+1)),T=()=>{let E;return u?E=h:p?E=g:c.route.Component?E=_.createElement(c.route.Component,null):c.route.element?E=c.route.element:E=l,_.createElement(sM,{match:c,routeContext:{outlet:l,matches:b,isDataRoute:n!=null},children:E})};return n&&(c.route.ErrorBoundary||c.route.errorElement||d===0)?_.createElement(iM,{location:n.location,revalidation:n.revalidation,component:h,error:u,children:T(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):T()},null)}function Nh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cM(e){let t=_.useContext(jo);return je(t,Nh(e)),t}function uM(e){let t=_.useContext(Zi);return je(t,Nh(e)),t}function dM(e){let t=_.useContext(Zn);return je(t,Nh(e)),t}function Ph(e){let t=dM(e),n=t.matches[t.matches.length-1];return je(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hM(){return Ph("useRouteId")}function Kb(){let e=_.useContext(Dh),t=uM("useRouteError"),n=Ph("useRouteError");return e!==void 0?e:t.errors?.[n]}function pM(){let{router:e}=cM("useNavigate"),t=Ph("useNavigate"),n=_.useRef(!1);return Yb(()=>{n.current=!0}),_.useCallback(async(o,a={})=>{Ft(n.current,Vb),n.current&&(typeof o=="number"?e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var Hm={};function Qb(e,t,n){!t&&!Hm[e]&&(Hm[e]=!0,Ft(!1,n))}var Um={};function zm(e,t){!e&&!Um[t]&&(Um[t]=!0,console.warn(t))}function fM(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Ft(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:_.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Ft(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:_.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Ft(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:_.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var mM=["HydrateFallback","hydrateFallbackElement"],gM=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function yM({router:e,flushSync:t}){let[n,r]=_.useState(e.state),[o,a]=_.useState(),[i,s]=_.useState({isTransitioning:!1}),[l,c]=_.useState(),[d,u]=_.useState(),[p,h]=_.useState(),g=_.useRef(new Map),b=_.useCallback((C,{deletedFetchers:A,flushSync:N,viewTransitionOpts:S})=>{C.fetchers.forEach((q,j)=>{q.data!==void 0&&g.current.set(j,q.data)}),A.forEach(q=>g.current.delete(q)),zm(N===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let M=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(zm(S==null||M,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!S||!M){t&&N?t(()=>r(C)):_.startTransition(()=>r(C));return}if(t&&N){t(()=>{d&&(l&&l.resolve(),d.skipTransition()),s({isTransitioning:!0,flushSync:!0,currentLocation:S.currentLocation,nextLocation:S.nextLocation})});let q=e.window.document.startViewTransition(()=>{t(()=>r(C))});q.finished.finally(()=>{t(()=>{c(void 0),u(void 0),a(void 0),s({isTransitioning:!1})})}),t(()=>u(q));return}d?(l&&l.resolve(),d.skipTransition(),h({state:C,currentLocation:S.currentLocation,nextLocation:S.nextLocation})):(a(C),s({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}))},[e.window,t,d,l]);_.useLayoutEffect(()=>e.subscribe(b),[e,b]),_.useEffect(()=>{i.isTransitioning&&!i.flushSync&&c(new gM)},[i]),_.useEffect(()=>{if(l&&o&&e.window){let C=o,A=l.promise,N=e.window.document.startViewTransition(async()=>{_.startTransition(()=>r(C)),await A});N.finished.finally(()=>{c(void 0),u(void 0),a(void 0),s({isTransitioning:!1})}),u(N)}},[o,l,e.window]),_.useEffect(()=>{l&&o&&n.location.key===o.location.key&&l.resolve()},[l,d,n.location,o]),_.useEffect(()=>{!i.isTransitioning&&p&&(a(p.state),s({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),h(void 0))},[i.isTransitioning,p]);let T=_.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:C=>e.navigate(C),push:(C,A,N)=>e.navigate(C,{state:A,preventScrollReset:N?.preventScrollReset}),replace:(C,A,N)=>e.navigate(C,{replace:!0,state:A,preventScrollReset:N?.preventScrollReset})}),[e]),E=e.basename||"/",v=_.useMemo(()=>({router:e,navigator:T,static:!1,basename:E}),[e,T,E]);return _.createElement(_.Fragment,null,_.createElement(jo.Provider,{value:v},_.createElement(Zi.Provider,{value:n},_.createElement(Wb.Provider,{value:g.current},_.createElement(_h.Provider,{value:i},_.createElement(xM,{basename:E,location:n.location,navigationType:n.historyAction,navigator:T},_.createElement(bM,{routes:e.routes,future:e.future,state:n})))))),null)}var bM=_.memo(EM);function EM({routes:e,future:t,state:n}){return rM(e,void 0,n,t)}function TM(e){return nM(e.context)}function xM({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){je(!es(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),s=_.useMemo(()=>({basename:i,navigator:o,static:a,future:{}}),[i,o,a]);typeof n=="string"&&(n=to(n));let{pathname:l="/",search:c="",hash:d="",state:u=null,key:p="default"}=n,h=_.useMemo(()=>{let g=Gn(l,i);return g==null?null:{location:{pathname:g,search:c,hash:d,state:u,key:p},navigationType:r}},[i,l,c,d,u,p,r]);return Ft(h!=null,`<Router basename="${i}"> is not able to match the URL "${l}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:_.createElement(br.Provider,{value:s},_.createElement(ac.Provider,{children:t,value:h}))}var Ws="get",Vs="application/x-www-form-urlencoded";function ic(e){return e!=null&&typeof e.tagName=="string"}function CM(e){return ic(e)&&e.tagName.toLowerCase()==="button"}function vM(e){return ic(e)&&e.tagName.toLowerCase()==="form"}function SM(e){return ic(e)&&e.tagName.toLowerCase()==="input"}function kM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function AM(e,t){return e.button===0&&(!t||t==="_self")&&!kM(e)}var Is=null;function IM(){if(Is===null)try{new FormData(document.createElement("form"),0),Is=!1}catch{Is=!0}return Is}var _M=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function cu(e){return e!=null&&!_M.has(e)?(Ft(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vs}"`),null):e}function DM(e,t){let n,r,o,a,i;if(vM(e)){let s=e.getAttribute("action");r=s?Gn(s,t):null,n=e.getAttribute("method")||Ws,o=cu(e.getAttribute("enctype"))||Vs,a=new FormData(e)}else if(CM(e)||SM(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?Gn(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Ws,o=cu(e.getAttribute("formenctype"))||cu(s.getAttribute("enctype"))||Vs,a=new FormData(s,e),!IM()){let{name:c,type:d,value:u}=e;if(d==="image"){let p=c?`${c}.`:"";a.append(`${p}x`,"0"),a.append(`${p}y`,"0")}else c&&a.append(c,u)}}else{if(ic(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ws,r=null,o=Vs,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rh(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wM(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&Gn(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function NM(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function PM(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function RM(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await NM(a,n);return i.links?i.links():[]}return[]}));return MM(r.flat(1).filter(PM).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Gm(e,t,n,r,o,a){let i=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,s=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return a==="assets"?t.filter((l,c)=>i(l,c)||s(l,c)):a==="data"?t.filter((l,c)=>{let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(i(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function LM(e,t,{includeHydrateFallback:n}={}){return $M(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function $M(e){return[...new Set(e)]}function OM(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function MM(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(OM(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function Xb(){let e=_.useContext(jo);return Rh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function FM(){let e=_.useContext(Zi);return Rh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Lh=_.createContext(void 0);Lh.displayName="FrameworkContext";function Jb(){let e=_.useContext(Lh);return Rh(e,"You must render this element inside a <HydratedRouter> element"),e}function BM(e,t){let n=_.useContext(Lh),[r,o]=_.useState(!1),[a,i]=_.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:u}=t,p=_.useRef(null);_.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let b=E=>{E.forEach(v=>{i(v.isIntersecting)})},T=new IntersectionObserver(b,{threshold:.5});return p.current&&T.observe(p.current),()=>{T.disconnect()}}},[e]),_.useEffect(()=>{if(r){let b=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(b)}}},[r]);let h=()=>{o(!0)},g=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,p,{}]:[a,p,{onFocus:Qa(s,h),onBlur:Qa(l,g),onMouseEnter:Qa(c,h),onMouseLeave:Qa(d,g),onTouchStart:Qa(u,h)}]:[!1,p,{}]}function Qa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function jM({page:e,...t}){let{router:n}=Xb(),r=_.useMemo(()=>zr(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?_.createElement(UM,{page:e,matches:r,...t}):null}function HM(e){let{manifest:t,routeModules:n}=Jb(),[r,o]=_.useState([]);return _.useEffect(()=>{let a=!1;return RM(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function UM({page:e,matches:t,...n}){let r=Ho(),{manifest:o,routeModules:a}=Jb(),{basename:i}=Xb(),{loaderData:s,matches:l}=FM(),c=_.useMemo(()=>Gm(e,t,l,o,r,"data"),[e,t,l,o,r]),d=_.useMemo(()=>Gm(e,t,l,o,r,"assets"),[e,t,l,o,r]),u=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let g=new Set,b=!1;if(t.forEach(E=>{let v=o.routes[E.route.id];!v||!v.hasLoader||(!c.some(C=>C.route.id===E.route.id)&&E.route.id in s&&a[E.route.id]?.shouldRevalidate||v.hasClientLoader?b=!0:g.add(E.route.id))}),g.size===0)return[];let T=wM(e,i,"data");return b&&g.size>0&&T.searchParams.set("_routes",t.filter(E=>g.has(E.route.id)).map(E=>E.route.id).join(",")),[T.pathname+T.search]},[i,s,r,o,c,t,e,a]),p=_.useMemo(()=>LM(d,o),[d,o]),h=HM(d);return _.createElement(_.Fragment,null,u.map(g=>_.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),p.map(g=>_.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),h.map(({key:g,link:b})=>_.createElement("link",{key:g,...b})))}function zM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Zb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Zb&&(window.__reactRouterVersion="7.7.1")}catch{}function GM(e,t){return RO({basename:t?.basename,unstable_getContext:t?.unstable_getContext,future:t?.future,history:J$({window:t?.window}),hydrationData:qM(),routes:e,mapRouteProperties:fM,hydrationRouteProperties:mM,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function qM(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:WM(e.errors)}),e}function WM(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Cl(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let a=new Error(o.message);a.stack="",n[r]=a}}else n[r]=o;return n}var eE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tE=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,state:s,target:l,to:c,preventScrollReset:d,viewTransition:u,...p},h){let{basename:g}=_.useContext(br),b=typeof c=="string"&&eE.test(c),T,E=!1;if(typeof c=="string"&&b&&(T=c,Zb))try{let j=new URL(window.location.href),y=c.startsWith("//")?new URL(j.protocol+c):new URL(c),R=Gn(y.pathname,g);y.origin===j.origin&&R!=null?c=R+y.search+y.hash:E=!0}catch{Ft(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=ZO(c,{relative:o}),[C,A,N]=BM(r,p),S=QM(c,{replace:i,state:s,target:l,preventScrollReset:d,relative:o,viewTransition:u});function M(j){t&&t(j),j.defaultPrevented||S(j)}let q=_.createElement("a",{...p,...N,href:T||v,onClick:E||a?t:M,ref:zM(h,A),target:l,"data-discover":!b&&n==="render"?"true":void 0});return C&&!b?_.createElement(_.Fragment,null,q,_.createElement(jM,{page:v})):q});tE.displayName="Link";var VM=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:s,children:l,...c},d){let u=ns(i,{relative:c.relative}),p=Ho(),h=_.useContext(Zi),{navigator:g,basename:b}=_.useContext(br),T=h!=null&&tF(u)&&s===!0,E=g.encodeLocation?g.encodeLocation(u).pathname:u.pathname,v=p.pathname,C=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(v=v.toLowerCase(),C=C?C.toLowerCase():null,E=E.toLowerCase()),C&&b&&(C=Gn(C,b)||C);const A=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let N=v===E||!o&&v.startsWith(E)&&v.charAt(A)==="/",S=C!=null&&(C===E||!o&&C.startsWith(E)&&C.charAt(E.length)==="/"),M={isActive:N,isPending:S,isTransitioning:T},q=N?t:void 0,j;typeof r=="function"?j=r(M):j=[r,N?"active":null,S?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let y=typeof a=="function"?a(M):a;return _.createElement(tE,{...c,"aria-current":q,className:j,ref:d,style:y,to:i,viewTransition:s},typeof l=="function"?l(M):l)});VM.displayName="NavLink";var YM=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Ws,action:s,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,...p},h)=>{let g=ZM(),b=eF(s,{relative:c}),T=i.toLowerCase()==="get"?"get":"post",E=typeof s=="string"&&eE.test(s),v=C=>{if(l&&l(C),C.defaultPrevented)return;C.preventDefault();let A=C.nativeEvent.submitter,N=A?.getAttribute("formmethod")||i;g(A||C.currentTarget,{fetcherKey:t,method:N,navigate:n,replace:o,state:a,relative:c,preventScrollReset:d,viewTransition:u})};return _.createElement("form",{ref:h,method:T,action:b,onSubmit:r?l:v,...p,"data-discover":!E&&e==="render"?"true":void 0})});YM.displayName="Form";function KM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nE(e){let t=_.useContext(jo);return je(t,KM(e)),t}function QM(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:i}={}){let s=wh(),l=Ho(),c=ns(e,{relative:a});return _.useCallback(d=>{if(AM(d,t)){d.preventDefault();let u=n!==void 0?n:Kr(l)===Kr(c);s(e,{replace:u,state:r,preventScrollReset:o,relative:a,viewTransition:i})}},[l,s,c,n,r,t,e,o,a,i])}var XM=0,JM=()=>`__${String(++XM)}__`;function ZM(){let{router:e}=nE("useSubmit"),{basename:t}=_.useContext(br),n=hM();return _.useCallback(async(r,o={})=>{let{action:a,method:i,encType:s,formData:l,body:c}=DM(r,t);if(o.navigate===!1){let d=o.fetcherKey||JM();await e.fetch(d,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||i,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||i,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function eF(e,{relative:t}={}){let{basename:n}=_.useContext(br),r=_.useContext(Zn);je(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...ns(e||".",{relative:t})},i=Ho();if(e==null){a.search=i.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(u=>u).forEach(u=>s.append("index",u));let d=s.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:pr([n,a.pathname])),Kr(a)}function tF(e,{relative:t}={}){let n=_.useContext(_h);je(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=nE("useViewTransitionState"),o=ns(e,{relative:t});if(!n.isTransitioning)return!1;let a=Gn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Gn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xl(o.pathname,i)!=null||xl(o.pathname,a)!=null}function nF(e){return _.createElement(yM,{flushSync:HE.flushSync,...e})}function rs(){const e=wh();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}const Zo=ze.createStack({createStyledComponent:mt("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Ca({props:e,name:"MuiStack"})}),rF=new Gl(new Jt);function oF({workbookPath:e,expandCodeCells:t,expandEmbeddings:n,hideEmbeddingIcons:r,defaultProjectName:o,defaultPackageName:a}){const i=rs(),{server:s,getAccessToken:l}=Qd(),{workbookStorage:c}=q$(),[d,u]=$.useState(void 0),[p,h]=$.useState(void 0);if(!c)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[g,b]=$.useState(),[T,E]=$.useState(),[v,C]=$.useState(),[A,N]=$.useState([]),[S,M]=$.useState(null),[q,j]=$.useState(null),y=!!S,R=()=>{M(null),j(null)},F=(J,k)=>{g&&(b(g.insertCell(k,{isMarkdown:J,value:""})),J?C(k):E(k),R(),console.log("handleAddCell",J,k))},[O,U]=$.useState(!1),X=()=>{U(!0)},ne=async()=>{e&&c&&await c.deleteWorkbook(e).then(()=>{h(void 0),u(void 0)}).catch(J=>{h(`Error deleting workbook: ${J.message}`),u(void 0)}),U(!1),i(`/${o}/${a}`)},me=()=>{U(!1)},se=$.useCallback(async()=>{if(!g){console.log("No workbook data ref");return}try{b(await g.saveWorkbook()),h(void 0),u("Workbook saved")}catch(J){h(`Error saving workbook: ${J.message}`),u(void 0)}},[g]);if($.useEffect(()=>{g&&(async()=>{const J=new Map(A.map(({modelPath:he,sourceInfos:de})=>[he,de])),k=[],V=[];for(const he of g.getModels())J.has(he)?k.push({modelPath:he,sourceInfos:J.get(he)}):(console.log("Fetching model from Publisher",he),V.push(rF.getModel(o,a,he,void 0,await $h(s,l)).then(de=>({modelPath:he,sourceInfos:de.data.sourceInfos.map(ye=>JSON.parse(ye))}))));if(V.length>0){const he=await Promise.all(V);N([...k,...he])}else N(k)})()},[l,g,a,o,s]),$.useEffect(()=>{e&&kI.loadWorkbook(c,e).then(J=>{b(J)})},[e,c]),!g)return f.jsx("div",{children:"Loading..."});const Z=J=>{const k=[];for(const V of J)for(const he of V.sourceInfos)k.push({modelPath:V.modelPath,sourceInfo:he});return k},D=(J,k)=>f.jsx(x.Button,{size:"small",startIcon:f.jsx(SI,{}),onClick:()=>F(J,k),variant:"contained",sx:{backgroundColor:"#fff",color:V=>V.palette.mode==="dark"?V.palette.grey[100]:V.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:V=>V.palette.mode==="dark"?V.palette.grey[500]:V.palette.grey[300],boxShadow:"none"}},children:J?"Markdown":"Explore"}),Ee=f.jsxs(x.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[D(!1,g.getCells().length),D(!0,g.getCells().length)]});return f.jsxs(Ut,{variant:"outlined",children:[f.jsxs(Nn,{children:[f.jsx(x.Box,{sx:{mb:2},children:f.jsx(x.Box,{sx:{minHeight:"24px"},children:p?f.jsx(x.Typography,{color:"error",variant:"body2",children:p}):d?f.jsx(x.Typography,{color:"success",variant:"body2",children:d}):f.jsx("span",{children:" "})})}),f.jsxs(Zo,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[f.jsxs(Zo,{direction:"row",spacing:1,alignItems:"center",children:[f.jsx(x.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),f.jsx(x.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),f.jsxs(Zo,{sx:{display:"flex",flexDirection:"row",gap:1},children:[f.jsx(x.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:f.jsx(aF,{workbookData:g})}),f.jsxs(x.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[f.jsx(x.Button,{color:"error",onClick:X,size:"small",children:"Delete"}),f.jsxs(x.Dialog,{open:O,onClose:me,children:[f.jsx(x.DialogTitle,{children:"Delete Workbook"}),f.jsx(x.DialogContent,{children:f.jsxs(x.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),f.jsxs(x.DialogActions,{children:[f.jsx(x.Button,{onClick:me,color:"primary",size:"small",children:"Cancel"}),f.jsx(x.Button,{onClick:ne,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),f.jsx(x.Divider,{}),f.jsxs(Zo,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[f.jsx(x.Box,{sx:{flex:1},children:f.jsx(K$,{initialSelectedModels:g.getModels(),onModelChange:J=>{b(g.setModels(J)),se()}})}),f.jsx(x.Box,{sx:{flex:1}})]})]}),f.jsx(jd,{children:f.jsxs(Zo,{children:[g.getCells().length===0&&f.jsxs(f.Fragment,{children:[f.jsx(x.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),f.jsx(x.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),g.getCells().map((J,k)=>f.jsx($.Fragment,{children:f.jsx(z$,{cell:J,addButtonCallback:V=>D(V,k),sourceAndPaths:Z(A),expandCodeCell:t,expandEmbedding:n,hideEmbeddingIcons:r,editingMarkdown:v===k,editingMalloy:T===k,onDelete:()=>{b(g.deleteCell(k)),se()},onCellChange:V=>{b(g.setCell(k,V))},onEdit:()=>{J.isMarkdown?C(k):E(k)},onClose:()=>{J.isMarkdown?C(void 0):E(void 0),se()}},`${k}-${J.isMarkdown}-${e.workspace}-${e.path}`)},`${k}-${g.getCells().length}`)),Ee,f.jsxs(x.Menu,{anchorEl:S,open:y,onClose:R,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[f.jsx(x.MenuItem,{onClick:()=>F(!0,q??0),children:"Add Markdown"}),f.jsx(x.MenuItem,{onClick:()=>F(!1,q??0),children:"Add Malloy"})]}),f.jsx(Zo,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function aF({workbookData:e}){const[t,n]=$.useState(!1);return f.jsx(x.Button,{color:"primary",onClick:async()=>{if(!e)return;const r=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}},size:"small",children:t?"Copied!":"Export"})}const iF=dt(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-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"})),sF=dt(f.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"})),qm=dt(f.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"})),lF=dt(f.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"})),cF=dt(f.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"})),uF=dt([f.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"),f.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")]),Wm=dt(f.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"})),dF=new D0(new Jt),hF=e=>{if(!e)return"Explore semantic models, run queries, and build dashboards";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[0]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."};function pF({navigate:e}){const{data:t,isSuccess:n,isError:r,error:o}=dn({queryKey:["projects"],queryFn:a=>dF.listProjects(a)});return r?f.jsx(Xt,{error:o,context:"Projects List"}):n?f.jsxs(x.Container,{maxWidth:"lg",sx:{py:4},children:[f.jsxs(x.Box,{sx:{textAlign:"center",mb:6},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(qm,{sx:{fontSize:32,color:"primary.main"}}),f.jsx(x.Typography,{variant:"h3",component:"h1",fontWeight:700,children:"Publisher"})]}),f.jsx(x.Typography,{variant:"h5",color:"text.secondary",sx:{mb:3,maxWidth:600,mx:"auto"},children:"The open-source semantic model server for the Malloy data language"}),f.jsx(x.Typography,{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."})]}),f.jsxs(x.Grid,{container:!0,spacing:3,sx:{mb:6},children:[f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(iF,{sx:{color:"info.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"Ad Hoc Analysis"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"No-code",size:"small",color:"primary",variant:"outlined"})]})})}),f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(lF,{sx:{color:"warning.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"Notebook Dashboards"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"Versioned",size:"small",color:"warning",variant:"outlined"})]})})}),f.jsx(x.Grid,{size:{xs:12,md:4},children:f.jsx(x.Card,{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:f.jsxs(x.CardContent,{sx:{p:3},children:[f.jsxs(x.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(uF,{sx:{color:"success.main",fontSize:28}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,children:"AI Data Agents"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Chip,{label:"AI-Ready",size:"small",color:"success",variant:"outlined"})]})})})]}),f.jsx(x.Divider,{sx:{my:4}}),t.data.length>0?f.jsxs(f.Fragment,{children:[f.jsxs(x.Box,{sx:{textAlign:"center",mb:4},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(Wm,{sx:{color:"primary.main",fontSize:24}}),f.jsx(x.Typography,{variant:"h4",fontWeight:600,children:"Select a Project"})]}),f.jsx(x.Typography,{variant:"body1",color:"text.secondary",children:"Choose a project to explore its semantic models and start analyzing your data"})]}),f.jsx(x.Grid,{container:!0,spacing:3,justifyContent:"center",children:t.data.map(a=>f.jsx(x.Grid,{size:{xs:12,sm:6,md:4},children:f.jsx(x.Card,{variant:"outlined",sx:{height:"100%",cursor:"pointer",transition:"all 0.2s ease","&:hover":{transform:"translateY(-2px)",boxShadow:2,borderColor:"primary.main"}},onClick:i=>e(`/${a.name}/`,i),children:f.jsxs(x.CardContent,{sx:{p:3,textAlign:"center"},children:[f.jsx(cF,{sx:{fontSize:48,color:"primary.main",mb:2}}),f.jsx(x.Typography,{variant:"h6",fontWeight:600,gutterBottom:!0,children:a.name}),f.jsx(x.Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:hF(a.readme)}),f.jsx(x.Button,{variant:"contained",color:"secondary",endIcon:f.jsx(sF,{}),fullWidth:!0,children:"Open Project"})]})})},a.name))})]}):f.jsxs(x.Box,{sx:{textAlign:"center",mb:4},children:[f.jsxs(x.Stack,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{mb:2},children:[f.jsx(Wm,{sx:{color:"primary.main",fontSize:24}}),f.jsx(x.Typography,{variant:"h4",fontWeight:600,children:"Get Started"})]}),f.jsx(x.Typography,{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."}),f.jsx(x.Button,{variant:"contained",size:"large",color:"primary",startIcon:f.jsx(qm,{}),href:"https://github.com/malloydata/publisher/blob/main/README.md#server-configuration",target:"_blank",rel:"noopener noreferrer",children:"Learn How to Create Models"})]}),f.jsx(x.Box,{sx:{textAlign:"center",mt:6,pt:4,borderTop:1,borderColor:"divider"},children:f.jsxs(x.Typography,{variant:"body2",color:"text.secondary",children:["Publisher is built on fully open infrastructure and designed for the AI era. Join the"," ",f.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."]})})]}):f.jsx(ln,{text:"Loading projects..."})}const rE=new yd.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),$h=async(e,t)=>{const n=t?await t():void 0,r=n?{Authorization:`Bearer ${n}`}:{};return{baseURL:e,withCredentials:!!n,headers:r}};function dn(e){const{server:t,getAccessToken:n}=Qd(),r={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{const o=await $h(t,n);return await e.queryFn(o)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return yd.useQuery(r,rE)}function fF(e){const{server:t,getAccessToken:n}=Qd(),r={...e,mutationFn:async o=>{try{const a=await $h(t,n);return await e.mutationFn(o,a)}catch(a){if(a&&typeof a=="object"&&"response"in a){const i=a;if(i.response?.data){const s=new Error(i.response.data.message||i.message);throw s.status=i.response.status,s.data=i.response.data,s}}throw a}},retry:!1,throwOnError:!1};return yd.useMutation(r,rE)}const mF=$.lazy(()=>Promise.resolve().then(()=>require("./index.es23-D9KeGh71.cjs"))),gF=new Hd(new Jt);function oE(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 yF({modelPath:e,query:t,sourceName:n,queryName:r,optionalProjectName:o,optionalPackageName:a,optionalVersionId:i}){const s=Pn(!1),l=o||s?.projectName,c=a||s?.packageName,d=i||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:p,isError:h,error:g}=dn({queryKey:["queryResult",l,c,e,d,t,n,r],queryFn:b=>gF.executeQuery(l,c,e,t,n,r,d,b)});return f.jsxs(f.Fragment,{children:[!p&&!h&&f.jsx(ln,{text:"Fetching Query Results..."}),p&&f.jsx($.Suspense,{fallback:f.jsx("div",{children:"Loading..."}),children:f.jsx(mF,{result:u.data.result})}),h&&f.jsx(Xt,{context:`${l} > ${c} > ${e}`,error:g})]})}const bF=x.styled(x.Card)({display:"flex",flexDirection:"column",height:"100%"});function EF({modelPath:e,sourceName:t,queryName:n,expandResult:r,hideResultIcon:o,expandEmbedding:a,hideEmbeddingIcon:i,noView:s,annotations:l}){const[c,d]=$.useState(r),[u,p]=$.useState(a),[h,g]=$.useState(),[b,T]=$.useState(),{packageName:E,projectName:v}=Pn(),C=oE({modelPath:e,sourceName:t,queryName:n,optionalPackageName:E,optionalProjectName:v});return $.useEffect(()=>{_o(C,"typescript").then(A=>{g(A)})},[u,C]),$.useEffect(()=>{if(l&&l.length>0){const A=l.map(N=>`// ${N}`).join(`
|
|
202
202
|
`);_o(A,"typescript").then(N=>{T(N)})}},[l]),f.jsx(f.Fragment,{children:f.jsxs(bF,{variant:"outlined",sx:{padding:"0px 10px 0px 10px",borderRadius:"0px"},children:[f.jsxs(x.Stack,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"},children:[f.jsx(x.Typography,{variant:"subtitle2",sx:{mt:"auto",mb:"auto"},children:`${s?"":"View >"} ${n}`}),f.jsxs(x.CardActions,{sx:{padding:"0px"},children:[!o&&f.jsx(x.Tooltip,{title:c?"Hide Results":"Show Results",children:f.jsx(x.IconButton,{size:"small",onClick:()=>{d(!c)},children:f.jsx(ek,{})})}),!i&&f.jsx(x.Tooltip,{title:u?"Hide Sharing":"Show Sharing",children:f.jsx(x.IconButton,{size:"small",onClick:()=>{p(!u)},children:f.jsx(ji,{})})})]})]}),f.jsxs(x.Collapse,{in:u,timeout:"auto",unmountOnExit:!0,children:[f.jsx(x.Divider,{}),f.jsxs(x.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[f.jsx(x.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:f.jsx("div",{dangerouslySetInnerHTML:{__html:h}})}),f.jsx(x.Tooltip,{title:"Copy Embeddable Code",children:f.jsx(x.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(C)},children:f.jsx(Ml,{})})})]})]}),f.jsxs(x.Collapse,{in:c,timeout:"auto",unmountOnExit:!0,children:[f.jsx(x.Divider,{sx:{mb:"4px"}}),b&&f.jsxs(f.Fragment,{children:[f.jsx(x.Stack,{sx:{borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:f.jsx(x.Typography,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:f.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:b}})})}),f.jsx(x.Divider,{sx:{mb:"4px"}})]}),f.jsx(x.CardContent,{children:f.jsx(yF,{modelPath:e,sourceName:t,queryName:n})})]})]})})}function TF({modelPath:e,versionId:t,expandResults:n,hideResultIcons:r,expandEmbeddings:o,hideEmbeddingIcons:a,onChange:i}){const[s,l]=$.useState(0),{data:c,isError:d,isLoading:u,error:p}=R0(e,t);return u?f.jsx(ln,{text:"Fetching Model..."}):d?(console.log("error",p),f.jsx(Xt,{error:p,context:`ModelExplorer > ${e}`})):f.jsxs(x.Stack,{spacing:2,component:"section",children:[Array.isArray(c.sourceInfos)&&c.sourceInfos.length>0&&f.jsx(x.Stack,{sx:{flexDirection:"row",justifyContent:"flex-start"},children:f.jsx(x.Tabs,{value:s,onChange:(h,g)=>l(g),variant:"scrollable",scrollButtons:"auto",sx:{borderBottom:1,borderColor:"divider",minHeight:36},children:c.sourceInfos.map((h,g)=>{let b;try{b=JSON.parse(h)}catch{b={name:String(g)}}return f.jsx(x.Tab,{label:b.name||`Source ${g+1}`,sx:{minHeight:36}},b.name||g)})})}),Array.isArray(c.sourceInfos)&&c.sourceInfos.length>0&&f.jsx(P0,{sourceAndPath:{modelPath:e,sourceInfo:JSON.parse(c.sourceInfos[s])},onChange:i}),c.queries?.length>0&&f.jsxs(Ut,{variant:"outlined",sx:{padding:"0px 10px 0px 10px"},children:[f.jsx(Nn,{sx:{p:"10px"},children:f.jsx(x.Typography,{variant:"subtitle1",children:"Named Queries"})}),f.jsx(x.Stack,{spacing:1,component:"section",children:c.queries.map(h=>f.jsx(EF,{modelPath:e,queryName:h.name,expandResult:n,hideResultIcon:r,expandEmbedding:o,hideEmbeddingIcon:a,noView:!0,annotations:h.annotations},h.name))}),f.jsx(x.Box,{height:"10px"})]}),f.jsx(x.Box,{height:"5px"})]})}function xF({modelPath:e,versionId:t,expandResults:n,hideResultIcons:r,expandEmbeddings:o,hideEmbeddingIcons:a,onChange:i}){const[s,l]=$.useState(!1),[c,d]=$.useState(),{isError:u,isLoading:p,error:h}=R0(e,t),g=CF(e);return $.useEffect(()=>{_o(g,"typescript").then(b=>{d(b)})},[s,g]),p?f.jsx(ln,{text:"Fetching Model..."}):u?(console.log("error",h),f.jsx(Xt,{error:h,context:`Model > ${e}`})):f.jsxs(Ut,{variant:"outlined",children:[f.jsxs(Nn,{children:[f.jsx(x.Stack,{sx:{flexDirection:"row",justifyContent:"flex-end"},children:!a&&f.jsx(x.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:f.jsx(x.Tooltip,{title:s?"Hide Embedding":"View Embedding",children:f.jsx(x.IconButton,{size:"small",onClick:()=>{l(!s)},children:f.jsx(ji,{})})})})}),f.jsxs(x.Collapse,{in:s,timeout:"auto",unmountOnExit:!0,children:[f.jsx(x.Divider,{}),f.jsxs(x.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[f.jsx(x.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:f.jsx("div",{dangerouslySetInnerHTML:{__html:c}})}),f.jsx(x.Tooltip,{title:"Copy Embeddable Code",children:f.jsx(x.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(g)},children:f.jsx(Ml,{})})})]})]}),f.jsx(x.Divider,{})]}),f.jsx(TF,{modelPath:e,versionId:t,expandResults:n,hideResultIcons:r,expandEmbeddings:o,hideEmbeddingIcons:a,onChange:i})]})}function CF(e){return`<Model
|
|
203
203
|
modelPath="${e}"
|
|
204
204
|
accessToken={accessToken}
|
package/dist/index.es.js
CHANGED
|
@@ -12580,7 +12580,7 @@ function x1(e, t) {
|
|
|
12580
12580
|
}
|
|
12581
12581
|
const I1 = ft(/* @__PURE__ */ g("path", {
|
|
12582
12582
|
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"
|
|
12583
|
-
})), Ax = t0(() => import("./index.
|
|
12583
|
+
})), Ax = t0(() => import("./index.es23-zsmphQm1.js"));
|
|
12584
12584
|
function _1({
|
|
12585
12585
|
result: e,
|
|
12586
12586
|
minHeight: t,
|
|
@@ -42105,7 +42105,7 @@ function E7(e) {
|
|
|
42105
42105
|
};
|
|
42106
42106
|
return HT(r, QE);
|
|
42107
42107
|
}
|
|
42108
|
-
const T7 = t0(() => import("./index.
|
|
42108
|
+
const T7 = t0(() => import("./index.es23-zsmphQm1.js")), C7 = new vp(new cn());
|
|
42109
42109
|
function XE(e) {
|
|
42110
42110
|
const { optionalProjectName: t, optionalPackageName: n } = e;
|
|
42111
42111
|
if (!t || !n)
|
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.97",
|
|
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.97",
|
|
38
38
|
"@mui/icons-material": "^7.0.2",
|
|
39
39
|
"@mui/material": "^7.0.2",
|
|
40
40
|
"@vitejs/plugin-react": "^4.3.1",
|
|
File without changes
|
|
File without changes
|