@malloy-publisher/server 0.4.0 → 0.4.1

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.
@@ -1 +1 @@
1
- import{r as l,b as w,d as N,bd as A,f as P,j as G,s as S,k as h,C as W,l as j,B as D,m as U,be as F}from"./index-DKvKsj6c.js";function H(t){return l.Children.toArray(t).filter(o=>l.isValidElement(o))}function q(t){return N("MuiToggleButton",t)}const f=w("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),E=l.createContext({}),V=l.createContext(void 0);function I(t,o){return o===void 0||t===void 0?!1:Array.isArray(o)?o.includes(t):t===o}const J=t=>{const{classes:o,fullWidth:a,selected:i,disabled:d,size:g,color:B}=t,u={root:["root",i&&"selected",d&&"disabled",a&&"fullWidth",`size${W(g)}`,B]};return j(u,q,o)},K=S(D,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[o.root,o[`size${W(a.size)}`]]}})(U(({theme:t})=>({...t.typography.button,borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active,[`&.${f.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${f.selected}`]:{color:(t.vars||t).palette.text.primary,backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity)}}}}},...Object.entries(t.palette).filter(F()).map(([o])=>({props:{color:o},style:{[`&.${f.selected}`]:{color:(t.vars||t).palette[o].main,backgroundColor:t.alpha((t.vars||t).palette[o].main,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette[o].main,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette[o].main,(t.vars||t).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:t.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:t.typography.pxToRem(15)}}]}))),_=l.forwardRef(function(o,a){const{value:i,...d}=l.useContext(E),g=l.useContext(V),B=A({...d,selected:I(o.value,i)},o),u=P({props:B,name:"MuiToggleButton"}),{children:R,className:$,color:p="standard",disabled:z=!1,disableFocusRipple:v=!1,fullWidth:s=!1,onChange:C,onClick:x,selected:c,size:k="medium",value:b,...L}=u,y={...u,color:p,disabled:z,disableFocusRipple:v,fullWidth:s,size:k},O=J(y),M=r=>{x&&(x(r,b),r.defaultPrevented)||C&&C(r,b)},n=g||"";return G.jsx(K,{className:h(d.className,O.root,$,n),disabled:z,focusRipple:!v,ref:a,onClick:M,onChange:C,value:b,ownerState:y,"aria-pressed":c,...L,children:R})});function Q(t){return N("MuiToggleButtonGroup",t)}const e=w("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),X=t=>{const{classes:o,orientation:a,fullWidth:i,disabled:d}=t,g={root:["root",a,i&&"fullWidth"],grouped:["grouped",`grouped${W(a)}`,d&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return j(g,Q,o)},Y=S("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[{[`& .${e.grouped}`]:o.grouped},{[`& .${e.grouped}`]:o[`grouped${W(a.orientation)}`]},{[`& .${e.firstButton}`]:o.firstButton},{[`& .${e.lastButton}`]:o.lastButton},{[`& .${e.middleButton}`]:o.middleButton},o.root,a.orientation==="vertical"&&o.vertical,a.fullWidth&&o.fullWidth]}})(U(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${e.grouped}`]:{[`&.${e.selected} + .${e.grouped}.${e.selected}`]:{borderTop:0,marginTop:0}},[`& .${e.firstButton},& .${e.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${e.lastButton},& .${e.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${e.lastButton}.${f.disabled},& .${e.middleButton}.${f.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${e.grouped}`]:{[`&.${e.selected} + .${e.grouped}.${e.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${e.firstButton},& .${e.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${e.lastButton},& .${e.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${e.lastButton}.${f.disabled},& .${e.middleButton}.${f.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),tt=l.forwardRef(function(o,a){const i=P({props:o,name:"MuiToggleButtonGroup"}),{children:d,className:g,color:B="standard",disabled:u=!1,exclusive:R=!1,fullWidth:$=!1,onChange:p,orientation:z="horizontal",size:v="medium",value:s,...C}=i,x={...i,disabled:u,fullWidth:$,orientation:z,size:v},c=X(x),k=l.useCallback((n,r)=>{if(!p)return;const T=s&&s.indexOf(r);let m;s&&T>=0?(m=s.slice(),m.splice(T,1)):m=s?s.concat(r):[r],p(n,m)},[p,s]),b=l.useCallback((n,r)=>{p&&p(n,s===r?null:r)},[p,s]),L=l.useMemo(()=>({className:c.grouped,onChange:R?b:k,value:s,size:v,fullWidth:$,color:B,disabled:u}),[c.grouped,R,b,k,s,v,$,B,u]),y=H(d),O=y.length,M=n=>{const r=n===0,T=n===O-1;return r&&T?"":r?c.firstButton:T?c.lastButton:c.middleButton};return G.jsx(Y,{role:"group",className:h(c.root,g),ref:a,ownerState:x,...C,children:G.jsx(E.Provider,{value:L,children:y.map((n,r)=>G.jsx(V.Provider,{value:M(r),children:n},r))})})});export{tt as T,_ as a};
1
+ import{r as l,b as w,d as N,be as A,h as P,j as G,s as S,k as h,C as W,l as j,B as D,m as U,bf as F}from"./index-CqxPodI3.js";function H(t){return l.Children.toArray(t).filter(o=>l.isValidElement(o))}function q(t){return N("MuiToggleButton",t)}const f=w("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),E=l.createContext({}),V=l.createContext(void 0);function I(t,o){return o===void 0||t===void 0?!1:Array.isArray(o)?o.includes(t):t===o}const J=t=>{const{classes:o,fullWidth:a,selected:i,disabled:d,size:g,color:B}=t,u={root:["root",i&&"selected",d&&"disabled",a&&"fullWidth",`size${W(g)}`,B]};return j(u,q,o)},K=S(D,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[o.root,o[`size${W(a.size)}`]]}})(U(({theme:t})=>({...t.typography.button,borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active,[`&.${f.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${f.selected}`]:{color:(t.vars||t).palette.text.primary,backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity)}}}}},...Object.entries(t.palette).filter(F()).map(([o])=>({props:{color:o},style:{[`&.${f.selected}`]:{color:(t.vars||t).palette[o].main,backgroundColor:t.alpha((t.vars||t).palette[o].main,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette[o].main,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette[o].main,(t.vars||t).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:t.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:t.typography.pxToRem(15)}}]}))),_=l.forwardRef(function(o,a){const{value:i,...d}=l.useContext(E),g=l.useContext(V),B=A({...d,selected:I(o.value,i)},o),u=P({props:B,name:"MuiToggleButton"}),{children:R,className:$,color:p="standard",disabled:z=!1,disableFocusRipple:v=!1,fullWidth:s=!1,onChange:C,onClick:x,selected:c,size:k="medium",value:b,...L}=u,y={...u,color:p,disabled:z,disableFocusRipple:v,fullWidth:s,size:k},O=J(y),M=r=>{x&&(x(r,b),r.defaultPrevented)||C&&C(r,b)},n=g||"";return G.jsx(K,{className:h(d.className,O.root,$,n),disabled:z,focusRipple:!v,ref:a,onClick:M,onChange:C,value:b,ownerState:y,"aria-pressed":c,...L,children:R})});function Q(t){return N("MuiToggleButtonGroup",t)}const e=w("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),X=t=>{const{classes:o,orientation:a,fullWidth:i,disabled:d}=t,g={root:["root",a,i&&"fullWidth"],grouped:["grouped",`grouped${W(a)}`,d&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return j(g,Q,o)},Y=S("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[{[`& .${e.grouped}`]:o.grouped},{[`& .${e.grouped}`]:o[`grouped${W(a.orientation)}`]},{[`& .${e.firstButton}`]:o.firstButton},{[`& .${e.lastButton}`]:o.lastButton},{[`& .${e.middleButton}`]:o.middleButton},o.root,a.orientation==="vertical"&&o.vertical,a.fullWidth&&o.fullWidth]}})(U(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${e.grouped}`]:{[`&.${e.selected} + .${e.grouped}.${e.selected}`]:{borderTop:0,marginTop:0}},[`& .${e.firstButton},& .${e.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${e.lastButton},& .${e.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${e.lastButton}.${f.disabled},& .${e.middleButton}.${f.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${e.grouped}`]:{[`&.${e.selected} + .${e.grouped}.${e.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${e.firstButton},& .${e.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${e.lastButton},& .${e.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${e.lastButton}.${f.disabled},& .${e.middleButton}.${f.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),tt=l.forwardRef(function(o,a){const i=P({props:o,name:"MuiToggleButtonGroup"}),{children:d,className:g,color:B="standard",disabled:u=!1,exclusive:R=!1,fullWidth:$=!1,onChange:p,orientation:z="horizontal",size:v="medium",value:s,...C}=i,x={...i,disabled:u,fullWidth:$,orientation:z,size:v},c=X(x),k=l.useCallback((n,r)=>{if(!p)return;const T=s&&s.indexOf(r);let m;s&&T>=0?(m=s.slice(),m.splice(T,1)):m=s?s.concat(r):[r],p(n,m)},[p,s]),b=l.useCallback((n,r)=>{p&&p(n,s===r?null:r)},[p,s]),L=l.useMemo(()=>({className:c.grouped,onChange:R?b:k,value:s,size:v,fullWidth:$,color:B,disabled:u}),[c.grouped,R,b,k,s,v,$,B,u]),y=H(d),O=y.length,M=n=>{const r=n===0,T=n===O-1;return r&&T?"":r?c.firstButton:T?c.lastButton:c.middleButton};return G.jsx(Y,{role:"group",className:h(c.root,g),ref:a,ownerState:x,...C,children:G.jsx(E.Provider,{value:L,children:y.map((n,r)=>G.jsx(V.Provider,{value:M(r),children:n},r))})})});export{tt as T,_ as a};
@@ -1,4 +1,4 @@
1
- import{aK as lf,bf as Qv}from"./index-DKvKsj6c.js";import{r as Ss}from"./index-w_0OQJgZ.js";import{r as um}from"./index-CRAwrhYM.js";function KD(n,p){for(var S=0;S<p.length;S++){const g=p[S];if(typeof g!="string"&&!Array.isArray(g)){for(const h in g)if(h!=="default"&&!(h in n)){const u=Object.getOwnPropertyDescriptor(g,h);u&&Object.defineProperty(n,h,u.get?u:{enumerable:!0,get:()=>g[h]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var ci={},Uh={},Lt={},kh={},gy;function Pe(){return gy||(gy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.TD=n.ValueType=void 0,n.safeRecordGet=S,n.mkSafeRecord=g,n.exprHasKids=h,n.exprHasE=u,n.exprIsLeaf=l,n.isAsymmetricExpr=a,n.mkTemporal=c,n.isRawCast=t,n.isFilterExprType=o,n.isTimeLiteral=s,n.isParameterType=x,n.paramHasValue=r,n.activeName=y,n.expressionIsScalar=d,n.expressionIsAggregate=m,n.expressionIsUngroupedAggregate=E,n.expressionInvolvesAggregate=_,n.expressionIsCalculation=v,n.expressionIsAnalytic=C,n.isExpressionTypeLEQ=L,n.maxExpressionType=A,n.maxOfExpressionTypes=O,n.hasExpression=D,n.isTemporalType=N,n.isBasicAtomicType=b,n.isAtomicFieldType=B,n.canOrderBy=U,n.fieldIsIntrinsic=z,n.mkFieldDef=ee,n.mkArrayDef=ae,n.mkArrayTypeDef=te,n.isRepeatedRecordFunctionParam=k,n.isRepeatedRecord=re,n.isRecordOrRepeatedRecord=K,n.isBasicArray=J,n.isMatrixOperation=q,n.isJoinable=j,n.isJoined=Q,n.isJoinedSource=w,n.isDateUnit=M,n.isTimestampUnit=I,n.isExtractUnit=W,n.refIsStructDef=oe,n.segmentHasErrors=ce,n.structHasErrors=se,n.isReduceSegment=ne,n.isPartialSegment=xe,n.isProjectSegment=de,n.isQuerySegment=me,n.isSamplingRows=Ae,n.isSamplingPercent=he,n.isSamplingEnable=Ee,n.isRawSegment=Re,n.isIndexSegment=je,n.bareFieldUsage=Ge,n.fieldUsageFrom=pe,n.givenUsageFrom=ye,n.mkRefSummary=Oe,n.mapFieldUsage=Fe,n.isSegmentSQL=Ie,n.isSegmentSource=Ve,n.isSourceRegistryReference=ze,n.sourceBase=Me,n.isSourceDef=tt,n.isPersistableSourceDef=rt,n.isBaseTable=Se,n.isLiteral=qe,n.mergeEvalSpaces=We,n.isBasicAtomic=ue,n.isUserTypeDef=fe,n.isCompoundArrayData=ge,n.isTurtle=Te,n.isAtomic=be,n.isValueString=Le,n.isValueNumber=$e,n.isValueBoolean=Xe,n.isValueTimestamp=at,n.isValueDate=dt,n.mergeUniqueKeyRequirement=it;const p=Object.prototype.hasOwnProperty;function S(Z,Ce){return p.call(Z,Ce)?Z[Ce]:void 0}function g(){return Object.create(null)}function h(Z){return"kids"in Z}function u(Z){return"e"in Z}function l(Z){return!(h(Z)||u(Z))}function a(Z){return Z.node==="aggregate"&&["sum","avg","count","distinct"].includes(Z.function)}function i(Z){return Z.node!=="arrayLiteral"&&Z.node!=="recordLiteral"}function c(Z,Ce){if(!("typeDef"in Z)){const Qe=typeof Ce=="string"?{type:Ce}:Ce;if(i(Z))return{...Z,typeDef:{...Qe}}}return Z}function t(Z){return"dstSQLType"in Z}function o(Z){return["string","number","boolean","date","timestamp","timestamptz"].includes(Z)}function s(Z){return Z.node==="dateLiteral"||Z.node==="timestampLiteral"||Z.node==="timestamptzLiteral"}function x(Z){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(Z)}function r(Z){return Z.value!==null}function y(Z){var Ce;return(Ce=Z.as)!==null&&Ce!==void 0?Ce:Z.name}function d(Z){return Z===void 0||Z==="scalar"}function m(Z){return Z==="aggregate"||Z==="ungrouped_aggregate"}function E(Z){return Z==="ungrouped_aggregate"}function _(Z){return Z==="aggregate"||Z==="ungrouped_aggregate"||Z==="aggregate_analytic"}function v(Z){return Z==="aggregate"||Z==="scalar_analytic"||Z==="aggregate_analytic"||Z==="ungrouped_aggregate"}function C(Z){return Z==="aggregate_analytic"||Z==="scalar_analytic"}function R(Z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[Z]}function L(Z,Ce){return Z===Ce||R(Z)<R(Ce)}function A(Z,Ce){let Qe="scalar";return(Z==="aggregate"||Ce==="aggregate")&&(Qe="aggregate"),(Z==="ungrouped_aggregate"||Ce==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(Z==="scalar_analytic"||Ce==="scalar_analytic")&&(Qe="scalar_analytic"),(Z==="aggregate_analytic"||Ce==="aggregate_analytic")&&(Qe="aggregate_analytic"),(Z==="scalar_analytic"&&Ce==="aggregate"||Z==="aggregate"&&Ce==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function O(Z){return Z.reduce(A,"scalar")}function D(Z){return"e"in Z&&Z.e!==void 0}function N(Z){return Z==="date"||Z==="timestamp"||Z==="timestamptz"}function b(Z){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(Z)}function B(Z){return b(Z)||Z==="record"||Z==="array"}function U(Z){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(Z)}function z(Z){return B(Z.type)&&!D(Z)}function ee(Z,Ce){if(J(Z))return ae(Z.elementTypeDef,Ce);if(re(Z)){const{type:Ne,fields:Ue,elementTypeDef:Ke}=Z;return{type:Ne,fields:Ue,elementTypeDef:Ke,join:"many",name:Ce}}if(Z.type==="record"){const{type:Ne,fields:Ue}=Z;return{type:Ne,fields:Ue,join:"one",name:Ce}}const Qe={name:Ce,type:Z.type};switch(Z.type){case"sql native":return{...Qe,rawType:Z.rawType};case"number":{const Ne=Z.numberType;return Ne?{...Qe,numberType:Ne}:Qe}case"date":{const Ne=Z.timeframe;return Ne?{name:Ce,type:"date",timeframe:Ne}:Qe}case"timestamp":{const Ne={name:Ce,type:"timestamp"};return Z.timeframe&&(Ne.timeframe=Z.timeframe),Ne}case"timestamptz":{const Ne={name:Ce,type:"timestamptz"};return Z.timeframe&&(Ne.timeframe=Z.timeframe),Ne}}return Qe}function ae(Z,Ce){if(Z.type==="record")return{type:"array",join:"many",name:Ce,elementTypeDef:{type:"record_element"},fields:Z.fields};const Qe=ee(Z,"value");return{type:"array",join:"many",name:Ce,elementTypeDef:Z,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function te(Z){return Z.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:Z.fields}:{type:"array",elementTypeDef:Z}}function k(Z){return Z.type==="array"&&Z.elementTypeDef.type==="record_element"}function re(Z){return Z.type==="array"&&Z.elementTypeDef.type==="record_element"}function K(Z){return Z.type==="record"||Z.type==="array"&&"elementTypeDef"in Z&&Z.elementTypeDef.type==="record_element"}function J(Z){return Z.type==="array"&&Z.elementTypeDef.type!=="record_element"}function q(Z){return["left","right","full","inner"].includes(Z)}function j(Z){return["composite","table","sql_select","query_source","virtual","array","record"].includes(Z.type)}function Q(Z){return"join"in Z}function w(Z){return tt(Z)&&Q(Z)}function M(Z){return["day","week","month","quarter","year"].includes(Z)}function I(Z){return M(Z)||["hour","minute","second"].includes(Z)}function W(Z){return I(Z)||Z==="day_of_week"||Z==="day_of_year"}var X;(function(Z){Z.Date="date",Z.Timestamp="timestamp",Z.Number="number",Z.String="string"})(X||(n.ValueType=X={}));function oe(Z){return typeof Z!="string"}function ce(Z){return!!((Z.type==="reduce"||Z.type==="project"||Z.type==="partial")&&(Z.extendSource&&Z.extendSource.some(Ce=>Ce.type==="error")||Z.queryFields.some(Ce=>Ce.type==="error")))}function se(Z){return Z.fields.some(Ce=>Ce.type==="error")}function ne(Z){return Z.type==="reduce"}function xe(Z){return Z.type==="partial"}function de(Z){return Z.type==="project"}function me(Z){return de(Z)||ne(Z)}function Ae(Z){return Z.rows!==void 0}function he(Z){return Z.percent!==void 0}function Ee(Z){return Z.enable!==void 0}function Re(Z){return Z.type==="raw"}function je(Z){return Z.type==="index"}function Ge(Z){return Z.uniqueKeyRequirement===void 0&&Z.analyticFunctionUse===void 0}function pe(Z){var Ce;return(Ce=Z?.fieldUsage)!==null&&Ce!==void 0?Ce:[]}function ye(Z){var Ce;return(Ce=Z?.givenUsage)!==null&&Ce!==void 0?Ce:[]}function Oe({fieldUsage:Z,givenUsage:Ce}){if(!(Z===void 0&&Ce===void 0))return{fieldUsage:Z??[],...Ce&&{givenUsage:Ce}}}function Fe(Z,Ce){return Z&&{...Z,fieldUsage:Z.fieldUsage.map(Ce)}}function Ie(Z){return"sql"in Z}function Ve(Z){return"type"in Z&&(Z.type==="sql_select"||Z.type==="query_source")}function ze(Z){return Z.type==="source_registry_reference"}function Me(Z){return{...Z}}function tt(Z){return Z.type==="table"||Z.type==="sql_select"||Z.type==="query_source"||Z.type==="query_result"||Z.type==="finalize"||Z.type==="nest_source"||Z.type==="virtual"||Z.type==="composite"}function rt(Z){return Z.type==="sql_select"||Z.type==="query_source"}function Se(Z){return w(Z)?!1:!!tt(Z)}function qe(Z){return Z==="literal"}function We(...Z){return Z.length<=1&&Z.every(Ce=>Ce==="literal")?"literal":Z.every(Ce=>Ce==="constant"||Ce==="literal")?"constant":Z.every(Ce=>Ce==="output"||Ce==="constant"||Ce==="literal")?"output":"input"}function ue(Z){return Z.type==="string"||N(Z.type)||Z.type==="number"||Z.type==="boolean"||Z.type==="json"||Z.type==="sql native"||Z.type==="error"}function fe(Z){return Z.type==="userType"}function ge(Z){return Array.isArray(Z)&&(Z.length===0||typeof Z[0]=="object"&&Z[0]!==null&&!Array.isArray(Z[0]))}function Te(Z){return Z.type==="turtle"}function be(Z){return B(Z.type)}function Le(Z,Ce){return Ce.type==="string"}function $e(Z,Ce){return Ce.type==="number"}function Xe(Z,Ce){return Ce.type==="boolean"}function at(Z,Ce){return Ce.type==="timestamp"}function dt(Z,Ce){return Ce.type==="date"}n.TD={isAtomic(Z){return Z!==void 0&&B(Z.type)},isBasicAtomic(Z){return Z!==void 0&&ue({type:Z.type})},isString:Z=>Z?.type==="string",isNumber:Z=>Z?.type==="number",isBoolean:Z=>Z?.type==="boolean",isJSON:Z=>Z?.type==="json",isSQL:Z=>Z?.type==="sql native",isDate:Z=>Z?.type==="date",isTimestamp:Z=>Z?.type==="timestamp",isTimestamptz:Z=>Z?.type==="timestamptz",isAnyTimestamp(Z){return Z?.type==="timestamp"||Z?.type==="timestamptz"},isTemporal(Z){var Ce;const Qe=(Ce=Z?.type)!==null&&Ce!==void 0?Ce:"";return N(Qe)},isError:Z=>Z?.type==="error",atomicDef(Z){if(!n.TD.isAtomic(Z))return{type:"error"};switch(Z.type){case"array":return re(Z)?{type:"array",elementTypeDef:Z.elementTypeDef,fields:Z.fields}:{type:"array",elementTypeDef:Z.elementTypeDef};case"record":return{type:"record",fields:Z.fields};case"number":return Z.numberType?{type:"number",numberType:Z.numberType}:{type:"number"};case"sql native":return Z.rawType?{type:"sql native",rawType:Z.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return Z.timeframe?{type:Z.type,timeframe:Z.timeframe}:{type:Z.type};default:return{type:Z.type}}},eq(Z,Ce){if(Z===void 0||Ce===void 0)return!1;function Qe(Ne,Ue){const Ke={},st=Ne.fields||[],Ye=Ue.fields||[];if(st.length!==Ye.length)return!1;for(const Ze of st)if(Ze.name)Ke[Ze.name]=Ze;else return!1;for(const Ze of Ye)if(!n.TD.eq(Ke[Ze.name],Ze))return!1;return!0}return Z.type==="array"&&Ce.type==="array"?Z.elementTypeDef.type!==Ce.elementTypeDef.type?!1:Z.elementTypeDef.type!=="record_element"&&Ce.elementTypeDef.type!=="record_element"?n.TD.eq(Z.elementTypeDef,Ce.elementTypeDef):n.TD.isAtomic(Z)&&n.TD.isAtomic(Ce)&&Qe(Z,Ce):Z.type==="record"&&Ce.type==="record"?n.TD.isAtomic(Z)&&n.TD.isAtomic(Ce)&&Qe(Z,Ce):Z.type==="sql native"&&Ce.type==="sql native"?Z.rawType!==void 0&&Z.rawType===Ce.rawType:Z.type===Ce.type}};function it(Z,Ce){return Z?Ce?{isCount:Z.isCount||Ce.isCount}:Z:Ce}})(kh)),kh}var Ey;function vn(){if(Ey)return Lt;Ey=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.arg=p,Lt.spread=S,Lt.sql=g,Lt.constant=h,Lt.output=u,Lt.literal=l,Lt.variadicParam=a,Lt.param=i,Lt.makeParam=c,Lt.maxScalar=t,Lt.maxAggregate=o,Lt.anyExprType=s,Lt.maxUngroupedAggregate=x,Lt.maxAnalytic=r,Lt.minScalar=y,Lt.minAggregate=d,Lt.minAnalytic=m,Lt.overload=E,Lt.expandBlueprintMap=J,Lt.expandOverrideMapFromBase=Q,Lt.def=M;const n=Pe();function p(I){return{node:"function_parameter",name:I}}function S(I,W=void 0,X=void 0){return{node:"spread",e:I,prefix:W,suffix:X}}function g(I,...W){const X={node:"genericSQLExpr",kids:{args:[]},src:[]},oe=[...W];let ce="";for(const se of I){ce+=se;const ne=oe.shift();ne!==void 0&&(typeof ne=="string"?ce+=ne:(X.src.push(ce),X.kids.args.push(ne),ce=""))}return ce.length>0&&X.src.push(ce),X}function h(I){return{...I,evalSpace:"constant"}}function u(I){return{...I,evalSpace:"output"}}function l(I){return{...I,evalSpace:"literal"}}function a(I,...W){return{name:I,isVariadic:!0,allowedTypes:W}}function i(I,...W){return{name:I,isVariadic:!1,allowedTypes:W}}function c(I,...W){return{param:i(I,...W),arg:p(I)}}function t(I){return{...I,expressionType:"scalar",evalSpace:"input"}}function o(I){return{...I,expressionType:"aggregate",evalSpace:"input"}}function s(I){return{...I,expressionType:void 0,evalSpace:"input"}}function x(I){return{...I,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function r(I){return{...I,expressionType:"aggregate_analytic",evalSpace:"input"}}function y(I){return{...I,expressionType:"scalar",evalSpace:"input"}}function d(I){return{...I,expressionType:"aggregate",evalSpace:"input"}}function m(I){return{...I,expressionType:"scalar_analytic",evalSpace:"input"}}function E(I,W,X,oe){return{returnType:I,params:W,e:X,needsWindowOrderBy:oe?.needsWindowOrderBy,between:oe?.between,isSymmetric:oe?.isSymmetric,supportsOrderBy:oe?.supportsOrderBy,defaultOrderByArgIndex:oe?.defaultOrderByArgIndex,supportsLimit:oe?.supportsLimit}}function _(I,W=!0,X=!0){if(!W&&I==="any")throw new Error("Return type cannot include any");if(typeof I=="string")return{type:I};if("array"in I){const oe=W?_(I.array,!0):_(I.array,!1);return oe.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:oe.fields}:{type:"array",elementTypeDef:oe}}else if("record"in I){const oe=[];for(const[ce,se]of Object.entries(I.record)){const ne=W?_(se,!0):_(se,!1);n.TD.isAtomic(ne)&&oe.push((0,n.mkFieldDef)(ne,ce))}return{type:"record",fields:oe}}else if("generic"in I){if(!X)throw new Error("Cannot use generic");return{type:"generic",generic:I.generic}}else if("sql_native"in I)return{type:"sql native",rawType:I.sql_native};throw new Error("Cannot figure out type")}function v(I){if(I==="any")throw new Error("Cannot return any type");if(typeof I=="string")return y({type:I});if("array"in I)return s(_(I,!1));if("record"in I)return s(_(I,!1));if("generic"in I)return y(_(I,!1));if("literal"in I)return l(y(_(I.literal,!1)));if("constant"in I)return h(y(_(I.constant,!1)));if("dimension"in I)return y(_(I.dimension,!1));if("measure"in I)return d(_(I.measure,!1));if("sql_native"in I)return s({type:"sql native",rawType:I.sql_native});if("calculation"in I)return m(_(I.calculation,!1));throw new Error("Invalid function blueprint")}function C(I){return typeof I=="string"||"array"in I||"record"in I||"generic"in I||"literal"in I||"constant"in I||"dimension"in I||"measure"in I||"calculation"in I||"sql_native"in I}function R(I){return C(I)?[I]:Array.isArray(I)?I:C(I.variadic)?[I.variadic]:I.variadic}function L(I){if(typeof I=="string")return s({type:I});if("generic"in I)return s(_(I));if("literal"in I)return l(t(_(I.literal)));if("constant"in I)return h(t(_(I.constant)));if("dimension"in I)return t(_(I.dimension));if("measure"in I)return o(_(I.measure));if("array"in I)return s(_(I,!1));if("record"in I)return s(_(I,!1));if("sql_native"in I)return s({type:"sql native",rawType:I.sql_native});if("calculation"in I)return r(_(I.calculation));throw new Error("Invalid function blueprint")}function A(I){return I.map(W=>L(W))}function O(I){return typeof I!="string"&&"variadic"in I}function D(I,W){return{name:I,allowedTypes:A(R(W)),isVariadic:O(W)}}function N(I){return Object.entries(I).map(X=>D(X[0],X[1]))}function b(I){const W=[],X=[];let oe=I;for(;oe.length>0;){const se=oe.indexOf("${");if(se===-1){W.push(oe);break}const ne=oe.slice(0,se);oe=oe.slice(se);const xe=oe.indexOf("}");if(xe===-1){W.push(ne+oe);break}const de=oe.slice(2,xe);oe=oe.slice(xe+1);const me=de.startsWith("..."),Ae=de.endsWith(":"),he=me?de.slice(3):Ae?de.slice(0,-1):de,Ee={node:"function_parameter",name:he};W.push(ne),me?X.push({node:"spread",e:Ee,prefix:"",suffix:""}):Ae&&he==="order_by"?X.push({node:"aggregate_order_by"}):Ae&&he==="limit"?X.push({node:"aggregate_limit"}):X.push(Ee)}return{node:"genericSQLExpr",kids:{args:X},src:W}}function B(I,W){return O(W)?{node:"spread",e:{node:"function_parameter",name:I},prefix:"",suffix:""}:{node:"function_parameter",name:I}}function U(I,W){const X=Object.entries(W.takes),oe=X.length>0?X.length-1:0;return{node:"genericSQLExpr",kids:{args:X.map(ce=>B(ce[0],ce[1]))},src:[`${I}(`,...Array(oe).fill(","),")"]}}function z(I){return"sql"in I.impl?b(I.impl.sql):"expr"in I.impl?I.impl.expr:U(I.impl.function,I)}function ee(I){return{e:z(I),between:I.impl.between,needsWindowOrderBy:I.impl.needsWindowOrderBy,defaultOrderByArgIndex:I.impl.defaultOrderByArgIndex}}function ae(I){if(I!==void 0)return Object.entries(I).map(([W,X])=>({name:W,acceptibleTypes:X.map(oe=>_(oe,!0,!1))}))}function te(I){return{returnType:v(I.returns),params:N(I.takes),isSymmetric:I.isSymmetric,supportsOrderBy:I.supportsOrderBy,supportsLimit:I.supportsLimit,genericTypes:ae(I.generic),...ee(I)}}function k(I){return"takes"in I&&"returns"in I&&"impl"in I}function re(I){return"function"in I||"sql"in I||"expr"in I}function K(I){return k(I)?[te(I)]:Object.values(I).flatMap(W=>te(W))}function J(I){const W={};for(const X in I)W[X]=K(I[X]);return W}function q(I,W){return[te({...I,impl:W})]}function j(I,W,X){if(re(X)){if(!k(W))throw new Error(`Malformed function override: ${I}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(W)})`);return q(W,X)}else{if(k(W))throw new Error(`Malformed function override: ${I}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(X)})`);return Object.entries(X).flatMap(([oe,ce])=>{const se=W[oe];if(se===void 0)throw new Error(`Malformed function override: ${I}. No overload named ${oe}`);return q(se,ce)})}}function Q(I,W){const X={};for(const oe in W){if(!(oe in I))throw new Error(`Malformed function override: ${oe}. No such function in Malloy standard`);X[oe]=j(oe,I[oe],W[oe])}return X}function*w(I){if(typeof I!="string"){if("generic"in I)yield I;else if("record"in I)for(const W of Object.values(I.record))yield*w(W);else for(const W of["array","literal","measure","dimension","measure","constant","cacluation"])if(W in I){yield*w(I[W]);return}}}function M(I,W,X,oe={}){let ce=!1;const se={};for(const xe of Object.values(W))for(const de of w(xe))se[de.generic]=["any"],ce=!0;ce&&oe.generic===void 0&&(oe.generic=se);const ne={takes:W,returns:X,impl:{function:I.toUpperCase()},...oe};return{[I]:ne}}return Lt}var $h={},i0={},Ay;function am(){if(Ay)return i0;Ay=1,Object.defineProperty(i0,"__esModule",{value:!0}),i0.decodeDottedTablePath=n,i0.validateDottedTablePath=p;function n(h,u){const{quoteChar:l,escapeStyle:a,bareIdentRegex:i,dialectName:c}=u;if(h.length===0)return{ok:!1,error:`${c} table path is empty`};const t=[];let o=0;for(;;){let s,x;if(h[o]===l){const r=S(h,o,l,a);if(r===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — unterminated quoted segment`};s=r.decoded,x=!0,o=r.end}else{const r=h.slice(o).match(i);if(!r||r.index!==0||r[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — invalid segment at position ${o}`};s=r[0],x=!1,o+=r[0].length}if(s.includes(";")||s.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(s)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(t.push({value:s,quoted:x}),o===h.length)return{ok:!0,segments:t};if(h[o]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — expected '.' at position ${o}`};if(o++,o===h.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — trailing dot`}}}function p(h,u){const l=n(h,u);return l.ok?{ok:!0,canonical:h}:l}function S(h,u,l,a){let i=u+1,c="";for(;i<h.length;){if(a==="backslash"&&h[i]==="\\"){if(i+1>=h.length)return null;c+=g(h[i+1]),i+=2;continue}if(h[i]===l){if(a==="doubled"&&h[i+1]===l){c+=l,i+=2;continue}return{decoded:c,end:i+1}}c+=h[i],i++}return null}function g(h){switch(h){case"n":return`
1
+ import{aK as lf,bg as Qv}from"./index-CqxPodI3.js";import{r as Ss}from"./index-w_0OQJgZ.js";import{r as um}from"./index-CRAwrhYM.js";function KD(n,p){for(var S=0;S<p.length;S++){const g=p[S];if(typeof g!="string"&&!Array.isArray(g)){for(const h in g)if(h!=="default"&&!(h in n)){const u=Object.getOwnPropertyDescriptor(g,h);u&&Object.defineProperty(n,h,u.get?u:{enumerable:!0,get:()=>g[h]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var ci={},Uh={},Lt={},kh={},gy;function Pe(){return gy||(gy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.TD=n.ValueType=void 0,n.safeRecordGet=S,n.mkSafeRecord=g,n.exprHasKids=h,n.exprHasE=u,n.exprIsLeaf=l,n.isAsymmetricExpr=a,n.mkTemporal=c,n.isRawCast=t,n.isFilterExprType=o,n.isTimeLiteral=s,n.isParameterType=x,n.paramHasValue=r,n.activeName=y,n.expressionIsScalar=d,n.expressionIsAggregate=m,n.expressionIsUngroupedAggregate=E,n.expressionInvolvesAggregate=_,n.expressionIsCalculation=v,n.expressionIsAnalytic=C,n.isExpressionTypeLEQ=L,n.maxExpressionType=A,n.maxOfExpressionTypes=O,n.hasExpression=D,n.isTemporalType=N,n.isBasicAtomicType=b,n.isAtomicFieldType=B,n.canOrderBy=U,n.fieldIsIntrinsic=z,n.mkFieldDef=ee,n.mkArrayDef=ae,n.mkArrayTypeDef=te,n.isRepeatedRecordFunctionParam=k,n.isRepeatedRecord=re,n.isRecordOrRepeatedRecord=K,n.isBasicArray=J,n.isMatrixOperation=q,n.isJoinable=j,n.isJoined=Q,n.isJoinedSource=w,n.isDateUnit=M,n.isTimestampUnit=I,n.isExtractUnit=W,n.refIsStructDef=oe,n.segmentHasErrors=ce,n.structHasErrors=se,n.isReduceSegment=ne,n.isPartialSegment=xe,n.isProjectSegment=de,n.isQuerySegment=me,n.isSamplingRows=Ae,n.isSamplingPercent=he,n.isSamplingEnable=Ee,n.isRawSegment=Re,n.isIndexSegment=je,n.bareFieldUsage=Ge,n.fieldUsageFrom=pe,n.givenUsageFrom=ye,n.mkRefSummary=Oe,n.mapFieldUsage=Fe,n.isSegmentSQL=Ie,n.isSegmentSource=Ve,n.isSourceRegistryReference=ze,n.sourceBase=Me,n.isSourceDef=tt,n.isPersistableSourceDef=rt,n.isBaseTable=Se,n.isLiteral=qe,n.mergeEvalSpaces=We,n.isBasicAtomic=ue,n.isUserTypeDef=fe,n.isCompoundArrayData=ge,n.isTurtle=Te,n.isAtomic=be,n.isValueString=Le,n.isValueNumber=$e,n.isValueBoolean=Xe,n.isValueTimestamp=at,n.isValueDate=dt,n.mergeUniqueKeyRequirement=it;const p=Object.prototype.hasOwnProperty;function S(Z,Ce){return p.call(Z,Ce)?Z[Ce]:void 0}function g(){return Object.create(null)}function h(Z){return"kids"in Z}function u(Z){return"e"in Z}function l(Z){return!(h(Z)||u(Z))}function a(Z){return Z.node==="aggregate"&&["sum","avg","count","distinct"].includes(Z.function)}function i(Z){return Z.node!=="arrayLiteral"&&Z.node!=="recordLiteral"}function c(Z,Ce){if(!("typeDef"in Z)){const Qe=typeof Ce=="string"?{type:Ce}:Ce;if(i(Z))return{...Z,typeDef:{...Qe}}}return Z}function t(Z){return"dstSQLType"in Z}function o(Z){return["string","number","boolean","date","timestamp","timestamptz"].includes(Z)}function s(Z){return Z.node==="dateLiteral"||Z.node==="timestampLiteral"||Z.node==="timestamptzLiteral"}function x(Z){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(Z)}function r(Z){return Z.value!==null}function y(Z){var Ce;return(Ce=Z.as)!==null&&Ce!==void 0?Ce:Z.name}function d(Z){return Z===void 0||Z==="scalar"}function m(Z){return Z==="aggregate"||Z==="ungrouped_aggregate"}function E(Z){return Z==="ungrouped_aggregate"}function _(Z){return Z==="aggregate"||Z==="ungrouped_aggregate"||Z==="aggregate_analytic"}function v(Z){return Z==="aggregate"||Z==="scalar_analytic"||Z==="aggregate_analytic"||Z==="ungrouped_aggregate"}function C(Z){return Z==="aggregate_analytic"||Z==="scalar_analytic"}function R(Z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[Z]}function L(Z,Ce){return Z===Ce||R(Z)<R(Ce)}function A(Z,Ce){let Qe="scalar";return(Z==="aggregate"||Ce==="aggregate")&&(Qe="aggregate"),(Z==="ungrouped_aggregate"||Ce==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(Z==="scalar_analytic"||Ce==="scalar_analytic")&&(Qe="scalar_analytic"),(Z==="aggregate_analytic"||Ce==="aggregate_analytic")&&(Qe="aggregate_analytic"),(Z==="scalar_analytic"&&Ce==="aggregate"||Z==="aggregate"&&Ce==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function O(Z){return Z.reduce(A,"scalar")}function D(Z){return"e"in Z&&Z.e!==void 0}function N(Z){return Z==="date"||Z==="timestamp"||Z==="timestamptz"}function b(Z){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(Z)}function B(Z){return b(Z)||Z==="record"||Z==="array"}function U(Z){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(Z)}function z(Z){return B(Z.type)&&!D(Z)}function ee(Z,Ce){if(J(Z))return ae(Z.elementTypeDef,Ce);if(re(Z)){const{type:Ne,fields:Ue,elementTypeDef:Ke}=Z;return{type:Ne,fields:Ue,elementTypeDef:Ke,join:"many",name:Ce}}if(Z.type==="record"){const{type:Ne,fields:Ue}=Z;return{type:Ne,fields:Ue,join:"one",name:Ce}}const Qe={name:Ce,type:Z.type};switch(Z.type){case"sql native":return{...Qe,rawType:Z.rawType};case"number":{const Ne=Z.numberType;return Ne?{...Qe,numberType:Ne}:Qe}case"date":{const Ne=Z.timeframe;return Ne?{name:Ce,type:"date",timeframe:Ne}:Qe}case"timestamp":{const Ne={name:Ce,type:"timestamp"};return Z.timeframe&&(Ne.timeframe=Z.timeframe),Ne}case"timestamptz":{const Ne={name:Ce,type:"timestamptz"};return Z.timeframe&&(Ne.timeframe=Z.timeframe),Ne}}return Qe}function ae(Z,Ce){if(Z.type==="record")return{type:"array",join:"many",name:Ce,elementTypeDef:{type:"record_element"},fields:Z.fields};const Qe=ee(Z,"value");return{type:"array",join:"many",name:Ce,elementTypeDef:Z,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function te(Z){return Z.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:Z.fields}:{type:"array",elementTypeDef:Z}}function k(Z){return Z.type==="array"&&Z.elementTypeDef.type==="record_element"}function re(Z){return Z.type==="array"&&Z.elementTypeDef.type==="record_element"}function K(Z){return Z.type==="record"||Z.type==="array"&&"elementTypeDef"in Z&&Z.elementTypeDef.type==="record_element"}function J(Z){return Z.type==="array"&&Z.elementTypeDef.type!=="record_element"}function q(Z){return["left","right","full","inner"].includes(Z)}function j(Z){return["composite","table","sql_select","query_source","virtual","array","record"].includes(Z.type)}function Q(Z){return"join"in Z}function w(Z){return tt(Z)&&Q(Z)}function M(Z){return["day","week","month","quarter","year"].includes(Z)}function I(Z){return M(Z)||["hour","minute","second"].includes(Z)}function W(Z){return I(Z)||Z==="day_of_week"||Z==="day_of_year"}var X;(function(Z){Z.Date="date",Z.Timestamp="timestamp",Z.Number="number",Z.String="string"})(X||(n.ValueType=X={}));function oe(Z){return typeof Z!="string"}function ce(Z){return!!((Z.type==="reduce"||Z.type==="project"||Z.type==="partial")&&(Z.extendSource&&Z.extendSource.some(Ce=>Ce.type==="error")||Z.queryFields.some(Ce=>Ce.type==="error")))}function se(Z){return Z.fields.some(Ce=>Ce.type==="error")}function ne(Z){return Z.type==="reduce"}function xe(Z){return Z.type==="partial"}function de(Z){return Z.type==="project"}function me(Z){return de(Z)||ne(Z)}function Ae(Z){return Z.rows!==void 0}function he(Z){return Z.percent!==void 0}function Ee(Z){return Z.enable!==void 0}function Re(Z){return Z.type==="raw"}function je(Z){return Z.type==="index"}function Ge(Z){return Z.uniqueKeyRequirement===void 0&&Z.analyticFunctionUse===void 0}function pe(Z){var Ce;return(Ce=Z?.fieldUsage)!==null&&Ce!==void 0?Ce:[]}function ye(Z){var Ce;return(Ce=Z?.givenUsage)!==null&&Ce!==void 0?Ce:[]}function Oe({fieldUsage:Z,givenUsage:Ce}){if(!(Z===void 0&&Ce===void 0))return{fieldUsage:Z??[],...Ce&&{givenUsage:Ce}}}function Fe(Z,Ce){return Z&&{...Z,fieldUsage:Z.fieldUsage.map(Ce)}}function Ie(Z){return"sql"in Z}function Ve(Z){return"type"in Z&&(Z.type==="sql_select"||Z.type==="query_source")}function ze(Z){return Z.type==="source_registry_reference"}function Me(Z){return{...Z}}function tt(Z){return Z.type==="table"||Z.type==="sql_select"||Z.type==="query_source"||Z.type==="query_result"||Z.type==="finalize"||Z.type==="nest_source"||Z.type==="virtual"||Z.type==="composite"}function rt(Z){return Z.type==="sql_select"||Z.type==="query_source"}function Se(Z){return w(Z)?!1:!!tt(Z)}function qe(Z){return Z==="literal"}function We(...Z){return Z.length<=1&&Z.every(Ce=>Ce==="literal")?"literal":Z.every(Ce=>Ce==="constant"||Ce==="literal")?"constant":Z.every(Ce=>Ce==="output"||Ce==="constant"||Ce==="literal")?"output":"input"}function ue(Z){return Z.type==="string"||N(Z.type)||Z.type==="number"||Z.type==="boolean"||Z.type==="json"||Z.type==="sql native"||Z.type==="error"}function fe(Z){return Z.type==="userType"}function ge(Z){return Array.isArray(Z)&&(Z.length===0||typeof Z[0]=="object"&&Z[0]!==null&&!Array.isArray(Z[0]))}function Te(Z){return Z.type==="turtle"}function be(Z){return B(Z.type)}function Le(Z,Ce){return Ce.type==="string"}function $e(Z,Ce){return Ce.type==="number"}function Xe(Z,Ce){return Ce.type==="boolean"}function at(Z,Ce){return Ce.type==="timestamp"}function dt(Z,Ce){return Ce.type==="date"}n.TD={isAtomic(Z){return Z!==void 0&&B(Z.type)},isBasicAtomic(Z){return Z!==void 0&&ue({type:Z.type})},isString:Z=>Z?.type==="string",isNumber:Z=>Z?.type==="number",isBoolean:Z=>Z?.type==="boolean",isJSON:Z=>Z?.type==="json",isSQL:Z=>Z?.type==="sql native",isDate:Z=>Z?.type==="date",isTimestamp:Z=>Z?.type==="timestamp",isTimestamptz:Z=>Z?.type==="timestamptz",isAnyTimestamp(Z){return Z?.type==="timestamp"||Z?.type==="timestamptz"},isTemporal(Z){var Ce;const Qe=(Ce=Z?.type)!==null&&Ce!==void 0?Ce:"";return N(Qe)},isError:Z=>Z?.type==="error",atomicDef(Z){if(!n.TD.isAtomic(Z))return{type:"error"};switch(Z.type){case"array":return re(Z)?{type:"array",elementTypeDef:Z.elementTypeDef,fields:Z.fields}:{type:"array",elementTypeDef:Z.elementTypeDef};case"record":return{type:"record",fields:Z.fields};case"number":return Z.numberType?{type:"number",numberType:Z.numberType}:{type:"number"};case"sql native":return Z.rawType?{type:"sql native",rawType:Z.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return Z.timeframe?{type:Z.type,timeframe:Z.timeframe}:{type:Z.type};default:return{type:Z.type}}},eq(Z,Ce){if(Z===void 0||Ce===void 0)return!1;function Qe(Ne,Ue){const Ke={},st=Ne.fields||[],Ye=Ue.fields||[];if(st.length!==Ye.length)return!1;for(const Ze of st)if(Ze.name)Ke[Ze.name]=Ze;else return!1;for(const Ze of Ye)if(!n.TD.eq(Ke[Ze.name],Ze))return!1;return!0}return Z.type==="array"&&Ce.type==="array"?Z.elementTypeDef.type!==Ce.elementTypeDef.type?!1:Z.elementTypeDef.type!=="record_element"&&Ce.elementTypeDef.type!=="record_element"?n.TD.eq(Z.elementTypeDef,Ce.elementTypeDef):n.TD.isAtomic(Z)&&n.TD.isAtomic(Ce)&&Qe(Z,Ce):Z.type==="record"&&Ce.type==="record"?n.TD.isAtomic(Z)&&n.TD.isAtomic(Ce)&&Qe(Z,Ce):Z.type==="sql native"&&Ce.type==="sql native"?Z.rawType!==void 0&&Z.rawType===Ce.rawType:Z.type===Ce.type}};function it(Z,Ce){return Z?Ce?{isCount:Z.isCount||Ce.isCount}:Z:Ce}})(kh)),kh}var Ey;function vn(){if(Ey)return Lt;Ey=1,Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.arg=p,Lt.spread=S,Lt.sql=g,Lt.constant=h,Lt.output=u,Lt.literal=l,Lt.variadicParam=a,Lt.param=i,Lt.makeParam=c,Lt.maxScalar=t,Lt.maxAggregate=o,Lt.anyExprType=s,Lt.maxUngroupedAggregate=x,Lt.maxAnalytic=r,Lt.minScalar=y,Lt.minAggregate=d,Lt.minAnalytic=m,Lt.overload=E,Lt.expandBlueprintMap=J,Lt.expandOverrideMapFromBase=Q,Lt.def=M;const n=Pe();function p(I){return{node:"function_parameter",name:I}}function S(I,W=void 0,X=void 0){return{node:"spread",e:I,prefix:W,suffix:X}}function g(I,...W){const X={node:"genericSQLExpr",kids:{args:[]},src:[]},oe=[...W];let ce="";for(const se of I){ce+=se;const ne=oe.shift();ne!==void 0&&(typeof ne=="string"?ce+=ne:(X.src.push(ce),X.kids.args.push(ne),ce=""))}return ce.length>0&&X.src.push(ce),X}function h(I){return{...I,evalSpace:"constant"}}function u(I){return{...I,evalSpace:"output"}}function l(I){return{...I,evalSpace:"literal"}}function a(I,...W){return{name:I,isVariadic:!0,allowedTypes:W}}function i(I,...W){return{name:I,isVariadic:!1,allowedTypes:W}}function c(I,...W){return{param:i(I,...W),arg:p(I)}}function t(I){return{...I,expressionType:"scalar",evalSpace:"input"}}function o(I){return{...I,expressionType:"aggregate",evalSpace:"input"}}function s(I){return{...I,expressionType:void 0,evalSpace:"input"}}function x(I){return{...I,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function r(I){return{...I,expressionType:"aggregate_analytic",evalSpace:"input"}}function y(I){return{...I,expressionType:"scalar",evalSpace:"input"}}function d(I){return{...I,expressionType:"aggregate",evalSpace:"input"}}function m(I){return{...I,expressionType:"scalar_analytic",evalSpace:"input"}}function E(I,W,X,oe){return{returnType:I,params:W,e:X,needsWindowOrderBy:oe?.needsWindowOrderBy,between:oe?.between,isSymmetric:oe?.isSymmetric,supportsOrderBy:oe?.supportsOrderBy,defaultOrderByArgIndex:oe?.defaultOrderByArgIndex,supportsLimit:oe?.supportsLimit}}function _(I,W=!0,X=!0){if(!W&&I==="any")throw new Error("Return type cannot include any");if(typeof I=="string")return{type:I};if("array"in I){const oe=W?_(I.array,!0):_(I.array,!1);return oe.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:oe.fields}:{type:"array",elementTypeDef:oe}}else if("record"in I){const oe=[];for(const[ce,se]of Object.entries(I.record)){const ne=W?_(se,!0):_(se,!1);n.TD.isAtomic(ne)&&oe.push((0,n.mkFieldDef)(ne,ce))}return{type:"record",fields:oe}}else if("generic"in I){if(!X)throw new Error("Cannot use generic");return{type:"generic",generic:I.generic}}else if("sql_native"in I)return{type:"sql native",rawType:I.sql_native};throw new Error("Cannot figure out type")}function v(I){if(I==="any")throw new Error("Cannot return any type");if(typeof I=="string")return y({type:I});if("array"in I)return s(_(I,!1));if("record"in I)return s(_(I,!1));if("generic"in I)return y(_(I,!1));if("literal"in I)return l(y(_(I.literal,!1)));if("constant"in I)return h(y(_(I.constant,!1)));if("dimension"in I)return y(_(I.dimension,!1));if("measure"in I)return d(_(I.measure,!1));if("sql_native"in I)return s({type:"sql native",rawType:I.sql_native});if("calculation"in I)return m(_(I.calculation,!1));throw new Error("Invalid function blueprint")}function C(I){return typeof I=="string"||"array"in I||"record"in I||"generic"in I||"literal"in I||"constant"in I||"dimension"in I||"measure"in I||"calculation"in I||"sql_native"in I}function R(I){return C(I)?[I]:Array.isArray(I)?I:C(I.variadic)?[I.variadic]:I.variadic}function L(I){if(typeof I=="string")return s({type:I});if("generic"in I)return s(_(I));if("literal"in I)return l(t(_(I.literal)));if("constant"in I)return h(t(_(I.constant)));if("dimension"in I)return t(_(I.dimension));if("measure"in I)return o(_(I.measure));if("array"in I)return s(_(I,!1));if("record"in I)return s(_(I,!1));if("sql_native"in I)return s({type:"sql native",rawType:I.sql_native});if("calculation"in I)return r(_(I.calculation));throw new Error("Invalid function blueprint")}function A(I){return I.map(W=>L(W))}function O(I){return typeof I!="string"&&"variadic"in I}function D(I,W){return{name:I,allowedTypes:A(R(W)),isVariadic:O(W)}}function N(I){return Object.entries(I).map(X=>D(X[0],X[1]))}function b(I){const W=[],X=[];let oe=I;for(;oe.length>0;){const se=oe.indexOf("${");if(se===-1){W.push(oe);break}const ne=oe.slice(0,se);oe=oe.slice(se);const xe=oe.indexOf("}");if(xe===-1){W.push(ne+oe);break}const de=oe.slice(2,xe);oe=oe.slice(xe+1);const me=de.startsWith("..."),Ae=de.endsWith(":"),he=me?de.slice(3):Ae?de.slice(0,-1):de,Ee={node:"function_parameter",name:he};W.push(ne),me?X.push({node:"spread",e:Ee,prefix:"",suffix:""}):Ae&&he==="order_by"?X.push({node:"aggregate_order_by"}):Ae&&he==="limit"?X.push({node:"aggregate_limit"}):X.push(Ee)}return{node:"genericSQLExpr",kids:{args:X},src:W}}function B(I,W){return O(W)?{node:"spread",e:{node:"function_parameter",name:I},prefix:"",suffix:""}:{node:"function_parameter",name:I}}function U(I,W){const X=Object.entries(W.takes),oe=X.length>0?X.length-1:0;return{node:"genericSQLExpr",kids:{args:X.map(ce=>B(ce[0],ce[1]))},src:[`${I}(`,...Array(oe).fill(","),")"]}}function z(I){return"sql"in I.impl?b(I.impl.sql):"expr"in I.impl?I.impl.expr:U(I.impl.function,I)}function ee(I){return{e:z(I),between:I.impl.between,needsWindowOrderBy:I.impl.needsWindowOrderBy,defaultOrderByArgIndex:I.impl.defaultOrderByArgIndex}}function ae(I){if(I!==void 0)return Object.entries(I).map(([W,X])=>({name:W,acceptibleTypes:X.map(oe=>_(oe,!0,!1))}))}function te(I){return{returnType:v(I.returns),params:N(I.takes),isSymmetric:I.isSymmetric,supportsOrderBy:I.supportsOrderBy,supportsLimit:I.supportsLimit,genericTypes:ae(I.generic),...ee(I)}}function k(I){return"takes"in I&&"returns"in I&&"impl"in I}function re(I){return"function"in I||"sql"in I||"expr"in I}function K(I){return k(I)?[te(I)]:Object.values(I).flatMap(W=>te(W))}function J(I){const W={};for(const X in I)W[X]=K(I[X]);return W}function q(I,W){return[te({...I,impl:W})]}function j(I,W,X){if(re(X)){if(!k(W))throw new Error(`Malformed function override: ${I}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(W)})`);return q(W,X)}else{if(k(W))throw new Error(`Malformed function override: ${I}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(X)})`);return Object.entries(X).flatMap(([oe,ce])=>{const se=W[oe];if(se===void 0)throw new Error(`Malformed function override: ${I}. No overload named ${oe}`);return q(se,ce)})}}function Q(I,W){const X={};for(const oe in W){if(!(oe in I))throw new Error(`Malformed function override: ${oe}. No such function in Malloy standard`);X[oe]=j(oe,I[oe],W[oe])}return X}function*w(I){if(typeof I!="string"){if("generic"in I)yield I;else if("record"in I)for(const W of Object.values(I.record))yield*w(W);else for(const W of["array","literal","measure","dimension","measure","constant","cacluation"])if(W in I){yield*w(I[W]);return}}}function M(I,W,X,oe={}){let ce=!1;const se={};for(const xe of Object.values(W))for(const de of w(xe))se[de.generic]=["any"],ce=!0;ce&&oe.generic===void 0&&(oe.generic=se);const ne={takes:W,returns:X,impl:{function:I.toUpperCase()},...oe};return{[I]:ne}}return Lt}var $h={},i0={},Ay;function am(){if(Ay)return i0;Ay=1,Object.defineProperty(i0,"__esModule",{value:!0}),i0.decodeDottedTablePath=n,i0.validateDottedTablePath=p;function n(h,u){const{quoteChar:l,escapeStyle:a,bareIdentRegex:i,dialectName:c}=u;if(h.length===0)return{ok:!1,error:`${c} table path is empty`};const t=[];let o=0;for(;;){let s,x;if(h[o]===l){const r=S(h,o,l,a);if(r===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — unterminated quoted segment`};s=r.decoded,x=!0,o=r.end}else{const r=h.slice(o).match(i);if(!r||r.index!==0||r[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — invalid segment at position ${o}`};s=r[0],x=!1,o+=r[0].length}if(s.includes(";")||s.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(s)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(t.push({value:s,quoted:x}),o===h.length)return{ok:!0,segments:t};if(h[o]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — expected '.' at position ${o}`};if(o++,o===h.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — trailing dot`}}}function p(h,u){const l=n(h,u);return l.ok?{ok:!0,canonical:h}:l}function S(h,u,l,a){let i=u+1,c="";for(;i<h.length;){if(a==="backslash"&&h[i]==="\\"){if(i+1>=h.length)return null;c+=g(h[i+1]),i+=2;continue}if(h[i]===l){if(a==="doubled"&&h[i+1]===l){c+=l,i+=2;continue}return{decoded:c,end:i+1}}c+=h[i],i++}return null}function g(h){switch(h){case"n":return`
2
2
  `;case"t":return" ";case"r":return"\r";default:return h}}return i0}var Sy;function Vn(){return Sy||(Sy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Dialect=n.dayIndex=n.EscapeStyle=n.MAX_DECIMAL38=n.MIN_DECIMAL38=n.MAX_INT128=n.MIN_INT128=n.MAX_INT64=n.MIN_INT64=n.MAX_INT32=n.MIN_INT32=void 0,n.inDays=h,n.qtz=u,n.turtleGroupSetCondition=l;const p=Pe(),S=am();n.MIN_INT32=-2147483648,n.MAX_INT32=2147483647,n.MIN_INT64=BigInt("-9223372036854775808"),n.MAX_INT64=BigInt("9223372036854775807"),n.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),n.MAX_INT128=BigInt("170141183460469231731687303715884105727"),n.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),n.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999"),n.EscapeStyle={Doubled:"doubled",Backslash:"backslash",Unset:"unset"};const g=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];n.dayIndex=g.indexOf("day");function h(i){return g.indexOf(i)>=n.dayIndex}function u(i){const c=i.queryTimezone;if(!(c===void 0||c===i.systemTimezone))return c}function l(i,c){return i===void 0?c:c?`group_set=${i} AND ${c}`:`group_set=${i}`}class a{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(n.MIN_INT32),max:BigInt(n.MAX_INT32),numberType:"integer"},{min:n.MIN_INT64,max:n.MAX_INT64,numberType:"bigint"}],this.tablePathBareIdentRegex=/^[A-Za-z_][A-Za-z0-9_]*/,this.identifierQuoteChar="",this.stringLiteralStyle=n.EscapeStyle.Unset,this.identifierEscapeStyle=n.EscapeStyle.Unset}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")}literalNumberType(c){if(!/^-?\d+$/.test(c))return{type:"number",numberType:"float"};const o=BigInt(c);for(const s of this.integerTypeMappings)if(o>=s.min&&o<=s.max)return{type:"number",numberType:s.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(c,t,o,s,x){var r;const y=(r=c?.hasTimestamptz)!==null&&r!==void 0?r:!1;return x==="date"?{node:"dateLiteral",literal:t,typeDef:{type:"date",timeframe:s!==void 0&&(0,p.isDateUnit)(s)?s:void 0}}:o&&y?{node:"timestamptzLiteral",literal:t,typeDef:{type:"timestamptz",timeframe:s},timezone:o}:o?{node:"timestampLiteral",literal:t,typeDef:{type:"timestamp",timeframe:s},timezone:o}:{node:"timestampLiteral",literal:t,typeDef:{type:"timestamp",timeframe:s}}}sqlValidateTableName(c){if(this.identifierEscapeStyle!==n.EscapeStyle.Doubled&&this.identifierEscapeStyle!==n.EscapeStyle.Backslash)throw new Error(`${this.name}: sqlValidateTableName requires identifierEscapeStyle to be set to Doubled or Backslash (or override sqlValidateTableName).`);return(0,S.validateDottedTablePath)(c,{quoteChar:this.identifierQuoteChar,escapeStyle:this.identifierEscapeStyle,bareIdentRegex:this.tablePathBareIdentRegex,dialectName:this.name})}sqlTurtleOrderByClause(c){const t=c.map(o=>` ${o.field} ${o.dir.toUpperCase()}`);return" "+this.sqlOrderBy(t,"turtle")}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 o="";for(const s of c)switch(s){case"\\":o+="\\\\";break;case`
3
3
  `:o+="\\n";break;case"\r":o+="\\r";break;case" ":o+="\\t";break;case t:o+="\\"+t;break;default:o+=s}return o}sqlQuoteIdentifier(c){const t=this.identifierQuoteChar;if(!t)throw new Error(`${this.name}: identifierQuoteChar is not set. Set it on the dialect (e.g. '"' or "\`"), or override sqlQuoteIdentifier.`);if(this.identifierEscapeStyle===n.EscapeStyle.Doubled)return t+c.split(t).join(t+t)+t;if(this.identifierEscapeStyle===n.EscapeStyle.Backslash)return t+this.escapeBackslashStyle(c,t)+t;throw new Error(`${this.name}: identifierEscapeStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlQuoteIdentifier.`)}sqlLiteralNumber(c){return c}ignoreInProject(c){return!1}needsCivilTimeComputation(c,t,o,s){const x=["day","week","month","quarter","year"],r=t!==void 0&&x.includes(t),y=o!==void 0&&x.includes(o),d=u(s);return{needed:p.TD.isAnyTimestamp(c)&&(r||y)&&d!==void 0,tz:d}}sqlTruncAndOffset(c,t,o,s){if(p.TD.isAnyTimestamp(c.typeDef)){const{needed:r,tz:y}=this.needsCivilTimeComputation(c.typeDef,o,s?.unit,t);if(r&&y){const d=this.sqlConvertToCivilTime(c.sql,y,c.typeDef);let m=d.sql;const E=d.typeDef;return o&&(m=this.sqlTruncate(m,o,E,!0,y)),s&&(m=this.sqlOffsetTime(m,s.op,s.magnitude,s.unit,E,!0,y)),this.sqlConvertFromCivilTime(m,y,c.typeDef)}}let x=c.sql;return o&&(x=this.sqlTruncate(x,o,c.typeDef,!1,u(t))),s&&(x=this.sqlOffsetTime(x,s.op,s.magnitude,s.unit,c.typeDef,!1,u(t))),x}sqlLiteralString(c){if(this.stringLiteralStyle==="doubled")return"'"+c.split("'").join("''")+"'";if(this.stringLiteralStyle==="backslash")return"'"+this.escapeBackslashStyle(c,"'")+"'";throw new Error(`${this.name}: stringLiteralStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlLiteralString.`)}sqlLiteralRegexp(c){return this.sqlLiteralString(c)}exprToSQL(c,t){switch(t.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(t);case"delta":{const o=t.kids.base;return o.node==="trunc"?this.sqlTruncAndOffset(o.e,c,o.units,{op:t.op,magnitude:t.kids.delta.sql,unit:t.units}):this.sqlTruncAndOffset(o,c,void 0,{op:t.op,magnitude:t.kids.delta.sql,unit:t.units})}case"trunc":return this.sqlTruncAndOffset(t.e,c,t.units);case"extract":return this.sqlTimeExtractExpr(c,t);case"cast":return this.sqlCast(c,t);case"regexpMatch":return this.sqlRegexpMatch(t);case"/":return this.divisionIsInteger?`${t.kids.left.sql}*1.0/${t.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${t.kids.left.sql},${t.kids.right.sql})`;case"dateLiteral":return this.sqlDateLiteral(c,t.literal);case"timestampLiteral":return this.sqlTimestampLiteral(c,t.literal,t.timezone);case"timestamptzLiteral":return this.sqlTimestamptzLiteral(c,t.literal,t.timezone);case"stringLiteral":return this.sqlLiteralString(t.literal);case"numberLiteral":return this.sqlLiteralNumber(t.literal);case"regexpLiteral":return this.sqlLiteralRegexp(t.literal);case"recordLiteral":return this.sqlLiteralRecord(t);case"arrayLiteral":return this.sqlLiteralArray(t)}}sqlSumDistinct(c,t,o){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(c,t,o){return"sqlAggDistinct called but not implemented"}sqlSampleTable(c,t){if(t!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return c}sqlOrderBy(c,t){return`ORDER BY ${c.join(",")}`}sqlTzStr(c){return`"${c.queryTimezone}"`}sqlMakeUnnestKey(c,t){return this.concat(c,"'x'",t)}sqlStringAggDistinct(c,t,o){const s="__STRING_AGG_KS__",x="__STRING_AGG_KE__";return`REGEXP_REPLACE(
4
4
  STRING_AGG(DISTINCT ${`concat('${s}', ${c}, '${x}', ${t})`}${o.length>0?","+o:""}),
@@ -1 +1 @@
1
- import{aL as a}from"./index-DKvKsj6c.js";import{r as f}from"./index-w_0OQJgZ.js";function c(t,n){for(var o=0;o<n.length;o++){const e=n[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s=f();const p=a(s),l=c({__proto__:null,default:p},[s]);export{s as d,l as i};
1
+ import{aL as a}from"./index-CqxPodI3.js";import{r as f}from"./index-w_0OQJgZ.js";function c(t,n){for(var o=0;o<n.length;o++){const e=n[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s=f();const p=a(s),l=c({__proto__:null,default:p},[s]);export{s as d,l as i};