@malloy-publisher/app 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-doc.yaml +141 -17
- package/dist/assets/{EnvironmentPage-fjRmUv5U.js → EnvironmentPage-CMzxoXwh.js} +1 -1
- package/dist/assets/{HomePage-BYcfSCYQ.js → HomePage-DGB13NHr.js} +1 -1
- package/dist/assets/{LightMode-HqTJd5sS.js → LightMode-drhYHM27.js} +1 -1
- package/dist/assets/{MainPage-BWO02VL1.js → MainPage-BfFE47Sp.js} +1 -1
- package/dist/assets/{MaterializationsPage-DtQTKXio.js → MaterializationsPage-C_iwL_3A.js} +1 -1
- package/dist/assets/{ModelPage-CHHRPUfJ.js → ModelPage-nls853_3.js} +1 -1
- package/dist/assets/{PackagePage-Dg83Zo7T.js → PackagePage-D_e_fXEW.js} +1 -1
- package/dist/assets/{RouteError-BYustUzP.js → RouteError-Bej8W2nX.js} +1 -1
- package/dist/assets/{ThemeEditorPage-DvOIp3pJ.js → ThemeEditorPage-BoxpETpC.js} +1 -1
- package/dist/assets/{WorkbookPage-jGyARm9R.js → WorkbookPage-DObenCMx.js} +1 -1
- package/dist/assets/{core-Dvp73xXv.es-C2zK6mlo.js → core-CHmvIICy.es-C_LOF_0M.js} +1 -1
- package/dist/assets/{index-CLXnplGh.js → index-5p0haSOb.js} +1 -1
- package/dist/assets/{index-BOsTtwKH.js → index-BmFFAoZx.js} +1 -1
- package/dist/assets/{index-DFsqNVYX.js → index-QM4T1eJn.js} +1 -1
- package/dist/assets/{index-CjFtnxaN.js → index-sZHvyEzw.js} +4 -4
- package/dist/index.html +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aN as w2,aO as e9,r as L,j as N,aj as Ut,R as t9,aP as r9,aQ as ns,aR as Os}from"./index-CjFtnxaN.js";import{r as Wa}from"./index-w_0OQJgZ.js";import{r as xA,d as ft}from"./index-CLXnplGh.js";import{d as bU}from"./index-DFsqNVYX.js";import{MalloyRenderer as n9,isCoreVizPluginInstance as RU}from"./index-DSoCUF-f.js";var Eo={},X3={},fr={},Z3={},yR;function He(){return yR||(yR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=i,e.exprHasKids=o,e.exprHasE=s,e.exprIsLeaf=a,e.isAsymmetricExpr=l,e.mkTemporal=d,e.isRawCast=c,e.isFilterExprType=f,e.isTimeLiteral=x,e.isParameterType=p,e.paramHasValue=h,e.activeName=g,e.expressionIsScalar=m,e.expressionIsAggregate=E,e.expressionIsUngroupedAggregate=v,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=A,e.expressionIsAnalytic=C,e.isExpressionTypeLEQ=D,e.maxExpressionType=S,e.maxOfExpressionTypes=w,e.hasExpression=R,e.isTemporalType=O,e.isBasicAtomicType=I,e.isAtomicFieldType=B,e.canOrderBy=$,e.fieldIsIntrinsic=Y,e.mkFieldDef=ee,e.mkArrayDef=oe,e.mkArrayTypeDef=re,e.isRepeatedRecordFunctionParam=U,e.isRepeatedRecord=ne,e.isRecordOrRepeatedRecord=J,e.isBasicArray=te,e.isMatrixOperation=q,e.isJoinable=H,e.isJoined=Q,e.isJoinedSource=k,e.isDateUnit=j,e.isTimestampUnit=P,e.isExtractUnit=V,e.refIsStructDef=ae,e.segmentHasErrors=ce,e.structHasErrors=le,e.isReduceSegment=se,e.isPartialSegment=xe,e.isProjectSegment=pe,e.isQuerySegment=ye,e.isSamplingRows=Ce,e.isSamplingPercent=me,e.isSamplingEnable=_e,e.isRawSegment=we,e.isIndexSegment=Je,e.bareFieldUsage=rt,e.fieldUsageFrom=ge,e.givenUsageFrom=Ee,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.isSegmentSQL=Me,e.isSegmentSource=Ze,e.isSourceRegistryReference=at,e.sourceBase=Ge,e.isSourceDef=gt,e.isPersistableSourceDef=yt,e.isBaseTable=Ae,e.isLiteral=Ve,e.mergeEvalSpaces=it,e.isBasicAtomic=de,e.isUserTypeDef=he,e.isCompoundArrayData=ve,e.isTurtle=Te,e.isAtomic=Be,e.isValueString=Le,e.isValueNumber=ze,e.isValueBoolean=nt,e.isValueTimestamp=pt,e.isValueDate=Et,e.mergeUniqueKeyRequirement=ut;const t=Object.prototype.hasOwnProperty;function r(ie,be){return t.call(ie,be)?ie[be]:void 0}function i(){return Object.create(null)}function o(ie){return"kids"in ie}function s(ie){return"e"in ie}function a(ie){return!(o(ie)||s(ie))}function l(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function u(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function d(ie,be){if(!("typeDef"in ie)){const Qe=typeof be=="string"?{type:be}:be;if(u(ie))return{...ie,typeDef:{...Qe}}}return ie}function c(ie){return"dstSQLType"in ie}function f(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function x(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function p(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function g(ie){var be;return(be=ie.as)!==null&&be!==void 0?be:ie.name}function m(ie){return ie===void 0||ie==="scalar"}function E(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function v(ie){return ie==="ungrouped_aggregate"}function _(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function A(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function C(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function b(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,be){return ie===be||b(ie)<b(be)}function S(ie,be){let Qe="scalar";return(ie==="aggregate"||be==="aggregate")&&(Qe="aggregate"),(ie==="ungrouped_aggregate"||be==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(ie==="scalar_analytic"||be==="scalar_analytic")&&(Qe="scalar_analytic"),(ie==="aggregate_analytic"||be==="aggregate_analytic")&&(Qe="aggregate_analytic"),(ie==="scalar_analytic"&&be==="aggregate"||ie==="aggregate"&&be==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function w(ie){return ie.reduce(S,"scalar")}function R(ie){return"e"in ie&&ie.e!==void 0}function O(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function I(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function B(ie){return I(ie)||ie==="record"||ie==="array"}function $(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function Y(ie){return B(ie.type)&&!R(ie)}function ee(ie,be){if(te(ie))return oe(ie.elementTypeDef,be);if(ne(ie)){const{type:Ie,fields:We,elementTypeDef:st}=ie;return{type:Ie,fields:We,elementTypeDef:st,join:"many",name:be}}if(ie.type==="record"){const{type:Ie,fields:We}=ie;return{type:Ie,fields:We,join:"one",name:be}}const Qe={name:be,type:ie.type};switch(ie.type){case"sql native":return{...Qe,rawType:ie.rawType};case"number":{const Ie=ie.numberType;return Ie?{...Qe,numberType:Ie}:Qe}case"date":{const Ie=ie.timeframe;return Ie?{name:be,type:"date",timeframe:Ie}:Qe}case"timestamp":{const Ie={name:be,type:"timestamp"};return ie.timeframe&&(Ie.timeframe=ie.timeframe),Ie}case"timestamptz":{const Ie={name:be,type:"timestamptz"};return ie.timeframe&&(Ie.timeframe=ie.timeframe),Ie}}return Qe}function oe(ie,be){if(ie.type==="record")return{type:"array",join:"many",name:be,elementTypeDef:{type:"record_element"},fields:ie.fields};const Qe=ee(ie,"value");return{type:"array",join:"many",name:be,elementTypeDef:ie,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function re(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function U(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function ne(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function J(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function te(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function q(ie){return["left","right","full","inner"].includes(ie)}function H(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function Q(ie){return"join"in ie}function k(ie){return gt(ie)&&Q(ie)}function j(ie){return["day","week","month","quarter","year"].includes(ie)}function P(ie){return j(ie)||["hour","minute","second"].includes(ie)}function V(ie){return P(ie)||ie==="day_of_week"||ie==="day_of_year"}var Z;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(Z||(e.ValueType=Z={}));function ae(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(be=>be.type==="error")||ie.queryFields.some(be=>be.type==="error")))}function le(ie){return ie.fields.some(be=>be.type==="error")}function se(ie){return ie.type==="reduce"}function xe(ie){return ie.type==="partial"}function pe(ie){return ie.type==="project"}function ye(ie){return pe(ie)||se(ie)}function Ce(ie){return ie.rows!==void 0}function me(ie){return ie.percent!==void 0}function _e(ie){return ie.enable!==void 0}function we(ie){return ie.type==="raw"}function Je(ie){return ie.type==="index"}function rt(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function ge(ie){var be;return(be=ie?.fieldUsage)!==null&&be!==void 0?be:[]}function Ee(ie){var be;return(be=ie?.givenUsage)!==null&&be!==void 0?be:[]}function Pe({fieldUsage:ie,givenUsage:be}){if(!(ie===void 0&&be===void 0))return{fieldUsage:ie??[],...be&&{givenUsage:be}}}function ke(ie,be){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(be)}}function Me(ie){return"sql"in ie}function Ze(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function at(ie){return ie.type==="source_registry_reference"}function Ge(ie){return{...ie}}function gt(ie){return ie.type==="table"||ie.type==="sql_select"||ie.type==="query_source"||ie.type==="query_result"||ie.type==="finalize"||ie.type==="nest_source"||ie.type==="virtual"||ie.type==="composite"}function yt(ie){return ie.type==="sql_select"||ie.type==="query_source"}function Ae(ie){return k(ie)?!1:!!gt(ie)}function Ve(ie){return ie==="literal"}function it(...ie){return ie.length<=1&&ie.every(be=>be==="literal")?"literal":ie.every(be=>be==="constant"||be==="literal")?"constant":ie.every(be=>be==="output"||be==="constant"||be==="literal")?"output":"input"}function de(ie){return ie.type==="string"||O(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function he(ie){return ie.type==="userType"}function ve(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Te(ie){return ie.type==="turtle"}function Be(ie){return B(ie.type)}function Le(ie,be){return be.type==="string"}function ze(ie,be){return be.type==="number"}function nt(ie,be){return be.type==="boolean"}function pt(ie,be){return be.type==="timestamp"}function Et(ie,be){return be.type==="date"}e.TD={isAtomic(ie){return ie!==void 0&&B(ie.type)},isBasicAtomic(ie){return ie!==void 0&&de({type:ie.type})},isString:ie=>ie?.type==="string",isNumber:ie=>ie?.type==="number",isBoolean:ie=>ie?.type==="boolean",isJSON:ie=>ie?.type==="json",isSQL:ie=>ie?.type==="sql native",isDate:ie=>ie?.type==="date",isTimestamp:ie=>ie?.type==="timestamp",isTimestamptz:ie=>ie?.type==="timestamptz",isAnyTimestamp(ie){return ie?.type==="timestamp"||ie?.type==="timestamptz"},isTemporal(ie){var be;const Qe=(be=ie?.type)!==null&&be!==void 0?be:"";return O(Qe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!e.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return ne(ie)?{type:"array",elementTypeDef:ie.elementTypeDef,fields:ie.fields}:{type:"array",elementTypeDef:ie.elementTypeDef};case"record":return{type:"record",fields:ie.fields};case"number":return ie.numberType?{type:"number",numberType:ie.numberType}:{type:"number"};case"sql native":return ie.rawType?{type:"sql native",rawType:ie.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return ie.timeframe?{type:ie.type,timeframe:ie.timeframe}:{type:ie.type};default:return{type:ie.type}}},eq(ie,be){if(ie===void 0||be===void 0)return!1;function Qe(Ie,We){const st={},mt=Ie.fields||[],lt=We.fields||[];if(mt.length!==lt.length)return!1;for(const ct of mt)if(ct.name)st[ct.name]=ct;else return!1;for(const ct of lt)if(!e.TD.eq(st[ct.name],ct))return!1;return!0}return ie.type==="array"&&be.type==="array"?ie.elementTypeDef.type!==be.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&be.elementTypeDef.type!=="record_element"?e.TD.eq(ie.elementTypeDef,be.elementTypeDef):e.TD.isAtomic(ie)&&e.TD.isAtomic(be)&&Qe(ie,be):ie.type==="record"&&be.type==="record"?e.TD.isAtomic(ie)&&e.TD.isAtomic(be)&&Qe(ie,be):ie.type==="sql native"&&be.type==="sql native"?ie.rawType!==void 0&&ie.rawType===be.rawType:ie.type===be.type}};function ut(ie,be){return ie?be?{isCount:ie.isCount||be.isCount}:ie:be}})(Z3)),Z3}var ER;function cs(){if(ER)return fr;ER=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.arg=t,fr.spread=r,fr.sql=i,fr.constant=o,fr.output=s,fr.literal=a,fr.variadicParam=l,fr.param=u,fr.makeParam=d,fr.maxScalar=c,fr.maxAggregate=f,fr.anyExprType=x,fr.maxUngroupedAggregate=p,fr.maxAnalytic=h,fr.minScalar=g,fr.minAggregate=m,fr.minAnalytic=E,fr.overload=v,fr.expandBlueprintMap=te,fr.expandOverrideMapFromBase=Q,fr.def=j;const e=He();function t(P){return{node:"function_parameter",name:P}}function r(P,V=void 0,Z=void 0){return{node:"spread",e:P,prefix:V,suffix:Z}}function i(P,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...V];let ce="";for(const le of P){ce+=le;const se=ae.shift();se!==void 0&&(typeof se=="string"?ce+=se:(Z.src.push(ce),Z.kids.args.push(se),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...V){return{name:P,isVariadic:!0,allowedTypes:V}}function u(P,...V){return{name:P,isVariadic:!1,allowedTypes:V}}function d(P,...V){return{param:u(P,...V),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function f(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function x(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function g(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function m(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function E(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function v(P,V,Z,ae){return{returnType:P,params:V,e:Z,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function _(P,V=!0,Z=!0){if(!V&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=V?_(P.array,!0):_(P.array,!1);return ae.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ae.fields}:{type:"array",elementTypeDef:ae}}else if("record"in P){const ae=[];for(const[ce,le]of Object.entries(P.record)){const se=V?_(le,!0):_(le,!1);e.TD.isAtomic(se)&&ae.push((0,e.mkFieldDef)(se,ce))}return{type:"record",fields:ae}}else if("generic"in P){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:P.generic}}else if("sql_native"in P)return{type:"sql native",rawType:P.sql_native};throw new Error("Cannot figure out type")}function A(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return g({type:P});if("array"in P)return x(_(P,!1));if("record"in P)return x(_(P,!1));if("generic"in P)return g(_(P,!1));if("literal"in P)return a(g(_(P.literal,!1)));if("constant"in P)return o(g(_(P.constant,!1)));if("dimension"in P)return g(_(P.dimension,!1));if("measure"in P)return m(_(P.measure,!1));if("sql_native"in P)return x({type:"sql native",rawType:P.sql_native});if("calculation"in P)return E(_(P.calculation,!1));throw new Error("Invalid function blueprint")}function C(P){return typeof P=="string"||"array"in P||"record"in P||"generic"in P||"literal"in P||"constant"in P||"dimension"in P||"measure"in P||"calculation"in P||"sql_native"in P}function b(P){return C(P)?[P]:Array.isArray(P)?P:C(P.variadic)?[P.variadic]:P.variadic}function D(P){if(typeof P=="string")return x({type:P});if("generic"in P)return x(_(P));if("literal"in P)return a(c(_(P.literal)));if("constant"in P)return o(c(_(P.constant)));if("dimension"in P)return c(_(P.dimension));if("measure"in P)return f(_(P.measure));if("array"in P)return x(_(P,!1));if("record"in P)return x(_(P,!1));if("sql_native"in P)return x({type:"sql native",rawType:P.sql_native});if("calculation"in P)return h(_(P.calculation));throw new Error("Invalid function blueprint")}function S(P){return P.map(V=>D(V))}function w(P){return typeof P!="string"&&"variadic"in P}function R(P,V){return{name:P,allowedTypes:S(b(V)),isVariadic:w(V)}}function O(P){return Object.entries(P).map(Z=>R(Z[0],Z[1]))}function I(P){const V=[],Z=[];let ae=P;for(;ae.length>0;){const le=ae.indexOf("${");if(le===-1){V.push(ae);break}const se=ae.slice(0,le);ae=ae.slice(le);const xe=ae.indexOf("}");if(xe===-1){V.push(se+ae);break}const pe=ae.slice(2,xe);ae=ae.slice(xe+1);const ye=pe.startsWith("..."),Ce=pe.endsWith(":"),me=ye?pe.slice(3):Ce?pe.slice(0,-1):pe,_e={node:"function_parameter",name:me};V.push(se),ye?Z.push({node:"spread",e:_e,prefix:"",suffix:""}):Ce&&me==="order_by"?Z.push({node:"aggregate_order_by"}):Ce&&me==="limit"?Z.push({node:"aggregate_limit"}):Z.push(_e)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function B(P,V){return w(V)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function $(P,V){const Z=Object.entries(V.takes),ae=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>B(ce[0],ce[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function Y(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:$(P.impl.function,P)}function ee(P){return{e:Y(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function oe(P){if(P!==void 0)return Object.entries(P).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ae=>_(ae,!0,!1))}))}function re(P){return{returnType:A(P.returns),params:O(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:oe(P.generic),...ee(P)}}function U(P){return"takes"in P&&"returns"in P&&"impl"in P}function ne(P){return"function"in P||"sql"in P||"expr"in P}function J(P){return U(P)?[re(P)]:Object.values(P).flatMap(V=>re(V))}function te(P){const V={};for(const Z in P)V[Z]=J(P[Z]);return V}function q(P,V){return[re({...P,impl:V})]}function H(P,V,Z){if(ne(Z)){if(!U(V))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return q(V,Z)}else{if(U(V))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ae,ce])=>{const le=V[ae];if(le===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return q(le,ce)})}}function Q(P,V){const Z={};for(const ae in V){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);Z[ae]=H(ae,P[ae],V[ae])}return Z}function*k(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const V of Object.values(P.record))yield*k(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in P){yield*k(P[V]);return}}}function j(P,V,Z,ae={}){let ce=!1;const le={};for(const xe of Object.values(V))for(const pe of k(xe))le[pe.generic]=["any"],ce=!0;ce&&ae.generic===void 0&&(ae.generic=le);const se={takes:V,returns:Z,impl:{function:P.toUpperCase()},...ae};return{[P]:se}}return fr}var ev={},wx={},vR;function hA(){if(vR)return wx;vR=1,Object.defineProperty(wx,"__esModule",{value:!0}),wx.decodeDottedTablePath=e,wx.validateDottedTablePath=t;function e(o,s){const{quoteChar:a,escapeStyle:l,bareIdentRegex:u,dialectName:d}=s;if(o.length===0)return{ok:!1,error:`${d} table path is empty`};const c=[];let f=0;for(;;){let x,p;if(o[f]===a){const h=r(o,f,a,l);if(h===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};x=h.decoded,p=!0,f=h.end}else{const h=o.slice(f).match(u);if(!h||h.index!==0||h[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${f}`};x=h[0],p=!1,f+=h[0].length}if(x.includes(";")||x.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(x)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:x,quoted:p}),f===o.length)return{ok:!0,segments:c};if(o[f]!==".")return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — expected '.' at position ${f}`};if(f++,f===o.length)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — trailing dot`}}}function t(o,s){const a=e(o,s);return a.ok?{ok:!0,canonical:o}:a}function r(o,s,a,l){let u=s+1,d="";for(;u<o.length;){if(l==="backslash"&&o[u]==="\\"){if(u+1>=o.length)return null;d+=i(o[u+1]),u+=2;continue}if(o[u]===a){if(l==="doubled"&&o[u+1]===a){d+=a,u+=2;continue}return{decoded:d,end:u+1}}d+=o[u],u++}return null}function i(o){switch(o){case"n":return`
|
|
1
|
+
import{aN as w2,aO as e9,r as L,j as N,aj as Ut,R as t9,aP as r9,aQ as ns,aR as Os}from"./index-sZHvyEzw.js";import{r as Wa}from"./index-w_0OQJgZ.js";import{r as xA,d as ft}from"./index-5p0haSOb.js";import{d as bU}from"./index-QM4T1eJn.js";import{MalloyRenderer as n9,isCoreVizPluginInstance as RU}from"./index-DSoCUF-f.js";var Eo={},X3={},fr={},Z3={},yR;function He(){return yR||(yR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=i,e.exprHasKids=o,e.exprHasE=s,e.exprIsLeaf=a,e.isAsymmetricExpr=l,e.mkTemporal=d,e.isRawCast=c,e.isFilterExprType=f,e.isTimeLiteral=x,e.isParameterType=p,e.paramHasValue=h,e.activeName=g,e.expressionIsScalar=m,e.expressionIsAggregate=E,e.expressionIsUngroupedAggregate=v,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=A,e.expressionIsAnalytic=C,e.isExpressionTypeLEQ=D,e.maxExpressionType=S,e.maxOfExpressionTypes=w,e.hasExpression=R,e.isTemporalType=O,e.isBasicAtomicType=I,e.isAtomicFieldType=B,e.canOrderBy=$,e.fieldIsIntrinsic=Y,e.mkFieldDef=ee,e.mkArrayDef=oe,e.mkArrayTypeDef=re,e.isRepeatedRecordFunctionParam=U,e.isRepeatedRecord=ne,e.isRecordOrRepeatedRecord=J,e.isBasicArray=te,e.isMatrixOperation=q,e.isJoinable=H,e.isJoined=Q,e.isJoinedSource=k,e.isDateUnit=j,e.isTimestampUnit=P,e.isExtractUnit=V,e.refIsStructDef=ae,e.segmentHasErrors=ce,e.structHasErrors=le,e.isReduceSegment=se,e.isPartialSegment=xe,e.isProjectSegment=pe,e.isQuerySegment=ye,e.isSamplingRows=Ce,e.isSamplingPercent=me,e.isSamplingEnable=_e,e.isRawSegment=we,e.isIndexSegment=Je,e.bareFieldUsage=rt,e.fieldUsageFrom=ge,e.givenUsageFrom=Ee,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.isSegmentSQL=Me,e.isSegmentSource=Ze,e.isSourceRegistryReference=at,e.sourceBase=Ge,e.isSourceDef=gt,e.isPersistableSourceDef=yt,e.isBaseTable=Ae,e.isLiteral=Ve,e.mergeEvalSpaces=it,e.isBasicAtomic=de,e.isUserTypeDef=he,e.isCompoundArrayData=ve,e.isTurtle=Te,e.isAtomic=Be,e.isValueString=Le,e.isValueNumber=ze,e.isValueBoolean=nt,e.isValueTimestamp=pt,e.isValueDate=Et,e.mergeUniqueKeyRequirement=ut;const t=Object.prototype.hasOwnProperty;function r(ie,be){return t.call(ie,be)?ie[be]:void 0}function i(){return Object.create(null)}function o(ie){return"kids"in ie}function s(ie){return"e"in ie}function a(ie){return!(o(ie)||s(ie))}function l(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function u(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function d(ie,be){if(!("typeDef"in ie)){const Qe=typeof be=="string"?{type:be}:be;if(u(ie))return{...ie,typeDef:{...Qe}}}return ie}function c(ie){return"dstSQLType"in ie}function f(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function x(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function p(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function g(ie){var be;return(be=ie.as)!==null&&be!==void 0?be:ie.name}function m(ie){return ie===void 0||ie==="scalar"}function E(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function v(ie){return ie==="ungrouped_aggregate"}function _(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function A(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function C(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function b(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,be){return ie===be||b(ie)<b(be)}function S(ie,be){let Qe="scalar";return(ie==="aggregate"||be==="aggregate")&&(Qe="aggregate"),(ie==="ungrouped_aggregate"||be==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(ie==="scalar_analytic"||be==="scalar_analytic")&&(Qe="scalar_analytic"),(ie==="aggregate_analytic"||be==="aggregate_analytic")&&(Qe="aggregate_analytic"),(ie==="scalar_analytic"&&be==="aggregate"||ie==="aggregate"&&be==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function w(ie){return ie.reduce(S,"scalar")}function R(ie){return"e"in ie&&ie.e!==void 0}function O(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function I(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function B(ie){return I(ie)||ie==="record"||ie==="array"}function $(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function Y(ie){return B(ie.type)&&!R(ie)}function ee(ie,be){if(te(ie))return oe(ie.elementTypeDef,be);if(ne(ie)){const{type:Ie,fields:We,elementTypeDef:st}=ie;return{type:Ie,fields:We,elementTypeDef:st,join:"many",name:be}}if(ie.type==="record"){const{type:Ie,fields:We}=ie;return{type:Ie,fields:We,join:"one",name:be}}const Qe={name:be,type:ie.type};switch(ie.type){case"sql native":return{...Qe,rawType:ie.rawType};case"number":{const Ie=ie.numberType;return Ie?{...Qe,numberType:Ie}:Qe}case"date":{const Ie=ie.timeframe;return Ie?{name:be,type:"date",timeframe:Ie}:Qe}case"timestamp":{const Ie={name:be,type:"timestamp"};return ie.timeframe&&(Ie.timeframe=ie.timeframe),Ie}case"timestamptz":{const Ie={name:be,type:"timestamptz"};return ie.timeframe&&(Ie.timeframe=ie.timeframe),Ie}}return Qe}function oe(ie,be){if(ie.type==="record")return{type:"array",join:"many",name:be,elementTypeDef:{type:"record_element"},fields:ie.fields};const Qe=ee(ie,"value");return{type:"array",join:"many",name:be,elementTypeDef:ie,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function re(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function U(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function ne(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function J(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function te(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function q(ie){return["left","right","full","inner"].includes(ie)}function H(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function Q(ie){return"join"in ie}function k(ie){return gt(ie)&&Q(ie)}function j(ie){return["day","week","month","quarter","year"].includes(ie)}function P(ie){return j(ie)||["hour","minute","second"].includes(ie)}function V(ie){return P(ie)||ie==="day_of_week"||ie==="day_of_year"}var Z;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(Z||(e.ValueType=Z={}));function ae(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(be=>be.type==="error")||ie.queryFields.some(be=>be.type==="error")))}function le(ie){return ie.fields.some(be=>be.type==="error")}function se(ie){return ie.type==="reduce"}function xe(ie){return ie.type==="partial"}function pe(ie){return ie.type==="project"}function ye(ie){return pe(ie)||se(ie)}function Ce(ie){return ie.rows!==void 0}function me(ie){return ie.percent!==void 0}function _e(ie){return ie.enable!==void 0}function we(ie){return ie.type==="raw"}function Je(ie){return ie.type==="index"}function rt(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function ge(ie){var be;return(be=ie?.fieldUsage)!==null&&be!==void 0?be:[]}function Ee(ie){var be;return(be=ie?.givenUsage)!==null&&be!==void 0?be:[]}function Pe({fieldUsage:ie,givenUsage:be}){if(!(ie===void 0&&be===void 0))return{fieldUsage:ie??[],...be&&{givenUsage:be}}}function ke(ie,be){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(be)}}function Me(ie){return"sql"in ie}function Ze(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function at(ie){return ie.type==="source_registry_reference"}function Ge(ie){return{...ie}}function gt(ie){return ie.type==="table"||ie.type==="sql_select"||ie.type==="query_source"||ie.type==="query_result"||ie.type==="finalize"||ie.type==="nest_source"||ie.type==="virtual"||ie.type==="composite"}function yt(ie){return ie.type==="sql_select"||ie.type==="query_source"}function Ae(ie){return k(ie)?!1:!!gt(ie)}function Ve(ie){return ie==="literal"}function it(...ie){return ie.length<=1&&ie.every(be=>be==="literal")?"literal":ie.every(be=>be==="constant"||be==="literal")?"constant":ie.every(be=>be==="output"||be==="constant"||be==="literal")?"output":"input"}function de(ie){return ie.type==="string"||O(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function he(ie){return ie.type==="userType"}function ve(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Te(ie){return ie.type==="turtle"}function Be(ie){return B(ie.type)}function Le(ie,be){return be.type==="string"}function ze(ie,be){return be.type==="number"}function nt(ie,be){return be.type==="boolean"}function pt(ie,be){return be.type==="timestamp"}function Et(ie,be){return be.type==="date"}e.TD={isAtomic(ie){return ie!==void 0&&B(ie.type)},isBasicAtomic(ie){return ie!==void 0&&de({type:ie.type})},isString:ie=>ie?.type==="string",isNumber:ie=>ie?.type==="number",isBoolean:ie=>ie?.type==="boolean",isJSON:ie=>ie?.type==="json",isSQL:ie=>ie?.type==="sql native",isDate:ie=>ie?.type==="date",isTimestamp:ie=>ie?.type==="timestamp",isTimestamptz:ie=>ie?.type==="timestamptz",isAnyTimestamp(ie){return ie?.type==="timestamp"||ie?.type==="timestamptz"},isTemporal(ie){var be;const Qe=(be=ie?.type)!==null&&be!==void 0?be:"";return O(Qe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!e.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return ne(ie)?{type:"array",elementTypeDef:ie.elementTypeDef,fields:ie.fields}:{type:"array",elementTypeDef:ie.elementTypeDef};case"record":return{type:"record",fields:ie.fields};case"number":return ie.numberType?{type:"number",numberType:ie.numberType}:{type:"number"};case"sql native":return ie.rawType?{type:"sql native",rawType:ie.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return ie.timeframe?{type:ie.type,timeframe:ie.timeframe}:{type:ie.type};default:return{type:ie.type}}},eq(ie,be){if(ie===void 0||be===void 0)return!1;function Qe(Ie,We){const st={},mt=Ie.fields||[],lt=We.fields||[];if(mt.length!==lt.length)return!1;for(const ct of mt)if(ct.name)st[ct.name]=ct;else return!1;for(const ct of lt)if(!e.TD.eq(st[ct.name],ct))return!1;return!0}return ie.type==="array"&&be.type==="array"?ie.elementTypeDef.type!==be.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&be.elementTypeDef.type!=="record_element"?e.TD.eq(ie.elementTypeDef,be.elementTypeDef):e.TD.isAtomic(ie)&&e.TD.isAtomic(be)&&Qe(ie,be):ie.type==="record"&&be.type==="record"?e.TD.isAtomic(ie)&&e.TD.isAtomic(be)&&Qe(ie,be):ie.type==="sql native"&&be.type==="sql native"?ie.rawType!==void 0&&ie.rawType===be.rawType:ie.type===be.type}};function ut(ie,be){return ie?be?{isCount:ie.isCount||be.isCount}:ie:be}})(Z3)),Z3}var ER;function cs(){if(ER)return fr;ER=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.arg=t,fr.spread=r,fr.sql=i,fr.constant=o,fr.output=s,fr.literal=a,fr.variadicParam=l,fr.param=u,fr.makeParam=d,fr.maxScalar=c,fr.maxAggregate=f,fr.anyExprType=x,fr.maxUngroupedAggregate=p,fr.maxAnalytic=h,fr.minScalar=g,fr.minAggregate=m,fr.minAnalytic=E,fr.overload=v,fr.expandBlueprintMap=te,fr.expandOverrideMapFromBase=Q,fr.def=j;const e=He();function t(P){return{node:"function_parameter",name:P}}function r(P,V=void 0,Z=void 0){return{node:"spread",e:P,prefix:V,suffix:Z}}function i(P,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...V];let ce="";for(const le of P){ce+=le;const se=ae.shift();se!==void 0&&(typeof se=="string"?ce+=se:(Z.src.push(ce),Z.kids.args.push(se),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...V){return{name:P,isVariadic:!0,allowedTypes:V}}function u(P,...V){return{name:P,isVariadic:!1,allowedTypes:V}}function d(P,...V){return{param:u(P,...V),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function f(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function x(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function g(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function m(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function E(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function v(P,V,Z,ae){return{returnType:P,params:V,e:Z,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function _(P,V=!0,Z=!0){if(!V&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=V?_(P.array,!0):_(P.array,!1);return ae.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ae.fields}:{type:"array",elementTypeDef:ae}}else if("record"in P){const ae=[];for(const[ce,le]of Object.entries(P.record)){const se=V?_(le,!0):_(le,!1);e.TD.isAtomic(se)&&ae.push((0,e.mkFieldDef)(se,ce))}return{type:"record",fields:ae}}else if("generic"in P){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:P.generic}}else if("sql_native"in P)return{type:"sql native",rawType:P.sql_native};throw new Error("Cannot figure out type")}function A(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return g({type:P});if("array"in P)return x(_(P,!1));if("record"in P)return x(_(P,!1));if("generic"in P)return g(_(P,!1));if("literal"in P)return a(g(_(P.literal,!1)));if("constant"in P)return o(g(_(P.constant,!1)));if("dimension"in P)return g(_(P.dimension,!1));if("measure"in P)return m(_(P.measure,!1));if("sql_native"in P)return x({type:"sql native",rawType:P.sql_native});if("calculation"in P)return E(_(P.calculation,!1));throw new Error("Invalid function blueprint")}function C(P){return typeof P=="string"||"array"in P||"record"in P||"generic"in P||"literal"in P||"constant"in P||"dimension"in P||"measure"in P||"calculation"in P||"sql_native"in P}function b(P){return C(P)?[P]:Array.isArray(P)?P:C(P.variadic)?[P.variadic]:P.variadic}function D(P){if(typeof P=="string")return x({type:P});if("generic"in P)return x(_(P));if("literal"in P)return a(c(_(P.literal)));if("constant"in P)return o(c(_(P.constant)));if("dimension"in P)return c(_(P.dimension));if("measure"in P)return f(_(P.measure));if("array"in P)return x(_(P,!1));if("record"in P)return x(_(P,!1));if("sql_native"in P)return x({type:"sql native",rawType:P.sql_native});if("calculation"in P)return h(_(P.calculation));throw new Error("Invalid function blueprint")}function S(P){return P.map(V=>D(V))}function w(P){return typeof P!="string"&&"variadic"in P}function R(P,V){return{name:P,allowedTypes:S(b(V)),isVariadic:w(V)}}function O(P){return Object.entries(P).map(Z=>R(Z[0],Z[1]))}function I(P){const V=[],Z=[];let ae=P;for(;ae.length>0;){const le=ae.indexOf("${");if(le===-1){V.push(ae);break}const se=ae.slice(0,le);ae=ae.slice(le);const xe=ae.indexOf("}");if(xe===-1){V.push(se+ae);break}const pe=ae.slice(2,xe);ae=ae.slice(xe+1);const ye=pe.startsWith("..."),Ce=pe.endsWith(":"),me=ye?pe.slice(3):Ce?pe.slice(0,-1):pe,_e={node:"function_parameter",name:me};V.push(se),ye?Z.push({node:"spread",e:_e,prefix:"",suffix:""}):Ce&&me==="order_by"?Z.push({node:"aggregate_order_by"}):Ce&&me==="limit"?Z.push({node:"aggregate_limit"}):Z.push(_e)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function B(P,V){return w(V)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function $(P,V){const Z=Object.entries(V.takes),ae=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>B(ce[0],ce[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function Y(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:$(P.impl.function,P)}function ee(P){return{e:Y(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function oe(P){if(P!==void 0)return Object.entries(P).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ae=>_(ae,!0,!1))}))}function re(P){return{returnType:A(P.returns),params:O(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:oe(P.generic),...ee(P)}}function U(P){return"takes"in P&&"returns"in P&&"impl"in P}function ne(P){return"function"in P||"sql"in P||"expr"in P}function J(P){return U(P)?[re(P)]:Object.values(P).flatMap(V=>re(V))}function te(P){const V={};for(const Z in P)V[Z]=J(P[Z]);return V}function q(P,V){return[re({...P,impl:V})]}function H(P,V,Z){if(ne(Z)){if(!U(V))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return q(V,Z)}else{if(U(V))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ae,ce])=>{const le=V[ae];if(le===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return q(le,ce)})}}function Q(P,V){const Z={};for(const ae in V){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);Z[ae]=H(ae,P[ae],V[ae])}return Z}function*k(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const V of Object.values(P.record))yield*k(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in P){yield*k(P[V]);return}}}function j(P,V,Z,ae={}){let ce=!1;const le={};for(const xe of Object.values(V))for(const pe of k(xe))le[pe.generic]=["any"],ce=!0;ce&&ae.generic===void 0&&(ae.generic=le);const se={takes:V,returns:Z,impl:{function:P.toUpperCase()},...ae};return{[P]:se}}return fr}var ev={},wx={},vR;function hA(){if(vR)return wx;vR=1,Object.defineProperty(wx,"__esModule",{value:!0}),wx.decodeDottedTablePath=e,wx.validateDottedTablePath=t;function e(o,s){const{quoteChar:a,escapeStyle:l,bareIdentRegex:u,dialectName:d}=s;if(o.length===0)return{ok:!1,error:`${d} table path is empty`};const c=[];let f=0;for(;;){let x,p;if(o[f]===a){const h=r(o,f,a,l);if(h===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};x=h.decoded,p=!0,f=h.end}else{const h=o.slice(f).match(u);if(!h||h.index!==0||h[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${f}`};x=h[0],p=!1,f+=h[0].length}if(x.includes(";")||x.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(x)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:x,quoted:p}),f===o.length)return{ok:!0,segments:c};if(o[f]!==".")return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — expected '.' at position ${f}`};if(f++,f===o.length)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — trailing dot`}}}function t(o,s){const a=e(o,s);return a.ok?{ok:!0,canonical:o}:a}function r(o,s,a,l){let u=s+1,d="";for(;u<o.length;){if(l==="backslash"&&o[u]==="\\"){if(u+1>=o.length)return null;d+=i(o[u+1]),u+=2;continue}if(o[u]===a){if(l==="doubled"&&o[u+1]===a){d+=a,u+=2;continue}return{decoded:d,end:u+1}}d+=o[u],u++}return null}function i(o){switch(o){case"n":return`
|
|
2
2
|
`;case"t":return" ";case"r":return"\r";default:return o}}return wx}var _R;function Vs(){return _R||(_R=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=e.EscapeStyle=e.MAX_DECIMAL38=e.MIN_DECIMAL38=e.MAX_INT128=e.MIN_INT128=e.MAX_INT64=e.MIN_INT64=e.MAX_INT32=e.MIN_INT32=void 0,e.inDays=o,e.qtz=s,e.turtleGroupSetCondition=a;const t=He(),r=hA();e.MIN_INT32=-2147483648,e.MAX_INT32=2147483647,e.MIN_INT64=BigInt("-9223372036854775808"),e.MAX_INT64=BigInt("9223372036854775807"),e.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),e.MAX_INT128=BigInt("170141183460469231731687303715884105727"),e.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),e.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999"),e.EscapeStyle={Doubled:"doubled",Backslash:"backslash",Unset:"unset"};const i=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=i.indexOf("day");function o(u){return i.indexOf(u)>=e.dayIndex}function s(u){const d=u.queryTimezone;if(!(d===void 0||d===u.systemTimezone))return d}function a(u,d){return u===void 0?d:d?`group_set=${u} AND ${d}`:`group_set=${u}`}class l{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsNestedProjectionLimit=!1,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsBigIntPrecision=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.maxIdentifierLength=128,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.requiresExplicitUnnestOrdering=!1,this.hasLateralColumnAliasInSelect=!1,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0,this.integerTypeMappings=[{min:BigInt(e.MIN_INT32),max:BigInt(e.MAX_INT32),numberType:"integer"},{min:e.MIN_INT64,max:e.MAX_INT64,numberType:"bigint"}],this.tablePathBareIdentRegex=/^[A-Za-z_][A-Za-z0-9_]*/,this.identifierQuoteChar="",this.stringLiteralStyle=e.EscapeStyle.Unset,this.identifierEscapeStyle=e.EscapeStyle.Unset}sqlLateralJoinBag(d){throw this.cantPartitionWindowFunctionsOnExpressions?new Error(`Dialect '${this.name}' sets cantPartitionWindowFunctionsOnExpressions but does not implement sqlLateralJoinBag`):new Error("Internal error: sqlLateralJoinBag called but cantPartitionWindowFunctionsOnExpressions is false")}literalNumberType(d){if(!/^-?\d+$/.test(d))return{type:"number",numberType:"float"};const f=BigInt(d);for(const x of this.integerTypeMappings)if(f>=x.min&&f<=x.max)return{type:"number",numberType:x.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(d,c,f,x,p){var h;const g=(h=d?.hasTimestamptz)!==null&&h!==void 0?h:!1;return p==="date"?{node:"dateLiteral",literal:c,typeDef:{type:"date",timeframe:x!==void 0&&(0,t.isDateUnit)(x)?x:void 0}}:f&&g?{node:"timestamptzLiteral",literal:c,typeDef:{type:"timestamptz",timeframe:x},timezone:f}:f?{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:x},timezone:f}:{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:x}}}sqlValidateTableName(d){if(this.identifierEscapeStyle!==e.EscapeStyle.Doubled&&this.identifierEscapeStyle!==e.EscapeStyle.Backslash)throw new Error(`${this.name}: sqlValidateTableName requires identifierEscapeStyle to be set to Doubled or Backslash (or override sqlValidateTableName).`);return(0,r.validateDottedTablePath)(d,{quoteChar:this.identifierQuoteChar,escapeStyle:this.identifierEscapeStyle,bareIdentRegex:this.tablePathBareIdentRegex,dialectName:this.name})}sqlTurtleOrderByClause(d){const c=d.map(f=>` ${f.field} ${f.dir.toUpperCase()}`);return" "+this.sqlOrderBy(c,"turtle")}sqlFinalStage(d,c){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}escapeBackslashStyle(d,c){let f="";for(const x of d)switch(x){case"\\":f+="\\\\";break;case`
|
|
3
3
|
`:f+="\\n";break;case"\r":f+="\\r";break;case" ":f+="\\t";break;case c:f+="\\"+c;break;default:f+=x}return f}sqlQuoteIdentifier(d){const c=this.identifierQuoteChar;if(!c)throw new Error(`${this.name}: identifierQuoteChar is not set. Set it on the dialect (e.g. '"' or "\`"), or override sqlQuoteIdentifier.`);if(this.identifierEscapeStyle===e.EscapeStyle.Doubled)return c+d.split(c).join(c+c)+c;if(this.identifierEscapeStyle===e.EscapeStyle.Backslash)return c+this.escapeBackslashStyle(d,c)+c;throw new Error(`${this.name}: identifierEscapeStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlQuoteIdentifier.`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}needsCivilTimeComputation(d,c,f,x){const p=["day","week","month","quarter","year"],h=c!==void 0&&p.includes(c),g=f!==void 0&&p.includes(f),m=s(x);return{needed:t.TD.isAnyTimestamp(d)&&(h||g)&&m!==void 0,tz:m}}sqlTruncAndOffset(d,c,f,x){if(t.TD.isAnyTimestamp(d.typeDef)){const{needed:h,tz:g}=this.needsCivilTimeComputation(d.typeDef,f,x?.unit,c);if(h&&g){const m=this.sqlConvertToCivilTime(d.sql,g,d.typeDef);let E=m.sql;const v=m.typeDef;return f&&(E=this.sqlTruncate(E,f,v,!0,g)),x&&(E=this.sqlOffsetTime(E,x.op,x.magnitude,x.unit,v,!0,g)),this.sqlConvertFromCivilTime(E,g,d.typeDef)}}let p=d.sql;return f&&(p=this.sqlTruncate(p,f,d.typeDef,!1,s(c))),x&&(p=this.sqlOffsetTime(p,x.op,x.magnitude,x.unit,d.typeDef,!1,s(c))),p}sqlLiteralString(d){if(this.stringLiteralStyle==="doubled")return"'"+d.split("'").join("''")+"'";if(this.stringLiteralStyle==="backslash")return"'"+this.escapeBackslashStyle(d,"'")+"'";throw new Error(`${this.name}: stringLiteralStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlLiteralString.`)}sqlLiteralRegexp(d){return this.sqlLiteralString(d)}exprToSQL(d,c){switch(c.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(c);case"delta":{const f=c.kids.base;return f.node==="trunc"?this.sqlTruncAndOffset(f.e,d,f.units,{op:c.op,magnitude:c.kids.delta.sql,unit:c.units}):this.sqlTruncAndOffset(f,d,void 0,{op:c.op,magnitude:c.kids.delta.sql,unit:c.units})}case"trunc":return this.sqlTruncAndOffset(c.e,d,c.units);case"extract":return this.sqlTimeExtractExpr(d,c);case"cast":return this.sqlCast(d,c);case"regexpMatch":return this.sqlRegexpMatch(c);case"/":return this.divisionIsInteger?`${c.kids.left.sql}*1.0/${c.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${c.kids.left.sql},${c.kids.right.sql})`;case"dateLiteral":return this.sqlDateLiteral(d,c.literal);case"timestampLiteral":return this.sqlTimestampLiteral(d,c.literal,c.timezone);case"timestamptzLiteral":return this.sqlTimestamptzLiteral(d,c.literal,c.timezone);case"stringLiteral":return this.sqlLiteralString(c.literal);case"numberLiteral":return this.sqlLiteralNumber(c.literal);case"regexpLiteral":return this.sqlLiteralRegexp(c.literal);case"recordLiteral":return this.sqlLiteralRecord(c);case"arrayLiteral":return this.sqlLiteralArray(c)}}sqlSumDistinct(d,c,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,c,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,c){if(c!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,c){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,c){return this.concat(d,"'x'",c)}sqlStringAggDistinct(d,c,f){const x="__STRING_AGG_KS__",p="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
4
4
|
STRING_AGG(DISTINCT ${`concat('${x}', ${d}, '${p}', ${c})`}${f.length>0?","+f:""}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aS as a}from"./index-
|
|
1
|
+
import{aS as a}from"./index-sZHvyEzw.js";import{r as f}from"./index-w_0OQJgZ.js";function c(t,n){for(var o=0;o<n.length;o++){const e=n[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s=f();const p=a(s),l=c({__proto__:null,default:p},[s]);export{s as d,l as i};
|