@malloydata/render 0.0.222-dev241212190052 → 0.0.222-dev241212204326

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.
@@ -594,7 +594,11 @@ function ble(t, e) {
594
594
  r[(n = i.as) !== null && n !== void 0 ? n : i.name] = i;
595
595
  return {
596
596
  fields: t.fields.filter((i) => CQ(r[i])),
597
- joinedUsage: t.joinedUsage
597
+ // Today it is not possible for a join to be composite, so we can safely throw
598
+ // away all join usage here...; if we ever allow joins in composite source
599
+ // inputs, then this will need to be updated to be the joinUsage with joins
600
+ // that are not composite filtered out...
601
+ joinedUsage: {}
598
602
  };
599
603
  }
600
604
  Object.defineProperty(st, "__esModule", { value: !0 });
@@ -1,4 +1,4 @@
1
- (function(yi,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(yi=typeof globalThis<"u"?globalThis:yi||self,T(yi.index={}))})(this,function(yi){"use strict";var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Z3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Z$(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Bt={},Ex={},it={},rt={},ta={};Object.defineProperty(ta,"__esModule",{value:!0}),ta.isNotUndefined=ta.locationContainsPosition=void 0;function mle(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}ta.locationContainsPosition=mle;function yle(t){return t!==void 0}ta.isNotUndefined=yle;var We={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(U){return"kids"in U}t.exprHasKids=e;function n(U){return"e"in U}t.exprHasE=n;function r(U){return!(e(U)||n(U))}t.exprIsLeaf=r;function i(U){return U.node==="aggregate"&&["sum","avg","count","distinct"].includes(U.function)}t.isAsymmetricExpr=i;function s(U){return U.node!=="arrayLiteral"&&U.node!=="recordLiteral"}function o(U,xe){const fe=typeof xe=="string"?{type:xe}:xe;return s(U)?{...U,typeDef:{...fe}}:U}t.mkTemporal=o;function u(U){return"dstSQLType"in U}t.isRawCast=u;function a(U){return U.value!==null}t.paramHasValue=a;function l(U){return U===void 0||U==="scalar"}t.expressionIsScalar=l;function c(U){return U==="aggregate"||U==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(U){return U==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(U){return U==="aggregate"||U==="ungrouped_aggregate"||U==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(U){return U==="aggregate"||U==="scalar_analytic"||U==="aggregate_analytic"||U==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(U){return U==="aggregate_analytic"||U==="scalar_analytic"}t.expressionIsAnalytic=p;function m(U){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[U]}function g(U,xe){return U===xe||m(U)<m(xe)}t.isExpressionTypeLEQ=g;function y(U,xe){let fe="scalar";return(U==="aggregate"||xe==="aggregate")&&(fe="aggregate"),(U==="ungrouped_aggregate"||xe==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(U==="scalar_analytic"||xe==="scalar_analytic")&&(fe="scalar_analytic"),(U==="aggregate_analytic"||xe==="aggregate_analytic")&&(fe="aggregate_analytic"),(U==="scalar_analytic"&&xe==="aggregate"||U==="aggregate"&&xe==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(U){return U.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function A(U){return"e"in U}t.hasExpression=A;function _(U){return U==="date"||U==="timestamp"}t.isTemporalType=_;function v(U){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(U)}t.isAtomicFieldType=v;function C(U){return["string","number","date","boolean","date","timestamp"].includes(U)}t.canOrderBy=C;function S(U){return["string","number","date","timestamp","boolean","json"].includes(U)}t.isCastType=S;function b(U){return v(U.type)&&!A(U)}t.fieldIsIntrinsic=b;function R(U,xe){if(j(U))return L(U.elementTypeDef,xe);if(B(U)){const{type:fe,fields:X,elementTypeDef:ne}=U;return{type:fe,fields:X,elementTypeDef:ne,join:"many",name:xe}}if(U.type==="record"){const{type:fe,fields:X}=U;return{type:fe,fields:X,join:"one",name:xe}}return{...U,name:xe}}t.mkFieldDef=R;function L(U,xe){if(U.type==="record")return{type:"array",join:"many",name:xe,elementTypeDef:{type:"record_element"},fields:U.fields};const fe=R(U,"value");return{type:"array",join:"many",name:xe,elementTypeDef:U,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=L;function B(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}t.isRepeatedRecord=B;function j(U){return U.type==="array"&&U.elementTypeDef.type!=="record_element"}t.isScalarArray=j;function z(U){return["left","right","full","inner"].includes(U)}t.isMatrixOperation=z;function Z(U){return["composite","table","sql_select","query_source","array","record"].includes(U.type)}t.isJoinable=Z;function W(U){return"join"in U}t.isJoined=W;function oe(U){return M(U)&&W(U)}t.isJoinedSource=oe;function ye(U){return["day","week","month","quarter","year"].includes(U)}t.isDateUnit=ye;function de(U){return ye(U)||["hour","minute","second"].includes(U)}t.isTimestampUnit=de;function se(U){return de(U)||U==="day_of_week"||U==="day_of_year"}t.isExtractUnit=se;var ae;(function(U){U.Date="date",U.Timestamp="timestamp",U.Number="number",U.String="string"})(ae||(t.ValueType=ae={}));function he(U){return typeof U!="string"}t.refIsStructDef=he;function be(U){return!!((U.type==="reduce"||U.type==="project"||U.type==="partial")&&(U.extendSource&&U.extendSource.some(xe=>xe.type==="error")||U.queryFields.some(xe=>xe.type==="error")))}t.segmentHasErrors=be;function F(U){return U.fields.some(xe=>xe.type==="error")}t.structHasErrors=F;function D(U){return U.type==="reduce"}t.isReduceSegment=D;function N(U){return U.type==="partial"}t.isPartialSegment=N;function P(U){return U.type==="project"}t.isProjectSegment=P;function G(U){return P(U)||D(U)}t.isQuerySegment=G;function H(U){return U.rows!==void 0}t.isSamplingRows=H;function O(U){return U.percent!==void 0}t.isSamplingPercent=O;function $(U){return U.enable!==void 0}t.isSamplingEnable=$;function k(U){return U.type==="raw"}t.isRawSegment=k;function Q(U){return U.type==="index"}t.isIndexSegment=Q;function I(U){return"sql"in U}t.isSegmentSQL=I;function q(U){return{...U}}t.sourceBase=q;function M(U){return U.type==="table"||U.type==="sql_select"||U.type==="query_source"||U.type==="query_result"||U.type==="finalize"||U.type==="nest_source"||U.type==="composite"}t.isSourceDef=M;function Y(U){return oe(U)?!1:!!M(U)}t.isBaseTable=Y;function le(U){return U==="literal"}t.isLiteral=le;function te(...U){return U.length<=1&&U.every(xe=>xe==="literal")?"literal":U.every(xe=>xe==="constant"||xe==="literal")?"constant":U.every(xe=>xe==="output"||xe==="constant"||xe==="literal")?"output":"input"}t.mergeEvalSpaces=te;function J(U){return U.type==="string"||_(U.type)||U.type==="number"||U.type==="boolean"||U.type==="json"||U.type==="sql native"||U.type==="error"}t.isLeafAtomic=J;function ue(U){return U.as!==void 0?U.as:U.name}t.getIdentifier=ue;function Be(U){return U.type==="turtle"}t.isTurtle=Be;function st(U){return v(U.type)}t.isAtomic=st;function mt(U,xe){return xe.type==="string"}t.isValueString=mt;function K(U,xe){return xe.type==="number"}t.isValueNumber=K;function ie(U,xe){return xe.type==="boolean"}t.isValueBoolean=ie;function Oe(U,xe){return xe.type==="timestamp"}t.isValueTimestamp=Oe;function je(U,xe){return xe.type==="date"}t.isValueDate=je,t.TD={isAtomic(U){return U!==void 0&&v(U.type)},isLeafAtomic(U){return U!==void 0&&J({type:U.type})},isString:U=>(U==null?void 0:U.type)==="string",isNumber:U=>(U==null?void 0:U.type)==="number",isBoolean:U=>(U==null?void 0:U.type)==="boolean",isJSON:U=>(U==null?void 0:U.type)==="json",isSQL:U=>(U==null?void 0:U.type)==="sql native",isDate:U=>(U==null?void 0:U.type)==="date",isTimestamp:U=>(U==null?void 0:U.type)==="timestamp",isTemporal(U){var xe;const fe=(xe=U==null?void 0:U.type)!==null&&xe!==void 0?xe:"";return _(fe)},isError:U=>(U==null?void 0:U.type)==="error",eq(U,xe){if(U===void 0||xe===void 0)return!1;function fe(X,ne){const ke={};for(const V of X.fields||[])if(V.name)ke[V.name]=V;else return!1;for(const V of ne.fields||[])if(!t.TD.eq(ke[V.name],V))return!1;return!0}return U.type==="array"&&xe.type==="array"?U.elementTypeDef.type!==xe.elementTypeDef.type?!1:U.elementTypeDef.type!=="record_element"&&xe.elementTypeDef.type!=="record_element"?t.TD.eq(U.elementTypeDef,xe.elementTypeDef):fe(U,xe):U.type==="record"&&xe.type==="record"?fe(U,xe):U.type==="sql native"&&xe.type==="sql native"?U.rawType!==void 0&&U.rawType===xe.rawType:U.type===xe.type}}})(We),Object.defineProperty(rt,"__esModule",{value:!0}),rt.compositeFieldUsageJoinPaths=rt.joinedCompositeFieldUsage=rt.compositeFieldUsageDifference=rt.emptyCompositeFieldUsage=rt.mergeCompositeFieldUsage=rt.unique=rt.formatCompositeFieldUsage=rt.compositeFieldUsageIsPlural=rt.isEmptyCompositeFieldUsage=rt.formatCompositeFieldUsages=rt.compositeFieldUsagePaths=rt.resolveCompositeSources=rt.narrowCompositeFieldResolution=rt.emptyNarrowedCompositeFieldResolution=void 0;const eB=ta,Zb=We;function ey(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=Rle(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:A}of x){const _=new Set;for(const v of E.fields)_.add((s=v.as)!==null&&s!==void 0?s:v.name);for(const v of n.fields)if(!_.has(v)){y.shift();continue e}if(E.type==="composite"){const v=ey(t,E,Ole(n,E),{source:A??E.sources.map(C=>({source:C,nested:[]})),joined:{}});if("error"in v){y.shift();continue e}f={...v.success},y[0]={source:E,nested:v.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],A=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:A}}};if((0,Zb.isJoined)(E)){if(!(0,Zb.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:A}}};const _=ey(A,E,y,m[g]);if("error"in _)return _;if(!(0,Zb.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:A}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function Ele(){return{source:void 0,joined:{}}}rt.emptyNarrowedCompositeFieldResolution=Ele;function Ale(t,e,n){const r=ey([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}rt.narrowCompositeFieldResolution=Ale;function _le(t,e){const n=ey([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}rt.resolveCompositeSources=_le;function eT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>eT(n).map(r=>[e,...r])).flat()]}rt.compositeFieldUsagePaths=eT;function vle(t){return eT(t).map(e=>tB(e)).join(", ")}rt.formatCompositeFieldUsages=vle;function tT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+tT(n),t.fields.length)}function Sle(t){return tT(t)===0}rt.isEmptyCompositeFieldUsage=Sle;function Cle(t){return tT(t)>1}rt.compositeFieldUsageIsPlural=Cle;function tB(t){return`\`${t.join(".")}\``}rt.formatCompositeFieldUsage=tB;function nB(t){return Array.from(new Set(t))}rt.unique=nB;function rB(...t){const e=t.filter(eB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=rB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(eB.isNotUndefined));return{fields:nB(e.map(i=>i.fields).flat()),joinedUsage:r}}rt.mergeCompositeFieldUsage=rB;function ble(){return{fields:[],joinedUsage:{}}}rt.emptyCompositeFieldUsage=ble;function Tle(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function iB(t,e){return{fields:Tle(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?iB(r,e.joinedUsage[n]):r]))}}rt.compositeFieldUsageDifference=iB;function sB(t,e){return t.length===0?e:sB(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}rt.joinedCompositeFieldUsage=sB;function oB(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>oB(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}rt.compositeFieldUsageJoinPaths=oB;function uB(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function Rle(t){return t.fields.filter(e=>!uB(e))}function Ole(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>uB(r[i])),joinedUsage:t.joinedUsage}}Object.defineProperty(it,"__esModule",{value:!0}),it.expandOverrideMapFromBase=it.expandBlueprintMap=it.overload=it.minAnalytic=it.minAggregate=it.minScalar=it.maxAnalytic=it.maxUngroupedAggregate=it.anyExprType=it.maxAggregate=it.maxScalar=it.makeParam=it.param=it.variadicParam=it.literal=it.output=it.constant=it.sql=it.spread=it.arg=void 0;const Dle=rt,nT=We;function aB(t){return{node:"function_parameter",name:t}}it.arg=aB;function Nle(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}it.spread=Nle;function wle(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}it.sql=wle;function rT(t){return{...t,evalSpace:"constant"}}it.constant=rT;function Fle(t){return{...t,evalSpace:"output"}}it.output=Fle;function iT(t){return{...t,evalSpace:"literal"}}it.literal=iT;function Lle(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}it.variadicParam=Lle;function lB(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}it.param=lB;function Ile(t,...e){return{param:lB(t,...e),arg:aB(t)}}it.makeParam=Ile;function ty(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}it.maxScalar=ty;function cB(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}it.maxAggregate=cB;function sT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}it.anyExprType=sT;function fB(t,e){return{...ny(t,e),expressionType:void 0,evalSpace:"input"}}function $le(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}it.maxUngroupedAggregate=$le;function xB(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}it.maxAnalytic=xB;function Ax(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}it.minScalar=Ax;function dB(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}it.minAggregate=dB;function hB(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}it.minAnalytic=hB;function Ble(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}it.overload=Ble;function _s(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function ny(t,e){var n;let r;if(typeof t=="string")r=Ax(t);else if("array"in t){const i=ny(t.array,e),{expressionType:s,evalSpace:o}=i;if(nT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=ny(o,e);nT.TD.isAtomic(u)&&i.push((0,nT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Ax(_s(t,e)):"literal"in t?r=iT(Ax(_s(t.literal,e))):"constant"in t?r=rT(Ax(_s(t.constant,e))):"dimension"in t?r=Ax(_s(t.dimension,e)):"measure"in t?r=dB(_s(t.measure,e)):r=hB(_s(t.calculation,e));return{...r,compositeFieldUsage:(0,Dle.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function pB(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function kle(t){return pB(t)?[t]:Array.isArray(t)?t:pB(t.variadic)?[t.variadic]:t.variadic}function Ple(t,e){return typeof t=="string"?sT(t):"generic"in t?sT(_s(t,e)):"literal"in t?iT(ty(_s(t.literal,e))):"constant"in t?rT(ty(_s(t.constant,e))):"dimension"in t?ty(_s(t.dimension,e)):"measure"in t?cB(_s(t.measure,e)):"array"in t||"record"in t?fB(t,e):xB(_s(t.calculation,e))}function Mle(t,e){return t.map(n=>Ple(n,e))}function gB(t){return typeof t!="string"&&"variadic"in t}function jle(t,e,n){return{name:t,allowedTypes:Mle(kle(e),n),isVariadic:gB(e)}}function Ule(t,e){return Object.entries(t).map(r=>jle(r[0],r[1],e))}function qle(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Hle(t,e){return gB(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function zle(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Hle(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Qle(t){return"sql"in t.impl?qle(t.impl.sql):"expr"in t.impl?t.impl.expr:zle(t.impl.function,t)}function Gle(t){return{e:Qle(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function mB(t,e){return{returnType:ny(t.returns,e),params:Ule(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Gle(t)}}function oT(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>mB(t,{name:e,type:n}))}return[mB(t)]}function uT(t){return"takes"in t&&"returns"in t&&"impl"in t}function Wle(t){return"function"in t||"sql"in t||"expr"in t}function Vle(t){return uT(t)?oT(t):Object.values(t).flatMap(e=>oT(e))}function Yle(t){const e={};for(const n in t)e[n]=Vle(t[n]);return e}it.expandBlueprintMap=Yle;function yB(t,e){return oT({...t,impl:e})}function Jle(t,e,n){if(Wle(n)){if(!uT(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return yB(e,n)}else{if(uT(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return yB(s,i)})}}function Kle(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=Jle(r,t[r],e[r])}return n}it.expandOverrideMapFromBase=Kle;var hl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=We;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
1
+ (function(yi,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(yi=typeof globalThis<"u"?globalThis:yi||self,T(yi.index={}))})(this,function(yi){"use strict";var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Z3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Z$(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Bt={},Ex={},it={},rt={},ta={};Object.defineProperty(ta,"__esModule",{value:!0}),ta.isNotUndefined=ta.locationContainsPosition=void 0;function mle(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}ta.locationContainsPosition=mle;function yle(t){return t!==void 0}ta.isNotUndefined=yle;var We={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(U){return"kids"in U}t.exprHasKids=e;function n(U){return"e"in U}t.exprHasE=n;function r(U){return!(e(U)||n(U))}t.exprIsLeaf=r;function i(U){return U.node==="aggregate"&&["sum","avg","count","distinct"].includes(U.function)}t.isAsymmetricExpr=i;function s(U){return U.node!=="arrayLiteral"&&U.node!=="recordLiteral"}function o(U,xe){const fe=typeof xe=="string"?{type:xe}:xe;return s(U)?{...U,typeDef:{...fe}}:U}t.mkTemporal=o;function u(U){return"dstSQLType"in U}t.isRawCast=u;function a(U){return U.value!==null}t.paramHasValue=a;function l(U){return U===void 0||U==="scalar"}t.expressionIsScalar=l;function c(U){return U==="aggregate"||U==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(U){return U==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(U){return U==="aggregate"||U==="ungrouped_aggregate"||U==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(U){return U==="aggregate"||U==="scalar_analytic"||U==="aggregate_analytic"||U==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(U){return U==="aggregate_analytic"||U==="scalar_analytic"}t.expressionIsAnalytic=p;function m(U){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[U]}function g(U,xe){return U===xe||m(U)<m(xe)}t.isExpressionTypeLEQ=g;function y(U,xe){let fe="scalar";return(U==="aggregate"||xe==="aggregate")&&(fe="aggregate"),(U==="ungrouped_aggregate"||xe==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(U==="scalar_analytic"||xe==="scalar_analytic")&&(fe="scalar_analytic"),(U==="aggregate_analytic"||xe==="aggregate_analytic")&&(fe="aggregate_analytic"),(U==="scalar_analytic"&&xe==="aggregate"||U==="aggregate"&&xe==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(U){return U.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function A(U){return"e"in U}t.hasExpression=A;function _(U){return U==="date"||U==="timestamp"}t.isTemporalType=_;function v(U){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(U)}t.isAtomicFieldType=v;function C(U){return["string","number","date","boolean","date","timestamp"].includes(U)}t.canOrderBy=C;function S(U){return["string","number","date","timestamp","boolean","json"].includes(U)}t.isCastType=S;function b(U){return v(U.type)&&!A(U)}t.fieldIsIntrinsic=b;function R(U,xe){if(j(U))return L(U.elementTypeDef,xe);if(B(U)){const{type:fe,fields:X,elementTypeDef:ne}=U;return{type:fe,fields:X,elementTypeDef:ne,join:"many",name:xe}}if(U.type==="record"){const{type:fe,fields:X}=U;return{type:fe,fields:X,join:"one",name:xe}}return{...U,name:xe}}t.mkFieldDef=R;function L(U,xe){if(U.type==="record")return{type:"array",join:"many",name:xe,elementTypeDef:{type:"record_element"},fields:U.fields};const fe=R(U,"value");return{type:"array",join:"many",name:xe,elementTypeDef:U,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=L;function B(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}t.isRepeatedRecord=B;function j(U){return U.type==="array"&&U.elementTypeDef.type!=="record_element"}t.isScalarArray=j;function z(U){return["left","right","full","inner"].includes(U)}t.isMatrixOperation=z;function Z(U){return["composite","table","sql_select","query_source","array","record"].includes(U.type)}t.isJoinable=Z;function W(U){return"join"in U}t.isJoined=W;function oe(U){return M(U)&&W(U)}t.isJoinedSource=oe;function ye(U){return["day","week","month","quarter","year"].includes(U)}t.isDateUnit=ye;function de(U){return ye(U)||["hour","minute","second"].includes(U)}t.isTimestampUnit=de;function se(U){return de(U)||U==="day_of_week"||U==="day_of_year"}t.isExtractUnit=se;var ae;(function(U){U.Date="date",U.Timestamp="timestamp",U.Number="number",U.String="string"})(ae||(t.ValueType=ae={}));function he(U){return typeof U!="string"}t.refIsStructDef=he;function be(U){return!!((U.type==="reduce"||U.type==="project"||U.type==="partial")&&(U.extendSource&&U.extendSource.some(xe=>xe.type==="error")||U.queryFields.some(xe=>xe.type==="error")))}t.segmentHasErrors=be;function F(U){return U.fields.some(xe=>xe.type==="error")}t.structHasErrors=F;function D(U){return U.type==="reduce"}t.isReduceSegment=D;function N(U){return U.type==="partial"}t.isPartialSegment=N;function P(U){return U.type==="project"}t.isProjectSegment=P;function G(U){return P(U)||D(U)}t.isQuerySegment=G;function H(U){return U.rows!==void 0}t.isSamplingRows=H;function O(U){return U.percent!==void 0}t.isSamplingPercent=O;function $(U){return U.enable!==void 0}t.isSamplingEnable=$;function k(U){return U.type==="raw"}t.isRawSegment=k;function Q(U){return U.type==="index"}t.isIndexSegment=Q;function I(U){return"sql"in U}t.isSegmentSQL=I;function q(U){return{...U}}t.sourceBase=q;function M(U){return U.type==="table"||U.type==="sql_select"||U.type==="query_source"||U.type==="query_result"||U.type==="finalize"||U.type==="nest_source"||U.type==="composite"}t.isSourceDef=M;function Y(U){return oe(U)?!1:!!M(U)}t.isBaseTable=Y;function le(U){return U==="literal"}t.isLiteral=le;function te(...U){return U.length<=1&&U.every(xe=>xe==="literal")?"literal":U.every(xe=>xe==="constant"||xe==="literal")?"constant":U.every(xe=>xe==="output"||xe==="constant"||xe==="literal")?"output":"input"}t.mergeEvalSpaces=te;function J(U){return U.type==="string"||_(U.type)||U.type==="number"||U.type==="boolean"||U.type==="json"||U.type==="sql native"||U.type==="error"}t.isLeafAtomic=J;function ue(U){return U.as!==void 0?U.as:U.name}t.getIdentifier=ue;function Be(U){return U.type==="turtle"}t.isTurtle=Be;function st(U){return v(U.type)}t.isAtomic=st;function mt(U,xe){return xe.type==="string"}t.isValueString=mt;function K(U,xe){return xe.type==="number"}t.isValueNumber=K;function ie(U,xe){return xe.type==="boolean"}t.isValueBoolean=ie;function Oe(U,xe){return xe.type==="timestamp"}t.isValueTimestamp=Oe;function je(U,xe){return xe.type==="date"}t.isValueDate=je,t.TD={isAtomic(U){return U!==void 0&&v(U.type)},isLeafAtomic(U){return U!==void 0&&J({type:U.type})},isString:U=>(U==null?void 0:U.type)==="string",isNumber:U=>(U==null?void 0:U.type)==="number",isBoolean:U=>(U==null?void 0:U.type)==="boolean",isJSON:U=>(U==null?void 0:U.type)==="json",isSQL:U=>(U==null?void 0:U.type)==="sql native",isDate:U=>(U==null?void 0:U.type)==="date",isTimestamp:U=>(U==null?void 0:U.type)==="timestamp",isTemporal(U){var xe;const fe=(xe=U==null?void 0:U.type)!==null&&xe!==void 0?xe:"";return _(fe)},isError:U=>(U==null?void 0:U.type)==="error",eq(U,xe){if(U===void 0||xe===void 0)return!1;function fe(X,ne){const ke={};for(const V of X.fields||[])if(V.name)ke[V.name]=V;else return!1;for(const V of ne.fields||[])if(!t.TD.eq(ke[V.name],V))return!1;return!0}return U.type==="array"&&xe.type==="array"?U.elementTypeDef.type!==xe.elementTypeDef.type?!1:U.elementTypeDef.type!=="record_element"&&xe.elementTypeDef.type!=="record_element"?t.TD.eq(U.elementTypeDef,xe.elementTypeDef):fe(U,xe):U.type==="record"&&xe.type==="record"?fe(U,xe):U.type==="sql native"&&xe.type==="sql native"?U.rawType!==void 0&&U.rawType===xe.rawType:U.type===xe.type}}})(We),Object.defineProperty(rt,"__esModule",{value:!0}),rt.compositeFieldUsageJoinPaths=rt.joinedCompositeFieldUsage=rt.compositeFieldUsageDifference=rt.emptyCompositeFieldUsage=rt.mergeCompositeFieldUsage=rt.unique=rt.formatCompositeFieldUsage=rt.compositeFieldUsageIsPlural=rt.isEmptyCompositeFieldUsage=rt.formatCompositeFieldUsages=rt.compositeFieldUsagePaths=rt.resolveCompositeSources=rt.narrowCompositeFieldResolution=rt.emptyNarrowedCompositeFieldResolution=void 0;const eB=ta,Zb=We;function ey(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=Rle(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:A}of x){const _=new Set;for(const v of E.fields)_.add((s=v.as)!==null&&s!==void 0?s:v.name);for(const v of n.fields)if(!_.has(v)){y.shift();continue e}if(E.type==="composite"){const v=ey(t,E,Ole(n,E),{source:A??E.sources.map(C=>({source:C,nested:[]})),joined:{}});if("error"in v){y.shift();continue e}f={...v.success},y[0]={source:E,nested:v.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],A=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:A}}};if((0,Zb.isJoined)(E)){if(!(0,Zb.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:A}}};const _=ey(A,E,y,m[g]);if("error"in _)return _;if(!(0,Zb.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:A}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function Ele(){return{source:void 0,joined:{}}}rt.emptyNarrowedCompositeFieldResolution=Ele;function Ale(t,e,n){const r=ey([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}rt.narrowCompositeFieldResolution=Ale;function _le(t,e){const n=ey([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}rt.resolveCompositeSources=_le;function eT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>eT(n).map(r=>[e,...r])).flat()]}rt.compositeFieldUsagePaths=eT;function vle(t){return eT(t).map(e=>tB(e)).join(", ")}rt.formatCompositeFieldUsages=vle;function tT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+tT(n),t.fields.length)}function Sle(t){return tT(t)===0}rt.isEmptyCompositeFieldUsage=Sle;function Cle(t){return tT(t)>1}rt.compositeFieldUsageIsPlural=Cle;function tB(t){return`\`${t.join(".")}\``}rt.formatCompositeFieldUsage=tB;function nB(t){return Array.from(new Set(t))}rt.unique=nB;function rB(...t){const e=t.filter(eB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=rB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(eB.isNotUndefined));return{fields:nB(e.map(i=>i.fields).flat()),joinedUsage:r}}rt.mergeCompositeFieldUsage=rB;function ble(){return{fields:[],joinedUsage:{}}}rt.emptyCompositeFieldUsage=ble;function Tle(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function iB(t,e){return{fields:Tle(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?iB(r,e.joinedUsage[n]):r]))}}rt.compositeFieldUsageDifference=iB;function sB(t,e){return t.length===0?e:sB(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}rt.joinedCompositeFieldUsage=sB;function oB(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>oB(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}rt.compositeFieldUsageJoinPaths=oB;function uB(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function Rle(t){return t.fields.filter(e=>!uB(e))}function Ole(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>uB(r[i])),joinedUsage:{}}}Object.defineProperty(it,"__esModule",{value:!0}),it.expandOverrideMapFromBase=it.expandBlueprintMap=it.overload=it.minAnalytic=it.minAggregate=it.minScalar=it.maxAnalytic=it.maxUngroupedAggregate=it.anyExprType=it.maxAggregate=it.maxScalar=it.makeParam=it.param=it.variadicParam=it.literal=it.output=it.constant=it.sql=it.spread=it.arg=void 0;const Dle=rt,nT=We;function aB(t){return{node:"function_parameter",name:t}}it.arg=aB;function Nle(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}it.spread=Nle;function wle(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}it.sql=wle;function rT(t){return{...t,evalSpace:"constant"}}it.constant=rT;function Fle(t){return{...t,evalSpace:"output"}}it.output=Fle;function iT(t){return{...t,evalSpace:"literal"}}it.literal=iT;function Lle(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}it.variadicParam=Lle;function lB(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}it.param=lB;function Ile(t,...e){return{param:lB(t,...e),arg:aB(t)}}it.makeParam=Ile;function ty(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}it.maxScalar=ty;function cB(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}it.maxAggregate=cB;function sT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}it.anyExprType=sT;function fB(t,e){return{...ny(t,e),expressionType:void 0,evalSpace:"input"}}function $le(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}it.maxUngroupedAggregate=$le;function xB(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}it.maxAnalytic=xB;function Ax(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}it.minScalar=Ax;function dB(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}it.minAggregate=dB;function hB(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}it.minAnalytic=hB;function Ble(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}it.overload=Ble;function _s(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function ny(t,e){var n;let r;if(typeof t=="string")r=Ax(t);else if("array"in t){const i=ny(t.array,e),{expressionType:s,evalSpace:o}=i;if(nT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=ny(o,e);nT.TD.isAtomic(u)&&i.push((0,nT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Ax(_s(t,e)):"literal"in t?r=iT(Ax(_s(t.literal,e))):"constant"in t?r=rT(Ax(_s(t.constant,e))):"dimension"in t?r=Ax(_s(t.dimension,e)):"measure"in t?r=dB(_s(t.measure,e)):r=hB(_s(t.calculation,e));return{...r,compositeFieldUsage:(0,Dle.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function pB(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function kle(t){return pB(t)?[t]:Array.isArray(t)?t:pB(t.variadic)?[t.variadic]:t.variadic}function Ple(t,e){return typeof t=="string"?sT(t):"generic"in t?sT(_s(t,e)):"literal"in t?iT(ty(_s(t.literal,e))):"constant"in t?rT(ty(_s(t.constant,e))):"dimension"in t?ty(_s(t.dimension,e)):"measure"in t?cB(_s(t.measure,e)):"array"in t||"record"in t?fB(t,e):xB(_s(t.calculation,e))}function Mle(t,e){return t.map(n=>Ple(n,e))}function gB(t){return typeof t!="string"&&"variadic"in t}function jle(t,e,n){return{name:t,allowedTypes:Mle(kle(e),n),isVariadic:gB(e)}}function Ule(t,e){return Object.entries(t).map(r=>jle(r[0],r[1],e))}function qle(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Hle(t,e){return gB(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function zle(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Hle(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Qle(t){return"sql"in t.impl?qle(t.impl.sql):"expr"in t.impl?t.impl.expr:zle(t.impl.function,t)}function Gle(t){return{e:Qle(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function mB(t,e){return{returnType:ny(t.returns,e),params:Ule(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Gle(t)}}function oT(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>mB(t,{name:e,type:n}))}return[mB(t)]}function uT(t){return"takes"in t&&"returns"in t&&"impl"in t}function Wle(t){return"function"in t||"sql"in t||"expr"in t}function Vle(t){return uT(t)?oT(t):Object.values(t).flatMap(e=>oT(e))}function Yle(t){const e={};for(const n in t)e[n]=Vle(t[n]);return e}it.expandBlueprintMap=Yle;function yB(t,e){return oT({...t,impl:e})}function Jle(t,e,n){if(Wle(n)){if(!uT(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return yB(e,n)}else{if(uT(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return yB(s,i)})}}function Kle(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=Jle(r,t[r],e[r])}return n}it.expandOverrideMapFromBase=Kle;var hl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=We;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
2
2
  STRING_AGG(DISTINCT ${`concat('${f}', ${a}, '${x}', ${l})`}${c.length>0?","+c:""}),
3
3
  '${f}.*?${x}',
4
4
  ''
@@ -1511,7 +1511,11 @@ function _ce(t, e) {
1511
1511
  r[(n = i.as) !== null && n !== void 0 ? n : i.name] = i;
1512
1512
  return {
1513
1513
  fields: t.fields.filter((i) => TG(r[i])),
1514
- joinedUsage: t.joinedUsage
1514
+ // Today it is not possible for a join to be composite, so we can safely throw
1515
+ // away all join usage here...; if we ever allow joins in composite source
1516
+ // inputs, then this will need to be updated to be the joinUsage with joins
1517
+ // that are not composite filtered out...
1518
+ joinedUsage: {}
1515
1519
  };
1516
1520
  }
1517
1521
  Object.defineProperty(at, "__esModule", { value: !0 });
@@ -1,4 +1,4 @@
1
- (function(tp,np){typeof exports=="object"&&typeof module<"u"?module.exports=np():typeof define=="function"&&define.amd?define(np):(tp=typeof globalThis<"u"?globalThis:tp||self,tp.register=np())})(this,function(){"use strict";function tp(t){return Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=Object.assign({},i),NB(i.value)&&!P0e(i.value)&&!Array.isArray(i.value)&&(n[r].value=Object.assign({},i.value)),Array.isArray(i.value)&&(n[r].value=i.value.slice(0)),n},{})}function np(t){return t?Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=NB(i)&&"value"in i?i:{value:i},n[r].attribute||(n[r].attribute=k0e(r)),n[r].parse="parse"in n[r]?n[r].parse:typeof n[r].value!="string",n},{}):{}}function $0e(t){return Object.keys(t).reduce((n,r)=>(n[r]=t[r].value,n),{})}function B0e(t,e){const n=tp(e);return Object.keys(e).forEach(i=>{const s=n[i],o=t.getAttribute(s.attribute),u=t[i];o&&(s.value=s.parse?DB(o):o),u!=null&&(s.value=Array.isArray(u)?u.slice(0):u),s.reflect&&wB(t,s.attribute,s.value,!!s.parse),Object.defineProperty(t,i,{get(){return s.value},set(a){const l=s.value;s.value=a,s.reflect&&wB(this,s.attribute,s.value,!!s.parse);for(let c=0,f=this.__propertyChangedCallbacks.length;c<f;c++)this.__propertyChangedCallbacks[c](i,a,l)},enumerable:!0,configurable:!0})}),n}function DB(t){if(t)try{return JSON.parse(t)}catch{return t}}function wB(t,e,n,r){if(n==null||n===!1)return t.removeAttribute(e);let i=r?JSON.stringify(n):n;t.__updating[e]=!0,i==="true"&&(i=""),t.setAttribute(e,i),Promise.resolve().then(()=>delete t.__updating[e])}function k0e(t){return t.replace(/\.?([A-Z]+)/g,(e,n)=>"-"+n.toLowerCase()).replace("_","-").replace(/^-/,"")}function NB(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function P0e(t){return Object.prototype.toString.call(t)==="[object Function]"}function M0e(t){return typeof t=="function"&&t.toString().indexOf("class")===0}let BT;function j0e(t,e){const n=Object.keys(e);return class extends t{static get observedAttributes(){return n.map(i=>e[i].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=B0e(this,e);const i=$0e(this.props),s=this.Component,o=BT;try{BT=this,this.__initialized=!0,M0e(s)?new s(i,{element:this}):s(i,{element:this})}finally{BT=o}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let i=null;for(;i=this.__releaseCallbacks.pop();)i(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(i,s,o){if(this.__initialized&&!this.__updating[i]&&(i=this.lookupProp(i),i in e)){if(o==null&&!this[i])return;this[i]=e[i].parse?DB(o):o}}lookupProp(i){if(e)return n.find(s=>i===s||i===e[s].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(i){this.__releaseCallbacks.push(i)}addPropertyChangedCallback(i){this.__propertyChangedCallbacks.push(i)}}}function FB(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function LB(t,e={},n={}){const{BaseElement:r=HTMLElement,extension:i,customElements:s=window.customElements}=n;return o=>{if(!t)throw new Error("tag is required to register a Component");let u=s.get(t);return u?(u.prototype.Component=o,u):(u=j0e(r,np(e)),u.prototype.Component=o,u.prototype.registeredTag=t,s.define(t,u,i),u)}}const U0e={context:void 0,registry:void 0},q0e=(t,e)=>t===e,Ko=Symbol("solid-proxy"),kT=Symbol("solid-track"),jy={equals:q0e};let IB=jB;const ya=1,Uy=2,$B={owned:null,cleanups:null,context:null,owner:null};var zt=null;let PT=null,z0e=null,ln=null,Tr=null,Ea=null,qy=0;function rp(t,e){const n=ln,r=zt,i=t.length===0,s=e===void 0?r:e,o=i?$B:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=i?t:()=>t(()=>Xi(()=>Gy(o)));zt=o,ln=null;try{return Dc(u,!0)}finally{ln=n,zt=r}}function hr(t,e){e=e?Object.assign({},jy,e):jy;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),MB(n,i));return[PB.bind(n),r]}function H0e(t,e,n){const r=zy(t,e,!0,ya);Wx(r)}function Pn(t,e,n){const r=zy(t,e,!1,ya);Wx(r)}function ws(t,e,n){IB=Y0e;const r=zy(t,e,!1,ya);(!n||!n.render)&&(r.user=!0),Ea?Ea.push(r):Wx(r)}function Fn(t,e,n){n=n?Object.assign({},jy,n):jy;const r=zy(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Wx(r),PB.bind(r)}function Q0e(t){return Dc(t,!1)}function Xi(t){if(ln===null)return t();const e=ln;ln=null;try{return t()}finally{ln=e}}function ip(t){ws(()=>Xi(t))}function sp(t){return zt===null||(zt.cleanups===null?zt.cleanups=[t]:zt.cleanups.push(t)),t}function MT(){return ln}function BB(){return zt}function G0e(t,e){const n=zt,r=ln;zt=t,ln=null;try{return Dc(e,!0)}catch(i){qT(i)}finally{zt=n,ln=r}}function jT(t,e){const n=Symbol("context");return{id:n,Provider:J0e(n),defaultValue:t}}function UT(t){return zt&&zt.context&&zt.context[t.id]!==void 0?zt.context[t.id]:t.defaultValue}function kB(t){const e=Fn(t),n=Fn(()=>zT(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function PB(){if(this.sources&&this.state)if(this.state===ya)Wx(this);else{const t=Tr;Tr=null,Dc(()=>Qy(this),!1),Tr=t}if(ln){const t=this.observers?this.observers.length:0;ln.sources?(ln.sources.push(this),ln.sourceSlots.push(t)):(ln.sources=[this],ln.sourceSlots=[t]),this.observers?(this.observers.push(ln),this.observerSlots.push(ln.sources.length-1)):(this.observers=[ln],this.observerSlots=[ln.sources.length-1])}return this.value}function MB(t,e,n){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&Dc(()=>{for(let i=0;i<t.observers.length;i+=1){const s=t.observers[i],o=PT&&PT.running;o&&PT.disposed.has(s),(o?!s.tState:!s.state)&&(s.pure?Tr.push(s):Ea.push(s),s.observers&&UB(s)),o||(s.state=ya)}if(Tr.length>1e6)throw Tr=[],new Error},!1)),e}function Wx(t){if(!t.fn)return;Gy(t);const e=qy;W0e(t,t.value,e)}function W0e(t,e,n){let r;const i=zt,s=ln;ln=zt=t;try{r=t.fn(e)}catch(o){return t.pure&&(t.state=ya,t.owned&&t.owned.forEach(Gy),t.owned=null),t.updatedAt=n+1,qT(o)}finally{ln=s,zt=i}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?MB(t,r):t.value=r,t.updatedAt=n)}function zy(t,e,n,r=ya,i){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:zt,context:zt?zt.context:null,pure:n};return zt===null||zt!==$B&&(zt.owned?zt.owned.push(s):zt.owned=[s]),s}function Hy(t){if(t.state===0)return;if(t.state===Uy)return Qy(t);if(t.suspense&&Xi(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<qy);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===ya)Wx(t);else if(t.state===Uy){const r=Tr;Tr=null,Dc(()=>Qy(t,e[0]),!1),Tr=r}}function Dc(t,e){if(Tr)return t();let n=!1;e||(Tr=[]),Ea?n=!0:Ea=[],qy++;try{const r=t();return V0e(n),r}catch(r){n||(Ea=null),Tr=null,qT(r)}}function V0e(t){if(Tr&&(jB(Tr),Tr=null),t)return;const e=Ea;Ea=null,e.length&&Dc(()=>IB(e),!1)}function jB(t){for(let e=0;e<t.length;e++)Hy(t[e])}function Y0e(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:Hy(r)}for(e=0;e<n;e++)Hy(t[e])}function Qy(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const r=t.sources[n];if(r.sources){const i=r.state;i===ya?r!==e&&(!r.updatedAt||r.updatedAt<qy)&&Hy(r):i===Uy&&Qy(r,e)}}}function UB(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=Uy,n.pure?Tr.push(n):Ea.push(n),n.observers&&UB(n))}}function Gy(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),r=t.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),o=n.observerSlots.pop();r<i.length&&(s.sourceSlots[o]=r,i[r]=s,n.observerSlots[r]=o)}}if(t.owned){for(e=t.owned.length-1;e>=0;e--)Gy(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function X0e(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function qT(t,e=zt){throw X0e(t)}function zT(t){if(typeof t=="function"&&!t.length)return zT(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const r=zT(t[n]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function J0e(t,e){return function(r){let i;return Pn(()=>i=Xi(()=>(zt.context={...zt.context,[t]:r.value},kB(()=>r.children))),void 0),i}}const K0e=Symbol("fallback");function qB(t){for(let e=0;e<t.length;e++)t[e]()}function Z0e(t,e,n={}){let r=[],i=[],s=[],o=0,u=e.length>1?[]:null;return sp(()=>qB(s)),()=>{let a=t()||[],l,c;return a[kT],Xi(()=>{let x=a.length,d,p,m,g,y,E,v,_,A;if(x===0)o!==0&&(qB(s),s=[],r=[],i=[],o=0,u&&(u=[])),n.fallback&&(r=[K0e],i[0]=rp(S=>(s[0]=S,n.fallback())),o=1);else if(o===0){for(i=new Array(x),c=0;c<x;c++)r[c]=a[c],i[c]=rp(f);o=x}else{for(m=new Array(x),g=new Array(x),u&&(y=new Array(x)),E=0,v=Math.min(o,x);E<v&&r[E]===a[E];E++);for(v=o-1,_=x-1;v>=E&&_>=E&&r[v]===a[_];v--,_--)m[_]=i[v],g[_]=s[v],u&&(y[_]=u[v]);for(d=new Map,p=new Array(_+1),c=_;c>=E;c--)A=a[c],l=d.get(A),p[c]=l===void 0?-1:l,d.set(A,c);for(l=E;l<=v;l++)A=r[l],c=d.get(A),c!==void 0&&c!==-1?(m[c]=i[l],g[c]=s[l],u&&(y[c]=u[l]),c=p[c],d.set(A,c)):s[l]();for(c=E;c<x;c++)c in m?(i[c]=m[c],s[c]=g[c],u&&(u[c]=y[c],u[c](c))):i[c]=rp(f);i=i.slice(0,o=x),r=a.slice(0)}return i});function f(x){if(s[c]=x,u){const[d,p]=hr(c);return u[c]=p,e(a[c],d)}return e(a[c])}}}function Ge(t,e){return Xi(()=>t(e||{}))}function Wy(){return!0}const ece={get(t,e,n){return e===Ko?n:t.get(e)},has(t,e){return e===Ko?!0:t.has(e)},set:Wy,deleteProperty:Wy,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Wy,deleteProperty:Wy}},ownKeys(t){return t.keys()}};function HT(t){return(t=typeof t=="function"?t():t)?t:{}}function tce(){for(let t=0,e=this.length;t<e;++t){const n=this[t]();if(n!==void 0)return n}}function Zo(...t){let e=!1;for(let o=0;o<t.length;o++){const u=t[o];e=e||!!u&&Ko in u,t[o]=typeof u=="function"?(e=!0,Fn(u)):u}if(e)return new Proxy({get(o){for(let u=t.length-1;u>=0;u--){const a=HT(t[u])[o];if(a!==void 0)return a}},has(o){for(let u=t.length-1;u>=0;u--)if(o in HT(t[u]))return!0;return!1},keys(){const o=[];for(let u=0;u<t.length;u++)o.push(...Object.keys(HT(t[u])));return[...new Set(o)]}},ece);const n={},r=Object.create(null);for(let o=t.length-1;o>=0;o--){const u=t[o];if(!u)continue;const a=Object.getOwnPropertyNames(u);for(let l=a.length-1;l>=0;l--){const c=a[l];if(c==="__proto__"||c==="constructor")continue;const f=Object.getOwnPropertyDescriptor(u,c);if(!r[c])r[c]=f.get?{enumerable:!0,configurable:!0,get:tce.bind(n[c]=[f.get.bind(u)])}:f.value!==void 0?f:void 0;else{const x=n[c];x&&(f.get?x.push(f.get.bind(u)):f.value!==void 0&&x.push(()=>f.value))}}}const i={},s=Object.keys(r);for(let o=s.length-1;o>=0;o--){const u=s[o],a=r[u];a&&a.get?Object.defineProperty(i,u,a):i[u]=a?a.value:void 0}return i}const zB=t=>`Stale read from <${t}>.`;function Yn(t){const e="fallback"in t&&{fallback:()=>t.fallback};return Fn(Z0e(()=>t.each,t.children,e||void 0))}function Or(t){const e=t.keyed,n=Fn(()=>t.when,void 0,{equals:(r,i)=>e?r===i:!r==!i});return Fn(()=>{const r=n();if(r){const i=t.children;return typeof i=="function"&&i.length>0?Xi(()=>i(e?r:()=>{if(!Xi(n))throw zB("Show");return t.when})):i}return t.fallback},void 0,void 0)}function HB(t){let e=!1;const n=(s,o)=>(e?s[1]===o[1]:!s[1]==!o[1])&&s[2]===o[2],r=kB(()=>t.children),i=Fn(()=>{let s=r();Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o++){const u=s[o].when;if(u)return e=!!s[o].keyed,[o,u,s[o]]}return[-1]},void 0,{equals:n});return Fn(()=>{const[s,o,u]=i();if(s<0)return t.fallback;const a=u.children;return typeof a=="function"&&a.length>0?Xi(()=>a(e?o:()=>{if(Xi(i)[0]!==s)throw zB("Match");return u.when})):a},void 0,void 0)}function Vy(t){return t}function nce(t,e,n){let r=n.length,i=e.length,s=r,o=0,u=0,a=e[i-1].nextSibling,l=null;for(;o<i||u<s;){if(e[o]===n[u]){o++,u++;continue}for(;e[i-1]===n[s-1];)i--,s--;if(i===o){const c=s<r?u?n[u-1].nextSibling:n[s-u]:a;for(;u<s;)t.insertBefore(n[u++],c)}else if(s===u)for(;o<i;)(!l||!l.has(e[o]))&&e[o].remove(),o++;else if(e[o]===n[s-1]&&n[u]===e[i-1]){const c=e[--i].nextSibling;t.insertBefore(n[u++],e[o++].nextSibling),t.insertBefore(n[--s],c),e[i]=n[s]}else{if(!l){l=new Map;let f=u;for(;f<s;)l.set(n[f],f++)}const c=l.get(e[o]);if(c!=null)if(u<c&&c<s){let f=o,x=1,d;for(;++f<i&&f<s&&!((d=l.get(e[f]))==null||d!==c+x);)x++;if(x>c-u){const p=e[o];for(;u<c;)t.insertBefore(n[u++],p)}else t.replaceChild(n[u++],e[o++])}else o++;else e[o++].remove()}}}const QB="_$DX_DELEGATE";function mt(t,e,n){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=t,n?o.content.firstChild.firstChild:o.content.firstChild},s=e?()=>Xi(()=>document.importNode(r||(r=i()),!0)):()=>(r||(r=i())).cloneNode(!0);return s.cloneNode=s,s}function QT(t,e=window.document){const n=e[QB]||(e[QB]=new Set);for(let r=0,i=t.length;r<i;r++){const s=t[r];n.has(s)||(n.add(s),e.addEventListener(s,rce))}}function Ji(t,e,n){n==null?t.removeAttribute(e):t.setAttribute(e,n)}function GB(t,e,n,r){Array.isArray(n)?(t[`$$${e}`]=n[0],t[`$$${e}Data`]=n[1]):t[`$$${e}`]=n}function wc(t,e,n){if(!e)return n?Ji(t,"style"):e;const r=t.style;if(typeof e=="string")return r.cssText=e;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),e||(e={});let i,s;for(s in n)e[s]==null&&r.removeProperty(s),delete n[s];for(s in e)i=e[s],i!==n[s]&&(r.setProperty(s,i),n[s]=i);return n}function lo(t,e,n){return Xi(()=>t(e,n))}function Je(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return Yy(t,e,r,n);Pn(i=>Yy(t,e(),i,n),r)}function rce(t){const e=`$$${t.type}`;let n=t.composedPath&&t.composedPath()[0]||t.target;for(t.target!==n&&Object.defineProperty(t,"target",{configurable:!0,value:n}),Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}});n;){const r=n[e];if(r&&!n.disabled){const i=n[`${e}Data`];if(i!==void 0?r.call(n,i,t):r.call(n,t),t.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Yy(t,e,n,r,i){for(;typeof n=="function";)n=n();if(e===n)return n;const s=typeof e,o=r!==void 0;if(t=o&&n[0]&&n[0].parentNode||t,s==="string"||s==="number")if(s==="number"&&(e=e.toString()),o){let u=n[0];u&&u.nodeType===3?u.data!==e&&(u.data=e):u=document.createTextNode(e),n=Vx(t,n,r,u)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e;else if(e==null||s==="boolean")n=Vx(t,n,r);else{if(s==="function")return Pn(()=>{let u=e();for(;typeof u=="function";)u=u();n=Yy(t,u,n,r)}),()=>n;if(Array.isArray(e)){const u=[],a=n&&Array.isArray(n);if(GT(u,e,n,i))return Pn(()=>n=Yy(t,u,n,r,!0)),()=>n;if(u.length===0){if(n=Vx(t,n,r),o)return n}else a?n.length===0?WB(t,u,r):nce(t,n,u):(n&&Vx(t),WB(t,u));n=u}else if(e.nodeType){if(Array.isArray(n)){if(o)return n=Vx(t,n,r,e);Vx(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function GT(t,e,n,r){let i=!1;for(let s=0,o=e.length;s<o;s++){let u=e[s],a=n&&n[t.length],l;if(!(u==null||u===!0||u===!1))if((l=typeof u)=="object"&&u.nodeType)t.push(u);else if(Array.isArray(u))i=GT(t,u,a)||i;else if(l==="function")if(r){for(;typeof u=="function";)u=u();i=GT(t,Array.isArray(u)?u:[u],Array.isArray(a)?a:[a])||i}else t.push(u),i=!0;else{const c=String(u);a&&a.nodeType===3&&a.data===c?t.push(a):t.push(document.createTextNode(c))}}return i}function WB(t,e,n=null){for(let r=0,i=e.length;r<i;r++)t.insertBefore(e[r],n)}function Vx(t,e,n,r){if(n===void 0)return t.textContent="";const i=r||document.createTextNode("");if(e.length){let s=!1;for(let o=e.length-1;o>=0;o--){const u=e[o];if(i!==u){const a=u.parentNode===t;!s&&!o?a?t.replaceChild(i,u):t.insertBefore(i,n):a&&u.remove()}else s=!0}}else t.insertBefore(i,n);return[i]}const ice="http://www.w3.org/2000/svg";function sce(t,e=!1){return e?document.createElementNS(ice,t):document.createElement(t)}function oce(t){const{useShadow:e}=t,n=document.createTextNode(""),r=()=>t.mount||document.body,i=BB();let s,o=!!U0e.context;return ws(()=>{s||(s=G0e(i,()=>Fn(()=>t.children)));const u=r();if(u instanceof HTMLHeadElement){const[a,l]=hr(!1),c=()=>l(!0);rp(f=>Je(u,()=>a()?f():s(),null)),sp(c)}else{const a=sce(t.isSVG?"g":"div",t.isSVG),l=e&&a.attachShadow?a.attachShadow({mode:"open"}):a;Object.defineProperty(a,"_$host",{get(){return n.parentNode},configurable:!0}),Je(l,s),u.appendChild(a),t.ref&&t.ref(a),sp(()=>u.removeChild(a))}},void 0,{render:!o}),n}function uce(t){const e=Object.keys(t),n={};for(let r=0;r<e.length;r++){const[i,s]=hr(t[e[r]]);Object.defineProperty(n,e[r],{get:i,set(o){s(()=>o)}})}return n}function ace(t){if(t.assignedSlot&&t.assignedSlot._$owner)return t.assignedSlot._$owner;let e=t.parentNode;for(;e&&!e._$owner&&!(e.assignedSlot&&e.assignedSlot._$owner);)e=e.parentNode;return e&&e.assignedSlot?e.assignedSlot._$owner:t._$owner}function VB(t){return(e,n)=>{const{element:r}=n;return rp(i=>{const s=uce(e);r.addPropertyChangedCallback((u,a)=>s[u]=a),r.addReleaseCallback(()=>{r.renderRoot.textContent="",i()});const o=t(s,n);return Je(r.renderRoot,o)},ace(r))}}var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function lce(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var YB={},Yx={},at={},ut={},va={};Object.defineProperty(va,"__esModule",{value:!0}),va.isNotUndefined=va.locationContainsPosition=void 0;function cce(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}va.locationContainsPosition=cce;function fce(t){return t!==void 0}va.isNotUndefined=fce;var Xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(z){return"kids"in z}t.exprHasKids=e;function n(z){return"e"in z}t.exprHasE=n;function r(z){return!(e(z)||n(z))}t.exprIsLeaf=r;function i(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}t.isAsymmetricExpr=i;function s(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function o(z,de){const fe=typeof de=="string"?{type:de}:de;return s(z)?{...z,typeDef:{...fe}}:z}t.mkTemporal=o;function u(z){return"dstSQLType"in z}t.isRawCast=u;function a(z){return z.value!==null}t.paramHasValue=a;function l(z){return z===void 0||z==="scalar"}t.expressionIsScalar=l;function c(z){return z==="aggregate"||z==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(z){return z==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(z){return z==="aggregate_analytic"||z==="scalar_analytic"}t.expressionIsAnalytic=p;function m(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function g(z,de){return z===de||m(z)<m(de)}t.isExpressionTypeLEQ=g;function y(z,de){let fe="scalar";return(z==="aggregate"||de==="aggregate")&&(fe="aggregate"),(z==="ungrouped_aggregate"||de==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(z==="scalar_analytic"||de==="scalar_analytic")&&(fe="scalar_analytic"),(z==="aggregate_analytic"||de==="aggregate_analytic")&&(fe="aggregate_analytic"),(z==="scalar_analytic"&&de==="aggregate"||z==="aggregate"&&de==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(z){return z.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function v(z){return"e"in z}t.hasExpression=v;function _(z){return z==="date"||z==="timestamp"}t.isTemporalType=_;function A(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}t.isAtomicFieldType=A;function S(z){return["string","number","date","boolean","date","timestamp"].includes(z)}t.canOrderBy=S;function b(z){return["string","number","date","timestamp","boolean","json"].includes(z)}t.isCastType=b;function C(z){return A(z.type)&&!v(z)}t.fieldIsIntrinsic=C;function w(z,de){if(M(z))return I(z.elementTypeDef,de);if(F(z)){const{type:fe,fields:K,elementTypeDef:ee}=z;return{type:fe,fields:K,elementTypeDef:ee,join:"many",name:de}}if(z.type==="record"){const{type:fe,fields:K}=z;return{type:fe,fields:K,join:"one",name:de}}return{...z,name:de}}t.mkFieldDef=w;function I(z,de){if(z.type==="record")return{type:"array",join:"many",name:de,elementTypeDef:{type:"record_element"},fields:z.fields};const fe=w(z,"value");return{type:"array",join:"many",name:de,elementTypeDef:z,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=I;function F(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}t.isRepeatedRecord=F;function M(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}t.isScalarArray=M;function U(z){return["left","right","full","inner"].includes(z)}t.isMatrixOperation=U;function X(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}t.isJoinable=X;function W(z){return"join"in z}t.isJoined=W;function ae(z){return j(z)&&W(z)}t.isJoinedSource=ae;function ge(z){return["day","week","month","quarter","year"].includes(z)}t.isDateUnit=ge;function he(z){return ge(z)||["hour","minute","second"].includes(z)}t.isTimestampUnit=he;function ue(z){return he(z)||z==="day_of_week"||z==="day_of_year"}t.isExtractUnit=ue;var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(t.ValueType=ce={}));function ie(z){return typeof z!="string"}t.refIsStructDef=ie;function re(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(de=>de.type==="error")||z.queryFields.some(de=>de.type==="error")))}t.segmentHasErrors=re;function R(z){return z.fields.some(de=>de.type==="error")}t.structHasErrors=R;function O(z){return z.type==="reduce"}t.isReduceSegment=O;function D(z){return z.type==="partial"}t.isPartialSegment=D;function k(z){return z.type==="project"}t.isProjectSegment=k;function G(z){return k(z)||O(z)}t.isQuerySegment=G;function q(z){return z.rows!==void 0}t.isSamplingRows=q;function N(z){return z.percent!==void 0}t.isSamplingPercent=N;function B(z){return z.enable!==void 0}t.isSamplingEnable=B;function P(z){return z.type==="raw"}t.isRawSegment=P;function Q(z){return z.type==="index"}t.isIndexSegment=Q;function $(z){return"sql"in z}t.isSegmentSQL=$;function H(z){return{...z}}t.sourceBase=H;function j(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}t.isSourceDef=j;function J(z){return ae(z)?!1:!!j(z)}t.isBaseTable=J;function xe(z){return z==="literal"}t.isLiteral=xe;function se(...z){return z.length<=1&&z.every(de=>de==="literal")?"literal":z.every(de=>de==="constant"||de==="literal")?"constant":z.every(de=>de==="output"||de==="constant"||de==="literal")?"output":"input"}t.mergeEvalSpaces=se;function Z(z){return z.type==="string"||_(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}t.isLeafAtomic=Z;function oe(z){return z.as!==void 0?z.as:z.name}t.getIdentifier=oe;function we(z){return z.type==="turtle"}t.isTurtle=we;function Pe(z){return A(z.type)}t.isAtomic=Pe;function ze(z,de){return de.type==="string"}t.isValueString=ze;function V(z,de){return de.type==="number"}t.isValueNumber=V;function ne(z,de){return de.type==="boolean"}t.isValueBoolean=ne;function Te(z,de){return de.type==="timestamp"}t.isValueTimestamp=Te;function Me(z,de){return de.type==="date"}t.isValueDate=Me,t.TD={isAtomic(z){return z!==void 0&&A(z.type)},isLeafAtomic(z){return z!==void 0&&Z({type:z.type})},isString:z=>(z==null?void 0:z.type)==="string",isNumber:z=>(z==null?void 0:z.type)==="number",isBoolean:z=>(z==null?void 0:z.type)==="boolean",isJSON:z=>(z==null?void 0:z.type)==="json",isSQL:z=>(z==null?void 0:z.type)==="sql native",isDate:z=>(z==null?void 0:z.type)==="date",isTimestamp:z=>(z==null?void 0:z.type)==="timestamp",isTemporal(z){var de;const fe=(de=z==null?void 0:z.type)!==null&&de!==void 0?de:"";return _(fe)},isError:z=>(z==null?void 0:z.type)==="error",eq(z,de){if(z===void 0||de===void 0)return!1;function fe(K,ee){const Oe={};for(const Y of K.fields||[])if(Y.name)Oe[Y.name]=Y;else return!1;for(const Y of ee.fields||[])if(!t.TD.eq(Oe[Y.name],Y))return!1;return!0}return z.type==="array"&&de.type==="array"?z.elementTypeDef.type!==de.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&de.elementTypeDef.type!=="record_element"?t.TD.eq(z.elementTypeDef,de.elementTypeDef):fe(z,de):z.type==="record"&&de.type==="record"?fe(z,de):z.type==="sql native"&&de.type==="sql native"?z.rawType!==void 0&&z.rawType===de.rawType:z.type===de.type}}})(Xe),Object.defineProperty(ut,"__esModule",{value:!0}),ut.compositeFieldUsageJoinPaths=ut.joinedCompositeFieldUsage=ut.compositeFieldUsageDifference=ut.emptyCompositeFieldUsage=ut.mergeCompositeFieldUsage=ut.unique=ut.formatCompositeFieldUsage=ut.compositeFieldUsageIsPlural=ut.isEmptyCompositeFieldUsage=ut.formatCompositeFieldUsages=ut.compositeFieldUsagePaths=ut.resolveCompositeSources=ut.narrowCompositeFieldResolution=ut.emptyNarrowedCompositeFieldResolution=void 0;const XB=va,WT=Xe;function Jy(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=vce(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:v}of x){const _=new Set;for(const A of E.fields)_.add((s=A.as)!==null&&s!==void 0?s:A.name);for(const A of n.fields)if(!_.has(A)){y.shift();continue e}if(E.type==="composite"){const A=Jy(t,E,_ce(n,E),{source:v??E.sources.map(S=>({source:S,nested:[]})),joined:{}});if("error"in A){y.shift();continue e}f={...A.success},y[0]={source:E,nested:A.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],v=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:v}}};if((0,WT.isJoined)(E)){if(!(0,WT.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:v}}};const _=Jy(v,E,y,m[g]);if("error"in _)return _;if(!(0,WT.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:v}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function xce(){return{source:void 0,joined:{}}}ut.emptyNarrowedCompositeFieldResolution=xce;function dce(t,e,n){const r=Jy([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}ut.narrowCompositeFieldResolution=dce;function hce(t,e){const n=Jy([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}ut.resolveCompositeSources=hce;function VT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>VT(n).map(r=>[e,...r])).flat()]}ut.compositeFieldUsagePaths=VT;function pce(t){return VT(t).map(e=>JB(e)).join(", ")}ut.formatCompositeFieldUsages=pce;function YT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+YT(n),t.fields.length)}function gce(t){return YT(t)===0}ut.isEmptyCompositeFieldUsage=gce;function mce(t){return YT(t)>1}ut.compositeFieldUsageIsPlural=mce;function JB(t){return`\`${t.join(".")}\``}ut.formatCompositeFieldUsage=JB;function KB(t){return Array.from(new Set(t))}ut.unique=KB;function ZB(...t){const e=t.filter(XB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=ZB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(XB.isNotUndefined));return{fields:KB(e.map(i=>i.fields).flat()),joinedUsage:r}}ut.mergeCompositeFieldUsage=ZB;function yce(){return{fields:[],joinedUsage:{}}}ut.emptyCompositeFieldUsage=yce;function Ece(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function ek(t,e){return{fields:Ece(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?ek(r,e.joinedUsage[n]):r]))}}ut.compositeFieldUsageDifference=ek;function tk(t,e){return t.length===0?e:tk(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}ut.joinedCompositeFieldUsage=tk;function nk(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>nk(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}ut.compositeFieldUsageJoinPaths=nk;function rk(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function vce(t){return t.fields.filter(e=>!rk(e))}function _ce(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>rk(r[i])),joinedUsage:t.joinedUsage}}Object.defineProperty(at,"__esModule",{value:!0}),at.expandOverrideMapFromBase=at.expandBlueprintMap=at.overload=at.minAnalytic=at.minAggregate=at.minScalar=at.maxAnalytic=at.maxUngroupedAggregate=at.anyExprType=at.maxAggregate=at.maxScalar=at.makeParam=at.param=at.variadicParam=at.literal=at.output=at.constant=at.sql=at.spread=at.arg=void 0;const Ace=ut,XT=Xe;function ik(t){return{node:"function_parameter",name:t}}at.arg=ik;function Sce(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}at.spread=Sce;function bce(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}at.sql=bce;function JT(t){return{...t,evalSpace:"constant"}}at.constant=JT;function Cce(t){return{...t,evalSpace:"output"}}at.output=Cce;function KT(t){return{...t,evalSpace:"literal"}}at.literal=KT;function Tce(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}at.variadicParam=Tce;function sk(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}at.param=sk;function Oce(t,...e){return{param:sk(t,...e),arg:ik(t)}}at.makeParam=Oce;function Ky(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.maxScalar=Ky;function ok(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.maxAggregate=ok;function ZT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}at.anyExprType=ZT;function uk(t,e){return{...Zy(t,e),expressionType:void 0,evalSpace:"input"}}function Rce(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}at.maxUngroupedAggregate=Rce;function ak(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}at.maxAnalytic=ak;function Xx(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.minScalar=Xx;function lk(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.minAggregate=lk;function ck(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}at.minAnalytic=ck;function Dce(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}at.overload=Dce;function Ns(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function Zy(t,e){var n;let r;if(typeof t=="string")r=Xx(t);else if("array"in t){const i=Zy(t.array,e),{expressionType:s,evalSpace:o}=i;if(XT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=Zy(o,e);XT.TD.isAtomic(u)&&i.push((0,XT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Xx(Ns(t,e)):"literal"in t?r=KT(Xx(Ns(t.literal,e))):"constant"in t?r=JT(Xx(Ns(t.constant,e))):"dimension"in t?r=Xx(Ns(t.dimension,e)):"measure"in t?r=lk(Ns(t.measure,e)):r=ck(Ns(t.calculation,e));return{...r,compositeFieldUsage:(0,Ace.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function fk(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function wce(t){return fk(t)?[t]:Array.isArray(t)?t:fk(t.variadic)?[t.variadic]:t.variadic}function Nce(t,e){return typeof t=="string"?ZT(t):"generic"in t?ZT(Ns(t,e)):"literal"in t?KT(Ky(Ns(t.literal,e))):"constant"in t?JT(Ky(Ns(t.constant,e))):"dimension"in t?Ky(Ns(t.dimension,e)):"measure"in t?ok(Ns(t.measure,e)):"array"in t||"record"in t?uk(t,e):ak(Ns(t.calculation,e))}function Fce(t,e){return t.map(n=>Nce(n,e))}function xk(t){return typeof t!="string"&&"variadic"in t}function Lce(t,e,n){return{name:t,allowedTypes:Fce(wce(e),n),isVariadic:xk(e)}}function Ice(t,e){return Object.entries(t).map(r=>Lce(r[0],r[1],e))}function $ce(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Bce(t,e){return xk(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function kce(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Bce(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Pce(t){return"sql"in t.impl?$ce(t.impl.sql):"expr"in t.impl?t.impl.expr:kce(t.impl.function,t)}function Mce(t){return{e:Pce(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function dk(t,e){return{returnType:Zy(t.returns,e),params:Ice(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Mce(t)}}function e6(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>dk(t,{name:e,type:n}))}return[dk(t)]}function t6(t){return"takes"in t&&"returns"in t&&"impl"in t}function jce(t){return"function"in t||"sql"in t||"expr"in t}function Uce(t){return t6(t)?e6(t):Object.values(t).flatMap(e=>e6(e))}function qce(t){const e={};for(const n in t)e[n]=Uce(t[n]);return e}at.expandBlueprintMap=qce;function hk(t,e){return e6({...t,impl:e})}function zce(t,e,n){if(jce(n)){if(!t6(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return hk(e,n)}else{if(t6(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return hk(s,i)})}}function Hce(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=zce(r,t[r],e[r])}return n}at.expandOverrideMapFromBase=Hce;var Bl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=Xe;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
1
+ (function(tp,np){typeof exports=="object"&&typeof module<"u"?module.exports=np():typeof define=="function"&&define.amd?define(np):(tp=typeof globalThis<"u"?globalThis:tp||self,tp.register=np())})(this,function(){"use strict";function tp(t){return Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=Object.assign({},i),NB(i.value)&&!P0e(i.value)&&!Array.isArray(i.value)&&(n[r].value=Object.assign({},i.value)),Array.isArray(i.value)&&(n[r].value=i.value.slice(0)),n},{})}function np(t){return t?Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=NB(i)&&"value"in i?i:{value:i},n[r].attribute||(n[r].attribute=k0e(r)),n[r].parse="parse"in n[r]?n[r].parse:typeof n[r].value!="string",n},{}):{}}function $0e(t){return Object.keys(t).reduce((n,r)=>(n[r]=t[r].value,n),{})}function B0e(t,e){const n=tp(e);return Object.keys(e).forEach(i=>{const s=n[i],o=t.getAttribute(s.attribute),u=t[i];o&&(s.value=s.parse?DB(o):o),u!=null&&(s.value=Array.isArray(u)?u.slice(0):u),s.reflect&&wB(t,s.attribute,s.value,!!s.parse),Object.defineProperty(t,i,{get(){return s.value},set(a){const l=s.value;s.value=a,s.reflect&&wB(this,s.attribute,s.value,!!s.parse);for(let c=0,f=this.__propertyChangedCallbacks.length;c<f;c++)this.__propertyChangedCallbacks[c](i,a,l)},enumerable:!0,configurable:!0})}),n}function DB(t){if(t)try{return JSON.parse(t)}catch{return t}}function wB(t,e,n,r){if(n==null||n===!1)return t.removeAttribute(e);let i=r?JSON.stringify(n):n;t.__updating[e]=!0,i==="true"&&(i=""),t.setAttribute(e,i),Promise.resolve().then(()=>delete t.__updating[e])}function k0e(t){return t.replace(/\.?([A-Z]+)/g,(e,n)=>"-"+n.toLowerCase()).replace("_","-").replace(/^-/,"")}function NB(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function P0e(t){return Object.prototype.toString.call(t)==="[object Function]"}function M0e(t){return typeof t=="function"&&t.toString().indexOf("class")===0}let BT;function j0e(t,e){const n=Object.keys(e);return class extends t{static get observedAttributes(){return n.map(i=>e[i].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=B0e(this,e);const i=$0e(this.props),s=this.Component,o=BT;try{BT=this,this.__initialized=!0,M0e(s)?new s(i,{element:this}):s(i,{element:this})}finally{BT=o}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let i=null;for(;i=this.__releaseCallbacks.pop();)i(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(i,s,o){if(this.__initialized&&!this.__updating[i]&&(i=this.lookupProp(i),i in e)){if(o==null&&!this[i])return;this[i]=e[i].parse?DB(o):o}}lookupProp(i){if(e)return n.find(s=>i===s||i===e[s].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(i){this.__releaseCallbacks.push(i)}addPropertyChangedCallback(i){this.__propertyChangedCallbacks.push(i)}}}function FB(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function LB(t,e={},n={}){const{BaseElement:r=HTMLElement,extension:i,customElements:s=window.customElements}=n;return o=>{if(!t)throw new Error("tag is required to register a Component");let u=s.get(t);return u?(u.prototype.Component=o,u):(u=j0e(r,np(e)),u.prototype.Component=o,u.prototype.registeredTag=t,s.define(t,u,i),u)}}const U0e={context:void 0,registry:void 0},q0e=(t,e)=>t===e,Ko=Symbol("solid-proxy"),kT=Symbol("solid-track"),jy={equals:q0e};let IB=jB;const ya=1,Uy=2,$B={owned:null,cleanups:null,context:null,owner:null};var zt=null;let PT=null,z0e=null,ln=null,Tr=null,Ea=null,qy=0;function rp(t,e){const n=ln,r=zt,i=t.length===0,s=e===void 0?r:e,o=i?$B:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=i?t:()=>t(()=>Xi(()=>Gy(o)));zt=o,ln=null;try{return Dc(u,!0)}finally{ln=n,zt=r}}function hr(t,e){e=e?Object.assign({},jy,e):jy;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),MB(n,i));return[PB.bind(n),r]}function H0e(t,e,n){const r=zy(t,e,!0,ya);Wx(r)}function Pn(t,e,n){const r=zy(t,e,!1,ya);Wx(r)}function ws(t,e,n){IB=Y0e;const r=zy(t,e,!1,ya);(!n||!n.render)&&(r.user=!0),Ea?Ea.push(r):Wx(r)}function Fn(t,e,n){n=n?Object.assign({},jy,n):jy;const r=zy(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Wx(r),PB.bind(r)}function Q0e(t){return Dc(t,!1)}function Xi(t){if(ln===null)return t();const e=ln;ln=null;try{return t()}finally{ln=e}}function ip(t){ws(()=>Xi(t))}function sp(t){return zt===null||(zt.cleanups===null?zt.cleanups=[t]:zt.cleanups.push(t)),t}function MT(){return ln}function BB(){return zt}function G0e(t,e){const n=zt,r=ln;zt=t,ln=null;try{return Dc(e,!0)}catch(i){qT(i)}finally{zt=n,ln=r}}function jT(t,e){const n=Symbol("context");return{id:n,Provider:J0e(n),defaultValue:t}}function UT(t){return zt&&zt.context&&zt.context[t.id]!==void 0?zt.context[t.id]:t.defaultValue}function kB(t){const e=Fn(t),n=Fn(()=>zT(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function PB(){if(this.sources&&this.state)if(this.state===ya)Wx(this);else{const t=Tr;Tr=null,Dc(()=>Qy(this),!1),Tr=t}if(ln){const t=this.observers?this.observers.length:0;ln.sources?(ln.sources.push(this),ln.sourceSlots.push(t)):(ln.sources=[this],ln.sourceSlots=[t]),this.observers?(this.observers.push(ln),this.observerSlots.push(ln.sources.length-1)):(this.observers=[ln],this.observerSlots=[ln.sources.length-1])}return this.value}function MB(t,e,n){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&Dc(()=>{for(let i=0;i<t.observers.length;i+=1){const s=t.observers[i],o=PT&&PT.running;o&&PT.disposed.has(s),(o?!s.tState:!s.state)&&(s.pure?Tr.push(s):Ea.push(s),s.observers&&UB(s)),o||(s.state=ya)}if(Tr.length>1e6)throw Tr=[],new Error},!1)),e}function Wx(t){if(!t.fn)return;Gy(t);const e=qy;W0e(t,t.value,e)}function W0e(t,e,n){let r;const i=zt,s=ln;ln=zt=t;try{r=t.fn(e)}catch(o){return t.pure&&(t.state=ya,t.owned&&t.owned.forEach(Gy),t.owned=null),t.updatedAt=n+1,qT(o)}finally{ln=s,zt=i}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?MB(t,r):t.value=r,t.updatedAt=n)}function zy(t,e,n,r=ya,i){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:zt,context:zt?zt.context:null,pure:n};return zt===null||zt!==$B&&(zt.owned?zt.owned.push(s):zt.owned=[s]),s}function Hy(t){if(t.state===0)return;if(t.state===Uy)return Qy(t);if(t.suspense&&Xi(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<qy);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===ya)Wx(t);else if(t.state===Uy){const r=Tr;Tr=null,Dc(()=>Qy(t,e[0]),!1),Tr=r}}function Dc(t,e){if(Tr)return t();let n=!1;e||(Tr=[]),Ea?n=!0:Ea=[],qy++;try{const r=t();return V0e(n),r}catch(r){n||(Ea=null),Tr=null,qT(r)}}function V0e(t){if(Tr&&(jB(Tr),Tr=null),t)return;const e=Ea;Ea=null,e.length&&Dc(()=>IB(e),!1)}function jB(t){for(let e=0;e<t.length;e++)Hy(t[e])}function Y0e(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:Hy(r)}for(e=0;e<n;e++)Hy(t[e])}function Qy(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const r=t.sources[n];if(r.sources){const i=r.state;i===ya?r!==e&&(!r.updatedAt||r.updatedAt<qy)&&Hy(r):i===Uy&&Qy(r,e)}}}function UB(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=Uy,n.pure?Tr.push(n):Ea.push(n),n.observers&&UB(n))}}function Gy(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),r=t.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),o=n.observerSlots.pop();r<i.length&&(s.sourceSlots[o]=r,i[r]=s,n.observerSlots[r]=o)}}if(t.owned){for(e=t.owned.length-1;e>=0;e--)Gy(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function X0e(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function qT(t,e=zt){throw X0e(t)}function zT(t){if(typeof t=="function"&&!t.length)return zT(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const r=zT(t[n]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function J0e(t,e){return function(r){let i;return Pn(()=>i=Xi(()=>(zt.context={...zt.context,[t]:r.value},kB(()=>r.children))),void 0),i}}const K0e=Symbol("fallback");function qB(t){for(let e=0;e<t.length;e++)t[e]()}function Z0e(t,e,n={}){let r=[],i=[],s=[],o=0,u=e.length>1?[]:null;return sp(()=>qB(s)),()=>{let a=t()||[],l,c;return a[kT],Xi(()=>{let x=a.length,d,p,m,g,y,E,v,_,A;if(x===0)o!==0&&(qB(s),s=[],r=[],i=[],o=0,u&&(u=[])),n.fallback&&(r=[K0e],i[0]=rp(S=>(s[0]=S,n.fallback())),o=1);else if(o===0){for(i=new Array(x),c=0;c<x;c++)r[c]=a[c],i[c]=rp(f);o=x}else{for(m=new Array(x),g=new Array(x),u&&(y=new Array(x)),E=0,v=Math.min(o,x);E<v&&r[E]===a[E];E++);for(v=o-1,_=x-1;v>=E&&_>=E&&r[v]===a[_];v--,_--)m[_]=i[v],g[_]=s[v],u&&(y[_]=u[v]);for(d=new Map,p=new Array(_+1),c=_;c>=E;c--)A=a[c],l=d.get(A),p[c]=l===void 0?-1:l,d.set(A,c);for(l=E;l<=v;l++)A=r[l],c=d.get(A),c!==void 0&&c!==-1?(m[c]=i[l],g[c]=s[l],u&&(y[c]=u[l]),c=p[c],d.set(A,c)):s[l]();for(c=E;c<x;c++)c in m?(i[c]=m[c],s[c]=g[c],u&&(u[c]=y[c],u[c](c))):i[c]=rp(f);i=i.slice(0,o=x),r=a.slice(0)}return i});function f(x){if(s[c]=x,u){const[d,p]=hr(c);return u[c]=p,e(a[c],d)}return e(a[c])}}}function Ge(t,e){return Xi(()=>t(e||{}))}function Wy(){return!0}const ece={get(t,e,n){return e===Ko?n:t.get(e)},has(t,e){return e===Ko?!0:t.has(e)},set:Wy,deleteProperty:Wy,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Wy,deleteProperty:Wy}},ownKeys(t){return t.keys()}};function HT(t){return(t=typeof t=="function"?t():t)?t:{}}function tce(){for(let t=0,e=this.length;t<e;++t){const n=this[t]();if(n!==void 0)return n}}function Zo(...t){let e=!1;for(let o=0;o<t.length;o++){const u=t[o];e=e||!!u&&Ko in u,t[o]=typeof u=="function"?(e=!0,Fn(u)):u}if(e)return new Proxy({get(o){for(let u=t.length-1;u>=0;u--){const a=HT(t[u])[o];if(a!==void 0)return a}},has(o){for(let u=t.length-1;u>=0;u--)if(o in HT(t[u]))return!0;return!1},keys(){const o=[];for(let u=0;u<t.length;u++)o.push(...Object.keys(HT(t[u])));return[...new Set(o)]}},ece);const n={},r=Object.create(null);for(let o=t.length-1;o>=0;o--){const u=t[o];if(!u)continue;const a=Object.getOwnPropertyNames(u);for(let l=a.length-1;l>=0;l--){const c=a[l];if(c==="__proto__"||c==="constructor")continue;const f=Object.getOwnPropertyDescriptor(u,c);if(!r[c])r[c]=f.get?{enumerable:!0,configurable:!0,get:tce.bind(n[c]=[f.get.bind(u)])}:f.value!==void 0?f:void 0;else{const x=n[c];x&&(f.get?x.push(f.get.bind(u)):f.value!==void 0&&x.push(()=>f.value))}}}const i={},s=Object.keys(r);for(let o=s.length-1;o>=0;o--){const u=s[o],a=r[u];a&&a.get?Object.defineProperty(i,u,a):i[u]=a?a.value:void 0}return i}const zB=t=>`Stale read from <${t}>.`;function Yn(t){const e="fallback"in t&&{fallback:()=>t.fallback};return Fn(Z0e(()=>t.each,t.children,e||void 0))}function Or(t){const e=t.keyed,n=Fn(()=>t.when,void 0,{equals:(r,i)=>e?r===i:!r==!i});return Fn(()=>{const r=n();if(r){const i=t.children;return typeof i=="function"&&i.length>0?Xi(()=>i(e?r:()=>{if(!Xi(n))throw zB("Show");return t.when})):i}return t.fallback},void 0,void 0)}function HB(t){let e=!1;const n=(s,o)=>(e?s[1]===o[1]:!s[1]==!o[1])&&s[2]===o[2],r=kB(()=>t.children),i=Fn(()=>{let s=r();Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o++){const u=s[o].when;if(u)return e=!!s[o].keyed,[o,u,s[o]]}return[-1]},void 0,{equals:n});return Fn(()=>{const[s,o,u]=i();if(s<0)return t.fallback;const a=u.children;return typeof a=="function"&&a.length>0?Xi(()=>a(e?o:()=>{if(Xi(i)[0]!==s)throw zB("Match");return u.when})):a},void 0,void 0)}function Vy(t){return t}function nce(t,e,n){let r=n.length,i=e.length,s=r,o=0,u=0,a=e[i-1].nextSibling,l=null;for(;o<i||u<s;){if(e[o]===n[u]){o++,u++;continue}for(;e[i-1]===n[s-1];)i--,s--;if(i===o){const c=s<r?u?n[u-1].nextSibling:n[s-u]:a;for(;u<s;)t.insertBefore(n[u++],c)}else if(s===u)for(;o<i;)(!l||!l.has(e[o]))&&e[o].remove(),o++;else if(e[o]===n[s-1]&&n[u]===e[i-1]){const c=e[--i].nextSibling;t.insertBefore(n[u++],e[o++].nextSibling),t.insertBefore(n[--s],c),e[i]=n[s]}else{if(!l){l=new Map;let f=u;for(;f<s;)l.set(n[f],f++)}const c=l.get(e[o]);if(c!=null)if(u<c&&c<s){let f=o,x=1,d;for(;++f<i&&f<s&&!((d=l.get(e[f]))==null||d!==c+x);)x++;if(x>c-u){const p=e[o];for(;u<c;)t.insertBefore(n[u++],p)}else t.replaceChild(n[u++],e[o++])}else o++;else e[o++].remove()}}}const QB="_$DX_DELEGATE";function mt(t,e,n){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=t,n?o.content.firstChild.firstChild:o.content.firstChild},s=e?()=>Xi(()=>document.importNode(r||(r=i()),!0)):()=>(r||(r=i())).cloneNode(!0);return s.cloneNode=s,s}function QT(t,e=window.document){const n=e[QB]||(e[QB]=new Set);for(let r=0,i=t.length;r<i;r++){const s=t[r];n.has(s)||(n.add(s),e.addEventListener(s,rce))}}function Ji(t,e,n){n==null?t.removeAttribute(e):t.setAttribute(e,n)}function GB(t,e,n,r){Array.isArray(n)?(t[`$$${e}`]=n[0],t[`$$${e}Data`]=n[1]):t[`$$${e}`]=n}function wc(t,e,n){if(!e)return n?Ji(t,"style"):e;const r=t.style;if(typeof e=="string")return r.cssText=e;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),e||(e={});let i,s;for(s in n)e[s]==null&&r.removeProperty(s),delete n[s];for(s in e)i=e[s],i!==n[s]&&(r.setProperty(s,i),n[s]=i);return n}function lo(t,e,n){return Xi(()=>t(e,n))}function Je(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return Yy(t,e,r,n);Pn(i=>Yy(t,e(),i,n),r)}function rce(t){const e=`$$${t.type}`;let n=t.composedPath&&t.composedPath()[0]||t.target;for(t.target!==n&&Object.defineProperty(t,"target",{configurable:!0,value:n}),Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}});n;){const r=n[e];if(r&&!n.disabled){const i=n[`${e}Data`];if(i!==void 0?r.call(n,i,t):r.call(n,t),t.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Yy(t,e,n,r,i){for(;typeof n=="function";)n=n();if(e===n)return n;const s=typeof e,o=r!==void 0;if(t=o&&n[0]&&n[0].parentNode||t,s==="string"||s==="number")if(s==="number"&&(e=e.toString()),o){let u=n[0];u&&u.nodeType===3?u.data!==e&&(u.data=e):u=document.createTextNode(e),n=Vx(t,n,r,u)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e;else if(e==null||s==="boolean")n=Vx(t,n,r);else{if(s==="function")return Pn(()=>{let u=e();for(;typeof u=="function";)u=u();n=Yy(t,u,n,r)}),()=>n;if(Array.isArray(e)){const u=[],a=n&&Array.isArray(n);if(GT(u,e,n,i))return Pn(()=>n=Yy(t,u,n,r,!0)),()=>n;if(u.length===0){if(n=Vx(t,n,r),o)return n}else a?n.length===0?WB(t,u,r):nce(t,n,u):(n&&Vx(t),WB(t,u));n=u}else if(e.nodeType){if(Array.isArray(n)){if(o)return n=Vx(t,n,r,e);Vx(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function GT(t,e,n,r){let i=!1;for(let s=0,o=e.length;s<o;s++){let u=e[s],a=n&&n[t.length],l;if(!(u==null||u===!0||u===!1))if((l=typeof u)=="object"&&u.nodeType)t.push(u);else if(Array.isArray(u))i=GT(t,u,a)||i;else if(l==="function")if(r){for(;typeof u=="function";)u=u();i=GT(t,Array.isArray(u)?u:[u],Array.isArray(a)?a:[a])||i}else t.push(u),i=!0;else{const c=String(u);a&&a.nodeType===3&&a.data===c?t.push(a):t.push(document.createTextNode(c))}}return i}function WB(t,e,n=null){for(let r=0,i=e.length;r<i;r++)t.insertBefore(e[r],n)}function Vx(t,e,n,r){if(n===void 0)return t.textContent="";const i=r||document.createTextNode("");if(e.length){let s=!1;for(let o=e.length-1;o>=0;o--){const u=e[o];if(i!==u){const a=u.parentNode===t;!s&&!o?a?t.replaceChild(i,u):t.insertBefore(i,n):a&&u.remove()}else s=!0}}else t.insertBefore(i,n);return[i]}const ice="http://www.w3.org/2000/svg";function sce(t,e=!1){return e?document.createElementNS(ice,t):document.createElement(t)}function oce(t){const{useShadow:e}=t,n=document.createTextNode(""),r=()=>t.mount||document.body,i=BB();let s,o=!!U0e.context;return ws(()=>{s||(s=G0e(i,()=>Fn(()=>t.children)));const u=r();if(u instanceof HTMLHeadElement){const[a,l]=hr(!1),c=()=>l(!0);rp(f=>Je(u,()=>a()?f():s(),null)),sp(c)}else{const a=sce(t.isSVG?"g":"div",t.isSVG),l=e&&a.attachShadow?a.attachShadow({mode:"open"}):a;Object.defineProperty(a,"_$host",{get(){return n.parentNode},configurable:!0}),Je(l,s),u.appendChild(a),t.ref&&t.ref(a),sp(()=>u.removeChild(a))}},void 0,{render:!o}),n}function uce(t){const e=Object.keys(t),n={};for(let r=0;r<e.length;r++){const[i,s]=hr(t[e[r]]);Object.defineProperty(n,e[r],{get:i,set(o){s(()=>o)}})}return n}function ace(t){if(t.assignedSlot&&t.assignedSlot._$owner)return t.assignedSlot._$owner;let e=t.parentNode;for(;e&&!e._$owner&&!(e.assignedSlot&&e.assignedSlot._$owner);)e=e.parentNode;return e&&e.assignedSlot?e.assignedSlot._$owner:t._$owner}function VB(t){return(e,n)=>{const{element:r}=n;return rp(i=>{const s=uce(e);r.addPropertyChangedCallback((u,a)=>s[u]=a),r.addReleaseCallback(()=>{r.renderRoot.textContent="",i()});const o=t(s,n);return Je(r.renderRoot,o)},ace(r))}}var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function lce(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var YB={},Yx={},at={},ut={},va={};Object.defineProperty(va,"__esModule",{value:!0}),va.isNotUndefined=va.locationContainsPosition=void 0;function cce(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}va.locationContainsPosition=cce;function fce(t){return t!==void 0}va.isNotUndefined=fce;var Xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(z){return"kids"in z}t.exprHasKids=e;function n(z){return"e"in z}t.exprHasE=n;function r(z){return!(e(z)||n(z))}t.exprIsLeaf=r;function i(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}t.isAsymmetricExpr=i;function s(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function o(z,de){const fe=typeof de=="string"?{type:de}:de;return s(z)?{...z,typeDef:{...fe}}:z}t.mkTemporal=o;function u(z){return"dstSQLType"in z}t.isRawCast=u;function a(z){return z.value!==null}t.paramHasValue=a;function l(z){return z===void 0||z==="scalar"}t.expressionIsScalar=l;function c(z){return z==="aggregate"||z==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(z){return z==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(z){return z==="aggregate_analytic"||z==="scalar_analytic"}t.expressionIsAnalytic=p;function m(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function g(z,de){return z===de||m(z)<m(de)}t.isExpressionTypeLEQ=g;function y(z,de){let fe="scalar";return(z==="aggregate"||de==="aggregate")&&(fe="aggregate"),(z==="ungrouped_aggregate"||de==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(z==="scalar_analytic"||de==="scalar_analytic")&&(fe="scalar_analytic"),(z==="aggregate_analytic"||de==="aggregate_analytic")&&(fe="aggregate_analytic"),(z==="scalar_analytic"&&de==="aggregate"||z==="aggregate"&&de==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(z){return z.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function v(z){return"e"in z}t.hasExpression=v;function _(z){return z==="date"||z==="timestamp"}t.isTemporalType=_;function A(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}t.isAtomicFieldType=A;function S(z){return["string","number","date","boolean","date","timestamp"].includes(z)}t.canOrderBy=S;function b(z){return["string","number","date","timestamp","boolean","json"].includes(z)}t.isCastType=b;function C(z){return A(z.type)&&!v(z)}t.fieldIsIntrinsic=C;function w(z,de){if(M(z))return I(z.elementTypeDef,de);if(F(z)){const{type:fe,fields:K,elementTypeDef:ee}=z;return{type:fe,fields:K,elementTypeDef:ee,join:"many",name:de}}if(z.type==="record"){const{type:fe,fields:K}=z;return{type:fe,fields:K,join:"one",name:de}}return{...z,name:de}}t.mkFieldDef=w;function I(z,de){if(z.type==="record")return{type:"array",join:"many",name:de,elementTypeDef:{type:"record_element"},fields:z.fields};const fe=w(z,"value");return{type:"array",join:"many",name:de,elementTypeDef:z,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=I;function F(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}t.isRepeatedRecord=F;function M(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}t.isScalarArray=M;function U(z){return["left","right","full","inner"].includes(z)}t.isMatrixOperation=U;function X(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}t.isJoinable=X;function W(z){return"join"in z}t.isJoined=W;function ae(z){return j(z)&&W(z)}t.isJoinedSource=ae;function ge(z){return["day","week","month","quarter","year"].includes(z)}t.isDateUnit=ge;function he(z){return ge(z)||["hour","minute","second"].includes(z)}t.isTimestampUnit=he;function ue(z){return he(z)||z==="day_of_week"||z==="day_of_year"}t.isExtractUnit=ue;var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(t.ValueType=ce={}));function ie(z){return typeof z!="string"}t.refIsStructDef=ie;function re(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(de=>de.type==="error")||z.queryFields.some(de=>de.type==="error")))}t.segmentHasErrors=re;function R(z){return z.fields.some(de=>de.type==="error")}t.structHasErrors=R;function O(z){return z.type==="reduce"}t.isReduceSegment=O;function D(z){return z.type==="partial"}t.isPartialSegment=D;function k(z){return z.type==="project"}t.isProjectSegment=k;function G(z){return k(z)||O(z)}t.isQuerySegment=G;function q(z){return z.rows!==void 0}t.isSamplingRows=q;function N(z){return z.percent!==void 0}t.isSamplingPercent=N;function B(z){return z.enable!==void 0}t.isSamplingEnable=B;function P(z){return z.type==="raw"}t.isRawSegment=P;function Q(z){return z.type==="index"}t.isIndexSegment=Q;function $(z){return"sql"in z}t.isSegmentSQL=$;function H(z){return{...z}}t.sourceBase=H;function j(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}t.isSourceDef=j;function J(z){return ae(z)?!1:!!j(z)}t.isBaseTable=J;function xe(z){return z==="literal"}t.isLiteral=xe;function se(...z){return z.length<=1&&z.every(de=>de==="literal")?"literal":z.every(de=>de==="constant"||de==="literal")?"constant":z.every(de=>de==="output"||de==="constant"||de==="literal")?"output":"input"}t.mergeEvalSpaces=se;function Z(z){return z.type==="string"||_(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}t.isLeafAtomic=Z;function oe(z){return z.as!==void 0?z.as:z.name}t.getIdentifier=oe;function we(z){return z.type==="turtle"}t.isTurtle=we;function Pe(z){return A(z.type)}t.isAtomic=Pe;function ze(z,de){return de.type==="string"}t.isValueString=ze;function V(z,de){return de.type==="number"}t.isValueNumber=V;function ne(z,de){return de.type==="boolean"}t.isValueBoolean=ne;function Te(z,de){return de.type==="timestamp"}t.isValueTimestamp=Te;function Me(z,de){return de.type==="date"}t.isValueDate=Me,t.TD={isAtomic(z){return z!==void 0&&A(z.type)},isLeafAtomic(z){return z!==void 0&&Z({type:z.type})},isString:z=>(z==null?void 0:z.type)==="string",isNumber:z=>(z==null?void 0:z.type)==="number",isBoolean:z=>(z==null?void 0:z.type)==="boolean",isJSON:z=>(z==null?void 0:z.type)==="json",isSQL:z=>(z==null?void 0:z.type)==="sql native",isDate:z=>(z==null?void 0:z.type)==="date",isTimestamp:z=>(z==null?void 0:z.type)==="timestamp",isTemporal(z){var de;const fe=(de=z==null?void 0:z.type)!==null&&de!==void 0?de:"";return _(fe)},isError:z=>(z==null?void 0:z.type)==="error",eq(z,de){if(z===void 0||de===void 0)return!1;function fe(K,ee){const Oe={};for(const Y of K.fields||[])if(Y.name)Oe[Y.name]=Y;else return!1;for(const Y of ee.fields||[])if(!t.TD.eq(Oe[Y.name],Y))return!1;return!0}return z.type==="array"&&de.type==="array"?z.elementTypeDef.type!==de.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&de.elementTypeDef.type!=="record_element"?t.TD.eq(z.elementTypeDef,de.elementTypeDef):fe(z,de):z.type==="record"&&de.type==="record"?fe(z,de):z.type==="sql native"&&de.type==="sql native"?z.rawType!==void 0&&z.rawType===de.rawType:z.type===de.type}}})(Xe),Object.defineProperty(ut,"__esModule",{value:!0}),ut.compositeFieldUsageJoinPaths=ut.joinedCompositeFieldUsage=ut.compositeFieldUsageDifference=ut.emptyCompositeFieldUsage=ut.mergeCompositeFieldUsage=ut.unique=ut.formatCompositeFieldUsage=ut.compositeFieldUsageIsPlural=ut.isEmptyCompositeFieldUsage=ut.formatCompositeFieldUsages=ut.compositeFieldUsagePaths=ut.resolveCompositeSources=ut.narrowCompositeFieldResolution=ut.emptyNarrowedCompositeFieldResolution=void 0;const XB=va,WT=Xe;function Jy(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=vce(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:v}of x){const _=new Set;for(const A of E.fields)_.add((s=A.as)!==null&&s!==void 0?s:A.name);for(const A of n.fields)if(!_.has(A)){y.shift();continue e}if(E.type==="composite"){const A=Jy(t,E,_ce(n,E),{source:v??E.sources.map(S=>({source:S,nested:[]})),joined:{}});if("error"in A){y.shift();continue e}f={...A.success},y[0]={source:E,nested:A.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],v=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:v}}};if((0,WT.isJoined)(E)){if(!(0,WT.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:v}}};const _=Jy(v,E,y,m[g]);if("error"in _)return _;if(!(0,WT.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:v}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function xce(){return{source:void 0,joined:{}}}ut.emptyNarrowedCompositeFieldResolution=xce;function dce(t,e,n){const r=Jy([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}ut.narrowCompositeFieldResolution=dce;function hce(t,e){const n=Jy([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}ut.resolveCompositeSources=hce;function VT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>VT(n).map(r=>[e,...r])).flat()]}ut.compositeFieldUsagePaths=VT;function pce(t){return VT(t).map(e=>JB(e)).join(", ")}ut.formatCompositeFieldUsages=pce;function YT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+YT(n),t.fields.length)}function gce(t){return YT(t)===0}ut.isEmptyCompositeFieldUsage=gce;function mce(t){return YT(t)>1}ut.compositeFieldUsageIsPlural=mce;function JB(t){return`\`${t.join(".")}\``}ut.formatCompositeFieldUsage=JB;function KB(t){return Array.from(new Set(t))}ut.unique=KB;function ZB(...t){const e=t.filter(XB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=ZB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(XB.isNotUndefined));return{fields:KB(e.map(i=>i.fields).flat()),joinedUsage:r}}ut.mergeCompositeFieldUsage=ZB;function yce(){return{fields:[],joinedUsage:{}}}ut.emptyCompositeFieldUsage=yce;function Ece(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function ek(t,e){return{fields:Ece(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?ek(r,e.joinedUsage[n]):r]))}}ut.compositeFieldUsageDifference=ek;function tk(t,e){return t.length===0?e:tk(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}ut.joinedCompositeFieldUsage=tk;function nk(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>nk(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}ut.compositeFieldUsageJoinPaths=nk;function rk(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function vce(t){return t.fields.filter(e=>!rk(e))}function _ce(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>rk(r[i])),joinedUsage:{}}}Object.defineProperty(at,"__esModule",{value:!0}),at.expandOverrideMapFromBase=at.expandBlueprintMap=at.overload=at.minAnalytic=at.minAggregate=at.minScalar=at.maxAnalytic=at.maxUngroupedAggregate=at.anyExprType=at.maxAggregate=at.maxScalar=at.makeParam=at.param=at.variadicParam=at.literal=at.output=at.constant=at.sql=at.spread=at.arg=void 0;const Ace=ut,XT=Xe;function ik(t){return{node:"function_parameter",name:t}}at.arg=ik;function Sce(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}at.spread=Sce;function bce(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}at.sql=bce;function JT(t){return{...t,evalSpace:"constant"}}at.constant=JT;function Cce(t){return{...t,evalSpace:"output"}}at.output=Cce;function KT(t){return{...t,evalSpace:"literal"}}at.literal=KT;function Tce(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}at.variadicParam=Tce;function sk(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}at.param=sk;function Oce(t,...e){return{param:sk(t,...e),arg:ik(t)}}at.makeParam=Oce;function Ky(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.maxScalar=Ky;function ok(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.maxAggregate=ok;function ZT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}at.anyExprType=ZT;function uk(t,e){return{...Zy(t,e),expressionType:void 0,evalSpace:"input"}}function Rce(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}at.maxUngroupedAggregate=Rce;function ak(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}at.maxAnalytic=ak;function Xx(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.minScalar=Xx;function lk(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.minAggregate=lk;function ck(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}at.minAnalytic=ck;function Dce(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}at.overload=Dce;function Ns(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function Zy(t,e){var n;let r;if(typeof t=="string")r=Xx(t);else if("array"in t){const i=Zy(t.array,e),{expressionType:s,evalSpace:o}=i;if(XT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=Zy(o,e);XT.TD.isAtomic(u)&&i.push((0,XT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Xx(Ns(t,e)):"literal"in t?r=KT(Xx(Ns(t.literal,e))):"constant"in t?r=JT(Xx(Ns(t.constant,e))):"dimension"in t?r=Xx(Ns(t.dimension,e)):"measure"in t?r=lk(Ns(t.measure,e)):r=ck(Ns(t.calculation,e));return{...r,compositeFieldUsage:(0,Ace.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function fk(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function wce(t){return fk(t)?[t]:Array.isArray(t)?t:fk(t.variadic)?[t.variadic]:t.variadic}function Nce(t,e){return typeof t=="string"?ZT(t):"generic"in t?ZT(Ns(t,e)):"literal"in t?KT(Ky(Ns(t.literal,e))):"constant"in t?JT(Ky(Ns(t.constant,e))):"dimension"in t?Ky(Ns(t.dimension,e)):"measure"in t?ok(Ns(t.measure,e)):"array"in t||"record"in t?uk(t,e):ak(Ns(t.calculation,e))}function Fce(t,e){return t.map(n=>Nce(n,e))}function xk(t){return typeof t!="string"&&"variadic"in t}function Lce(t,e,n){return{name:t,allowedTypes:Fce(wce(e),n),isVariadic:xk(e)}}function Ice(t,e){return Object.entries(t).map(r=>Lce(r[0],r[1],e))}function $ce(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Bce(t,e){return xk(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function kce(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Bce(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Pce(t){return"sql"in t.impl?$ce(t.impl.sql):"expr"in t.impl?t.impl.expr:kce(t.impl.function,t)}function Mce(t){return{e:Pce(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function dk(t,e){return{returnType:Zy(t.returns,e),params:Ice(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Mce(t)}}function e6(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>dk(t,{name:e,type:n}))}return[dk(t)]}function t6(t){return"takes"in t&&"returns"in t&&"impl"in t}function jce(t){return"function"in t||"sql"in t||"expr"in t}function Uce(t){return t6(t)?e6(t):Object.values(t).flatMap(e=>e6(e))}function qce(t){const e={};for(const n in t)e[n]=Uce(t[n]);return e}at.expandBlueprintMap=qce;function hk(t,e){return e6({...t,impl:e})}function zce(t,e,n){if(jce(n)){if(!t6(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return hk(e,n)}else{if(t6(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return hk(s,i)})}}function Hce(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=zce(r,t[r],e[r])}return n}at.expandOverrideMapFromBase=Hce;var Bl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=Xe;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
2
2
  STRING_AGG(DISTINCT ${`concat('${f}', ${a}, '${x}', ${l})`}${c.length>0?","+c:""}),
3
3
  '${f}.*?${x}',
4
4
  ''
@@ -1511,7 +1511,11 @@ function _ce(t, e) {
1511
1511
  r[(n = i.as) !== null && n !== void 0 ? n : i.name] = i;
1512
1512
  return {
1513
1513
  fields: t.fields.filter((i) => TG(r[i])),
1514
- joinedUsage: t.joinedUsage
1514
+ // Today it is not possible for a join to be composite, so we can safely throw
1515
+ // away all join usage here...; if we ever allow joins in composite source
1516
+ // inputs, then this will need to be updated to be the joinUsage with joins
1517
+ // that are not composite filtered out...
1518
+ joinedUsage: {}
1515
1519
  };
1516
1520
  }
1517
1521
  Object.defineProperty(at, "__esModule", { value: !0 });
@@ -1,4 +1,4 @@
1
- (function(Py){typeof define=="function"&&define.amd?define(Py):Py()})(function(){"use strict";function Py(t){return Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=Object.assign({},i),wB(i.value)&&!P0e(i.value)&&!Array.isArray(i.value)&&(n[r].value=Object.assign({},i.value)),Array.isArray(i.value)&&(n[r].value=i.value.slice(0)),n},{})}function I0e(t){return t?Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=wB(i)&&"value"in i?i:{value:i},n[r].attribute||(n[r].attribute=k0e(r)),n[r].parse="parse"in n[r]?n[r].parse:typeof n[r].value!="string",n},{}):{}}function $0e(t){return Object.keys(t).reduce((n,r)=>(n[r]=t[r].value,n),{})}function B0e(t,e){const n=Py(e);return Object.keys(e).forEach(i=>{const s=n[i],o=t.getAttribute(s.attribute),u=t[i];o&&(s.value=s.parse?RB(o):o),u!=null&&(s.value=Array.isArray(u)?u.slice(0):u),s.reflect&&DB(t,s.attribute,s.value,!!s.parse),Object.defineProperty(t,i,{get(){return s.value},set(a){const l=s.value;s.value=a,s.reflect&&DB(this,s.attribute,s.value,!!s.parse);for(let c=0,f=this.__propertyChangedCallbacks.length;c<f;c++)this.__propertyChangedCallbacks[c](i,a,l)},enumerable:!0,configurable:!0})}),n}function RB(t){if(t)try{return JSON.parse(t)}catch{return t}}function DB(t,e,n,r){if(n==null||n===!1)return t.removeAttribute(e);let i=r?JSON.stringify(n):n;t.__updating[e]=!0,i==="true"&&(i=""),t.setAttribute(e,i),Promise.resolve().then(()=>delete t.__updating[e])}function k0e(t){return t.replace(/\.?([A-Z]+)/g,(e,n)=>"-"+n.toLowerCase()).replace("_","-").replace(/^-/,"")}function wB(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function P0e(t){return Object.prototype.toString.call(t)==="[object Function]"}function M0e(t){return typeof t=="function"&&t.toString().indexOf("class")===0}let $T;function j0e(t,e){const n=Object.keys(e);return class extends t{static get observedAttributes(){return n.map(i=>e[i].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=B0e(this,e);const i=$0e(this.props),s=this.Component,o=$T;try{$T=this,this.__initialized=!0,M0e(s)?new s(i,{element:this}):s(i,{element:this})}finally{$T=o}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let i=null;for(;i=this.__releaseCallbacks.pop();)i(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(i,s,o){if(this.__initialized&&!this.__updating[i]&&(i=this.lookupProp(i),i in e)){if(o==null&&!this[i])return;this[i]=e[i].parse?RB(o):o}}lookupProp(i){if(e)return n.find(s=>i===s||i===e[s].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(i){this.__releaseCallbacks.push(i)}addPropertyChangedCallback(i){this.__propertyChangedCallbacks.push(i)}}}function NB(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function FB(t,e={},n={}){const{BaseElement:r=HTMLElement,extension:i,customElements:s=window.customElements}=n;return o=>{if(!t)throw new Error("tag is required to register a Component");let u=s.get(t);return u?(u.prototype.Component=o,u):(u=j0e(r,I0e(e)),u.prototype.Component=o,u.prototype.registeredTag=t,s.define(t,u,i),u)}}const U0e={context:void 0,registry:void 0},q0e=(t,e)=>t===e,Ko=Symbol("solid-proxy"),BT=Symbol("solid-track"),My={equals:q0e};let LB=MB;const ya=1,jy=2,IB={owned:null,cleanups:null,context:null,owner:null};var zt=null;let kT=null,z0e=null,ln=null,Tr=null,Ea=null,Uy=0;function tp(t,e){const n=ln,r=zt,i=t.length===0,s=e===void 0?r:e,o=i?IB:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=i?t:()=>t(()=>Xi(()=>Qy(o)));zt=o,ln=null;try{return Dc(u,!0)}finally{ln=n,zt=r}}function hr(t,e){e=e?Object.assign({},My,e):My;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),PB(n,i));return[kB.bind(n),r]}function H0e(t,e,n){const r=qy(t,e,!0,ya);Wx(r)}function Pn(t,e,n){const r=qy(t,e,!1,ya);Wx(r)}function ws(t,e,n){LB=Y0e;const r=qy(t,e,!1,ya);(!n||!n.render)&&(r.user=!0),Ea?Ea.push(r):Wx(r)}function Fn(t,e,n){n=n?Object.assign({},My,n):My;const r=qy(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Wx(r),kB.bind(r)}function Q0e(t){return Dc(t,!1)}function Xi(t){if(ln===null)return t();const e=ln;ln=null;try{return t()}finally{ln=e}}function np(t){ws(()=>Xi(t))}function rp(t){return zt===null||(zt.cleanups===null?zt.cleanups=[t]:zt.cleanups.push(t)),t}function PT(){return ln}function $B(){return zt}function G0e(t,e){const n=zt,r=ln;zt=t,ln=null;try{return Dc(e,!0)}catch(i){UT(i)}finally{zt=n,ln=r}}function MT(t,e){const n=Symbol("context");return{id:n,Provider:J0e(n),defaultValue:t}}function jT(t){return zt&&zt.context&&zt.context[t.id]!==void 0?zt.context[t.id]:t.defaultValue}function BB(t){const e=Fn(t),n=Fn(()=>qT(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function kB(){if(this.sources&&this.state)if(this.state===ya)Wx(this);else{const t=Tr;Tr=null,Dc(()=>Hy(this),!1),Tr=t}if(ln){const t=this.observers?this.observers.length:0;ln.sources?(ln.sources.push(this),ln.sourceSlots.push(t)):(ln.sources=[this],ln.sourceSlots=[t]),this.observers?(this.observers.push(ln),this.observerSlots.push(ln.sources.length-1)):(this.observers=[ln],this.observerSlots=[ln.sources.length-1])}return this.value}function PB(t,e,n){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&Dc(()=>{for(let i=0;i<t.observers.length;i+=1){const s=t.observers[i],o=kT&&kT.running;o&&kT.disposed.has(s),(o?!s.tState:!s.state)&&(s.pure?Tr.push(s):Ea.push(s),s.observers&&jB(s)),o||(s.state=ya)}if(Tr.length>1e6)throw Tr=[],new Error},!1)),e}function Wx(t){if(!t.fn)return;Qy(t);const e=Uy;W0e(t,t.value,e)}function W0e(t,e,n){let r;const i=zt,s=ln;ln=zt=t;try{r=t.fn(e)}catch(o){return t.pure&&(t.state=ya,t.owned&&t.owned.forEach(Qy),t.owned=null),t.updatedAt=n+1,UT(o)}finally{ln=s,zt=i}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?PB(t,r):t.value=r,t.updatedAt=n)}function qy(t,e,n,r=ya,i){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:zt,context:zt?zt.context:null,pure:n};return zt===null||zt!==IB&&(zt.owned?zt.owned.push(s):zt.owned=[s]),s}function zy(t){if(t.state===0)return;if(t.state===jy)return Hy(t);if(t.suspense&&Xi(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<Uy);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===ya)Wx(t);else if(t.state===jy){const r=Tr;Tr=null,Dc(()=>Hy(t,e[0]),!1),Tr=r}}function Dc(t,e){if(Tr)return t();let n=!1;e||(Tr=[]),Ea?n=!0:Ea=[],Uy++;try{const r=t();return V0e(n),r}catch(r){n||(Ea=null),Tr=null,UT(r)}}function V0e(t){if(Tr&&(MB(Tr),Tr=null),t)return;const e=Ea;Ea=null,e.length&&Dc(()=>LB(e),!1)}function MB(t){for(let e=0;e<t.length;e++)zy(t[e])}function Y0e(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:zy(r)}for(e=0;e<n;e++)zy(t[e])}function Hy(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const r=t.sources[n];if(r.sources){const i=r.state;i===ya?r!==e&&(!r.updatedAt||r.updatedAt<Uy)&&zy(r):i===jy&&Hy(r,e)}}}function jB(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=jy,n.pure?Tr.push(n):Ea.push(n),n.observers&&jB(n))}}function Qy(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),r=t.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),o=n.observerSlots.pop();r<i.length&&(s.sourceSlots[o]=r,i[r]=s,n.observerSlots[r]=o)}}if(t.owned){for(e=t.owned.length-1;e>=0;e--)Qy(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function X0e(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function UT(t,e=zt){throw X0e(t)}function qT(t){if(typeof t=="function"&&!t.length)return qT(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const r=qT(t[n]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function J0e(t,e){return function(r){let i;return Pn(()=>i=Xi(()=>(zt.context={...zt.context,[t]:r.value},BB(()=>r.children))),void 0),i}}const K0e=Symbol("fallback");function UB(t){for(let e=0;e<t.length;e++)t[e]()}function Z0e(t,e,n={}){let r=[],i=[],s=[],o=0,u=e.length>1?[]:null;return rp(()=>UB(s)),()=>{let a=t()||[],l,c;return a[BT],Xi(()=>{let x=a.length,d,p,m,g,y,E,v,_,A;if(x===0)o!==0&&(UB(s),s=[],r=[],i=[],o=0,u&&(u=[])),n.fallback&&(r=[K0e],i[0]=tp(S=>(s[0]=S,n.fallback())),o=1);else if(o===0){for(i=new Array(x),c=0;c<x;c++)r[c]=a[c],i[c]=tp(f);o=x}else{for(m=new Array(x),g=new Array(x),u&&(y=new Array(x)),E=0,v=Math.min(o,x);E<v&&r[E]===a[E];E++);for(v=o-1,_=x-1;v>=E&&_>=E&&r[v]===a[_];v--,_--)m[_]=i[v],g[_]=s[v],u&&(y[_]=u[v]);for(d=new Map,p=new Array(_+1),c=_;c>=E;c--)A=a[c],l=d.get(A),p[c]=l===void 0?-1:l,d.set(A,c);for(l=E;l<=v;l++)A=r[l],c=d.get(A),c!==void 0&&c!==-1?(m[c]=i[l],g[c]=s[l],u&&(y[c]=u[l]),c=p[c],d.set(A,c)):s[l]();for(c=E;c<x;c++)c in m?(i[c]=m[c],s[c]=g[c],u&&(u[c]=y[c],u[c](c))):i[c]=tp(f);i=i.slice(0,o=x),r=a.slice(0)}return i});function f(x){if(s[c]=x,u){const[d,p]=hr(c);return u[c]=p,e(a[c],d)}return e(a[c])}}}function Ge(t,e){return Xi(()=>t(e||{}))}function Gy(){return!0}const ece={get(t,e,n){return e===Ko?n:t.get(e)},has(t,e){return e===Ko?!0:t.has(e)},set:Gy,deleteProperty:Gy,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Gy,deleteProperty:Gy}},ownKeys(t){return t.keys()}};function zT(t){return(t=typeof t=="function"?t():t)?t:{}}function tce(){for(let t=0,e=this.length;t<e;++t){const n=this[t]();if(n!==void 0)return n}}function Zo(...t){let e=!1;for(let o=0;o<t.length;o++){const u=t[o];e=e||!!u&&Ko in u,t[o]=typeof u=="function"?(e=!0,Fn(u)):u}if(e)return new Proxy({get(o){for(let u=t.length-1;u>=0;u--){const a=zT(t[u])[o];if(a!==void 0)return a}},has(o){for(let u=t.length-1;u>=0;u--)if(o in zT(t[u]))return!0;return!1},keys(){const o=[];for(let u=0;u<t.length;u++)o.push(...Object.keys(zT(t[u])));return[...new Set(o)]}},ece);const n={},r=Object.create(null);for(let o=t.length-1;o>=0;o--){const u=t[o];if(!u)continue;const a=Object.getOwnPropertyNames(u);for(let l=a.length-1;l>=0;l--){const c=a[l];if(c==="__proto__"||c==="constructor")continue;const f=Object.getOwnPropertyDescriptor(u,c);if(!r[c])r[c]=f.get?{enumerable:!0,configurable:!0,get:tce.bind(n[c]=[f.get.bind(u)])}:f.value!==void 0?f:void 0;else{const x=n[c];x&&(f.get?x.push(f.get.bind(u)):f.value!==void 0&&x.push(()=>f.value))}}}const i={},s=Object.keys(r);for(let o=s.length-1;o>=0;o--){const u=s[o],a=r[u];a&&a.get?Object.defineProperty(i,u,a):i[u]=a?a.value:void 0}return i}const qB=t=>`Stale read from <${t}>.`;function Yn(t){const e="fallback"in t&&{fallback:()=>t.fallback};return Fn(Z0e(()=>t.each,t.children,e||void 0))}function Or(t){const e=t.keyed,n=Fn(()=>t.when,void 0,{equals:(r,i)=>e?r===i:!r==!i});return Fn(()=>{const r=n();if(r){const i=t.children;return typeof i=="function"&&i.length>0?Xi(()=>i(e?r:()=>{if(!Xi(n))throw qB("Show");return t.when})):i}return t.fallback},void 0,void 0)}function zB(t){let e=!1;const n=(s,o)=>(e?s[1]===o[1]:!s[1]==!o[1])&&s[2]===o[2],r=BB(()=>t.children),i=Fn(()=>{let s=r();Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o++){const u=s[o].when;if(u)return e=!!s[o].keyed,[o,u,s[o]]}return[-1]},void 0,{equals:n});return Fn(()=>{const[s,o,u]=i();if(s<0)return t.fallback;const a=u.children;return typeof a=="function"&&a.length>0?Xi(()=>a(e?o:()=>{if(Xi(i)[0]!==s)throw qB("Match");return u.when})):a},void 0,void 0)}function Wy(t){return t}function nce(t,e,n){let r=n.length,i=e.length,s=r,o=0,u=0,a=e[i-1].nextSibling,l=null;for(;o<i||u<s;){if(e[o]===n[u]){o++,u++;continue}for(;e[i-1]===n[s-1];)i--,s--;if(i===o){const c=s<r?u?n[u-1].nextSibling:n[s-u]:a;for(;u<s;)t.insertBefore(n[u++],c)}else if(s===u)for(;o<i;)(!l||!l.has(e[o]))&&e[o].remove(),o++;else if(e[o]===n[s-1]&&n[u]===e[i-1]){const c=e[--i].nextSibling;t.insertBefore(n[u++],e[o++].nextSibling),t.insertBefore(n[--s],c),e[i]=n[s]}else{if(!l){l=new Map;let f=u;for(;f<s;)l.set(n[f],f++)}const c=l.get(e[o]);if(c!=null)if(u<c&&c<s){let f=o,x=1,d;for(;++f<i&&f<s&&!((d=l.get(e[f]))==null||d!==c+x);)x++;if(x>c-u){const p=e[o];for(;u<c;)t.insertBefore(n[u++],p)}else t.replaceChild(n[u++],e[o++])}else o++;else e[o++].remove()}}}const HB="_$DX_DELEGATE";function mt(t,e,n){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=t,n?o.content.firstChild.firstChild:o.content.firstChild},s=e?()=>Xi(()=>document.importNode(r||(r=i()),!0)):()=>(r||(r=i())).cloneNode(!0);return s.cloneNode=s,s}function HT(t,e=window.document){const n=e[HB]||(e[HB]=new Set);for(let r=0,i=t.length;r<i;r++){const s=t[r];n.has(s)||(n.add(s),e.addEventListener(s,rce))}}function Ji(t,e,n){n==null?t.removeAttribute(e):t.setAttribute(e,n)}function QB(t,e,n,r){Array.isArray(n)?(t[`$$${e}`]=n[0],t[`$$${e}Data`]=n[1]):t[`$$${e}`]=n}function wc(t,e,n){if(!e)return n?Ji(t,"style"):e;const r=t.style;if(typeof e=="string")return r.cssText=e;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),e||(e={});let i,s;for(s in n)e[s]==null&&r.removeProperty(s),delete n[s];for(s in e)i=e[s],i!==n[s]&&(r.setProperty(s,i),n[s]=i);return n}function lo(t,e,n){return Xi(()=>t(e,n))}function Je(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return Vy(t,e,r,n);Pn(i=>Vy(t,e(),i,n),r)}function rce(t){const e=`$$${t.type}`;let n=t.composedPath&&t.composedPath()[0]||t.target;for(t.target!==n&&Object.defineProperty(t,"target",{configurable:!0,value:n}),Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}});n;){const r=n[e];if(r&&!n.disabled){const i=n[`${e}Data`];if(i!==void 0?r.call(n,i,t):r.call(n,t),t.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Vy(t,e,n,r,i){for(;typeof n=="function";)n=n();if(e===n)return n;const s=typeof e,o=r!==void 0;if(t=o&&n[0]&&n[0].parentNode||t,s==="string"||s==="number")if(s==="number"&&(e=e.toString()),o){let u=n[0];u&&u.nodeType===3?u.data!==e&&(u.data=e):u=document.createTextNode(e),n=Vx(t,n,r,u)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e;else if(e==null||s==="boolean")n=Vx(t,n,r);else{if(s==="function")return Pn(()=>{let u=e();for(;typeof u=="function";)u=u();n=Vy(t,u,n,r)}),()=>n;if(Array.isArray(e)){const u=[],a=n&&Array.isArray(n);if(QT(u,e,n,i))return Pn(()=>n=Vy(t,u,n,r,!0)),()=>n;if(u.length===0){if(n=Vx(t,n,r),o)return n}else a?n.length===0?GB(t,u,r):nce(t,n,u):(n&&Vx(t),GB(t,u));n=u}else if(e.nodeType){if(Array.isArray(n)){if(o)return n=Vx(t,n,r,e);Vx(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function QT(t,e,n,r){let i=!1;for(let s=0,o=e.length;s<o;s++){let u=e[s],a=n&&n[t.length],l;if(!(u==null||u===!0||u===!1))if((l=typeof u)=="object"&&u.nodeType)t.push(u);else if(Array.isArray(u))i=QT(t,u,a)||i;else if(l==="function")if(r){for(;typeof u=="function";)u=u();i=QT(t,Array.isArray(u)?u:[u],Array.isArray(a)?a:[a])||i}else t.push(u),i=!0;else{const c=String(u);a&&a.nodeType===3&&a.data===c?t.push(a):t.push(document.createTextNode(c))}}return i}function GB(t,e,n=null){for(let r=0,i=e.length;r<i;r++)t.insertBefore(e[r],n)}function Vx(t,e,n,r){if(n===void 0)return t.textContent="";const i=r||document.createTextNode("");if(e.length){let s=!1;for(let o=e.length-1;o>=0;o--){const u=e[o];if(i!==u){const a=u.parentNode===t;!s&&!o?a?t.replaceChild(i,u):t.insertBefore(i,n):a&&u.remove()}else s=!0}}else t.insertBefore(i,n);return[i]}const ice="http://www.w3.org/2000/svg";function sce(t,e=!1){return e?document.createElementNS(ice,t):document.createElement(t)}function oce(t){const{useShadow:e}=t,n=document.createTextNode(""),r=()=>t.mount||document.body,i=$B();let s,o=!!U0e.context;return ws(()=>{s||(s=G0e(i,()=>Fn(()=>t.children)));const u=r();if(u instanceof HTMLHeadElement){const[a,l]=hr(!1),c=()=>l(!0);tp(f=>Je(u,()=>a()?f():s(),null)),rp(c)}else{const a=sce(t.isSVG?"g":"div",t.isSVG),l=e&&a.attachShadow?a.attachShadow({mode:"open"}):a;Object.defineProperty(a,"_$host",{get(){return n.parentNode},configurable:!0}),Je(l,s),u.appendChild(a),t.ref&&t.ref(a),rp(()=>u.removeChild(a))}},void 0,{render:!o}),n}function uce(t){const e=Object.keys(t),n={};for(let r=0;r<e.length;r++){const[i,s]=hr(t[e[r]]);Object.defineProperty(n,e[r],{get:i,set(o){s(()=>o)}})}return n}function ace(t){if(t.assignedSlot&&t.assignedSlot._$owner)return t.assignedSlot._$owner;let e=t.parentNode;for(;e&&!e._$owner&&!(e.assignedSlot&&e.assignedSlot._$owner);)e=e.parentNode;return e&&e.assignedSlot?e.assignedSlot._$owner:t._$owner}function WB(t){return(e,n)=>{const{element:r}=n;return tp(i=>{const s=uce(e);r.addPropertyChangedCallback((u,a)=>s[u]=a),r.addReleaseCallback(()=>{r.renderRoot.textContent="",i()});const o=t(s,n);return Je(r.renderRoot,o)},ace(r))}}var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function lce(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var VB={},Yx={},at={},ut={},va={};Object.defineProperty(va,"__esModule",{value:!0}),va.isNotUndefined=va.locationContainsPosition=void 0;function cce(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}va.locationContainsPosition=cce;function fce(t){return t!==void 0}va.isNotUndefined=fce;var Xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(z){return"kids"in z}t.exprHasKids=e;function n(z){return"e"in z}t.exprHasE=n;function r(z){return!(e(z)||n(z))}t.exprIsLeaf=r;function i(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}t.isAsymmetricExpr=i;function s(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function o(z,de){const fe=typeof de=="string"?{type:de}:de;return s(z)?{...z,typeDef:{...fe}}:z}t.mkTemporal=o;function u(z){return"dstSQLType"in z}t.isRawCast=u;function a(z){return z.value!==null}t.paramHasValue=a;function l(z){return z===void 0||z==="scalar"}t.expressionIsScalar=l;function c(z){return z==="aggregate"||z==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(z){return z==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(z){return z==="aggregate_analytic"||z==="scalar_analytic"}t.expressionIsAnalytic=p;function m(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function g(z,de){return z===de||m(z)<m(de)}t.isExpressionTypeLEQ=g;function y(z,de){let fe="scalar";return(z==="aggregate"||de==="aggregate")&&(fe="aggregate"),(z==="ungrouped_aggregate"||de==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(z==="scalar_analytic"||de==="scalar_analytic")&&(fe="scalar_analytic"),(z==="aggregate_analytic"||de==="aggregate_analytic")&&(fe="aggregate_analytic"),(z==="scalar_analytic"&&de==="aggregate"||z==="aggregate"&&de==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(z){return z.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function v(z){return"e"in z}t.hasExpression=v;function _(z){return z==="date"||z==="timestamp"}t.isTemporalType=_;function A(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}t.isAtomicFieldType=A;function S(z){return["string","number","date","boolean","date","timestamp"].includes(z)}t.canOrderBy=S;function b(z){return["string","number","date","timestamp","boolean","json"].includes(z)}t.isCastType=b;function C(z){return A(z.type)&&!v(z)}t.fieldIsIntrinsic=C;function w(z,de){if(M(z))return I(z.elementTypeDef,de);if(F(z)){const{type:fe,fields:K,elementTypeDef:ee}=z;return{type:fe,fields:K,elementTypeDef:ee,join:"many",name:de}}if(z.type==="record"){const{type:fe,fields:K}=z;return{type:fe,fields:K,join:"one",name:de}}return{...z,name:de}}t.mkFieldDef=w;function I(z,de){if(z.type==="record")return{type:"array",join:"many",name:de,elementTypeDef:{type:"record_element"},fields:z.fields};const fe=w(z,"value");return{type:"array",join:"many",name:de,elementTypeDef:z,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=I;function F(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}t.isRepeatedRecord=F;function M(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}t.isScalarArray=M;function U(z){return["left","right","full","inner"].includes(z)}t.isMatrixOperation=U;function X(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}t.isJoinable=X;function W(z){return"join"in z}t.isJoined=W;function ae(z){return j(z)&&W(z)}t.isJoinedSource=ae;function ge(z){return["day","week","month","quarter","year"].includes(z)}t.isDateUnit=ge;function he(z){return ge(z)||["hour","minute","second"].includes(z)}t.isTimestampUnit=he;function ue(z){return he(z)||z==="day_of_week"||z==="day_of_year"}t.isExtractUnit=ue;var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(t.ValueType=ce={}));function ie(z){return typeof z!="string"}t.refIsStructDef=ie;function re(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(de=>de.type==="error")||z.queryFields.some(de=>de.type==="error")))}t.segmentHasErrors=re;function R(z){return z.fields.some(de=>de.type==="error")}t.structHasErrors=R;function O(z){return z.type==="reduce"}t.isReduceSegment=O;function D(z){return z.type==="partial"}t.isPartialSegment=D;function k(z){return z.type==="project"}t.isProjectSegment=k;function G(z){return k(z)||O(z)}t.isQuerySegment=G;function q(z){return z.rows!==void 0}t.isSamplingRows=q;function N(z){return z.percent!==void 0}t.isSamplingPercent=N;function B(z){return z.enable!==void 0}t.isSamplingEnable=B;function P(z){return z.type==="raw"}t.isRawSegment=P;function Q(z){return z.type==="index"}t.isIndexSegment=Q;function $(z){return"sql"in z}t.isSegmentSQL=$;function H(z){return{...z}}t.sourceBase=H;function j(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}t.isSourceDef=j;function J(z){return ae(z)?!1:!!j(z)}t.isBaseTable=J;function xe(z){return z==="literal"}t.isLiteral=xe;function se(...z){return z.length<=1&&z.every(de=>de==="literal")?"literal":z.every(de=>de==="constant"||de==="literal")?"constant":z.every(de=>de==="output"||de==="constant"||de==="literal")?"output":"input"}t.mergeEvalSpaces=se;function Z(z){return z.type==="string"||_(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}t.isLeafAtomic=Z;function oe(z){return z.as!==void 0?z.as:z.name}t.getIdentifier=oe;function we(z){return z.type==="turtle"}t.isTurtle=we;function Pe(z){return A(z.type)}t.isAtomic=Pe;function ze(z,de){return de.type==="string"}t.isValueString=ze;function V(z,de){return de.type==="number"}t.isValueNumber=V;function ne(z,de){return de.type==="boolean"}t.isValueBoolean=ne;function Te(z,de){return de.type==="timestamp"}t.isValueTimestamp=Te;function Me(z,de){return de.type==="date"}t.isValueDate=Me,t.TD={isAtomic(z){return z!==void 0&&A(z.type)},isLeafAtomic(z){return z!==void 0&&Z({type:z.type})},isString:z=>(z==null?void 0:z.type)==="string",isNumber:z=>(z==null?void 0:z.type)==="number",isBoolean:z=>(z==null?void 0:z.type)==="boolean",isJSON:z=>(z==null?void 0:z.type)==="json",isSQL:z=>(z==null?void 0:z.type)==="sql native",isDate:z=>(z==null?void 0:z.type)==="date",isTimestamp:z=>(z==null?void 0:z.type)==="timestamp",isTemporal(z){var de;const fe=(de=z==null?void 0:z.type)!==null&&de!==void 0?de:"";return _(fe)},isError:z=>(z==null?void 0:z.type)==="error",eq(z,de){if(z===void 0||de===void 0)return!1;function fe(K,ee){const Oe={};for(const Y of K.fields||[])if(Y.name)Oe[Y.name]=Y;else return!1;for(const Y of ee.fields||[])if(!t.TD.eq(Oe[Y.name],Y))return!1;return!0}return z.type==="array"&&de.type==="array"?z.elementTypeDef.type!==de.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&de.elementTypeDef.type!=="record_element"?t.TD.eq(z.elementTypeDef,de.elementTypeDef):fe(z,de):z.type==="record"&&de.type==="record"?fe(z,de):z.type==="sql native"&&de.type==="sql native"?z.rawType!==void 0&&z.rawType===de.rawType:z.type===de.type}}})(Xe),Object.defineProperty(ut,"__esModule",{value:!0}),ut.compositeFieldUsageJoinPaths=ut.joinedCompositeFieldUsage=ut.compositeFieldUsageDifference=ut.emptyCompositeFieldUsage=ut.mergeCompositeFieldUsage=ut.unique=ut.formatCompositeFieldUsage=ut.compositeFieldUsageIsPlural=ut.isEmptyCompositeFieldUsage=ut.formatCompositeFieldUsages=ut.compositeFieldUsagePaths=ut.resolveCompositeSources=ut.narrowCompositeFieldResolution=ut.emptyNarrowedCompositeFieldResolution=void 0;const YB=va,GT=Xe;function Xy(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=vce(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:v}of x){const _=new Set;for(const A of E.fields)_.add((s=A.as)!==null&&s!==void 0?s:A.name);for(const A of n.fields)if(!_.has(A)){y.shift();continue e}if(E.type==="composite"){const A=Xy(t,E,_ce(n,E),{source:v??E.sources.map(S=>({source:S,nested:[]})),joined:{}});if("error"in A){y.shift();continue e}f={...A.success},y[0]={source:E,nested:A.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],v=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:v}}};if((0,GT.isJoined)(E)){if(!(0,GT.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:v}}};const _=Xy(v,E,y,m[g]);if("error"in _)return _;if(!(0,GT.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:v}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function xce(){return{source:void 0,joined:{}}}ut.emptyNarrowedCompositeFieldResolution=xce;function dce(t,e,n){const r=Xy([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}ut.narrowCompositeFieldResolution=dce;function hce(t,e){const n=Xy([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}ut.resolveCompositeSources=hce;function WT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>WT(n).map(r=>[e,...r])).flat()]}ut.compositeFieldUsagePaths=WT;function pce(t){return WT(t).map(e=>XB(e)).join(", ")}ut.formatCompositeFieldUsages=pce;function VT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+VT(n),t.fields.length)}function gce(t){return VT(t)===0}ut.isEmptyCompositeFieldUsage=gce;function mce(t){return VT(t)>1}ut.compositeFieldUsageIsPlural=mce;function XB(t){return`\`${t.join(".")}\``}ut.formatCompositeFieldUsage=XB;function JB(t){return Array.from(new Set(t))}ut.unique=JB;function KB(...t){const e=t.filter(YB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=KB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(YB.isNotUndefined));return{fields:JB(e.map(i=>i.fields).flat()),joinedUsage:r}}ut.mergeCompositeFieldUsage=KB;function yce(){return{fields:[],joinedUsage:{}}}ut.emptyCompositeFieldUsage=yce;function Ece(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function ZB(t,e){return{fields:Ece(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?ZB(r,e.joinedUsage[n]):r]))}}ut.compositeFieldUsageDifference=ZB;function ek(t,e){return t.length===0?e:ek(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}ut.joinedCompositeFieldUsage=ek;function tk(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>tk(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}ut.compositeFieldUsageJoinPaths=tk;function nk(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function vce(t){return t.fields.filter(e=>!nk(e))}function _ce(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>nk(r[i])),joinedUsage:t.joinedUsage}}Object.defineProperty(at,"__esModule",{value:!0}),at.expandOverrideMapFromBase=at.expandBlueprintMap=at.overload=at.minAnalytic=at.minAggregate=at.minScalar=at.maxAnalytic=at.maxUngroupedAggregate=at.anyExprType=at.maxAggregate=at.maxScalar=at.makeParam=at.param=at.variadicParam=at.literal=at.output=at.constant=at.sql=at.spread=at.arg=void 0;const Ace=ut,YT=Xe;function rk(t){return{node:"function_parameter",name:t}}at.arg=rk;function Sce(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}at.spread=Sce;function bce(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}at.sql=bce;function XT(t){return{...t,evalSpace:"constant"}}at.constant=XT;function Cce(t){return{...t,evalSpace:"output"}}at.output=Cce;function JT(t){return{...t,evalSpace:"literal"}}at.literal=JT;function Tce(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}at.variadicParam=Tce;function ik(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}at.param=ik;function Oce(t,...e){return{param:ik(t,...e),arg:rk(t)}}at.makeParam=Oce;function Jy(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.maxScalar=Jy;function sk(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.maxAggregate=sk;function KT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}at.anyExprType=KT;function ok(t,e){return{...Ky(t,e),expressionType:void 0,evalSpace:"input"}}function Rce(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}at.maxUngroupedAggregate=Rce;function uk(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}at.maxAnalytic=uk;function Xx(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.minScalar=Xx;function ak(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.minAggregate=ak;function lk(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}at.minAnalytic=lk;function Dce(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}at.overload=Dce;function Ns(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function Ky(t,e){var n;let r;if(typeof t=="string")r=Xx(t);else if("array"in t){const i=Ky(t.array,e),{expressionType:s,evalSpace:o}=i;if(YT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=Ky(o,e);YT.TD.isAtomic(u)&&i.push((0,YT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Xx(Ns(t,e)):"literal"in t?r=JT(Xx(Ns(t.literal,e))):"constant"in t?r=XT(Xx(Ns(t.constant,e))):"dimension"in t?r=Xx(Ns(t.dimension,e)):"measure"in t?r=ak(Ns(t.measure,e)):r=lk(Ns(t.calculation,e));return{...r,compositeFieldUsage:(0,Ace.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function ck(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function wce(t){return ck(t)?[t]:Array.isArray(t)?t:ck(t.variadic)?[t.variadic]:t.variadic}function Nce(t,e){return typeof t=="string"?KT(t):"generic"in t?KT(Ns(t,e)):"literal"in t?JT(Jy(Ns(t.literal,e))):"constant"in t?XT(Jy(Ns(t.constant,e))):"dimension"in t?Jy(Ns(t.dimension,e)):"measure"in t?sk(Ns(t.measure,e)):"array"in t||"record"in t?ok(t,e):uk(Ns(t.calculation,e))}function Fce(t,e){return t.map(n=>Nce(n,e))}function fk(t){return typeof t!="string"&&"variadic"in t}function Lce(t,e,n){return{name:t,allowedTypes:Fce(wce(e),n),isVariadic:fk(e)}}function Ice(t,e){return Object.entries(t).map(r=>Lce(r[0],r[1],e))}function $ce(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Bce(t,e){return fk(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function kce(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Bce(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Pce(t){return"sql"in t.impl?$ce(t.impl.sql):"expr"in t.impl?t.impl.expr:kce(t.impl.function,t)}function Mce(t){return{e:Pce(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function xk(t,e){return{returnType:Ky(t.returns,e),params:Ice(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Mce(t)}}function ZT(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>xk(t,{name:e,type:n}))}return[xk(t)]}function e6(t){return"takes"in t&&"returns"in t&&"impl"in t}function jce(t){return"function"in t||"sql"in t||"expr"in t}function Uce(t){return e6(t)?ZT(t):Object.values(t).flatMap(e=>ZT(e))}function qce(t){const e={};for(const n in t)e[n]=Uce(t[n]);return e}at.expandBlueprintMap=qce;function dk(t,e){return ZT({...t,impl:e})}function zce(t,e,n){if(jce(n)){if(!e6(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return dk(e,n)}else{if(e6(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return dk(s,i)})}}function Hce(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=zce(r,t[r],e[r])}return n}at.expandOverrideMapFromBase=Hce;var Bl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=Xe;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
1
+ (function(Py){typeof define=="function"&&define.amd?define(Py):Py()})(function(){"use strict";function Py(t){return Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=Object.assign({},i),wB(i.value)&&!P0e(i.value)&&!Array.isArray(i.value)&&(n[r].value=Object.assign({},i.value)),Array.isArray(i.value)&&(n[r].value=i.value.slice(0)),n},{})}function I0e(t){return t?Object.keys(t).reduce((n,r)=>{const i=t[r];return n[r]=wB(i)&&"value"in i?i:{value:i},n[r].attribute||(n[r].attribute=k0e(r)),n[r].parse="parse"in n[r]?n[r].parse:typeof n[r].value!="string",n},{}):{}}function $0e(t){return Object.keys(t).reduce((n,r)=>(n[r]=t[r].value,n),{})}function B0e(t,e){const n=Py(e);return Object.keys(e).forEach(i=>{const s=n[i],o=t.getAttribute(s.attribute),u=t[i];o&&(s.value=s.parse?RB(o):o),u!=null&&(s.value=Array.isArray(u)?u.slice(0):u),s.reflect&&DB(t,s.attribute,s.value,!!s.parse),Object.defineProperty(t,i,{get(){return s.value},set(a){const l=s.value;s.value=a,s.reflect&&DB(this,s.attribute,s.value,!!s.parse);for(let c=0,f=this.__propertyChangedCallbacks.length;c<f;c++)this.__propertyChangedCallbacks[c](i,a,l)},enumerable:!0,configurable:!0})}),n}function RB(t){if(t)try{return JSON.parse(t)}catch{return t}}function DB(t,e,n,r){if(n==null||n===!1)return t.removeAttribute(e);let i=r?JSON.stringify(n):n;t.__updating[e]=!0,i==="true"&&(i=""),t.setAttribute(e,i),Promise.resolve().then(()=>delete t.__updating[e])}function k0e(t){return t.replace(/\.?([A-Z]+)/g,(e,n)=>"-"+n.toLowerCase()).replace("_","-").replace(/^-/,"")}function wB(t){return t!=null&&(typeof t=="object"||typeof t=="function")}function P0e(t){return Object.prototype.toString.call(t)==="[object Function]"}function M0e(t){return typeof t=="function"&&t.toString().indexOf("class")===0}let $T;function j0e(t,e){const n=Object.keys(e);return class extends t{static get observedAttributes(){return n.map(i=>e[i].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=B0e(this,e);const i=$0e(this.props),s=this.Component,o=$T;try{$T=this,this.__initialized=!0,M0e(s)?new s(i,{element:this}):s(i,{element:this})}finally{$T=o}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let i=null;for(;i=this.__releaseCallbacks.pop();)i(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(i,s,o){if(this.__initialized&&!this.__updating[i]&&(i=this.lookupProp(i),i in e)){if(o==null&&!this[i])return;this[i]=e[i].parse?RB(o):o}}lookupProp(i){if(e)return n.find(s=>i===s||i===e[s].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(i){this.__releaseCallbacks.push(i)}addPropertyChangedCallback(i){this.__propertyChangedCallbacks.push(i)}}}function NB(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function FB(t,e={},n={}){const{BaseElement:r=HTMLElement,extension:i,customElements:s=window.customElements}=n;return o=>{if(!t)throw new Error("tag is required to register a Component");let u=s.get(t);return u?(u.prototype.Component=o,u):(u=j0e(r,I0e(e)),u.prototype.Component=o,u.prototype.registeredTag=t,s.define(t,u,i),u)}}const U0e={context:void 0,registry:void 0},q0e=(t,e)=>t===e,Ko=Symbol("solid-proxy"),BT=Symbol("solid-track"),My={equals:q0e};let LB=MB;const ya=1,jy=2,IB={owned:null,cleanups:null,context:null,owner:null};var zt=null;let kT=null,z0e=null,ln=null,Tr=null,Ea=null,Uy=0;function tp(t,e){const n=ln,r=zt,i=t.length===0,s=e===void 0?r:e,o=i?IB:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=i?t:()=>t(()=>Xi(()=>Qy(o)));zt=o,ln=null;try{return Dc(u,!0)}finally{ln=n,zt=r}}function hr(t,e){e=e?Object.assign({},My,e):My;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),PB(n,i));return[kB.bind(n),r]}function H0e(t,e,n){const r=qy(t,e,!0,ya);Wx(r)}function Pn(t,e,n){const r=qy(t,e,!1,ya);Wx(r)}function ws(t,e,n){LB=Y0e;const r=qy(t,e,!1,ya);(!n||!n.render)&&(r.user=!0),Ea?Ea.push(r):Wx(r)}function Fn(t,e,n){n=n?Object.assign({},My,n):My;const r=qy(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Wx(r),kB.bind(r)}function Q0e(t){return Dc(t,!1)}function Xi(t){if(ln===null)return t();const e=ln;ln=null;try{return t()}finally{ln=e}}function np(t){ws(()=>Xi(t))}function rp(t){return zt===null||(zt.cleanups===null?zt.cleanups=[t]:zt.cleanups.push(t)),t}function PT(){return ln}function $B(){return zt}function G0e(t,e){const n=zt,r=ln;zt=t,ln=null;try{return Dc(e,!0)}catch(i){UT(i)}finally{zt=n,ln=r}}function MT(t,e){const n=Symbol("context");return{id:n,Provider:J0e(n),defaultValue:t}}function jT(t){return zt&&zt.context&&zt.context[t.id]!==void 0?zt.context[t.id]:t.defaultValue}function BB(t){const e=Fn(t),n=Fn(()=>qT(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function kB(){if(this.sources&&this.state)if(this.state===ya)Wx(this);else{const t=Tr;Tr=null,Dc(()=>Hy(this),!1),Tr=t}if(ln){const t=this.observers?this.observers.length:0;ln.sources?(ln.sources.push(this),ln.sourceSlots.push(t)):(ln.sources=[this],ln.sourceSlots=[t]),this.observers?(this.observers.push(ln),this.observerSlots.push(ln.sources.length-1)):(this.observers=[ln],this.observerSlots=[ln.sources.length-1])}return this.value}function PB(t,e,n){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&Dc(()=>{for(let i=0;i<t.observers.length;i+=1){const s=t.observers[i],o=kT&&kT.running;o&&kT.disposed.has(s),(o?!s.tState:!s.state)&&(s.pure?Tr.push(s):Ea.push(s),s.observers&&jB(s)),o||(s.state=ya)}if(Tr.length>1e6)throw Tr=[],new Error},!1)),e}function Wx(t){if(!t.fn)return;Qy(t);const e=Uy;W0e(t,t.value,e)}function W0e(t,e,n){let r;const i=zt,s=ln;ln=zt=t;try{r=t.fn(e)}catch(o){return t.pure&&(t.state=ya,t.owned&&t.owned.forEach(Qy),t.owned=null),t.updatedAt=n+1,UT(o)}finally{ln=s,zt=i}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?PB(t,r):t.value=r,t.updatedAt=n)}function qy(t,e,n,r=ya,i){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:zt,context:zt?zt.context:null,pure:n};return zt===null||zt!==IB&&(zt.owned?zt.owned.push(s):zt.owned=[s]),s}function zy(t){if(t.state===0)return;if(t.state===jy)return Hy(t);if(t.suspense&&Xi(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<Uy);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===ya)Wx(t);else if(t.state===jy){const r=Tr;Tr=null,Dc(()=>Hy(t,e[0]),!1),Tr=r}}function Dc(t,e){if(Tr)return t();let n=!1;e||(Tr=[]),Ea?n=!0:Ea=[],Uy++;try{const r=t();return V0e(n),r}catch(r){n||(Ea=null),Tr=null,UT(r)}}function V0e(t){if(Tr&&(MB(Tr),Tr=null),t)return;const e=Ea;Ea=null,e.length&&Dc(()=>LB(e),!1)}function MB(t){for(let e=0;e<t.length;e++)zy(t[e])}function Y0e(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:zy(r)}for(e=0;e<n;e++)zy(t[e])}function Hy(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const r=t.sources[n];if(r.sources){const i=r.state;i===ya?r!==e&&(!r.updatedAt||r.updatedAt<Uy)&&zy(r):i===jy&&Hy(r,e)}}}function jB(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=jy,n.pure?Tr.push(n):Ea.push(n),n.observers&&jB(n))}}function Qy(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),r=t.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),o=n.observerSlots.pop();r<i.length&&(s.sourceSlots[o]=r,i[r]=s,n.observerSlots[r]=o)}}if(t.owned){for(e=t.owned.length-1;e>=0;e--)Qy(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function X0e(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function UT(t,e=zt){throw X0e(t)}function qT(t){if(typeof t=="function"&&!t.length)return qT(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const r=qT(t[n]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function J0e(t,e){return function(r){let i;return Pn(()=>i=Xi(()=>(zt.context={...zt.context,[t]:r.value},BB(()=>r.children))),void 0),i}}const K0e=Symbol("fallback");function UB(t){for(let e=0;e<t.length;e++)t[e]()}function Z0e(t,e,n={}){let r=[],i=[],s=[],o=0,u=e.length>1?[]:null;return rp(()=>UB(s)),()=>{let a=t()||[],l,c;return a[BT],Xi(()=>{let x=a.length,d,p,m,g,y,E,v,_,A;if(x===0)o!==0&&(UB(s),s=[],r=[],i=[],o=0,u&&(u=[])),n.fallback&&(r=[K0e],i[0]=tp(S=>(s[0]=S,n.fallback())),o=1);else if(o===0){for(i=new Array(x),c=0;c<x;c++)r[c]=a[c],i[c]=tp(f);o=x}else{for(m=new Array(x),g=new Array(x),u&&(y=new Array(x)),E=0,v=Math.min(o,x);E<v&&r[E]===a[E];E++);for(v=o-1,_=x-1;v>=E&&_>=E&&r[v]===a[_];v--,_--)m[_]=i[v],g[_]=s[v],u&&(y[_]=u[v]);for(d=new Map,p=new Array(_+1),c=_;c>=E;c--)A=a[c],l=d.get(A),p[c]=l===void 0?-1:l,d.set(A,c);for(l=E;l<=v;l++)A=r[l],c=d.get(A),c!==void 0&&c!==-1?(m[c]=i[l],g[c]=s[l],u&&(y[c]=u[l]),c=p[c],d.set(A,c)):s[l]();for(c=E;c<x;c++)c in m?(i[c]=m[c],s[c]=g[c],u&&(u[c]=y[c],u[c](c))):i[c]=tp(f);i=i.slice(0,o=x),r=a.slice(0)}return i});function f(x){if(s[c]=x,u){const[d,p]=hr(c);return u[c]=p,e(a[c],d)}return e(a[c])}}}function Ge(t,e){return Xi(()=>t(e||{}))}function Gy(){return!0}const ece={get(t,e,n){return e===Ko?n:t.get(e)},has(t,e){return e===Ko?!0:t.has(e)},set:Gy,deleteProperty:Gy,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Gy,deleteProperty:Gy}},ownKeys(t){return t.keys()}};function zT(t){return(t=typeof t=="function"?t():t)?t:{}}function tce(){for(let t=0,e=this.length;t<e;++t){const n=this[t]();if(n!==void 0)return n}}function Zo(...t){let e=!1;for(let o=0;o<t.length;o++){const u=t[o];e=e||!!u&&Ko in u,t[o]=typeof u=="function"?(e=!0,Fn(u)):u}if(e)return new Proxy({get(o){for(let u=t.length-1;u>=0;u--){const a=zT(t[u])[o];if(a!==void 0)return a}},has(o){for(let u=t.length-1;u>=0;u--)if(o in zT(t[u]))return!0;return!1},keys(){const o=[];for(let u=0;u<t.length;u++)o.push(...Object.keys(zT(t[u])));return[...new Set(o)]}},ece);const n={},r=Object.create(null);for(let o=t.length-1;o>=0;o--){const u=t[o];if(!u)continue;const a=Object.getOwnPropertyNames(u);for(let l=a.length-1;l>=0;l--){const c=a[l];if(c==="__proto__"||c==="constructor")continue;const f=Object.getOwnPropertyDescriptor(u,c);if(!r[c])r[c]=f.get?{enumerable:!0,configurable:!0,get:tce.bind(n[c]=[f.get.bind(u)])}:f.value!==void 0?f:void 0;else{const x=n[c];x&&(f.get?x.push(f.get.bind(u)):f.value!==void 0&&x.push(()=>f.value))}}}const i={},s=Object.keys(r);for(let o=s.length-1;o>=0;o--){const u=s[o],a=r[u];a&&a.get?Object.defineProperty(i,u,a):i[u]=a?a.value:void 0}return i}const qB=t=>`Stale read from <${t}>.`;function Yn(t){const e="fallback"in t&&{fallback:()=>t.fallback};return Fn(Z0e(()=>t.each,t.children,e||void 0))}function Or(t){const e=t.keyed,n=Fn(()=>t.when,void 0,{equals:(r,i)=>e?r===i:!r==!i});return Fn(()=>{const r=n();if(r){const i=t.children;return typeof i=="function"&&i.length>0?Xi(()=>i(e?r:()=>{if(!Xi(n))throw qB("Show");return t.when})):i}return t.fallback},void 0,void 0)}function zB(t){let e=!1;const n=(s,o)=>(e?s[1]===o[1]:!s[1]==!o[1])&&s[2]===o[2],r=BB(()=>t.children),i=Fn(()=>{let s=r();Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o++){const u=s[o].when;if(u)return e=!!s[o].keyed,[o,u,s[o]]}return[-1]},void 0,{equals:n});return Fn(()=>{const[s,o,u]=i();if(s<0)return t.fallback;const a=u.children;return typeof a=="function"&&a.length>0?Xi(()=>a(e?o:()=>{if(Xi(i)[0]!==s)throw qB("Match");return u.when})):a},void 0,void 0)}function Wy(t){return t}function nce(t,e,n){let r=n.length,i=e.length,s=r,o=0,u=0,a=e[i-1].nextSibling,l=null;for(;o<i||u<s;){if(e[o]===n[u]){o++,u++;continue}for(;e[i-1]===n[s-1];)i--,s--;if(i===o){const c=s<r?u?n[u-1].nextSibling:n[s-u]:a;for(;u<s;)t.insertBefore(n[u++],c)}else if(s===u)for(;o<i;)(!l||!l.has(e[o]))&&e[o].remove(),o++;else if(e[o]===n[s-1]&&n[u]===e[i-1]){const c=e[--i].nextSibling;t.insertBefore(n[u++],e[o++].nextSibling),t.insertBefore(n[--s],c),e[i]=n[s]}else{if(!l){l=new Map;let f=u;for(;f<s;)l.set(n[f],f++)}const c=l.get(e[o]);if(c!=null)if(u<c&&c<s){let f=o,x=1,d;for(;++f<i&&f<s&&!((d=l.get(e[f]))==null||d!==c+x);)x++;if(x>c-u){const p=e[o];for(;u<c;)t.insertBefore(n[u++],p)}else t.replaceChild(n[u++],e[o++])}else o++;else e[o++].remove()}}}const HB="_$DX_DELEGATE";function mt(t,e,n){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=t,n?o.content.firstChild.firstChild:o.content.firstChild},s=e?()=>Xi(()=>document.importNode(r||(r=i()),!0)):()=>(r||(r=i())).cloneNode(!0);return s.cloneNode=s,s}function HT(t,e=window.document){const n=e[HB]||(e[HB]=new Set);for(let r=0,i=t.length;r<i;r++){const s=t[r];n.has(s)||(n.add(s),e.addEventListener(s,rce))}}function Ji(t,e,n){n==null?t.removeAttribute(e):t.setAttribute(e,n)}function QB(t,e,n,r){Array.isArray(n)?(t[`$$${e}`]=n[0],t[`$$${e}Data`]=n[1]):t[`$$${e}`]=n}function wc(t,e,n){if(!e)return n?Ji(t,"style"):e;const r=t.style;if(typeof e=="string")return r.cssText=e;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),e||(e={});let i,s;for(s in n)e[s]==null&&r.removeProperty(s),delete n[s];for(s in e)i=e[s],i!==n[s]&&(r.setProperty(s,i),n[s]=i);return n}function lo(t,e,n){return Xi(()=>t(e,n))}function Je(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return Vy(t,e,r,n);Pn(i=>Vy(t,e(),i,n),r)}function rce(t){const e=`$$${t.type}`;let n=t.composedPath&&t.composedPath()[0]||t.target;for(t.target!==n&&Object.defineProperty(t,"target",{configurable:!0,value:n}),Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}});n;){const r=n[e];if(r&&!n.disabled){const i=n[`${e}Data`];if(i!==void 0?r.call(n,i,t):r.call(n,t),t.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Vy(t,e,n,r,i){for(;typeof n=="function";)n=n();if(e===n)return n;const s=typeof e,o=r!==void 0;if(t=o&&n[0]&&n[0].parentNode||t,s==="string"||s==="number")if(s==="number"&&(e=e.toString()),o){let u=n[0];u&&u.nodeType===3?u.data!==e&&(u.data=e):u=document.createTextNode(e),n=Vx(t,n,r,u)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e;else if(e==null||s==="boolean")n=Vx(t,n,r);else{if(s==="function")return Pn(()=>{let u=e();for(;typeof u=="function";)u=u();n=Vy(t,u,n,r)}),()=>n;if(Array.isArray(e)){const u=[],a=n&&Array.isArray(n);if(QT(u,e,n,i))return Pn(()=>n=Vy(t,u,n,r,!0)),()=>n;if(u.length===0){if(n=Vx(t,n,r),o)return n}else a?n.length===0?GB(t,u,r):nce(t,n,u):(n&&Vx(t),GB(t,u));n=u}else if(e.nodeType){if(Array.isArray(n)){if(o)return n=Vx(t,n,r,e);Vx(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function QT(t,e,n,r){let i=!1;for(let s=0,o=e.length;s<o;s++){let u=e[s],a=n&&n[t.length],l;if(!(u==null||u===!0||u===!1))if((l=typeof u)=="object"&&u.nodeType)t.push(u);else if(Array.isArray(u))i=QT(t,u,a)||i;else if(l==="function")if(r){for(;typeof u=="function";)u=u();i=QT(t,Array.isArray(u)?u:[u],Array.isArray(a)?a:[a])||i}else t.push(u),i=!0;else{const c=String(u);a&&a.nodeType===3&&a.data===c?t.push(a):t.push(document.createTextNode(c))}}return i}function GB(t,e,n=null){for(let r=0,i=e.length;r<i;r++)t.insertBefore(e[r],n)}function Vx(t,e,n,r){if(n===void 0)return t.textContent="";const i=r||document.createTextNode("");if(e.length){let s=!1;for(let o=e.length-1;o>=0;o--){const u=e[o];if(i!==u){const a=u.parentNode===t;!s&&!o?a?t.replaceChild(i,u):t.insertBefore(i,n):a&&u.remove()}else s=!0}}else t.insertBefore(i,n);return[i]}const ice="http://www.w3.org/2000/svg";function sce(t,e=!1){return e?document.createElementNS(ice,t):document.createElement(t)}function oce(t){const{useShadow:e}=t,n=document.createTextNode(""),r=()=>t.mount||document.body,i=$B();let s,o=!!U0e.context;return ws(()=>{s||(s=G0e(i,()=>Fn(()=>t.children)));const u=r();if(u instanceof HTMLHeadElement){const[a,l]=hr(!1),c=()=>l(!0);tp(f=>Je(u,()=>a()?f():s(),null)),rp(c)}else{const a=sce(t.isSVG?"g":"div",t.isSVG),l=e&&a.attachShadow?a.attachShadow({mode:"open"}):a;Object.defineProperty(a,"_$host",{get(){return n.parentNode},configurable:!0}),Je(l,s),u.appendChild(a),t.ref&&t.ref(a),rp(()=>u.removeChild(a))}},void 0,{render:!o}),n}function uce(t){const e=Object.keys(t),n={};for(let r=0;r<e.length;r++){const[i,s]=hr(t[e[r]]);Object.defineProperty(n,e[r],{get:i,set(o){s(()=>o)}})}return n}function ace(t){if(t.assignedSlot&&t.assignedSlot._$owner)return t.assignedSlot._$owner;let e=t.parentNode;for(;e&&!e._$owner&&!(e.assignedSlot&&e.assignedSlot._$owner);)e=e.parentNode;return e&&e.assignedSlot?e.assignedSlot._$owner:t._$owner}function WB(t){return(e,n)=>{const{element:r}=n;return tp(i=>{const s=uce(e);r.addPropertyChangedCallback((u,a)=>s[u]=a),r.addReleaseCallback(()=>{r.renderRoot.textContent="",i()});const o=t(s,n);return Je(r.renderRoot,o)},ace(r))}}var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function lce(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var VB={},Yx={},at={},ut={},va={};Object.defineProperty(va,"__esModule",{value:!0}),va.isNotUndefined=va.locationContainsPosition=void 0;function cce(t,e){return t.range.start.line<=e.line&&t.range.end.line>=e.line&&(e.line!==t.range.start.line||e.character>=t.range.start.character)&&(e.line!==t.range.end.line||e.character<=t.range.end.character)}va.locationContainsPosition=cce;function fce(t){return t!==void 0}va.isNotUndefined=fce;var Xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isBaseTable=t.isSourceDef=t.sourceBase=t.isSegmentSQL=t.isIndexSegment=t.isRawSegment=t.isSamplingEnable=t.isSamplingPercent=t.isSamplingRows=t.isQuerySegment=t.isProjectSegment=t.isPartialSegment=t.isReduceSegment=t.structHasErrors=t.segmentHasErrors=t.refIsStructDef=t.ValueType=t.isExtractUnit=t.isTimestampUnit=t.isDateUnit=t.isJoinedSource=t.isJoined=t.isJoinable=t.isMatrixOperation=t.isScalarArray=t.isRepeatedRecord=t.mkArrayDef=t.mkFieldDef=t.fieldIsIntrinsic=t.isCastType=t.canOrderBy=t.isAtomicFieldType=t.isTemporalType=t.hasExpression=t.maxOfExpressionTypes=t.maxExpressionType=t.isExpressionTypeLEQ=t.expressionIsAnalytic=t.expressionIsCalculation=t.expressionInvolvesAggregate=t.expressionIsUngroupedAggregate=t.expressionIsAggregate=t.expressionIsScalar=t.paramHasValue=t.isRawCast=t.mkTemporal=t.isAsymmetricExpr=t.exprIsLeaf=t.exprHasE=t.exprHasKids=void 0,t.TD=t.isValueDate=t.isValueTimestamp=t.isValueBoolean=t.isValueNumber=t.isValueString=t.isAtomic=t.isTurtle=t.getIdentifier=t.isLeafAtomic=t.mergeEvalSpaces=t.isLiteral=void 0;function e(z){return"kids"in z}t.exprHasKids=e;function n(z){return"e"in z}t.exprHasE=n;function r(z){return!(e(z)||n(z))}t.exprIsLeaf=r;function i(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}t.isAsymmetricExpr=i;function s(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function o(z,de){const fe=typeof de=="string"?{type:de}:de;return s(z)?{...z,typeDef:{...fe}}:z}t.mkTemporal=o;function u(z){return"dstSQLType"in z}t.isRawCast=u;function a(z){return z.value!==null}t.paramHasValue=a;function l(z){return z===void 0||z==="scalar"}t.expressionIsScalar=l;function c(z){return z==="aggregate"||z==="ungrouped_aggregate"}t.expressionIsAggregate=c;function f(z){return z==="ungrouped_aggregate"}t.expressionIsUngroupedAggregate=f;function x(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}t.expressionInvolvesAggregate=x;function d(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}t.expressionIsCalculation=d;function p(z){return z==="aggregate_analytic"||z==="scalar_analytic"}t.expressionIsAnalytic=p;function m(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function g(z,de){return z===de||m(z)<m(de)}t.isExpressionTypeLEQ=g;function y(z,de){let fe="scalar";return(z==="aggregate"||de==="aggregate")&&(fe="aggregate"),(z==="ungrouped_aggregate"||de==="ungrouped_aggregate")&&(fe="ungrouped_aggregate"),(z==="scalar_analytic"||de==="scalar_analytic")&&(fe="scalar_analytic"),(z==="aggregate_analytic"||de==="aggregate_analytic")&&(fe="aggregate_analytic"),(z==="scalar_analytic"&&de==="aggregate"||z==="aggregate"&&de==="scalar_analytic")&&(fe="aggregate_analytic"),fe}t.maxExpressionType=y;function E(z){return z.reduce(y,"scalar")}t.maxOfExpressionTypes=E;function v(z){return"e"in z}t.hasExpression=v;function _(z){return z==="date"||z==="timestamp"}t.isTemporalType=_;function A(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}t.isAtomicFieldType=A;function S(z){return["string","number","date","boolean","date","timestamp"].includes(z)}t.canOrderBy=S;function b(z){return["string","number","date","timestamp","boolean","json"].includes(z)}t.isCastType=b;function C(z){return A(z.type)&&!v(z)}t.fieldIsIntrinsic=C;function w(z,de){if(M(z))return I(z.elementTypeDef,de);if(F(z)){const{type:fe,fields:K,elementTypeDef:ee}=z;return{type:fe,fields:K,elementTypeDef:ee,join:"many",name:de}}if(z.type==="record"){const{type:fe,fields:K}=z;return{type:fe,fields:K,join:"one",name:de}}return{...z,name:de}}t.mkFieldDef=w;function I(z,de){if(z.type==="record")return{type:"array",join:"many",name:de,elementTypeDef:{type:"record_element"},fields:z.fields};const fe=w(z,"value");return{type:"array",join:"many",name:de,elementTypeDef:z,fields:[fe,{...fe,name:"each",e:{node:"field",path:["value"]}}]}}t.mkArrayDef=I;function F(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}t.isRepeatedRecord=F;function M(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}t.isScalarArray=M;function U(z){return["left","right","full","inner"].includes(z)}t.isMatrixOperation=U;function X(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}t.isJoinable=X;function W(z){return"join"in z}t.isJoined=W;function ae(z){return j(z)&&W(z)}t.isJoinedSource=ae;function ge(z){return["day","week","month","quarter","year"].includes(z)}t.isDateUnit=ge;function he(z){return ge(z)||["hour","minute","second"].includes(z)}t.isTimestampUnit=he;function ue(z){return he(z)||z==="day_of_week"||z==="day_of_year"}t.isExtractUnit=ue;var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(t.ValueType=ce={}));function ie(z){return typeof z!="string"}t.refIsStructDef=ie;function re(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(de=>de.type==="error")||z.queryFields.some(de=>de.type==="error")))}t.segmentHasErrors=re;function R(z){return z.fields.some(de=>de.type==="error")}t.structHasErrors=R;function O(z){return z.type==="reduce"}t.isReduceSegment=O;function D(z){return z.type==="partial"}t.isPartialSegment=D;function k(z){return z.type==="project"}t.isProjectSegment=k;function G(z){return k(z)||O(z)}t.isQuerySegment=G;function q(z){return z.rows!==void 0}t.isSamplingRows=q;function N(z){return z.percent!==void 0}t.isSamplingPercent=N;function B(z){return z.enable!==void 0}t.isSamplingEnable=B;function P(z){return z.type==="raw"}t.isRawSegment=P;function Q(z){return z.type==="index"}t.isIndexSegment=Q;function $(z){return"sql"in z}t.isSegmentSQL=$;function H(z){return{...z}}t.sourceBase=H;function j(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}t.isSourceDef=j;function J(z){return ae(z)?!1:!!j(z)}t.isBaseTable=J;function xe(z){return z==="literal"}t.isLiteral=xe;function se(...z){return z.length<=1&&z.every(de=>de==="literal")?"literal":z.every(de=>de==="constant"||de==="literal")?"constant":z.every(de=>de==="output"||de==="constant"||de==="literal")?"output":"input"}t.mergeEvalSpaces=se;function Z(z){return z.type==="string"||_(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}t.isLeafAtomic=Z;function oe(z){return z.as!==void 0?z.as:z.name}t.getIdentifier=oe;function we(z){return z.type==="turtle"}t.isTurtle=we;function Pe(z){return A(z.type)}t.isAtomic=Pe;function ze(z,de){return de.type==="string"}t.isValueString=ze;function V(z,de){return de.type==="number"}t.isValueNumber=V;function ne(z,de){return de.type==="boolean"}t.isValueBoolean=ne;function Te(z,de){return de.type==="timestamp"}t.isValueTimestamp=Te;function Me(z,de){return de.type==="date"}t.isValueDate=Me,t.TD={isAtomic(z){return z!==void 0&&A(z.type)},isLeafAtomic(z){return z!==void 0&&Z({type:z.type})},isString:z=>(z==null?void 0:z.type)==="string",isNumber:z=>(z==null?void 0:z.type)==="number",isBoolean:z=>(z==null?void 0:z.type)==="boolean",isJSON:z=>(z==null?void 0:z.type)==="json",isSQL:z=>(z==null?void 0:z.type)==="sql native",isDate:z=>(z==null?void 0:z.type)==="date",isTimestamp:z=>(z==null?void 0:z.type)==="timestamp",isTemporal(z){var de;const fe=(de=z==null?void 0:z.type)!==null&&de!==void 0?de:"";return _(fe)},isError:z=>(z==null?void 0:z.type)==="error",eq(z,de){if(z===void 0||de===void 0)return!1;function fe(K,ee){const Oe={};for(const Y of K.fields||[])if(Y.name)Oe[Y.name]=Y;else return!1;for(const Y of ee.fields||[])if(!t.TD.eq(Oe[Y.name],Y))return!1;return!0}return z.type==="array"&&de.type==="array"?z.elementTypeDef.type!==de.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&de.elementTypeDef.type!=="record_element"?t.TD.eq(z.elementTypeDef,de.elementTypeDef):fe(z,de):z.type==="record"&&de.type==="record"?fe(z,de):z.type==="sql native"&&de.type==="sql native"?z.rawType!==void 0&&z.rawType===de.rawType:z.type===de.type}}})(Xe),Object.defineProperty(ut,"__esModule",{value:!0}),ut.compositeFieldUsageJoinPaths=ut.joinedCompositeFieldUsage=ut.compositeFieldUsageDifference=ut.emptyCompositeFieldUsage=ut.mergeCompositeFieldUsage=ut.unique=ut.formatCompositeFieldUsage=ut.compositeFieldUsageIsPlural=ut.isEmptyCompositeFieldUsage=ut.formatCompositeFieldUsages=ut.compositeFieldUsagePaths=ut.resolveCompositeSources=ut.narrowCompositeFieldResolution=ut.emptyNarrowedCompositeFieldResolution=void 0;const YB=va,GT=Xe;function Xy(t,e,n,r=void 0){var i,s,o,u,a,l,c;let f={...e},x;const d=vce(e);if(n.fields.length>0||e.type==="composite")if(e.type==="composite"){let g=!1;x=(i=r==null?void 0:r.source)!==null&&i!==void 0?i:e.sources.map(E=>({source:E,nested:void 0}));const y=[...x];e:for(const{source:E,nested:v}of x){const _=new Set;for(const A of E.fields)_.add((s=A.as)!==null&&s!==void 0?s:A.name);for(const A of n.fields)if(!_.has(A)){y.shift();continue e}if(E.type==="composite"){const A=Xy(t,E,_ce(n,E),{source:v??E.sources.map(S=>({source:S,nested:[]})),joined:{}});if("error"in A){y.shift();continue e}f={...A.success},y[0]={source:E,nested:A.narrowedCompositeFieldResolution.source}}else f={...E};g=!0,f={...f,fields:[...d,...f.fields],filterList:[...(o=e.filterList)!==null&&o!==void 0?o:[],...(u=f.filterList)!==null&&u!==void 0?u:[]]};break}if(!g)return{error:{code:"no_suitable_composite_source_input",data:{fields:n.fields,path:t}}};x=y}else return{error:{code:"not_a_composite_source",data:{path:t}}};const p={},m=(a=r==null?void 0:r.joined)!==null&&a!==void 0?a:{};for(const g of f.fields)p[(l=g.as)!==null&&l!==void 0?l:g.name]=g;for(const[g,y]of Object.entries(n.joinedUsage)){const E=p[g],v=[...t,g];if(E===void 0)return{error:{code:"composite_source_not_defined",data:{path:v}}};if((0,GT.isJoined)(E)){if(!(0,GT.isSourceDef)(E))continue}else return{error:{code:"composite_source_not_a_join",data:{path:v}}};const _=Xy(v,E,y,m[g]);if("error"in _)return _;if(!(0,GT.isJoinable)(_.success))return{error:{code:"composite_source_is_not_joinable",data:{path:v}}};p[g]={..._.success,join:E.join,as:(c=E.as)!==null&&c!==void 0?c:E.name,onExpression:E.onExpression},m[g]=_.narrowedCompositeFieldResolution}return{success:{...f,fields:Object.values(p)},narrowedCompositeFieldResolution:{source:x,joined:m}}}function xce(){return{source:void 0,joined:{}}}ut.emptyNarrowedCompositeFieldResolution=xce;function dce(t,e,n){const r=Xy([],t,e,n);return"success"in r?{narrowedCompositeFieldResolution:r.narrowedCompositeFieldResolution,error:void 0}:{narrowedCompositeFieldResolution:void 0,error:r.error}}ut.narrowCompositeFieldResolution=dce;function hce(t,e){const n=Xy([],t,e);return"success"in n?{sourceDef:n.success,error:void 0}:{sourceDef:void 0,error:n.error}}ut.resolveCompositeSources=hce;function WT(t){return[...t.fields.map(e=>[e]),...Object.entries(t.joinedUsage).map(([e,n])=>WT(n).map(r=>[e,...r])).flat()]}ut.compositeFieldUsagePaths=WT;function pce(t){return WT(t).map(e=>XB(e)).join(", ")}ut.formatCompositeFieldUsages=pce;function VT(t){return Object.values(t.joinedUsage).reduce((e,n)=>e+VT(n),t.fields.length)}function gce(t){return VT(t)===0}ut.isEmptyCompositeFieldUsage=gce;function mce(t){return VT(t)>1}ut.compositeFieldUsageIsPlural=mce;function XB(t){return`\`${t.join(".")}\``}ut.formatCompositeFieldUsage=XB;function JB(t){return Array.from(new Set(t))}ut.unique=JB;function KB(...t){const e=t.filter(YB.isNotUndefined),n=new Set(e.map(i=>Object.keys(i.joinedUsage)).flat()),r={};for(const i of n)r[i]=KB(...e.map(s=>s==null?void 0:s.joinedUsage[i]).filter(YB.isNotUndefined));return{fields:JB(e.map(i=>i.fields).flat()),joinedUsage:r}}ut.mergeCompositeFieldUsage=KB;function yce(){return{fields:[],joinedUsage:{}}}ut.emptyCompositeFieldUsage=yce;function Ece(t,e){const n=new Set(e),r=[];for(const i of t)n.has(i)||r.push(i);return r}function ZB(t,e){return{fields:Ece(t.fields,e.fields),joinedUsage:Object.fromEntries(Object.entries(t.joinedUsage).map(([n,r])=>[n,n in e.joinedUsage?ZB(r,e.joinedUsage[n]):r]))}}ut.compositeFieldUsageDifference=ZB;function ek(t,e){return t.length===0?e:ek(t.slice(0,-1),{fields:[],joinedUsage:{[t[t.length-1]]:e}})}ut.joinedCompositeFieldUsage=ek;function tk(t){const e=Object.keys(t.joinedUsage);return[...e.map(n=>[n]),...e.map(n=>tk(t.joinedUsage[n]).map(r=>[n,...r])).flat()]}ut.compositeFieldUsageJoinPaths=tk;function nk(t){var e;return"e"in t&&((e=t.e)===null||e===void 0?void 0:e.node)==="compositeField"}function vce(t){return t.fields.filter(e=>!nk(e))}function _ce(t,e){var n;const r={};for(const i of e.fields)r[(n=i.as)!==null&&n!==void 0?n:i.name]=i;return{fields:t.fields.filter(i=>nk(r[i])),joinedUsage:{}}}Object.defineProperty(at,"__esModule",{value:!0}),at.expandOverrideMapFromBase=at.expandBlueprintMap=at.overload=at.minAnalytic=at.minAggregate=at.minScalar=at.maxAnalytic=at.maxUngroupedAggregate=at.anyExprType=at.maxAggregate=at.maxScalar=at.makeParam=at.param=at.variadicParam=at.literal=at.output=at.constant=at.sql=at.spread=at.arg=void 0;const Ace=ut,YT=Xe;function rk(t){return{node:"function_parameter",name:t}}at.arg=rk;function Sce(t,e=void 0,n=void 0){return{node:"spread",e:t,prefix:e,suffix:n}}at.spread=Sce;function bce(t,...e){const n={node:"genericSQLExpr",kids:{args:[]},src:[]},r=[...e];let i="";for(const s of t){i+=s;const o=r.shift();o!==void 0&&(typeof o=="string"?i+=o:(n.src.push(i),n.kids.args.push(o),i=""))}return i.length>0&&n.src.push(i),n}at.sql=bce;function XT(t){return{...t,evalSpace:"constant"}}at.constant=XT;function Cce(t){return{...t,evalSpace:"output"}}at.output=Cce;function JT(t){return{...t,evalSpace:"literal"}}at.literal=JT;function Tce(t,...e){return{name:t,isVariadic:!0,allowedTypes:e}}at.variadicParam=Tce;function ik(t,...e){return{name:t,isVariadic:!1,allowedTypes:e}}at.param=ik;function Oce(t,...e){return{param:ik(t,...e),arg:rk(t)}}at.makeParam=Oce;function Jy(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.maxScalar=Jy;function sk(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.maxAggregate=sk;function KT(t){return{type:t,expressionType:void 0,evalSpace:"input"}}at.anyExprType=KT;function ok(t,e){return{...Ky(t,e),expressionType:void 0,evalSpace:"input"}}function Rce(t){return{type:t,expressionType:"ungrouped_aggregate",evalSpace:"input"}}at.maxUngroupedAggregate=Rce;function uk(t){return{type:t,expressionType:"aggregate_analytic",evalSpace:"input"}}at.maxAnalytic=uk;function Xx(t){return{type:t,expressionType:"scalar",evalSpace:"input"}}at.minScalar=Xx;function ak(t){return{type:t,expressionType:"aggregate",evalSpace:"input"}}at.minAggregate=ak;function lk(t){return{type:t,expressionType:"scalar_analytic",evalSpace:"input"}}at.minAnalytic=lk;function Dce(t,e,n,r){return{returnType:t,params:e,e:n,needsWindowOrderBy:r==null?void 0:r.needsWindowOrderBy,between:r==null?void 0:r.between,isSymmetric:r==null?void 0:r.isSymmetric,supportsOrderBy:r==null?void 0:r.supportsOrderBy,defaultOrderByArgIndex:r==null?void 0:r.defaultOrderByArgIndex,supportsLimit:r==null?void 0:r.supportsLimit}}at.overload=Dce;function Ns(t,e){if(typeof t=="string")return t;if(t.generic!==(e==null?void 0:e.name))throw new Error(`Cannot expand generic name ${t.generic}`);return e.type}function Ky(t,e){var n;let r;if(typeof t=="string")r=Xx(t);else if("array"in t){const i=Ky(t.array,e),{expressionType:s,evalSpace:o}=i;if(YT.TD.isAtomic(i))i.type!=="record"?r={type:"array",elementTypeDef:i,expressionType:s,evalSpace:o}:r={type:"array",elementTypeDef:{type:"record_element"},fields:i.fields,expressionType:s,evalSpace:o};else throw new Error(`TypeDescElementBlueprint should never allow ${t.array}`)}else if("record"in t){const i=[];for(const[s,o]of Object.entries(t.record)){const u=Ky(o,e);YT.TD.isAtomic(u)&&i.push((0,YT.mkFieldDef)(u,s))}r={type:"record",fields:i,evalSpace:"input",expressionType:"scalar"}}else"generic"in t?r=Xx(Ns(t,e)):"literal"in t?r=JT(Xx(Ns(t.literal,e))):"constant"in t?r=XT(Xx(Ns(t.constant,e))):"dimension"in t?r=Xx(Ns(t.dimension,e)):"measure"in t?r=ak(Ns(t.measure,e)):r=lk(Ns(t.calculation,e));return{...r,compositeFieldUsage:(0,Ace.emptyCompositeFieldUsage)(),expressionType:(n=r.expressionType)!==null&&n!==void 0?n:"scalar"}}function ck(t){return typeof t=="string"||"array"in t||"record"in t||"generic"in t||"literal"in t||"constant"in t||"dimension"in t||"measure"in t||"calculation"in t}function wce(t){return ck(t)?[t]:Array.isArray(t)?t:ck(t.variadic)?[t.variadic]:t.variadic}function Nce(t,e){return typeof t=="string"?KT(t):"generic"in t?KT(Ns(t,e)):"literal"in t?JT(Jy(Ns(t.literal,e))):"constant"in t?XT(Jy(Ns(t.constant,e))):"dimension"in t?Jy(Ns(t.dimension,e)):"measure"in t?sk(Ns(t.measure,e)):"array"in t||"record"in t?ok(t,e):uk(Ns(t.calculation,e))}function Fce(t,e){return t.map(n=>Nce(n,e))}function fk(t){return typeof t!="string"&&"variadic"in t}function Lce(t,e,n){return{name:t,allowedTypes:Fce(wce(e),n),isVariadic:fk(e)}}function Ice(t,e){return Object.entries(t).map(r=>Lce(r[0],r[1],e))}function $ce(t){const e=[],n=[];let r=t;for(;r.length>0;){const s=r.indexOf("${");if(s===-1){e.push(r);break}const o=r.slice(0,s);r=r.slice(s);const u=r.indexOf("}");if(u===-1){e.push(o+r);break}const a=r.slice(2,u);r=r.slice(u+1);const l=a.startsWith("..."),c=a.endsWith(":"),f=l?a.slice(3):c?a.slice(0,-1):a,x={node:"function_parameter",name:f};e.push(o),l?n.push({node:"spread",e:x,prefix:"",suffix:""}):c&&f==="order_by"?n.push({node:"aggregate_order_by"}):c&&f==="limit"?n.push({node:"aggregate_limit"}):n.push(x)}return{node:"genericSQLExpr",kids:{args:n},src:e}}function Bce(t,e){return fk(e)?{node:"spread",e:{node:"function_parameter",name:t},prefix:"",suffix:""}:{node:"function_parameter",name:t}}function kce(t,e){const n=Object.entries(e.takes),r=n.length>0?n.length-1:0;return{node:"genericSQLExpr",kids:{args:n.map(i=>Bce(i[0],i[1]))},src:[`${t}(`,...Array(r).fill(","),")"]}}function Pce(t){return"sql"in t.impl?$ce(t.impl.sql):"expr"in t.impl?t.impl.expr:kce(t.impl.function,t)}function Mce(t){return{e:Pce(t),between:t.impl.between,needsWindowOrderBy:t.impl.needsWindowOrderBy,defaultOrderByArgIndex:t.impl.defaultOrderByArgIndex}}function xk(t,e){return{returnType:Ky(t.returns,e),params:Ice(t.takes,e),isSymmetric:t.isSymmetric,supportsOrderBy:t.supportsOrderBy,supportsLimit:t.supportsLimit,...Mce(t)}}function ZT(t){if(t.generic!==void 0){const e=t.generic[0];return t.generic[1].map(n=>xk(t,{name:e,type:n}))}return[xk(t)]}function e6(t){return"takes"in t&&"returns"in t&&"impl"in t}function jce(t){return"function"in t||"sql"in t||"expr"in t}function Uce(t){return e6(t)?ZT(t):Object.values(t).flatMap(e=>ZT(e))}function qce(t){const e={};for(const n in t)e[n]=Uce(t[n]);return e}at.expandBlueprintMap=qce;function dk(t,e){return ZT({...t,impl:e})}function zce(t,e,n){if(jce(n)){if(!e6(e))throw new Error(`Malformed function override: ${t}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(e)})`);return dk(e,n)}else{if(e6(e))throw new Error(`Malformed function override: ${t}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(n)})`);return Object.entries(n).flatMap(([r,i])=>{const s=e[r];if(s===void 0)throw new Error(`Malformed function override: ${t}. No overload named ${r}`);return dk(s,i)})}}function Hce(t,e){const n={};for(const r in e){if(!(r in t))throw new Error(`Malformed function override: ${r}. No such function in Malloy standard`);n[r]=zce(r,t[r],e[r])}return n}at.expandOverrideMapFromBase=Hce;var Bl={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Dialect=t.qtz=t.inDays=t.dayIndex=t.isDialectFieldStruct=void 0;const e=Xe;function n(u){return u.type==="struct"}t.isDialectFieldStruct=n;const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];t.dayIndex=r.indexOf("day");function i(u){return r.indexOf(u)>=t.dayIndex}t.inDays=i;function s(u){const a=u.queryTimezone;if(!(a===void 0||a===u.systemTimezone))return a}t.qtz=s;class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsFullJoin=!0,this.nativeBoolean=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0}sqlFinalStage(a,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(a){return this.castToString(`DATE(${a})`)}sqlLiteralNumber(a){return a}ignoreInProject(a){return!1}exprToSQL(a,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(a,l);case"extract":return this.sqlTimeExtractExpr(a,l);case"cast":return this.sqlCast(a,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(a,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(a,l,c){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(a,l,c){return"sqlAggDistinct called but not implemented"}sqlSampleTable(a,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return a}sqlOrderBy(a){return`ORDER BY ${a.join(",")}`}sqlTzStr(a){return`"${a.queryTimezone}"`}sqlMakeUnnestKey(a,l){return this.concat(a,"'x'",l)}sqlStringAggDistinct(a,l,c){const f="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
2
2
  STRING_AGG(DISTINCT ${`concat('${f}', ${a}, '${x}', ${l})`}${c.length>0?","+c:""}),
3
3
  '${f}.*?${x}',
4
4
  ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.222-dev241212190052",
3
+ "version": "0.0.222-dev241212204326",
4
4
  "license": "MIT",
5
5
  "main": "dist/module/index.umd.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "build-types": "tsc --build --declaration --emitDeclarationOnly"
31
31
  },
32
32
  "dependencies": {
33
- "@malloydata/malloy": "^0.0.222-dev241212190052",
33
+ "@malloydata/malloy": "^0.0.222-dev241212204326",
34
34
  "@tanstack/solid-virtual": "^3.10.4",
35
35
  "component-register": "^0.8.6",
36
36
  "lodash": "^4.17.20",