@malloy-publisher/app 0.0.217 → 0.0.218
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 +98 -0
- package/dist/assets/{EnvironmentPage-BX71Wsun.js → EnvironmentPage-DxOiCxcd.js} +1 -1
- package/dist/assets/{HomePage-Bnp4Puv4.js → HomePage-i8qAtD6x.js} +1 -1
- package/dist/assets/{MainPage-chkqUlI0.js → MainPage-B58d5pmX.js} +1 -1
- package/dist/assets/{MaterializationsPage-DG4e_wRd.js → MaterializationsPage-6OEVM543.js} +1 -1
- package/dist/assets/{ModelPage-DbLU-ABs.js → ModelPage-8d5l7YkU.js} +1 -1
- package/dist/assets/{PackagePage-EvWf3VZ4.js → PackagePage-BVmoVsPQ.js} +1 -1
- package/dist/assets/{RouteError-POj8kImc.js → RouteError-DFX521_t.js} +1 -1
- package/dist/assets/{WorkbookPage-Bkq3C1MS.js → WorkbookPage-CzucDJ-T.js} +1 -1
- package/dist/assets/{core-DiLT6QvL.es-Jn6sdy15.js → core-B95VQkAV.es-Cbn-yKG-.js} +1 -1
- package/dist/assets/{index-gjr27uMq.js → index--xJ1pzL-.js} +3 -3
- package/dist/assets/{index-bAdd7U9-.js → index-Bxkza-hz.js} +1 -1
- package/dist/assets/{index-C_AT6ZZw.js → index-DxRKma36.js} +1 -1
- package/dist/assets/{index.umd-BxzPw_1E.js → index.umd-o-yUIEtS.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as Q$,aj as mF,r as O,j as L,ak as Ut,R as gF,al as yF,am as ls}from"./index-gjr27uMq.js";import{r as rf,a as Zs,b as eA,d as dt}from"./index-bAdd7U9-.js";import{a as qC}from"./index.umd-BxzPw_1E.js";var Ao={},k3={},fr={},M3={},iR;function He(){return iR||(iR=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=h,e.isParameterType=p,e.paramHasValue=x,e.activeName=m,e.expressionIsScalar=g,e.expressionIsAggregate=y,e.expressionIsUngroupedAggregate=_,e.expressionInvolvesAggregate=S,e.expressionIsCalculation=C,e.expressionIsAnalytic=T,e.isExpressionTypeLEQ=v,e.maxExpressionType=R,e.maxOfExpressionTypes=D,e.hasExpression=w,e.isTemporalType=N,e.isBasicAtomicType=I,e.isAtomicFieldType=k,e.canOrderBy=U,e.fieldIsIntrinsic=J,e.mkFieldDef=te,e.mkArrayDef=ne,e.mkArrayTypeDef=oe,e.isRepeatedRecordFunctionParam=H,e.isRepeatedRecord=Z,e.isRecordOrRepeatedRecord=K,e.isBasicArray=ee,e.isMatrixOperation=$,e.isJoinable=Q,e.isJoined=z,e.isJoinedSource=M,e.isDateUnit=q,e.isTimestampUnit=P,e.isExtractUnit=Y,e.refIsStructDef=ae,e.segmentHasErrors=le,e.structHasErrors=ue,e.isReduceSegment=ie,e.isPartialSegment=de,e.isProjectSegment=xe,e.isQuerySegment=me,e.isSamplingRows=Ce,e.isSamplingPercent=he,e.isSamplingEnable=ve,e.isRawSegment=Re,e.isIndexSegment=Ve,e.bareFieldUsage=et,e.fieldUsageFrom=pe,e.givenUsageFrom=ge,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.setFieldUsage=Me,e.isSegmentSQL=Ke,e.isSegmentSource=st,e.isSourceRegistryReference=Qe,e.sourceBase=gt,e.isSourceDef=ht,e.isPersistableSourceDef=Te,e.isBaseTable=ze,e.isLiteral=nt,e.mergeEvalSpaces=ce,e.isBasicAtomic=fe,e.isUserTypeDef=Ee,e.isCompoundArrayData=be,e.isTurtle=Be,e.isAtomic=Ie,e.isValueString=Ge,e.isValueNumber=tt,e.isValueBoolean=pt,e.isValueTimestamp=mt,e.isValueDate=ot,e.mergeUniqueKeyRequirement=Xe;const t=Object.prototype.hasOwnProperty;function r(re,Ae){return t.call(re,Ae)?re[Ae]:void 0}function i(){return Object.create(null)}function o(re){return"kids"in re}function s(re){return"e"in re}function a(re){return!(o(re)||s(re))}function l(re){return re.node==="aggregate"&&["sum","avg","count","distinct"].includes(re.function)}function u(re){return re.node!=="arrayLiteral"&&re.node!=="recordLiteral"}function d(re,Ae){if(!("typeDef"in re)){const Ne=typeof Ae=="string"?{type:Ae}:Ae;if(u(re))return{...re,typeDef:{...Ne}}}return re}function c(re){return"dstSQLType"in re}function f(re){return["string","number","boolean","date","timestamp","timestamptz"].includes(re)}function h(re){return re.node==="dateLiteral"||re.node==="timestampLiteral"||re.node==="timestamptzLiteral"}function p(re){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(re)}function x(re){return re.value!==null}function m(re){var Ae;return(Ae=re.as)!==null&&Ae!==void 0?Ae:re.name}function g(re){return re===void 0||re==="scalar"}function y(re){return re==="aggregate"||re==="ungrouped_aggregate"}function _(re){return re==="ungrouped_aggregate"}function S(re){return re==="aggregate"||re==="ungrouped_aggregate"||re==="aggregate_analytic"}function C(re){return re==="aggregate"||re==="scalar_analytic"||re==="aggregate_analytic"||re==="ungrouped_aggregate"}function T(re){return re==="aggregate_analytic"||re==="scalar_analytic"}function b(re){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[re]}function v(re,Ae){return re===Ae||b(re)<b(Ae)}function R(re,Ae){let Ne="scalar";return(re==="aggregate"||Ae==="aggregate")&&(Ne="aggregate"),(re==="ungrouped_aggregate"||Ae==="ungrouped_aggregate")&&(Ne="ungrouped_aggregate"),(re==="scalar_analytic"||Ae==="scalar_analytic")&&(Ne="scalar_analytic"),(re==="aggregate_analytic"||Ae==="aggregate_analytic")&&(Ne="aggregate_analytic"),(re==="scalar_analytic"&&Ae==="aggregate"||re==="aggregate"&&Ae==="scalar_analytic")&&(Ne="aggregate_analytic"),Ne}function D(re){return re.reduce(R,"scalar")}function w(re){return"e"in re&&re.e!==void 0}function N(re){return re==="date"||re==="timestamp"||re==="timestamptz"}function I(re){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(re)}function k(re){return I(re)||re==="record"||re==="array"}function U(re){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(re)}function J(re){return k(re.type)&&!w(re)}function te(re,Ae){if(ee(re))return ne(re.elementTypeDef,Ae);if(Z(re)){const{type:qe,fields:rt,elementTypeDef:lt}=re;return{type:qe,fields:rt,elementTypeDef:lt,join:"many",name:Ae}}if(re.type==="record"){const{type:qe,fields:rt}=re;return{type:qe,fields:rt,join:"one",name:Ae}}const Ne={name:Ae,type:re.type};switch(re.type){case"sql native":return{...Ne,rawType:re.rawType};case"number":{const qe=re.numberType;return qe?{...Ne,numberType:qe}:Ne}case"date":{const qe=re.timeframe;return qe?{name:Ae,type:"date",timeframe:qe}:Ne}case"timestamp":{const qe={name:Ae,type:"timestamp"};return re.timeframe&&(qe.timeframe=re.timeframe),qe}case"timestamptz":{const qe={name:Ae,type:"timestamptz"};return re.timeframe&&(qe.timeframe=re.timeframe),qe}}return Ne}function ne(re,Ae){if(re.type==="record")return{type:"array",join:"many",name:Ae,elementTypeDef:{type:"record_element"},fields:re.fields};const Ne=te(re,"value");return{type:"array",join:"many",name:Ae,elementTypeDef:re,fields:[Ne,{...Ne,name:"each",e:{node:"field",path:["value"]}}]}}function oe(re){return re.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:re.fields}:{type:"array",elementTypeDef:re}}function H(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function Z(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function K(re){return re.type==="record"||re.type==="array"&&"elementTypeDef"in re&&re.elementTypeDef.type==="record_element"}function ee(re){return re.type==="array"&&re.elementTypeDef.type!=="record_element"}function $(re){return["left","right","full","inner"].includes(re)}function Q(re){return["composite","table","sql_select","query_source","virtual","array","record"].includes(re.type)}function z(re){return"join"in re}function M(re){return ht(re)&&z(re)}function q(re){return["day","week","month","quarter","year"].includes(re)}function P(re){return q(re)||["hour","minute","second"].includes(re)}function Y(re){return P(re)||re==="day_of_week"||re==="day_of_year"}var X;(function(re){re.Date="date",re.Timestamp="timestamp",re.Number="number",re.String="string"})(X||(e.ValueType=X={}));function ae(re){return typeof re!="string"}function le(re){return!!((re.type==="reduce"||re.type==="project"||re.type==="partial")&&(re.extendSource&&re.extendSource.some(Ae=>Ae.type==="error")||re.queryFields.some(Ae=>Ae.type==="error")))}function ue(re){return re.fields.some(Ae=>Ae.type==="error")}function ie(re){return re.type==="reduce"}function de(re){return re.type==="partial"}function xe(re){return re.type==="project"}function me(re){return xe(re)||ie(re)}function Ce(re){return re.rows!==void 0}function he(re){return re.percent!==void 0}function ve(re){return re.enable!==void 0}function Re(re){return re.type==="raw"}function Ve(re){return re.type==="index"}function et(re){return re.uniqueKeyRequirement===void 0&&re.analyticFunctionUse===void 0}function pe(re){var Ae;return(Ae=re?.fieldUsage)!==null&&Ae!==void 0?Ae:[]}function ge(re){var Ae;return(Ae=re?.givenUsage)!==null&&Ae!==void 0?Ae:[]}function Pe({fieldUsage:re,givenUsage:Ae}){if(!(re===void 0&&Ae===void 0))return{fieldUsage:re??[],...Ae&&{givenUsage:Ae}}}function ke(re,Ae){return re&&{...re,fieldUsage:re.fieldUsage.map(Ae)}}function Me(re,Ae){re.refSummary?re.refSummary.fieldUsage=Ae:re.refSummary={fieldUsage:Ae}}function Ke(re){return"sql"in re}function st(re){return"type"in re&&(re.type==="sql_select"||re.type==="query_source")}function Qe(re){return re.type==="source_registry_reference"}function gt(re){return{...re}}function ht(re){return re.type==="table"||re.type==="sql_select"||re.type==="query_source"||re.type==="query_result"||re.type==="finalize"||re.type==="nest_source"||re.type==="virtual"||re.type==="composite"}function Te(re){return re.type==="sql_select"||re.type==="query_source"}function ze(re){return M(re)?!1:!!ht(re)}function nt(re){return re==="literal"}function ce(...re){return re.length<=1&&re.every(Ae=>Ae==="literal")?"literal":re.every(Ae=>Ae==="constant"||Ae==="literal")?"constant":re.every(Ae=>Ae==="output"||Ae==="constant"||Ae==="literal")?"output":"input"}function fe(re){return re.type==="string"||N(re.type)||re.type==="number"||re.type==="boolean"||re.type==="json"||re.type==="sql native"||re.type==="error"}function Ee(re){return re.type==="userType"}function be(re){return Array.isArray(re)&&(re.length===0||typeof re[0]=="object"&&re[0]!==null&&!Array.isArray(re[0]))}function Be(re){return re.type==="turtle"}function Ie(re){return k(re.type)}function Ge(re,Ae){return Ae.type==="string"}function tt(re,Ae){return Ae.type==="number"}function pt(re,Ae){return Ae.type==="boolean"}function mt(re,Ae){return Ae.type==="timestamp"}function ot(re,Ae){return Ae.type==="date"}e.TD={isAtomic(re){return re!==void 0&&k(re.type)},isBasicAtomic(re){return re!==void 0&&fe({type:re.type})},isString:re=>re?.type==="string",isNumber:re=>re?.type==="number",isBoolean:re=>re?.type==="boolean",isJSON:re=>re?.type==="json",isSQL:re=>re?.type==="sql native",isDate:re=>re?.type==="date",isTimestamp:re=>re?.type==="timestamp",isTimestamptz:re=>re?.type==="timestamptz",isAnyTimestamp(re){return re?.type==="timestamp"||re?.type==="timestamptz"},isTemporal(re){var Ae;const Ne=(Ae=re?.type)!==null&&Ae!==void 0?Ae:"";return N(Ne)},isError:re=>re?.type==="error",atomicDef(re){if(!e.TD.isAtomic(re))return{type:"error"};switch(re.type){case"array":return Z(re)?{type:"array",elementTypeDef:re.elementTypeDef,fields:re.fields}:{type:"array",elementTypeDef:re.elementTypeDef};case"record":return{type:"record",fields:re.fields};case"number":return re.numberType?{type:"number",numberType:re.numberType}:{type:"number"};case"sql native":return re.rawType?{type:"sql native",rawType:re.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return re.timeframe?{type:re.type,timeframe:re.timeframe}:{type:re.type};default:return{type:re.type}}},eq(re,Ae){if(re===void 0||Ae===void 0)return!1;function Ne(qe,rt){const lt={},at=qe.fields||[],ct=rt.fields||[];if(at.length!==ct.length)return!1;for(const Lt of at)if(Lt.name)lt[Lt.name]=Lt;else return!1;for(const Lt of ct)if(!e.TD.eq(lt[Lt.name],Lt))return!1;return!0}return re.type==="array"&&Ae.type==="array"?re.elementTypeDef.type!==Ae.elementTypeDef.type?!1:re.elementTypeDef.type!=="record_element"&&Ae.elementTypeDef.type!=="record_element"?e.TD.eq(re.elementTypeDef,Ae.elementTypeDef):e.TD.isAtomic(re)&&e.TD.isAtomic(Ae)&&Ne(re,Ae):re.type==="record"&&Ae.type==="record"?e.TD.isAtomic(re)&&e.TD.isAtomic(Ae)&&Ne(re,Ae):re.type==="sql native"&&Ae.type==="sql native"?re.rawType!==void 0&&re.rawType===Ae.rawType:re.type===Ae.type}};function Xe(re,Ae){return re?Ae?{isCount:re.isCount||Ae.isCount}:re:Ae}})(M3)),M3}var sR;function ms(){if(sR)return fr;sR=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=h,fr.maxUngroupedAggregate=p,fr.maxAnalytic=x,fr.minScalar=m,fr.minAggregate=g,fr.minAnalytic=y,fr.overload=_,fr.expandBlueprintMap=ee,fr.expandOverrideMapFromBase=z,fr.def=q;const e=He();function t(P){return{node:"function_parameter",name:P}}function r(P,Y=void 0,X=void 0){return{node:"spread",e:P,prefix:Y,suffix:X}}function i(P,...Y){const X={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...Y];let le="";for(const ue of P){le+=ue;const ie=ae.shift();ie!==void 0&&(typeof ie=="string"?le+=ie:(X.src.push(le),X.kids.args.push(ie),le=""))}return le.length>0&&X.src.push(le),X}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...Y){return{name:P,isVariadic:!0,allowedTypes:Y}}function u(P,...Y){return{name:P,isVariadic:!1,allowedTypes:Y}}function d(P,...Y){return{param:u(P,...Y),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function f(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function x(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function g(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function y(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function _(P,Y,X,ae){return{returnType:P,params:Y,e:X,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function S(P,Y=!0,X=!0){if(!Y&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=Y?S(P.array,!0):S(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[le,ue]of Object.entries(P.record)){const ie=Y?S(ue,!0):S(ue,!1);e.TD.isAtomic(ie)&&ae.push((0,e.mkFieldDef)(ie,le))}return{type:"record",fields:ae}}else if("generic"in P){if(!X)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 C(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return m({type:P});if("array"in P)return h(S(P,!1));if("record"in P)return h(S(P,!1));if("generic"in P)return m(S(P,!1));if("literal"in P)return a(m(S(P.literal,!1)));if("constant"in P)return o(m(S(P.constant,!1)));if("dimension"in P)return m(S(P.dimension,!1));if("measure"in P)return g(S(P.measure,!1));if("sql_native"in P)return h({type:"sql native",rawType:P.sql_native});if("calculation"in P)return y(S(P.calculation,!1));throw new Error("Invalid function blueprint")}function T(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 T(P)?[P]:Array.isArray(P)?P:T(P.variadic)?[P.variadic]:P.variadic}function v(P){if(typeof P=="string")return h({type:P});if("generic"in P)return h(S(P));if("literal"in P)return a(c(S(P.literal)));if("constant"in P)return o(c(S(P.constant)));if("dimension"in P)return c(S(P.dimension));if("measure"in P)return f(S(P.measure));if("array"in P)return h(S(P,!1));if("record"in P)return h(S(P,!1));if("sql_native"in P)return h({type:"sql native",rawType:P.sql_native});if("calculation"in P)return x(S(P.calculation));throw new Error("Invalid function blueprint")}function R(P){return P.map(Y=>v(Y))}function D(P){return typeof P!="string"&&"variadic"in P}function w(P,Y){return{name:P,allowedTypes:R(b(Y)),isVariadic:D(Y)}}function N(P){return Object.entries(P).map(X=>w(X[0],X[1]))}function I(P){const Y=[],X=[];let ae=P;for(;ae.length>0;){const ue=ae.indexOf("${");if(ue===-1){Y.push(ae);break}const ie=ae.slice(0,ue);ae=ae.slice(ue);const de=ae.indexOf("}");if(de===-1){Y.push(ie+ae);break}const xe=ae.slice(2,de);ae=ae.slice(de+1);const me=xe.startsWith("..."),Ce=xe.endsWith(":"),he=me?xe.slice(3):Ce?xe.slice(0,-1):xe,ve={node:"function_parameter",name:he};Y.push(ie),me?X.push({node:"spread",e:ve,prefix:"",suffix:""}):Ce&&he==="order_by"?X.push({node:"aggregate_order_by"}):Ce&&he==="limit"?X.push({node:"aggregate_limit"}):X.push(ve)}return{node:"genericSQLExpr",kids:{args:X},src:Y}}function k(P,Y){return D(Y)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function U(P,Y){const X=Object.entries(Y.takes),ae=X.length>0?X.length-1:0;return{node:"genericSQLExpr",kids:{args:X.map(le=>k(le[0],le[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function J(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:U(P.impl.function,P)}function te(P){return{e:J(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function ne(P){if(P!==void 0)return Object.entries(P).map(([Y,X])=>({name:Y,acceptibleTypes:X.map(ae=>S(ae,!0,!1))}))}function oe(P){return{returnType:C(P.returns),params:N(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:ne(P.generic),...te(P)}}function H(P){return"takes"in P&&"returns"in P&&"impl"in P}function Z(P){return"function"in P||"sql"in P||"expr"in P}function K(P){return H(P)?[oe(P)]:Object.values(P).flatMap(Y=>oe(Y))}function ee(P){const Y={};for(const X in P)Y[X]=K(P[X]);return Y}function $(P,Y){return[oe({...P,impl:Y})]}function Q(P,Y,X){if(Z(X)){if(!H(Y))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Y)})`);return $(Y,X)}else{if(H(Y))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(X)})`);return Object.entries(X).flatMap(([ae,le])=>{const ue=Y[ae];if(ue===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return $(ue,le)})}}function z(P,Y){const X={};for(const ae in Y){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);X[ae]=Q(ae,P[ae],Y[ae])}return X}function*M(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const Y of Object.values(P.record))yield*M(Y);else for(const Y of["array","literal","measure","dimension","measure","constant","cacluation"])if(Y in P){yield*M(P[Y]);return}}}function q(P,Y,X,ae={}){let le=!1;const ue={};for(const de of Object.values(Y))for(const xe of M(de))ue[xe.generic]=["any"],le=!0;le&&ae.generic===void 0&&(ae.generic=ue);const ie={takes:Y,returns:X,impl:{function:P.toUpperCase()},...ae};return{[P]:ie}}return fr}var B3={},Lx={},oR;function tA(){if(oR)return Lx;oR=1,Object.defineProperty(Lx,"__esModule",{value:!0}),Lx.decodeDottedTablePath=e,Lx.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 h,p;if(o[f]===a){const x=r(o,f,a,l);if(x===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};h=x.decoded,p=!0,f=x.end}else{const x=o.slice(f).match(u);if(!x||x.index!==0||x[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${f}`};h=x[0],p=!1,f+=x[0].length}if(h.includes(";")||h.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(h)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:h,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{ai as Q$,aj as mF,r as O,j as L,ak as Ut,R as gF,al as yF,am as ls}from"./index--xJ1pzL-.js";import{r as rf,a as Zs,b as eA,d as dt}from"./index-Bxkza-hz.js";import{a as qC}from"./index.umd-o-yUIEtS.js";var Ao={},k3={},fr={},M3={},iR;function He(){return iR||(iR=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=h,e.isParameterType=p,e.paramHasValue=x,e.activeName=m,e.expressionIsScalar=g,e.expressionIsAggregate=y,e.expressionIsUngroupedAggregate=_,e.expressionInvolvesAggregate=S,e.expressionIsCalculation=C,e.expressionIsAnalytic=T,e.isExpressionTypeLEQ=v,e.maxExpressionType=R,e.maxOfExpressionTypes=D,e.hasExpression=w,e.isTemporalType=N,e.isBasicAtomicType=I,e.isAtomicFieldType=k,e.canOrderBy=U,e.fieldIsIntrinsic=J,e.mkFieldDef=te,e.mkArrayDef=ne,e.mkArrayTypeDef=oe,e.isRepeatedRecordFunctionParam=H,e.isRepeatedRecord=Z,e.isRecordOrRepeatedRecord=K,e.isBasicArray=ee,e.isMatrixOperation=$,e.isJoinable=Q,e.isJoined=z,e.isJoinedSource=M,e.isDateUnit=q,e.isTimestampUnit=P,e.isExtractUnit=Y,e.refIsStructDef=ae,e.segmentHasErrors=le,e.structHasErrors=ue,e.isReduceSegment=ie,e.isPartialSegment=de,e.isProjectSegment=xe,e.isQuerySegment=me,e.isSamplingRows=Ce,e.isSamplingPercent=he,e.isSamplingEnable=ve,e.isRawSegment=Re,e.isIndexSegment=Ve,e.bareFieldUsage=et,e.fieldUsageFrom=pe,e.givenUsageFrom=ge,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.setFieldUsage=Me,e.isSegmentSQL=Ke,e.isSegmentSource=st,e.isSourceRegistryReference=Qe,e.sourceBase=gt,e.isSourceDef=ht,e.isPersistableSourceDef=Te,e.isBaseTable=ze,e.isLiteral=nt,e.mergeEvalSpaces=ce,e.isBasicAtomic=fe,e.isUserTypeDef=Ee,e.isCompoundArrayData=be,e.isTurtle=Be,e.isAtomic=Ie,e.isValueString=Ge,e.isValueNumber=tt,e.isValueBoolean=pt,e.isValueTimestamp=mt,e.isValueDate=ot,e.mergeUniqueKeyRequirement=Xe;const t=Object.prototype.hasOwnProperty;function r(re,Ae){return t.call(re,Ae)?re[Ae]:void 0}function i(){return Object.create(null)}function o(re){return"kids"in re}function s(re){return"e"in re}function a(re){return!(o(re)||s(re))}function l(re){return re.node==="aggregate"&&["sum","avg","count","distinct"].includes(re.function)}function u(re){return re.node!=="arrayLiteral"&&re.node!=="recordLiteral"}function d(re,Ae){if(!("typeDef"in re)){const Ne=typeof Ae=="string"?{type:Ae}:Ae;if(u(re))return{...re,typeDef:{...Ne}}}return re}function c(re){return"dstSQLType"in re}function f(re){return["string","number","boolean","date","timestamp","timestamptz"].includes(re)}function h(re){return re.node==="dateLiteral"||re.node==="timestampLiteral"||re.node==="timestamptzLiteral"}function p(re){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(re)}function x(re){return re.value!==null}function m(re){var Ae;return(Ae=re.as)!==null&&Ae!==void 0?Ae:re.name}function g(re){return re===void 0||re==="scalar"}function y(re){return re==="aggregate"||re==="ungrouped_aggregate"}function _(re){return re==="ungrouped_aggregate"}function S(re){return re==="aggregate"||re==="ungrouped_aggregate"||re==="aggregate_analytic"}function C(re){return re==="aggregate"||re==="scalar_analytic"||re==="aggregate_analytic"||re==="ungrouped_aggregate"}function T(re){return re==="aggregate_analytic"||re==="scalar_analytic"}function b(re){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[re]}function v(re,Ae){return re===Ae||b(re)<b(Ae)}function R(re,Ae){let Ne="scalar";return(re==="aggregate"||Ae==="aggregate")&&(Ne="aggregate"),(re==="ungrouped_aggregate"||Ae==="ungrouped_aggregate")&&(Ne="ungrouped_aggregate"),(re==="scalar_analytic"||Ae==="scalar_analytic")&&(Ne="scalar_analytic"),(re==="aggregate_analytic"||Ae==="aggregate_analytic")&&(Ne="aggregate_analytic"),(re==="scalar_analytic"&&Ae==="aggregate"||re==="aggregate"&&Ae==="scalar_analytic")&&(Ne="aggregate_analytic"),Ne}function D(re){return re.reduce(R,"scalar")}function w(re){return"e"in re&&re.e!==void 0}function N(re){return re==="date"||re==="timestamp"||re==="timestamptz"}function I(re){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(re)}function k(re){return I(re)||re==="record"||re==="array"}function U(re){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(re)}function J(re){return k(re.type)&&!w(re)}function te(re,Ae){if(ee(re))return ne(re.elementTypeDef,Ae);if(Z(re)){const{type:qe,fields:rt,elementTypeDef:lt}=re;return{type:qe,fields:rt,elementTypeDef:lt,join:"many",name:Ae}}if(re.type==="record"){const{type:qe,fields:rt}=re;return{type:qe,fields:rt,join:"one",name:Ae}}const Ne={name:Ae,type:re.type};switch(re.type){case"sql native":return{...Ne,rawType:re.rawType};case"number":{const qe=re.numberType;return qe?{...Ne,numberType:qe}:Ne}case"date":{const qe=re.timeframe;return qe?{name:Ae,type:"date",timeframe:qe}:Ne}case"timestamp":{const qe={name:Ae,type:"timestamp"};return re.timeframe&&(qe.timeframe=re.timeframe),qe}case"timestamptz":{const qe={name:Ae,type:"timestamptz"};return re.timeframe&&(qe.timeframe=re.timeframe),qe}}return Ne}function ne(re,Ae){if(re.type==="record")return{type:"array",join:"many",name:Ae,elementTypeDef:{type:"record_element"},fields:re.fields};const Ne=te(re,"value");return{type:"array",join:"many",name:Ae,elementTypeDef:re,fields:[Ne,{...Ne,name:"each",e:{node:"field",path:["value"]}}]}}function oe(re){return re.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:re.fields}:{type:"array",elementTypeDef:re}}function H(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function Z(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function K(re){return re.type==="record"||re.type==="array"&&"elementTypeDef"in re&&re.elementTypeDef.type==="record_element"}function ee(re){return re.type==="array"&&re.elementTypeDef.type!=="record_element"}function $(re){return["left","right","full","inner"].includes(re)}function Q(re){return["composite","table","sql_select","query_source","virtual","array","record"].includes(re.type)}function z(re){return"join"in re}function M(re){return ht(re)&&z(re)}function q(re){return["day","week","month","quarter","year"].includes(re)}function P(re){return q(re)||["hour","minute","second"].includes(re)}function Y(re){return P(re)||re==="day_of_week"||re==="day_of_year"}var X;(function(re){re.Date="date",re.Timestamp="timestamp",re.Number="number",re.String="string"})(X||(e.ValueType=X={}));function ae(re){return typeof re!="string"}function le(re){return!!((re.type==="reduce"||re.type==="project"||re.type==="partial")&&(re.extendSource&&re.extendSource.some(Ae=>Ae.type==="error")||re.queryFields.some(Ae=>Ae.type==="error")))}function ue(re){return re.fields.some(Ae=>Ae.type==="error")}function ie(re){return re.type==="reduce"}function de(re){return re.type==="partial"}function xe(re){return re.type==="project"}function me(re){return xe(re)||ie(re)}function Ce(re){return re.rows!==void 0}function he(re){return re.percent!==void 0}function ve(re){return re.enable!==void 0}function Re(re){return re.type==="raw"}function Ve(re){return re.type==="index"}function et(re){return re.uniqueKeyRequirement===void 0&&re.analyticFunctionUse===void 0}function pe(re){var Ae;return(Ae=re?.fieldUsage)!==null&&Ae!==void 0?Ae:[]}function ge(re){var Ae;return(Ae=re?.givenUsage)!==null&&Ae!==void 0?Ae:[]}function Pe({fieldUsage:re,givenUsage:Ae}){if(!(re===void 0&&Ae===void 0))return{fieldUsage:re??[],...Ae&&{givenUsage:Ae}}}function ke(re,Ae){return re&&{...re,fieldUsage:re.fieldUsage.map(Ae)}}function Me(re,Ae){re.refSummary?re.refSummary.fieldUsage=Ae:re.refSummary={fieldUsage:Ae}}function Ke(re){return"sql"in re}function st(re){return"type"in re&&(re.type==="sql_select"||re.type==="query_source")}function Qe(re){return re.type==="source_registry_reference"}function gt(re){return{...re}}function ht(re){return re.type==="table"||re.type==="sql_select"||re.type==="query_source"||re.type==="query_result"||re.type==="finalize"||re.type==="nest_source"||re.type==="virtual"||re.type==="composite"}function Te(re){return re.type==="sql_select"||re.type==="query_source"}function ze(re){return M(re)?!1:!!ht(re)}function nt(re){return re==="literal"}function ce(...re){return re.length<=1&&re.every(Ae=>Ae==="literal")?"literal":re.every(Ae=>Ae==="constant"||Ae==="literal")?"constant":re.every(Ae=>Ae==="output"||Ae==="constant"||Ae==="literal")?"output":"input"}function fe(re){return re.type==="string"||N(re.type)||re.type==="number"||re.type==="boolean"||re.type==="json"||re.type==="sql native"||re.type==="error"}function Ee(re){return re.type==="userType"}function be(re){return Array.isArray(re)&&(re.length===0||typeof re[0]=="object"&&re[0]!==null&&!Array.isArray(re[0]))}function Be(re){return re.type==="turtle"}function Ie(re){return k(re.type)}function Ge(re,Ae){return Ae.type==="string"}function tt(re,Ae){return Ae.type==="number"}function pt(re,Ae){return Ae.type==="boolean"}function mt(re,Ae){return Ae.type==="timestamp"}function ot(re,Ae){return Ae.type==="date"}e.TD={isAtomic(re){return re!==void 0&&k(re.type)},isBasicAtomic(re){return re!==void 0&&fe({type:re.type})},isString:re=>re?.type==="string",isNumber:re=>re?.type==="number",isBoolean:re=>re?.type==="boolean",isJSON:re=>re?.type==="json",isSQL:re=>re?.type==="sql native",isDate:re=>re?.type==="date",isTimestamp:re=>re?.type==="timestamp",isTimestamptz:re=>re?.type==="timestamptz",isAnyTimestamp(re){return re?.type==="timestamp"||re?.type==="timestamptz"},isTemporal(re){var Ae;const Ne=(Ae=re?.type)!==null&&Ae!==void 0?Ae:"";return N(Ne)},isError:re=>re?.type==="error",atomicDef(re){if(!e.TD.isAtomic(re))return{type:"error"};switch(re.type){case"array":return Z(re)?{type:"array",elementTypeDef:re.elementTypeDef,fields:re.fields}:{type:"array",elementTypeDef:re.elementTypeDef};case"record":return{type:"record",fields:re.fields};case"number":return re.numberType?{type:"number",numberType:re.numberType}:{type:"number"};case"sql native":return re.rawType?{type:"sql native",rawType:re.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return re.timeframe?{type:re.type,timeframe:re.timeframe}:{type:re.type};default:return{type:re.type}}},eq(re,Ae){if(re===void 0||Ae===void 0)return!1;function Ne(qe,rt){const lt={},at=qe.fields||[],ct=rt.fields||[];if(at.length!==ct.length)return!1;for(const Lt of at)if(Lt.name)lt[Lt.name]=Lt;else return!1;for(const Lt of ct)if(!e.TD.eq(lt[Lt.name],Lt))return!1;return!0}return re.type==="array"&&Ae.type==="array"?re.elementTypeDef.type!==Ae.elementTypeDef.type?!1:re.elementTypeDef.type!=="record_element"&&Ae.elementTypeDef.type!=="record_element"?e.TD.eq(re.elementTypeDef,Ae.elementTypeDef):e.TD.isAtomic(re)&&e.TD.isAtomic(Ae)&&Ne(re,Ae):re.type==="record"&&Ae.type==="record"?e.TD.isAtomic(re)&&e.TD.isAtomic(Ae)&&Ne(re,Ae):re.type==="sql native"&&Ae.type==="sql native"?re.rawType!==void 0&&re.rawType===Ae.rawType:re.type===Ae.type}};function Xe(re,Ae){return re?Ae?{isCount:re.isCount||Ae.isCount}:re:Ae}})(M3)),M3}var sR;function ms(){if(sR)return fr;sR=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=h,fr.maxUngroupedAggregate=p,fr.maxAnalytic=x,fr.minScalar=m,fr.minAggregate=g,fr.minAnalytic=y,fr.overload=_,fr.expandBlueprintMap=ee,fr.expandOverrideMapFromBase=z,fr.def=q;const e=He();function t(P){return{node:"function_parameter",name:P}}function r(P,Y=void 0,X=void 0){return{node:"spread",e:P,prefix:Y,suffix:X}}function i(P,...Y){const X={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...Y];let le="";for(const ue of P){le+=ue;const ie=ae.shift();ie!==void 0&&(typeof ie=="string"?le+=ie:(X.src.push(le),X.kids.args.push(ie),le=""))}return le.length>0&&X.src.push(le),X}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...Y){return{name:P,isVariadic:!0,allowedTypes:Y}}function u(P,...Y){return{name:P,isVariadic:!1,allowedTypes:Y}}function d(P,...Y){return{param:u(P,...Y),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function f(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function x(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function g(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function y(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function _(P,Y,X,ae){return{returnType:P,params:Y,e:X,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function S(P,Y=!0,X=!0){if(!Y&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=Y?S(P.array,!0):S(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[le,ue]of Object.entries(P.record)){const ie=Y?S(ue,!0):S(ue,!1);e.TD.isAtomic(ie)&&ae.push((0,e.mkFieldDef)(ie,le))}return{type:"record",fields:ae}}else if("generic"in P){if(!X)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 C(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return m({type:P});if("array"in P)return h(S(P,!1));if("record"in P)return h(S(P,!1));if("generic"in P)return m(S(P,!1));if("literal"in P)return a(m(S(P.literal,!1)));if("constant"in P)return o(m(S(P.constant,!1)));if("dimension"in P)return m(S(P.dimension,!1));if("measure"in P)return g(S(P.measure,!1));if("sql_native"in P)return h({type:"sql native",rawType:P.sql_native});if("calculation"in P)return y(S(P.calculation,!1));throw new Error("Invalid function blueprint")}function T(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 T(P)?[P]:Array.isArray(P)?P:T(P.variadic)?[P.variadic]:P.variadic}function v(P){if(typeof P=="string")return h({type:P});if("generic"in P)return h(S(P));if("literal"in P)return a(c(S(P.literal)));if("constant"in P)return o(c(S(P.constant)));if("dimension"in P)return c(S(P.dimension));if("measure"in P)return f(S(P.measure));if("array"in P)return h(S(P,!1));if("record"in P)return h(S(P,!1));if("sql_native"in P)return h({type:"sql native",rawType:P.sql_native});if("calculation"in P)return x(S(P.calculation));throw new Error("Invalid function blueprint")}function R(P){return P.map(Y=>v(Y))}function D(P){return typeof P!="string"&&"variadic"in P}function w(P,Y){return{name:P,allowedTypes:R(b(Y)),isVariadic:D(Y)}}function N(P){return Object.entries(P).map(X=>w(X[0],X[1]))}function I(P){const Y=[],X=[];let ae=P;for(;ae.length>0;){const ue=ae.indexOf("${");if(ue===-1){Y.push(ae);break}const ie=ae.slice(0,ue);ae=ae.slice(ue);const de=ae.indexOf("}");if(de===-1){Y.push(ie+ae);break}const xe=ae.slice(2,de);ae=ae.slice(de+1);const me=xe.startsWith("..."),Ce=xe.endsWith(":"),he=me?xe.slice(3):Ce?xe.slice(0,-1):xe,ve={node:"function_parameter",name:he};Y.push(ie),me?X.push({node:"spread",e:ve,prefix:"",suffix:""}):Ce&&he==="order_by"?X.push({node:"aggregate_order_by"}):Ce&&he==="limit"?X.push({node:"aggregate_limit"}):X.push(ve)}return{node:"genericSQLExpr",kids:{args:X},src:Y}}function k(P,Y){return D(Y)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function U(P,Y){const X=Object.entries(Y.takes),ae=X.length>0?X.length-1:0;return{node:"genericSQLExpr",kids:{args:X.map(le=>k(le[0],le[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function J(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:U(P.impl.function,P)}function te(P){return{e:J(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function ne(P){if(P!==void 0)return Object.entries(P).map(([Y,X])=>({name:Y,acceptibleTypes:X.map(ae=>S(ae,!0,!1))}))}function oe(P){return{returnType:C(P.returns),params:N(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:ne(P.generic),...te(P)}}function H(P){return"takes"in P&&"returns"in P&&"impl"in P}function Z(P){return"function"in P||"sql"in P||"expr"in P}function K(P){return H(P)?[oe(P)]:Object.values(P).flatMap(Y=>oe(Y))}function ee(P){const Y={};for(const X in P)Y[X]=K(P[X]);return Y}function $(P,Y){return[oe({...P,impl:Y})]}function Q(P,Y,X){if(Z(X)){if(!H(Y))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Y)})`);return $(Y,X)}else{if(H(Y))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(X)})`);return Object.entries(X).flatMap(([ae,le])=>{const ue=Y[ae];if(ue===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return $(ue,le)})}}function z(P,Y){const X={};for(const ae in Y){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);X[ae]=Q(ae,P[ae],Y[ae])}return X}function*M(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const Y of Object.values(P.record))yield*M(Y);else for(const Y of["array","literal","measure","dimension","measure","constant","cacluation"])if(Y in P){yield*M(P[Y]);return}}}function q(P,Y,X,ae={}){let le=!1;const ue={};for(const de of Object.values(Y))for(const xe of M(de))ue[xe.generic]=["any"],le=!0;le&&ae.generic===void 0&&(ae.generic=ue);const ie={takes:Y,returns:X,impl:{function:P.toUpperCase()},...ae};return{[P]:ie}}return fr}var B3={},Lx={},oR;function tA(){if(oR)return Lx;oR=1,Object.defineProperty(Lx,"__esModule",{value:!0}),Lx.decodeDottedTablePath=e,Lx.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 h,p;if(o[f]===a){const x=r(o,f,a,l);if(x===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};h=x.decoded,p=!0,f=x.end}else{const x=o.slice(f).match(u);if(!x||x.index!==0||x[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${f}`};h=x[0],p=!1,f+=x[0].length}if(h.includes(";")||h.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(h)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:h,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 Lx}var aR;function eo(){return aR||(aR=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=tA();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 h of this.integerTypeMappings)if(f>=h.min&&f<=h.max)return{type:"number",numberType:h.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(d,c,f,h,p){var x;const m=(x=d?.hasTimestamptz)!==null&&x!==void 0?x:!1;return p==="date"?{node:"dateLiteral",literal:c,typeDef:{type:"date",timeframe:h!==void 0&&(0,t.isDateUnit)(h)?h:void 0}}:f&&m?{node:"timestamptzLiteral",literal:c,typeDef:{type:"timestamptz",timeframe:h},timezone:f}:f?{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:h},timezone:f}:{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:h}}}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 h of d)switch(h){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+=h}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,h){const p=["day","week","month","quarter","year"],x=c!==void 0&&p.includes(c),m=f!==void 0&&p.includes(f),g=s(h);return{needed:t.TD.isAnyTimestamp(d)&&(x||m)&&g!==void 0,tz:g}}sqlTruncAndOffset(d,c,f,h){if(t.TD.isAnyTimestamp(d.typeDef)){const{needed:x,tz:m}=this.needsCivilTimeComputation(d.typeDef,f,h?.unit,c);if(x&&m){const g=this.sqlConvertToCivilTime(d.sql,m,d.typeDef);let y=g.sql;const _=g.typeDef;return f&&(y=this.sqlTruncate(y,f,_,!0,m)),h&&(y=this.sqlOffsetTime(y,h.op,h.magnitude,h.unit,_,!0,m)),this.sqlConvertFromCivilTime(y,m,d.typeDef)}}let p=d.sql;return f&&(p=this.sqlTruncate(p,f,d.typeDef,!1,s(c))),h&&(p=this.sqlOffsetTime(p,h.op,h.magnitude,h.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 h="__STRING_AGG_KS__",p="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
4
4
|
STRING_AGG(DISTINCT ${`concat('${h}', ${d}, '${p}', ${c})`}${f.length>0?","+f:""}),
|