@malloy-publisher/app 0.17.2 → 0.18.0

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.
Files changed (23) hide show
  1. package/dist/api-doc.yaml +619 -99
  2. package/dist/assets/{EnvironmentPage-DF2PahCR.js → EnvironmentPage-BYi5H87v.js} +1 -1
  3. package/dist/assets/{HomePage-DIYlgPCz.js → HomePage-DB-CSs0p.js} +1 -1
  4. package/dist/assets/{MainPage-C7PGAA5k.js → MainPage-2j-MpcYJ.js} +1 -1
  5. package/dist/assets/{ModelPage-BMoBnrW7.js → ModelPage-BQE-ZC6E.js} +2 -2
  6. package/dist/assets/{PackagePage-DD2vLSFe.js → PackagePage-BMv6ojk4.js} +1 -1
  7. package/dist/assets/{PackageSplatRoute-BYIMwnLL.js → PackageSplatRoute-BOAFRQKR.js} +2 -2
  8. package/dist/assets/{RenderedResult-CYJ2Y9Fm.es-C8nokn71.js → RenderedResult-QdYnecnr.es-PKDmuES7.js} +1 -1
  9. package/dist/assets/{RouteError-B8dE60Vs.js → RouteError-7Fw_wYUy.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-D0wf74fh.js → ThemeEditorPage-DmiRg7rU.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-CX0_J2zR.js → ToggleButtonGroup-BXVbLuei.js} +1 -1
  12. package/dist/assets/{documentRoutes-DgSMAc0m.js → documentRoutes-DWIPC8nU.js} +1 -1
  13. package/dist/assets/{editPageMounted-BUGVg-_g.js → editPageMounted-BaGHeFZ5.js} +2 -2
  14. package/dist/assets/{index-DAQjZOAL.js → index-APmAmrTn.js} +1 -1
  15. package/dist/assets/{index-BQL8UUcK.js → index-BRdik0lA.js} +1 -1
  16. package/dist/assets/{index-BiOT4K_d.js → index-CHfKShi-.js} +1 -1
  17. package/dist/assets/{index-DRkw60sj.js → index-OQqQyWrE.js} +5 -5
  18. package/dist/assets/{index.es-DgNl8IqU.js → index.es-DLFu6xFm.js} +1 -1
  19. package/dist/assets/usePackageLinkNavigate-DTlEYsed.js +1 -0
  20. package/dist/assets/{usePackageRoute-BhB6txS6.js → usePackageRoute-pIAy965Q.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/package.json +2 -2
  23. package/dist/assets/usePackageLinkNavigate-bHr_AFYo.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aw as pd,aq as Ts,ax as cR,ay as gN}from"./index-DRkw60sj.js";import{r as A2}from"./index-B0BUzE-t.js";function EN(r,g){for(var A=0;A<g.length;A++){const y=g[A];if(typeof y!="string"&&!Array.isArray(y)){for(const p in y)if(p!=="default"&&!(p in r)){const o=Object.getOwnPropertyDescriptor(y,p);o&&Object.defineProperty(r,p,o.get?o:{enumerable:!0,get:()=>y[p]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var xi={},Xh={},It={},Zh={},Ly;function Ie(){return Ly||(Ly=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.TD=r.ValueType=void 0,r.safeRecordGet=A,r.mkSafeRecord=y,r.exprHasKids=p,r.exprHasE=o,r.exprIsLeaf=l,r.isAsymmetricExpr=u,r.mkTemporal=c,r.isRawCast=t,r.isFilterExprType=a,r.isTimeLiteral=i,r.arrayQueryReturnsValue=x,r.arrayQueryOnlyAggregates=n,r.arrayValueNotOneAggregate=m,r.isParameterType=f,r.paramHasValue=h,r.activeName=E,r.expressionIsScalar=T,r.expressionIsAggregate=v,r.expressionIsUngroupedAggregate=R,r.expressionInvolvesAggregate=C,r.expressionIsCalculation=O,r.expressionIsAnalytic=S,r.isExpressionTypeLEQ=D,r.maxExpressionType=b,r.maxOfExpressionTypes=I,r.hasExpression=L,r.isTemporalType=M,r.isBasicAtomicType=W,r.isAtomicFieldType=ee,r.canOrderBy=Y,r.fieldIsIntrinsic=te,r.mkFieldDef=G,r.mkArrayDef=U,r.mkArrayTypeDef=$,r.isRepeatedRecordFunctionParam=X,r.isRepeatedRecord=w,r.isRecordOrRepeatedRecord=k,r.isBasicArray=j,r.isMatrixOperation=P,r.isJoinable=Q,r.isJoined=q,r.isJoinedSource=H,r.isDateUnit=J,r.isTimestampUnit=Z,r.isExtractUnit=oe,r.refIsStructDef=ue,r.segmentHasErrors=ce,r.structHasErrors=he,r.isReduceSegment=ye,r.isPartialSegment=Se,r.isProjectSegment=le,r.isQuerySegment=ge,r.isSamplingRows=ve,r.isSamplingPercent=Be,r.isSamplingEnable=ke,r.isRawSegment=me,r.isIndexSegment=Ee,r.bareFieldUsage=Ne,r.fieldUsageFrom=be,r.givenUsageFrom=Le,r.mkRefSummary=He,r.mapFieldUsage=je,r.isSegmentSQL=we,r.isSegmentSource=Xe,r.isSourceRegistryReference=Ze,r.sourceBase=Ce,r.isSourceDef=Me,r.isPersistableSourceDef=ze,r.isBaseTable=tt,r.isLiteral=xe,r.mergeEvalSpaces=de,r.isBasicAtomic=Ae,r.isUserTypeDef=Re,r.isCompoundArrayData=Fe,r.isTurtle=Ue,r.isAtomic=Ve,r.isValueString=nt,r.isValueNumber=at,r.isValueBoolean=pt,r.isValueTimestamp=ut,r.isValueDate=Je;const g=Object.prototype.hasOwnProperty;function A(ie,Te){return g.call(ie,Te)?ie[Te]:void 0}function y(){return Object.create(null)}function p(ie){return"kids"in ie}function o(ie){return"e"in ie}function l(ie){return!(p(ie)||o(ie))}function u(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function s(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function c(ie,Te){if(!("typeDef"in ie)){const Pe=typeof Te=="string"?{type:Te}:Te;if(s(ie))return{...ie,typeDef:{...Pe}}}return ie}function t(ie){return"dstSQLType"in ie}function a(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function i(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function x(ie){const[Te,...Pe]=ie;return Pe.length===0&&Te?.type==="reduce"&&Te.outputStruct.fields.length===1&&n(Te)}function n(ie){return ie.queryFields.every(Te=>Te.type!=="fieldref"&&Te.type!=="turtle"&&v(Te.expressionType))}function m(ie){var Te;if(((Te=ie.filterList)!==null&&Te!==void 0?Te:[]).some(Ke=>!T(Ke.expressionType)))return"it has a `having:`";const[Pe]=ie.queryFields;if(Pe!==void 0&&Pe.type!=="fieldref"&&L(Pe)&&(Pe.e.node==="filteredExpr"?Pe.e.kids.e:Pe.e).node!=="aggregate")return`\`${Pe.name}\` is not one aggregate`}function f(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function E(ie){var Te;return(Te=ie.as)!==null&&Te!==void 0?Te:ie.name}function T(ie){return ie===void 0||ie==="scalar"}function v(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function R(ie){return ie==="ungrouped_aggregate"}function C(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function O(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function S(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function N(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,Te){return ie===Te||N(ie)<N(Te)}function b(ie,Te){let Pe="scalar";return(ie==="aggregate"||Te==="aggregate")&&(Pe="aggregate"),(ie==="ungrouped_aggregate"||Te==="ungrouped_aggregate")&&(Pe="ungrouped_aggregate"),(ie==="scalar_analytic"||Te==="scalar_analytic")&&(Pe="scalar_analytic"),(ie==="aggregate_analytic"||Te==="aggregate_analytic")&&(Pe="aggregate_analytic"),(ie==="scalar_analytic"&&Te==="aggregate"||ie==="aggregate"&&Te==="scalar_analytic")&&(Pe="aggregate_analytic"),Pe}function I(ie){return ie.reduce(b,"scalar")}function L(ie){return"e"in ie&&ie.e!==void 0}function M(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function W(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function ee(ie){return W(ie)||ie==="record"||ie==="array"}function Y(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function te(ie){return ee(ie.type)&&!L(ie)}function G(ie,Te){if(j(ie))return U(ie.elementTypeDef,Te);if(w(ie)){const{type:Ke,fields:Ge,elementTypeDef:Qe}=ie;return{type:Ke,fields:Ge,elementTypeDef:Qe,join:"many",name:Te}}if(ie.type==="record"){const{type:Ke,fields:Ge}=ie;return{type:Ke,fields:Ge,join:"one",name:Te}}const Pe={name:Te,type:ie.type};switch(ie.type){case"sql native":return{...Pe,rawType:ie.rawType};case"number":{const Ke=ie.numberType;return Ke?{...Pe,numberType:Ke}:Pe}case"date":{const Ke=ie.timeframe;return Ke?{name:Te,type:"date",timeframe:Ke}:Pe}case"timestamp":{const Ke={name:Te,type:"timestamp"};return ie.timeframe&&(Ke.timeframe=ie.timeframe),Ke}case"timestamptz":{const Ke={name:Te,type:"timestamptz"};return ie.timeframe&&(Ke.timeframe=ie.timeframe),Ke}}return Pe}function U(ie,Te){if(ie.type==="record")return{type:"array",join:"many",name:Te,elementTypeDef:{type:"record_element"},fields:ie.fields};const Pe=G(ie,"value");return{type:"array",join:"many",name:Te,elementTypeDef:ie,fields:[Pe,{...Pe,name:"each",e:{node:"field",path:["value"]}}]}}function $(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function X(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function w(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function k(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function j(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function P(ie){return["left","right","full","inner"].includes(ie)}function Q(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function q(ie){return"join"in ie}function H(ie){return Me(ie)&&q(ie)}function J(ie){return["day","week","month","quarter","year"].includes(ie)}function Z(ie){return J(ie)||["hour","minute","second"].includes(ie)}function oe(ie){return Z(ie)||ie==="day_of_week"||ie==="day_of_year"}var se;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(se||(r.ValueType=se={}));function ue(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(Te=>Te.type==="error")||ie.queryFields.some(Te=>Te.type==="error")))}function he(ie){return ie.fields.some(Te=>Te.type==="error")}function ye(ie){return ie.type==="reduce"}function Se(ie){return ie.type==="partial"}function le(ie){return ie.type==="project"}function ge(ie){return le(ie)||ye(ie)}function ve(ie){return ie.rows!==void 0}function Be(ie){return ie.percent!==void 0}function ke(ie){return ie.enable!==void 0}function me(ie){return ie.type==="raw"}function Ee(ie){return ie.type==="index"}function Ne(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function be(ie){var Te;return(Te=ie?.fieldUsage)!==null&&Te!==void 0?Te:[]}function Le(ie){var Te;return(Te=ie?.givenUsage)!==null&&Te!==void 0?Te:[]}function He({fieldUsage:ie,givenUsage:Te}){if(!(ie===void 0&&Te===void 0))return{fieldUsage:ie??[],...Te&&{givenUsage:Te}}}function je(ie,Te){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(Te)}}function we(ie){return"sql"in ie}function Xe(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function Ze(ie){return ie.type==="source_registry_reference"}function Ce(ie){return{...ie}}function Me(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 ze(ie){return ie.type==="sql_select"||ie.type==="query_source"}function tt(ie){return H(ie)?!1:!!Me(ie)}function xe(ie){return ie==="literal"}function de(...ie){return ie.length<=1&&ie.every(Te=>Te==="literal")?"literal":ie.every(Te=>Te==="constant"||Te==="literal")?"constant":ie.every(Te=>Te==="output"||Te==="constant"||Te==="literal")?"output":"input"}function Ae(ie){return ie.type==="string"||M(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function Re(ie){return ie.type==="userType"}function Fe(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Ue(ie){return ie.type==="turtle"}function Ve(ie){return ee(ie.type)}function nt(ie,Te){return Te.type==="string"}function at(ie,Te){return Te.type==="number"}function pt(ie,Te){return Te.type==="boolean"}function ut(ie,Te){return Te.type==="timestamp"}function Je(ie,Te){return Te.type==="date"}r.TD={isAtomic(ie){return ie!==void 0&&ee(ie.type)},isBasicAtomic(ie){return ie!==void 0&&Ae({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 Te;const Pe=(Te=ie?.type)!==null&&Te!==void 0?Te:"";return M(Pe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!r.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return w(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,Te){if(ie===void 0||Te===void 0)return!1;function Pe(Ke,Ge){const Qe={},rt=Ke.fields||[],lt=Ge.fields||[];if(rt.length!==lt.length)return!1;for(const yt of rt)if(yt.name)Qe[yt.name]=yt;else return!1;for(const yt of lt)if(!r.TD.eq(Qe[yt.name],yt))return!1;return!0}return ie.type==="array"&&Te.type==="array"?ie.elementTypeDef.type!==Te.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&Te.elementTypeDef.type!=="record_element"?r.TD.eq(ie.elementTypeDef,Te.elementTypeDef):r.TD.isAtomic(ie)&&r.TD.isAtomic(Te)&&Pe(ie,Te):ie.type==="record"&&Te.type==="record"?r.TD.isAtomic(ie)&&r.TD.isAtomic(Te)&&Pe(ie,Te):ie.type==="sql native"&&Te.type==="sql native"?ie.rawType!==void 0&&ie.rawType===Te.rawType:ie.type===Te.type}}})(Zh)),Zh}var Fy;function Hr(){if(Fy)return It;Fy=1,Object.defineProperty(It,"__esModule",{value:!0}),It.arg=g,It.spread=A,It.sql=y,It.constant=p,It.output=o,It.literal=l,It.variadicParam=u,It.param=s,It.makeParam=c,It.maxScalar=t,It.maxAggregate=a,It.anyExprType=i,It.maxUngroupedAggregate=x,It.maxAnalytic=n,It.minScalar=m,It.minAggregate=f,It.minAnalytic=h,It.overload=E,It.expandBlueprintMap=X,It.expandOverrideMapFromBase=j,It.def=Q;const r=Ie();function g(q){return{node:"function_parameter",name:q}}function A(q,H=void 0,J=void 0){return{node:"spread",e:q,prefix:H,suffix:J}}function y(q,...H){const J={node:"genericSQLExpr",kids:{args:[]},src:[]},Z=[...H];let oe="";for(const se of q){oe+=se;const ue=Z.shift();ue!==void 0&&(typeof ue=="string"?oe+=ue:(J.src.push(oe),J.kids.args.push(ue),oe=""))}return oe.length>0&&J.src.push(oe),J}function p(q){return{...q,evalSpace:"constant"}}function o(q){return{...q,evalSpace:"output"}}function l(q){return{...q,evalSpace:"literal"}}function u(q,...H){return{name:q,isVariadic:!0,allowedTypes:H}}function s(q,...H){return{name:q,isVariadic:!1,allowedTypes:H}}function c(q,...H){return{param:s(q,...H),arg:g(q)}}function t(q){return{...q,expressionType:"scalar",evalSpace:"input"}}function a(q){return{...q,expressionType:"aggregate",evalSpace:"input"}}function i(q){return{...q,expressionType:void 0,evalSpace:"input"}}function x(q){return{...q,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function n(q){return{...q,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(q){return{...q,expressionType:"scalar",evalSpace:"input"}}function f(q){return{...q,expressionType:"aggregate",evalSpace:"input"}}function h(q){return{...q,expressionType:"scalar_analytic",evalSpace:"input"}}function E(q,H,J,Z){return{returnType:q,params:H,e:J,needsWindowOrderBy:Z?.needsWindowOrderBy,between:Z?.between,isSymmetric:Z?.isSymmetric,supportsOrderBy:Z?.supportsOrderBy,defaultOrderByArgIndex:Z?.defaultOrderByArgIndex,supportsLimit:Z?.supportsLimit}}function T(q,H=!0,J=!0){if(!H&&q==="any")throw new Error("Return type cannot include any");if(typeof q=="string")return{type:q};if("array"in q){const Z=H?T(q.array,!0):T(q.array,!1);return Z.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:Z.fields}:{type:"array",elementTypeDef:Z}}else if("record"in q){const Z=[];for(const[oe,se]of Object.entries(q.record)){const ue=H?T(se,!0):T(se,!1);r.TD.isAtomic(ue)&&Z.push((0,r.mkFieldDef)(ue,oe))}return{type:"record",fields:Z}}else if("generic"in q){if(!J)throw new Error("Cannot use generic");return{type:"generic",generic:q.generic}}else if("sql_native"in q)return{type:"sql native",rawType:q.sql_native};throw new Error("Cannot figure out type")}function v(q){if(q==="any")throw new Error("Cannot return any type");if(typeof q=="string")return m({type:q});if("array"in q)return i(T(q,!1));if("record"in q)return i(T(q,!1));if("generic"in q)return m(T(q,!1));if("literal"in q)return l(m(T(q.literal,!1)));if("constant"in q)return p(m(T(q.constant,!1)));if("dimension"in q)return m(T(q.dimension,!1));if("measure"in q)return f(T(q.measure,!1));if("sql_native"in q)return i({type:"sql native",rawType:q.sql_native});if("calculation"in q)return h(T(q.calculation,!1));throw new Error("Invalid function blueprint")}function R(q){return typeof q=="string"||"array"in q||"record"in q||"generic"in q||"literal"in q||"constant"in q||"dimension"in q||"measure"in q||"calculation"in q||"sql_native"in q}function C(q){return R(q)?[q]:Array.isArray(q)?q:R(q.variadic)?[q.variadic]:q.variadic}function O(q){if(typeof q=="string")return i({type:q});if("generic"in q)return i(T(q));if("literal"in q)return l(t(T(q.literal)));if("constant"in q)return p(t(T(q.constant)));if("dimension"in q)return t(T(q.dimension));if("measure"in q)return a(T(q.measure));if("array"in q)return i(T(q,!1));if("record"in q)return i(T(q,!1));if("sql_native"in q)return i({type:"sql native",rawType:q.sql_native});if("calculation"in q)return n(T(q.calculation));throw new Error("Invalid function blueprint")}function S(q){return q.map(H=>O(H))}function N(q){return typeof q!="string"&&"variadic"in q}function D(q,H){return{name:q,allowedTypes:S(C(H)),isVariadic:N(H)}}function b(q){return Object.entries(q).map(J=>D(J[0],J[1]))}function I(q){const H=[],J=[];let Z=q;for(;Z.length>0;){const se=Z.indexOf("${");if(se===-1){H.push(Z);break}const ue=Z.slice(0,se);Z=Z.slice(se);const ce=Z.indexOf("}");if(ce===-1){H.push(ue+Z);break}const he=Z.slice(2,ce);Z=Z.slice(ce+1);const ye=he.startsWith("..."),Se=he.endsWith(":"),le=ye?he.slice(3):Se?he.slice(0,-1):he,ge={node:"function_parameter",name:le};H.push(ue),ye?J.push({node:"spread",e:ge,prefix:"",suffix:""}):Se&&le==="order_by"?J.push({node:"aggregate_order_by"}):Se&&le==="limit"?J.push({node:"aggregate_limit"}):J.push(ge)}return{node:"genericSQLExpr",kids:{args:J},src:H}}function L(q,H){return N(H)?{node:"spread",e:{node:"function_parameter",name:q},prefix:"",suffix:""}:{node:"function_parameter",name:q}}function M(q,H){const J=Object.entries(H.takes),Z=J.length>0?J.length-1:0;return{node:"genericSQLExpr",kids:{args:J.map(oe=>L(oe[0],oe[1]))},src:[`${q}(`,...Array(Z).fill(","),")"]}}function W(q){return"sql"in q.impl?I(q.impl.sql):"expr"in q.impl?q.impl.expr:M(q.impl.function,q)}function ee(q){return{e:W(q),between:q.impl.between,needsWindowOrderBy:q.impl.needsWindowOrderBy,defaultOrderByArgIndex:q.impl.defaultOrderByArgIndex}}function Y(q){if(q!==void 0)return Object.entries(q).map(([H,J])=>({name:H,acceptibleTypes:J.map(Z=>T(Z,!0,!1))}))}function te(q){return{returnType:v(q.returns),params:b(q.takes),isSymmetric:q.isSymmetric,supportsOrderBy:q.supportsOrderBy,supportsLimit:q.supportsLimit,genericTypes:Y(q.generic),...ee(q)}}function G(q){return"takes"in q&&"returns"in q&&"impl"in q}function U(q){return"function"in q||"sql"in q||"expr"in q}function $(q){return G(q)?[te(q)]:Object.values(q).flatMap(H=>te(H))}function X(q){const H={};for(const J in q)H[J]=$(q[J]);return H}function w(q,H){return[te({...q,impl:H})]}function k(q,H,J){if(U(J)){if(!G(H))throw new Error(`Malformed function override: ${q}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(H)})`);return w(H,J)}else{if(G(H))throw new Error(`Malformed function override: ${q}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(J)})`);return Object.entries(J).flatMap(([Z,oe])=>{const se=H[Z];if(se===void 0)throw new Error(`Malformed function override: ${q}. No overload named ${Z}`);return w(se,oe)})}}function j(q,H){const J={};for(const Z in H){if(!(Z in q))throw new Error(`Malformed function override: ${Z}. No such function in Malloy standard`);J[Z]=k(Z,q[Z],H[Z])}return J}function*P(q){if(typeof q!="string"){if("generic"in q)yield q;else if("record"in q)for(const H of Object.values(q.record))yield*P(H);else for(const H of["array","literal","measure","dimension","measure","constant","cacluation"])if(H in q){yield*P(q[H]);return}}}function Q(q,H,J,Z={}){let oe=!1;const se={};for(const ce of Object.values(H))for(const he of P(ce))se[he.generic]=["any"],oe=!0;oe&&Z.generic===void 0&&(Z.generic=se);const ue={takes:H,returns:J,impl:{function:q.toUpperCase()},...Z};return{[q]:ue}}return It}var ep={},o0={},Iy;function S2(){if(Iy)return o0;Iy=1,Object.defineProperty(o0,"__esModule",{value:!0}),o0.decodeDottedTablePath=r,o0.validateDottedTablePath=g;function r(p,o){const{quoteChar:l,escapeStyle:u,bareIdentRegex:s,dialectName:c}=o;if(p.length===0)return{ok:!1,error:`${c} table path is empty`};const t=[];let a=0;for(;;){let i,x;if(p[a]===l){const n=A(p,a,l,u);if(n===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — unterminated quoted segment`};i=n.decoded,x=!0,a=n.end}else{const n=p.slice(a).match(s);if(!n||n.index!==0||n[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — invalid segment at position ${a}`};i=n[0],x=!1,a+=n[0].length}if(i.includes(";")||i.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(i)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(t.push({value:i,quoted:x}),a===p.length)return{ok:!0,segments:t};if(p[a]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — expected '.' at position ${a}`};if(a++,a===p.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — trailing dot`}}}function g(p,o){const l=r(p,o);return l.ok?{ok:!0,canonical:p}:l}function A(p,o,l,u){let s=o+1,c="";for(;s<p.length;){if(u==="backslash"&&p[s]==="\\"){if(s+1>=p.length)return null;c+=y(p[s+1]),s+=2;continue}if(p[s]===l){if(u==="doubled"&&p[s+1]===l){c+=l,s+=2;continue}return{decoded:c,end:s+1}}c+=p[s],s++}return null}function y(p){switch(p){case"n":return`
1
+ import{aw as pd,aq as Ts,ax as cR,ay as gN}from"./index-OQqQyWrE.js";import{r as A2}from"./index-B0BUzE-t.js";function EN(r,g){for(var A=0;A<g.length;A++){const y=g[A];if(typeof y!="string"&&!Array.isArray(y)){for(const p in y)if(p!=="default"&&!(p in r)){const o=Object.getOwnPropertyDescriptor(y,p);o&&Object.defineProperty(r,p,o.get?o:{enumerable:!0,get:()=>y[p]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var xi={},Xh={},It={},Zh={},Ly;function Ie(){return Ly||(Ly=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.TD=r.ValueType=void 0,r.safeRecordGet=A,r.mkSafeRecord=y,r.exprHasKids=p,r.exprHasE=o,r.exprIsLeaf=l,r.isAsymmetricExpr=u,r.mkTemporal=c,r.isRawCast=t,r.isFilterExprType=a,r.isTimeLiteral=i,r.arrayQueryReturnsValue=x,r.arrayQueryOnlyAggregates=n,r.arrayValueNotOneAggregate=m,r.isParameterType=f,r.paramHasValue=h,r.activeName=E,r.expressionIsScalar=T,r.expressionIsAggregate=v,r.expressionIsUngroupedAggregate=R,r.expressionInvolvesAggregate=C,r.expressionIsCalculation=O,r.expressionIsAnalytic=S,r.isExpressionTypeLEQ=D,r.maxExpressionType=b,r.maxOfExpressionTypes=I,r.hasExpression=L,r.isTemporalType=M,r.isBasicAtomicType=W,r.isAtomicFieldType=ee,r.canOrderBy=Y,r.fieldIsIntrinsic=te,r.mkFieldDef=G,r.mkArrayDef=U,r.mkArrayTypeDef=$,r.isRepeatedRecordFunctionParam=X,r.isRepeatedRecord=w,r.isRecordOrRepeatedRecord=k,r.isBasicArray=j,r.isMatrixOperation=P,r.isJoinable=Q,r.isJoined=q,r.isJoinedSource=H,r.isDateUnit=J,r.isTimestampUnit=Z,r.isExtractUnit=oe,r.refIsStructDef=ue,r.segmentHasErrors=ce,r.structHasErrors=he,r.isReduceSegment=ye,r.isPartialSegment=Se,r.isProjectSegment=le,r.isQuerySegment=ge,r.isSamplingRows=ve,r.isSamplingPercent=Be,r.isSamplingEnable=ke,r.isRawSegment=me,r.isIndexSegment=Ee,r.bareFieldUsage=Ne,r.fieldUsageFrom=be,r.givenUsageFrom=Le,r.mkRefSummary=He,r.mapFieldUsage=je,r.isSegmentSQL=we,r.isSegmentSource=Xe,r.isSourceRegistryReference=Ze,r.sourceBase=Ce,r.isSourceDef=Me,r.isPersistableSourceDef=ze,r.isBaseTable=tt,r.isLiteral=xe,r.mergeEvalSpaces=de,r.isBasicAtomic=Ae,r.isUserTypeDef=Re,r.isCompoundArrayData=Fe,r.isTurtle=Ue,r.isAtomic=Ve,r.isValueString=nt,r.isValueNumber=at,r.isValueBoolean=pt,r.isValueTimestamp=ut,r.isValueDate=Je;const g=Object.prototype.hasOwnProperty;function A(ie,Te){return g.call(ie,Te)?ie[Te]:void 0}function y(){return Object.create(null)}function p(ie){return"kids"in ie}function o(ie){return"e"in ie}function l(ie){return!(p(ie)||o(ie))}function u(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function s(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function c(ie,Te){if(!("typeDef"in ie)){const Pe=typeof Te=="string"?{type:Te}:Te;if(s(ie))return{...ie,typeDef:{...Pe}}}return ie}function t(ie){return"dstSQLType"in ie}function a(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function i(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function x(ie){const[Te,...Pe]=ie;return Pe.length===0&&Te?.type==="reduce"&&Te.outputStruct.fields.length===1&&n(Te)}function n(ie){return ie.queryFields.every(Te=>Te.type!=="fieldref"&&Te.type!=="turtle"&&v(Te.expressionType))}function m(ie){var Te;if(((Te=ie.filterList)!==null&&Te!==void 0?Te:[]).some(Ke=>!T(Ke.expressionType)))return"it has a `having:`";const[Pe]=ie.queryFields;if(Pe!==void 0&&Pe.type!=="fieldref"&&L(Pe)&&(Pe.e.node==="filteredExpr"?Pe.e.kids.e:Pe.e).node!=="aggregate")return`\`${Pe.name}\` is not one aggregate`}function f(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function E(ie){var Te;return(Te=ie.as)!==null&&Te!==void 0?Te:ie.name}function T(ie){return ie===void 0||ie==="scalar"}function v(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function R(ie){return ie==="ungrouped_aggregate"}function C(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function O(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function S(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function N(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,Te){return ie===Te||N(ie)<N(Te)}function b(ie,Te){let Pe="scalar";return(ie==="aggregate"||Te==="aggregate")&&(Pe="aggregate"),(ie==="ungrouped_aggregate"||Te==="ungrouped_aggregate")&&(Pe="ungrouped_aggregate"),(ie==="scalar_analytic"||Te==="scalar_analytic")&&(Pe="scalar_analytic"),(ie==="aggregate_analytic"||Te==="aggregate_analytic")&&(Pe="aggregate_analytic"),(ie==="scalar_analytic"&&Te==="aggregate"||ie==="aggregate"&&Te==="scalar_analytic")&&(Pe="aggregate_analytic"),Pe}function I(ie){return ie.reduce(b,"scalar")}function L(ie){return"e"in ie&&ie.e!==void 0}function M(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function W(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function ee(ie){return W(ie)||ie==="record"||ie==="array"}function Y(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function te(ie){return ee(ie.type)&&!L(ie)}function G(ie,Te){if(j(ie))return U(ie.elementTypeDef,Te);if(w(ie)){const{type:Ke,fields:Ge,elementTypeDef:Qe}=ie;return{type:Ke,fields:Ge,elementTypeDef:Qe,join:"many",name:Te}}if(ie.type==="record"){const{type:Ke,fields:Ge}=ie;return{type:Ke,fields:Ge,join:"one",name:Te}}const Pe={name:Te,type:ie.type};switch(ie.type){case"sql native":return{...Pe,rawType:ie.rawType};case"number":{const Ke=ie.numberType;return Ke?{...Pe,numberType:Ke}:Pe}case"date":{const Ke=ie.timeframe;return Ke?{name:Te,type:"date",timeframe:Ke}:Pe}case"timestamp":{const Ke={name:Te,type:"timestamp"};return ie.timeframe&&(Ke.timeframe=ie.timeframe),Ke}case"timestamptz":{const Ke={name:Te,type:"timestamptz"};return ie.timeframe&&(Ke.timeframe=ie.timeframe),Ke}}return Pe}function U(ie,Te){if(ie.type==="record")return{type:"array",join:"many",name:Te,elementTypeDef:{type:"record_element"},fields:ie.fields};const Pe=G(ie,"value");return{type:"array",join:"many",name:Te,elementTypeDef:ie,fields:[Pe,{...Pe,name:"each",e:{node:"field",path:["value"]}}]}}function $(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function X(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function w(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function k(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function j(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function P(ie){return["left","right","full","inner"].includes(ie)}function Q(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function q(ie){return"join"in ie}function H(ie){return Me(ie)&&q(ie)}function J(ie){return["day","week","month","quarter","year"].includes(ie)}function Z(ie){return J(ie)||["hour","minute","second"].includes(ie)}function oe(ie){return Z(ie)||ie==="day_of_week"||ie==="day_of_year"}var se;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(se||(r.ValueType=se={}));function ue(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(Te=>Te.type==="error")||ie.queryFields.some(Te=>Te.type==="error")))}function he(ie){return ie.fields.some(Te=>Te.type==="error")}function ye(ie){return ie.type==="reduce"}function Se(ie){return ie.type==="partial"}function le(ie){return ie.type==="project"}function ge(ie){return le(ie)||ye(ie)}function ve(ie){return ie.rows!==void 0}function Be(ie){return ie.percent!==void 0}function ke(ie){return ie.enable!==void 0}function me(ie){return ie.type==="raw"}function Ee(ie){return ie.type==="index"}function Ne(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function be(ie){var Te;return(Te=ie?.fieldUsage)!==null&&Te!==void 0?Te:[]}function Le(ie){var Te;return(Te=ie?.givenUsage)!==null&&Te!==void 0?Te:[]}function He({fieldUsage:ie,givenUsage:Te}){if(!(ie===void 0&&Te===void 0))return{fieldUsage:ie??[],...Te&&{givenUsage:Te}}}function je(ie,Te){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(Te)}}function we(ie){return"sql"in ie}function Xe(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function Ze(ie){return ie.type==="source_registry_reference"}function Ce(ie){return{...ie}}function Me(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 ze(ie){return ie.type==="sql_select"||ie.type==="query_source"}function tt(ie){return H(ie)?!1:!!Me(ie)}function xe(ie){return ie==="literal"}function de(...ie){return ie.length<=1&&ie.every(Te=>Te==="literal")?"literal":ie.every(Te=>Te==="constant"||Te==="literal")?"constant":ie.every(Te=>Te==="output"||Te==="constant"||Te==="literal")?"output":"input"}function Ae(ie){return ie.type==="string"||M(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function Re(ie){return ie.type==="userType"}function Fe(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Ue(ie){return ie.type==="turtle"}function Ve(ie){return ee(ie.type)}function nt(ie,Te){return Te.type==="string"}function at(ie,Te){return Te.type==="number"}function pt(ie,Te){return Te.type==="boolean"}function ut(ie,Te){return Te.type==="timestamp"}function Je(ie,Te){return Te.type==="date"}r.TD={isAtomic(ie){return ie!==void 0&&ee(ie.type)},isBasicAtomic(ie){return ie!==void 0&&Ae({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 Te;const Pe=(Te=ie?.type)!==null&&Te!==void 0?Te:"";return M(Pe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!r.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return w(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,Te){if(ie===void 0||Te===void 0)return!1;function Pe(Ke,Ge){const Qe={},rt=Ke.fields||[],lt=Ge.fields||[];if(rt.length!==lt.length)return!1;for(const yt of rt)if(yt.name)Qe[yt.name]=yt;else return!1;for(const yt of lt)if(!r.TD.eq(Qe[yt.name],yt))return!1;return!0}return ie.type==="array"&&Te.type==="array"?ie.elementTypeDef.type!==Te.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&Te.elementTypeDef.type!=="record_element"?r.TD.eq(ie.elementTypeDef,Te.elementTypeDef):r.TD.isAtomic(ie)&&r.TD.isAtomic(Te)&&Pe(ie,Te):ie.type==="record"&&Te.type==="record"?r.TD.isAtomic(ie)&&r.TD.isAtomic(Te)&&Pe(ie,Te):ie.type==="sql native"&&Te.type==="sql native"?ie.rawType!==void 0&&ie.rawType===Te.rawType:ie.type===Te.type}}})(Zh)),Zh}var Fy;function Hr(){if(Fy)return It;Fy=1,Object.defineProperty(It,"__esModule",{value:!0}),It.arg=g,It.spread=A,It.sql=y,It.constant=p,It.output=o,It.literal=l,It.variadicParam=u,It.param=s,It.makeParam=c,It.maxScalar=t,It.maxAggregate=a,It.anyExprType=i,It.maxUngroupedAggregate=x,It.maxAnalytic=n,It.minScalar=m,It.minAggregate=f,It.minAnalytic=h,It.overload=E,It.expandBlueprintMap=X,It.expandOverrideMapFromBase=j,It.def=Q;const r=Ie();function g(q){return{node:"function_parameter",name:q}}function A(q,H=void 0,J=void 0){return{node:"spread",e:q,prefix:H,suffix:J}}function y(q,...H){const J={node:"genericSQLExpr",kids:{args:[]},src:[]},Z=[...H];let oe="";for(const se of q){oe+=se;const ue=Z.shift();ue!==void 0&&(typeof ue=="string"?oe+=ue:(J.src.push(oe),J.kids.args.push(ue),oe=""))}return oe.length>0&&J.src.push(oe),J}function p(q){return{...q,evalSpace:"constant"}}function o(q){return{...q,evalSpace:"output"}}function l(q){return{...q,evalSpace:"literal"}}function u(q,...H){return{name:q,isVariadic:!0,allowedTypes:H}}function s(q,...H){return{name:q,isVariadic:!1,allowedTypes:H}}function c(q,...H){return{param:s(q,...H),arg:g(q)}}function t(q){return{...q,expressionType:"scalar",evalSpace:"input"}}function a(q){return{...q,expressionType:"aggregate",evalSpace:"input"}}function i(q){return{...q,expressionType:void 0,evalSpace:"input"}}function x(q){return{...q,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function n(q){return{...q,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(q){return{...q,expressionType:"scalar",evalSpace:"input"}}function f(q){return{...q,expressionType:"aggregate",evalSpace:"input"}}function h(q){return{...q,expressionType:"scalar_analytic",evalSpace:"input"}}function E(q,H,J,Z){return{returnType:q,params:H,e:J,needsWindowOrderBy:Z?.needsWindowOrderBy,between:Z?.between,isSymmetric:Z?.isSymmetric,supportsOrderBy:Z?.supportsOrderBy,defaultOrderByArgIndex:Z?.defaultOrderByArgIndex,supportsLimit:Z?.supportsLimit}}function T(q,H=!0,J=!0){if(!H&&q==="any")throw new Error("Return type cannot include any");if(typeof q=="string")return{type:q};if("array"in q){const Z=H?T(q.array,!0):T(q.array,!1);return Z.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:Z.fields}:{type:"array",elementTypeDef:Z}}else if("record"in q){const Z=[];for(const[oe,se]of Object.entries(q.record)){const ue=H?T(se,!0):T(se,!1);r.TD.isAtomic(ue)&&Z.push((0,r.mkFieldDef)(ue,oe))}return{type:"record",fields:Z}}else if("generic"in q){if(!J)throw new Error("Cannot use generic");return{type:"generic",generic:q.generic}}else if("sql_native"in q)return{type:"sql native",rawType:q.sql_native};throw new Error("Cannot figure out type")}function v(q){if(q==="any")throw new Error("Cannot return any type");if(typeof q=="string")return m({type:q});if("array"in q)return i(T(q,!1));if("record"in q)return i(T(q,!1));if("generic"in q)return m(T(q,!1));if("literal"in q)return l(m(T(q.literal,!1)));if("constant"in q)return p(m(T(q.constant,!1)));if("dimension"in q)return m(T(q.dimension,!1));if("measure"in q)return f(T(q.measure,!1));if("sql_native"in q)return i({type:"sql native",rawType:q.sql_native});if("calculation"in q)return h(T(q.calculation,!1));throw new Error("Invalid function blueprint")}function R(q){return typeof q=="string"||"array"in q||"record"in q||"generic"in q||"literal"in q||"constant"in q||"dimension"in q||"measure"in q||"calculation"in q||"sql_native"in q}function C(q){return R(q)?[q]:Array.isArray(q)?q:R(q.variadic)?[q.variadic]:q.variadic}function O(q){if(typeof q=="string")return i({type:q});if("generic"in q)return i(T(q));if("literal"in q)return l(t(T(q.literal)));if("constant"in q)return p(t(T(q.constant)));if("dimension"in q)return t(T(q.dimension));if("measure"in q)return a(T(q.measure));if("array"in q)return i(T(q,!1));if("record"in q)return i(T(q,!1));if("sql_native"in q)return i({type:"sql native",rawType:q.sql_native});if("calculation"in q)return n(T(q.calculation));throw new Error("Invalid function blueprint")}function S(q){return q.map(H=>O(H))}function N(q){return typeof q!="string"&&"variadic"in q}function D(q,H){return{name:q,allowedTypes:S(C(H)),isVariadic:N(H)}}function b(q){return Object.entries(q).map(J=>D(J[0],J[1]))}function I(q){const H=[],J=[];let Z=q;for(;Z.length>0;){const se=Z.indexOf("${");if(se===-1){H.push(Z);break}const ue=Z.slice(0,se);Z=Z.slice(se);const ce=Z.indexOf("}");if(ce===-1){H.push(ue+Z);break}const he=Z.slice(2,ce);Z=Z.slice(ce+1);const ye=he.startsWith("..."),Se=he.endsWith(":"),le=ye?he.slice(3):Se?he.slice(0,-1):he,ge={node:"function_parameter",name:le};H.push(ue),ye?J.push({node:"spread",e:ge,prefix:"",suffix:""}):Se&&le==="order_by"?J.push({node:"aggregate_order_by"}):Se&&le==="limit"?J.push({node:"aggregate_limit"}):J.push(ge)}return{node:"genericSQLExpr",kids:{args:J},src:H}}function L(q,H){return N(H)?{node:"spread",e:{node:"function_parameter",name:q},prefix:"",suffix:""}:{node:"function_parameter",name:q}}function M(q,H){const J=Object.entries(H.takes),Z=J.length>0?J.length-1:0;return{node:"genericSQLExpr",kids:{args:J.map(oe=>L(oe[0],oe[1]))},src:[`${q}(`,...Array(Z).fill(","),")"]}}function W(q){return"sql"in q.impl?I(q.impl.sql):"expr"in q.impl?q.impl.expr:M(q.impl.function,q)}function ee(q){return{e:W(q),between:q.impl.between,needsWindowOrderBy:q.impl.needsWindowOrderBy,defaultOrderByArgIndex:q.impl.defaultOrderByArgIndex}}function Y(q){if(q!==void 0)return Object.entries(q).map(([H,J])=>({name:H,acceptibleTypes:J.map(Z=>T(Z,!0,!1))}))}function te(q){return{returnType:v(q.returns),params:b(q.takes),isSymmetric:q.isSymmetric,supportsOrderBy:q.supportsOrderBy,supportsLimit:q.supportsLimit,genericTypes:Y(q.generic),...ee(q)}}function G(q){return"takes"in q&&"returns"in q&&"impl"in q}function U(q){return"function"in q||"sql"in q||"expr"in q}function $(q){return G(q)?[te(q)]:Object.values(q).flatMap(H=>te(H))}function X(q){const H={};for(const J in q)H[J]=$(q[J]);return H}function w(q,H){return[te({...q,impl:H})]}function k(q,H,J){if(U(J)){if(!G(H))throw new Error(`Malformed function override: ${q}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(H)})`);return w(H,J)}else{if(G(H))throw new Error(`Malformed function override: ${q}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(J)})`);return Object.entries(J).flatMap(([Z,oe])=>{const se=H[Z];if(se===void 0)throw new Error(`Malformed function override: ${q}. No overload named ${Z}`);return w(se,oe)})}}function j(q,H){const J={};for(const Z in H){if(!(Z in q))throw new Error(`Malformed function override: ${Z}. No such function in Malloy standard`);J[Z]=k(Z,q[Z],H[Z])}return J}function*P(q){if(typeof q!="string"){if("generic"in q)yield q;else if("record"in q)for(const H of Object.values(q.record))yield*P(H);else for(const H of["array","literal","measure","dimension","measure","constant","cacluation"])if(H in q){yield*P(q[H]);return}}}function Q(q,H,J,Z={}){let oe=!1;const se={};for(const ce of Object.values(H))for(const he of P(ce))se[he.generic]=["any"],oe=!0;oe&&Z.generic===void 0&&(Z.generic=se);const ue={takes:H,returns:J,impl:{function:q.toUpperCase()},...Z};return{[q]:ue}}return It}var ep={},o0={},Iy;function S2(){if(Iy)return o0;Iy=1,Object.defineProperty(o0,"__esModule",{value:!0}),o0.decodeDottedTablePath=r,o0.validateDottedTablePath=g;function r(p,o){const{quoteChar:l,escapeStyle:u,bareIdentRegex:s,dialectName:c}=o;if(p.length===0)return{ok:!1,error:`${c} table path is empty`};const t=[];let a=0;for(;;){let i,x;if(p[a]===l){const n=A(p,a,l,u);if(n===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — unterminated quoted segment`};i=n.decoded,x=!0,a=n.end}else{const n=p.slice(a).match(s);if(!n||n.index!==0||n[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — invalid segment at position ${a}`};i=n[0],x=!1,a+=n[0].length}if(i.includes(";")||i.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(i)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(t.push({value:i,quoted:x}),a===p.length)return{ok:!0,segments:t};if(p[a]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — expected '.' at position ${a}`};if(a++,a===p.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(p)} — trailing dot`}}}function g(p,o){const l=r(p,o);return l.ok?{ok:!0,canonical:p}:l}function A(p,o,l,u){let s=o+1,c="";for(;s<p.length;){if(u==="backslash"&&p[s]==="\\"){if(s+1>=p.length)return null;c+=y(p[s+1]),s+=2;continue}if(p[s]===l){if(u==="doubled"&&p[s+1]===l){c+=l,s+=2;continue}return{decoded:c,end:s+1}}c+=p[s],s++}return null}function y(p){switch(p){case"n":return`
2
2
  `;case"t":return" ";case"r":return"\r";default:return p}}return o0}var wy;function Gr(){return wy||(wy=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.Dialect=r.dayIndex=r.CivilTime=r.EscapeStyle=r.MAX_DECIMAL38=r.MIN_DECIMAL38=r.MAX_INT128=r.MIN_INT128=r.MAX_INT64=r.MIN_INT64=r.MAX_INT32=r.MIN_INT32=void 0,r.inDays=p,r.queryZone=o,r.turtleGroupSetCondition=l;const g=Ie(),A=S2();r.MIN_INT32=-2147483648,r.MAX_INT32=2147483647,r.MIN_INT64=BigInt("-9223372036854775808"),r.MAX_INT64=BigInt("9223372036854775807"),r.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),r.MAX_INT128=BigInt("170141183460469231731687303715884105727"),r.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),r.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999"),r.EscapeStyle={Doubled:"doubled",Backslash:"backslash",Unset:"unset"},r.CivilTime={Date:"date",DateAndTime:"date_and_time"};const y=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];r.dayIndex=y.indexOf("day");function p(s){return y.indexOf(s)>=r.dayIndex}function o(s){var c;return(c=s.queryTimezone)!==null&&c!==void 0?c:"UTC"}function l(s,c){return s===void 0?c:c?`group_set=${s} AND ${c}`:`group_set=${s}`}class u{constructor(){this.experimentalAccepted=!1,this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsNestedProjectionLimit=!1,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.groupByClause="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.likeExtraWildcards=[],this.integerTypeMappings=[{min:BigInt(r.MIN_INT32),max:BigInt(r.MAX_INT32),numberType:"integer"},{min:r.MIN_INT64,max:r.MAX_INT64,numberType:"bigint"}],this.tablePathBareIdentRegex=/^[A-Za-z_][A-Za-z0-9_]*/,this.arrayQueries=void 0,this.identifierQuoteChar="",this.stringLiteralStyle=r.EscapeStyle.Unset,this.identifierEscapeStyle=r.EscapeStyle.Unset}isExperimental(){return this.experimental&&!this.experimentalAccepted}acceptExperimental(){this.experimentalAccepted=!0}sqlLateralJoinBag(c){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")}sqlOrderByLimit(c,t){let a=c.length>0?this.sqlOrderBy(c,"query")+`
3
3
  `:"";return t!==void 0&&(a+=`LIMIT ${t}
4
4
  `),a}literalNumberType(c){if(!/^-?\d+$/.test(c))return{type:"number",numberType:"float"};const a=BigInt(c);for(const i of this.integerTypeMappings)if(a>=i.min&&a<=i.max)return{type:"number",numberType:i.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(c,t,a,i,x){var n;const m=(n=c?.hasTimestamptz)!==null&&n!==void 0?n:!1;return x==="date"?{node:"dateLiteral",literal:t,typeDef:{type:"date",timeframe:i!==void 0&&(0,g.isDateUnit)(i)?i:void 0}}:a&&m?{node:"timestamptzLiteral",literal:t,typeDef:{type:"timestamptz",timeframe:i},timezone:a}:a?{node:"timestampLiteral",literal:t,typeDef:{type:"timestamp",timeframe:i},timezone:a}:{node:"timestampLiteral",literal:t,typeDef:{type:"timestamp",timeframe:i}}}sqlValidateTableName(c){if(this.identifierEscapeStyle!==r.EscapeStyle.Doubled&&this.identifierEscapeStyle!==r.EscapeStyle.Backslash)throw new Error(`${this.name}: sqlValidateTableName requires identifierEscapeStyle to be set to Doubled or Backslash (or override sqlValidateTableName).`);return(0,A.validateDottedTablePath)(c,{quoteChar:this.identifierQuoteChar,escapeStyle:this.identifierEscapeStyle,bareIdentRegex:this.tablePathBareIdentRegex,dialectName:this.name})}sqlTurtleOrderByClause(c){const t=c.map(a=>` ${a.field} ${a.dir.toUpperCase()}`);return" "+this.sqlOrderBy(t,"turtle")}sqlCombineLastStageOrderBy(c,t){return c===void 0||c.length===0?"":` ORDER BY ${c.map(i=>{const x=typeof i.field=="string"?i.field:t[i.field-1].rawName;return`${this.sqlQuoteIdentifier(x)} ${i.dir||"asc"}`}).join(", ")}`}sqlArrayAggregate(c){}sqlArrayOrEmpty(c){return c}arrayQueryHasSubquery(){const c=this.arrayQueries;return c!==void 0&&(c.value==="subquery"||c.arrays)}sqlFinalStage(c,t){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(c){return this.castToString(`DATE(${c})`)}escapeBackslashStyle(c,t){let a="";for(const i of c)switch(i){case"\\":a+="\\\\";break;case`