@malloydata/render 0.0.238 → 0.0.239-dev250226183425

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.
@@ -1271,7 +1271,7 @@ QUERY: ${(0,WG.inspect)(n,{breakLength:72,depth:1/0})}`)}return VG.ErrorFactory.
1271
1271
  | ${l}`,u>0&&(i=i+`
1272
1272
  | ${" ".repeat(u)}^`)}else i=`line ${o+1}: char ${u}: ${r.message}`}n!==s&&(i=`FILE: ${s}
1273
1273
  `+i,n=s),e!==""?e=`${e}
1274
- ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,e7e.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,l7e.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}S0.MalloyTranslation=HF;class wV extends HF{constructor(e,n){super(e),this.root=n}}S0.MalloyChildTranslator=wV;class T7e extends HF{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new qF.Zone,this.importZone=new qF.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new qF.Zone,this.root=this,this.logger=new FV.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,FV.makeLogMessage)(e,n,{severity:"error",...r})),e}}S0.MalloyTranslator=T7e;function NV(t){return[...Object.keys(t),...Object.keys(t).map(e=>NV(t[e])).flat()]}var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.exploreQueryWalkerBuilder=Vh.ExploreQueryWalker=void 0;const R7e=c0;class LV{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Vh.ExploreQueryWalker=LV;function D7e(t,e){const n=new LV(t),r=n;return R7e.ParseTreeWalker.DEFAULT.walk(r,e),n}Vh.exploreQueryWalkerBuilder=D7e,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=S0;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Vh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(JD);var we={},yS={};Object.defineProperty(yS,"__esModule",{value:!0}),yS.MALLOY_VERSION=void 0,yS.MALLOY_VERSION="0.0.238",Object.defineProperty(we,"__esModule",{value:!0}),we.InMemoryModelCache=we.CacheManager=we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const IV=JD,ar=Ui,BV=di,zF=Ad,O7e=yS,F7e=Bp,On=ps,$V="internal://internal.malloy";class Wi{static get version(){return O7e.MALLOY_VERSION}static _parse(e,n,r,i,s){n===void 0&&(n=new URL($V));let o=n;i!=null&&i.importBaseURL&&(o=i==null?void 0:i.importBaseURL);const u=new IV.MalloyTranslator(n.toString(),o.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(u.allDialectsEnabled=!0),new MV(u,s)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Wi._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return TS(n,e).then(({contents:o,invalidationKey:u})=>Wi._parse(o,e,i,s,u))}static async compile({url:e,source:n,parse:r,urlReader:i,connections:s,model:o,refreshSchemaCache:u,noThrowOnError:a,eventStream:l,replaceMaterializedReferences:c,materializedTablePrefix:f,importBaseURL:d,cacheManager:h}){var p,m,g,y,E;let A;if(u&&(A=typeof u=="number"?u:Date.now()),e===void 0&&n===void 0&&r===void 0)throw new Error("Internal Error: url, source, or parse required.");e===void 0&&(r!==void 0?e=new URL(r._translator.sourceURL):e=new URL($V));const v={};if(n===void 0&&h!==void 0){const S=await h.getCachedModelDef(i,e.toString());if(S)return new Yh(S.modelDef,[],[e.toString(),...bS(S.modelDef.dependencies)])}d??(d=e);let _;const C=e.toString();if(r!==void 0){_=r._translator;const S=(p=r._invalidationKey)!==null&&p!==void 0?p:await r8(i,e);v[C]=S}else{if(n===void 0){const{contents:S,invalidationKey:b}=await TS(i,e);v[C]=b,n=S}else{const S=await r8(i,e);v[C]=S}_=new IV.MalloyTranslator(C,d.toString(),{urls:{[C]:n}},l)}for(;;){const S=_.translate(o==null?void 0:o._modelDef);if(S.final)if(S.modelDef){await(h==null?void 0:h.setCachedModelDef(e.toString(),{modelDef:S.modelDef,invalidationKeys:v}));for(const b of _.newlyTranslatedDependencies())await(h==null?void 0:h.setCachedModelDef(b.url,{modelDef:b.modelDef,invalidationKeys:v}));return new Yh(S.modelDef,S.problems||[],[...(m=o==null?void 0:o.fromSources)!==null&&m!==void 0?m:[],...(g=S.fromSources)!==null&&g!==void 0?g:[]],b=>_.referenceAt(b),b=>_.importAt(b))}else if(a){const b={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},R=(o==null?void 0:o._modelDef)||b;return new Yh(R,S.problems||[],[...(y=o==null?void 0:o.fromSources)!==null&&y!==void 0?y:[],...(E=S.fromSources)!==null&&E!==void 0?E:[]],I=>_.referenceAt(I),I=>_.importAt(I))}else{const b=S.problems||[],R=_.prettyErrors();throw new kV(`Error(s) compiling model:
1274
+ ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,e7e.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,l7e.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}S0.MalloyTranslation=HF;class wV extends HF{constructor(e,n){super(e),this.root=n}}S0.MalloyChildTranslator=wV;class T7e extends HF{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new qF.Zone,this.importZone=new qF.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new qF.Zone,this.root=this,this.logger=new FV.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,FV.makeLogMessage)(e,n,{severity:"error",...r})),e}}S0.MalloyTranslator=T7e;function NV(t){return[...Object.keys(t),...Object.keys(t).map(e=>NV(t[e])).flat()]}var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.exploreQueryWalkerBuilder=Vh.ExploreQueryWalker=void 0;const R7e=c0;class LV{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Vh.ExploreQueryWalker=LV;function D7e(t,e){const n=new LV(t),r=n;return R7e.ParseTreeWalker.DEFAULT.walk(r,e),n}Vh.exploreQueryWalkerBuilder=D7e,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=S0;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Vh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(JD);var we={},yS={};Object.defineProperty(yS,"__esModule",{value:!0}),yS.MALLOY_VERSION=void 0,yS.MALLOY_VERSION="0.0.239",Object.defineProperty(we,"__esModule",{value:!0}),we.InMemoryModelCache=we.CacheManager=we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const IV=JD,ar=Ui,BV=di,zF=Ad,O7e=yS,F7e=Bp,On=ps,$V="internal://internal.malloy";class Wi{static get version(){return O7e.MALLOY_VERSION}static _parse(e,n,r,i,s){n===void 0&&(n=new URL($V));let o=n;i!=null&&i.importBaseURL&&(o=i==null?void 0:i.importBaseURL);const u=new IV.MalloyTranslator(n.toString(),o.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(u.allDialectsEnabled=!0),new MV(u,s)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Wi._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return TS(n,e).then(({contents:o,invalidationKey:u})=>Wi._parse(o,e,i,s,u))}static async compile({url:e,source:n,parse:r,urlReader:i,connections:s,model:o,refreshSchemaCache:u,noThrowOnError:a,eventStream:l,replaceMaterializedReferences:c,materializedTablePrefix:f,importBaseURL:d,cacheManager:h}){var p,m,g,y,E;let A;if(u&&(A=typeof u=="number"?u:Date.now()),e===void 0&&n===void 0&&r===void 0)throw new Error("Internal Error: url, source, or parse required.");e===void 0&&(r!==void 0?e=new URL(r._translator.sourceURL):e=new URL($V));const v={};if(n===void 0&&h!==void 0){const S=await h.getCachedModelDef(i,e.toString());if(S)return new Yh(S.modelDef,[],[e.toString(),...bS(S.modelDef.dependencies)])}d??(d=e);let _;const C=e.toString();if(r!==void 0){_=r._translator;const S=(p=r._invalidationKey)!==null&&p!==void 0?p:await r8(i,e);v[C]=S}else{if(n===void 0){const{contents:S,invalidationKey:b}=await TS(i,e);v[C]=b,n=S}else{const S=await r8(i,e);v[C]=S}_=new IV.MalloyTranslator(C,d.toString(),{urls:{[C]:n}},l)}for(;;){const S=_.translate(o==null?void 0:o._modelDef);if(S.final)if(S.modelDef){await(h==null?void 0:h.setCachedModelDef(e.toString(),{modelDef:S.modelDef,invalidationKeys:v}));for(const b of _.newlyTranslatedDependencies())await(h==null?void 0:h.setCachedModelDef(b.url,{modelDef:b.modelDef,invalidationKeys:v}));return new Yh(S.modelDef,S.problems||[],[...(m=o==null?void 0:o.fromSources)!==null&&m!==void 0?m:[],...(g=S.fromSources)!==null&&g!==void 0?g:[]],b=>_.referenceAt(b),b=>_.importAt(b))}else if(a){const b={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},R=(o==null?void 0:o._modelDef)||b;return new Yh(R,S.problems||[],[...(y=o==null?void 0:o.fromSources)!==null&&y!==void 0?y:[],...(E=S.fromSources)!==null&&E!==void 0?E:[]],I=>_.referenceAt(I),I=>_.importAt(I))}else{const b=S.problems||[],R=_.prettyErrors();throw new kV(`Error(s) compiling model:
1275
1275
  ${R}`,b)}else{if(S.urls)for(const R of S.urls)try{if(RS(R))throw new Error("In order to use relative imports, you must compile a file via a URL.");if(h!==void 0){const j=await h.getCachedModelDef(i,R);if(j){for(const J in j.invalidationKeys)v[J]=j.invalidationKeys[J];_.update({translations:{[R]:j.modelDef}});continue}}const{contents:I,invalidationKey:L}=await TS(i,new URL(R)),M={[R]:I};v[R]=L,_.update({urls:M})}catch(I){_.update({errors:{urls:{[R]:I.message}}})}const{modelAnnotation:b}=_.modelAnnotation(o==null?void 0:o._modelDef);if(S.tables){const R=new Map;for(const I in S.tables){const{connectionName:L,tablePath:M}=S.tables[I],j=R.get(L);j===void 0?R.set(L,{[I]:M}):j[I]=M}for(const[I,L]of R)try{const M=await s.lookupConnection(I),{schemas:j,errors:J}=await Wi.safelyFetchTableSchema(M,L,{refreshTimestamp:A,modelAnnotation:b});_.update({tables:j,errors:{tables:J}})}catch(M){const j={},J={};for(const Q in L)J[Q]=M.toString();_.update({tables:j,errors:{tables:J}})}}if(S.compileSQL){const R=S.compileSQL,I=R.connection;try{const L=await s.lookupConnection(I),M=Wi.compileSQLBlock(L.dialectName,S.partialModel,R,{replaceMaterializedReferences:c,materializedTablePrefix:f,eventStream:l}),j=await L.fetchSchemaForSQLStruct(M,{refreshTimestamp:A,modelAnnotation:b});j.error&&_.update({errors:{compileSQL:{[M.name]:j.error}}}),j.structDef&&_.update({compileSQL:{[M.name]:j.structDef}})}catch(L){const M={};M[R.name]=L.toString(),_.update({errors:{compileSQL:M}})}}}}}static async safelyFetchTableSchema(e,n,r){const i=await e.fetchSchemaForTables(n,r);for(const s of Object.keys(n))if(i.schemas[s]===void 0&&i.errors[s]===void 0)throw new Error(`Schema fetch error for ${e.name}, no response for ${s} from ${e.dialectName}`);return i}static compileSQLBlock(e,n,r,i){let s,o="",u=!1;for(const c of r.select)if((0,ar.isSegmentSQL)(c))o+=c.sql,u=c.sql.match(/\(\s*$/)!==null;else{if(!s){if(!n)throw new Error("Internal error: Partial model missing when compiling SQL block");s=new ar.QueryModel(n,i==null?void 0:i.eventStream)}const f=s.compileQuery(c,{...i,defaultRowLimit:void 0},!1).sql;o+=u?f:`(${f})`,u=!1}const{name:a,connection:l}=r;return{type:"sql_select",name:a,connection:l,dialect:e,selectStr:o,fields:[]}}static async run({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(!i){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);i=await e.lookupConnection(o)}if(r){const o=await i.runSQL(r.selectStr);return new Nm({structs:[r],sql:r.selectStr,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,lastStageName:r.name,malloy:"",connectionName:r.connection,sourceExplore:"",sourceFilters:[],profilingUrl:o.profilingUrl},{name:"empty_model",exports:[],contents:{},queryList:[],dependencies:{}})}else if(n){const o=await i.runSQL(n.sql,s);return new Nm({...n._rawQuery,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,profilingUrl:o.profilingUrl},n._modelDef)}else throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}static async*runStream({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(r===void 0&&n===void 0)throw new Error("Internal error: sqlBlock or preparedResult must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);if(i===void 0){if(e===void 0)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");i=await e.lookupConnection(o)}if(!i.canStream())throw new Error(`Connection '${o}' cannot stream results.`);let u,a;if(r)a=new Ds(r),u=r.selectStr;else if(n!==void 0)a=n.resultExplore,u=n.sql;else throw new Error("Internal error: sqlStruct or preparedResult must be provided.");let l=0;for await(const c of i.runSQLStream(u,s))yield new Xf(c,l,a,void 0,void 0),l+=1}static async estimateQueryCost({connections:e,preparedResult:n,sqlStruct:r}){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const i=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName),s=await e.lookupConnection(i);if(r)return await s.estimateQueryCost(r.selectStr);if(n)return await s.estimateQueryCost(n.sql);throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}}we.Malloy=Wi;class kV extends Error{constructor(e,n=[]){super(e),this.problems=n}}we.MalloyError=kV;let Yh=class{constructor(e,n,r,i=()=>{},s=()=>{}){this.modelDef=e,this.problems=n,this.fromSources=r,this._referenceAt=i,this._importAt=s}tagParse(e){return(0,On.annotationToTag)(this.modelDef.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this.modelDef.annotation,e)}getReference(e){return this._referenceAt(e)}getImport(e){return this._importAt(e)}getPreparedQueryByName(e){const n=this.modelDef.contents[e];if((n==null?void 0:n.type)==="query")return new Kh(n,this.modelDef,this.problems,e);throw new Error("Given query name does not refer to a named query.")}getPreparedQueryByIndex(e){if(e<0)throw new Error(`Invalid index ${e}.`);if(e>=this.modelDef.queryList.length)throw new Error(`Query index ${e} is out of bounds.`);return new Kh(this.modelDef.queryList[e],this.modelDef,this.problems)}get preparedQuery(){return this.getPreparedQuery()}getPreparedQuery(){if(this.modelDef.queryList.length===0)throw new Error("Model has no queries.");return new Kh(this.modelDef.queryList[this.modelDef.queryList.length-1],this.modelDef,this.problems)}getExploreByName(e){const n=this.modelDef.contents[e];if((0,ar.isSourceDef)(n))return new Ds(n);throw new Error("'name' is not an explore")}get explores(){return Object.values(this.modelDef.contents).filter(ar.isSourceDef).map(e=>new Ds(e))}get namedQueries(){const e=n=>n.type==="query";return Object.values(this.modelDef.contents).filter(e)}get exportedExplores(){return this.explores.filter(e=>this.modelDef.exports.includes(e.name))}get _modelDef(){return this.modelDef}};we.Model=Yh;class Kh{constructor(e,n,r,i){this.problems=r,this.name=i,this._query=e,this._modelDef=n}tagParse(e){const n=(0,On.annotationToTag)(this._modelDef.annotation).tag;return e=(0,On.addModelScope)(e,n),(0,On.annotationToTag)(this._query.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this._query.annotation,e)}get preparedResult(){return this.getPreparedResult()}getPreparedResult(e){const r=new ar.QueryModel(this._modelDef,e==null?void 0:e.eventStream).compileQuery(this._query,e);return new Fm({...r,queryName:this.name||r.queryName},this._modelDef)}get dialect(){const e=this._query.structRef,n=typeof e=="string"?this._modelDef.contents[e]:e;if(!(0,ar.isSourceDef)(n))throw new Error("Invalid source for query");return n.dialect}getFlattenedQuery(e){return this}}we.PreparedQuery=Kh;class MV{constructor(e,n){this.translator=e,this.invalidationKey=n}get symbols(){return(this.translator.metadata().symbols||[]).map(e=>new ES(e))}get tablePathInfo(){var e;return((e=this.translator.tablePathInfo().pathInfo)!==null&&e!==void 0?e:[]).map(r=>new PV(r))}get _translator(){return this.translator}get _invalidationKey(){return this.invalidationKey}completions(e){return(this.translator.completions(e).completions||[]).map(n=>new UV(n))}helpContext(e){return this.translator.helpContext(e).helpContext}}we.Parse=MV;class PV{constructor(e){this._range=Jh.fromJSON(e.range),this._connectionId=e.connectionId,this._tablePath=e.tablePath}get range(){return this._range}get connectionId(){return this._connectionId}get tablePath(){return this._tablePath}}we.DocumentTablePath=PV;class Jh{constructor(e,n){this._start=e,this._end=n}get start(){return this._start}get end(){return this._end}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static fromJSON(e){return new Jh(new QF(e.start.line,e.start.character),new QF(e.end.line,e.end.character))}}we.DocumentRange=Jh;class QF{constructor(e,n){this._line=e,this._character=n}get line(){return this._line}get character(){return this._character}toJSON(){return{line:this.line,character:this.character}}}we.DocumentPosition=QF;class ES{constructor(e){this._range=Jh.fromJSON(e.range),this._lensRange=e.lensRange?Jh.fromJSON(e.lensRange):void 0,this._type=e.type,this._name=e.name,this._children=e.children.map(n=>new ES(n))}get range(){return this._range}get lensRange(){var e;return(e=this._lensRange)!==null&&e!==void 0?e:this._range}get type(){return this._type}get name(){return this._name}get children(){return this._children}}we.DocumentSymbol=ES;class UV{constructor(e){this.type=e.type,this.text=e.text}}we.DocumentCompletion=UV;class Fm{constructor(e,n){this.modelDef=n,this.inner=e}static fromJson({query:e,modelDef:n}){if(!e||!n)throw new Error("Missing required properties in JSON data");return new Fm(e,n)}tagParse(e){const n=(0,On.annotationToTag)(this.modelDef.annotation).tag;return e=(0,On.addModelScope)(e,n),(0,On.annotationToTag)(this.inner.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this.inner.annotation,e)}get annotation(){return this.inner.annotation}get modelAnnotation(){return this.modelDef.annotation}get modelTag(){return(0,On.annotationToTag)(this.modelDef.annotation).tag}get connectionName(){return this.inner.connectionName}get _rawQuery(){return this.inner}get _modelDef(){return this.modelDef}get sql(){return this.inner.sql}get dependenciesToMaterialize(){return this.inner.dependenciesToMaterialize}get materialization(){return this.inner.materialization}get resultExplore(){if(this.inner.structs.length===0)throw new Error("Malformed query result.");const e=this.inner.structs[this.inner.structs.length-1],n={...e,annotation:this.inner.annotation,name:this.inner.queryName||e.name};try{return new Ds(n,this.sourceExplore)}catch{return new Ds(n)}}get sourceExplore(){const e=this.inner.sourceExplore,n=this.modelDef.contents[e];if(n===void 0)throw new Error("Malformed query result.");if((0,ar.isSourceDef)(n))return new Ds(n);throw new Error(`'${e} is not an explore`)}get _sourceExploreName(){return this.inner.sourceExplore}get _sourceFilters(){return this.inner.sourceFilters||[]}}we.PreparedResult=Fm;class jV{async readURL(e){throw new Error("No files.")}async getInvalidationKey(e){throw new Error("No files.")}}we.EmptyURLReader=jV;class w7e{constructor(e){this.files=e}async readURL(e){const n=this.files.get(e.toString());if(n!==void 0)return Promise.resolve({contents:n,invalidationKey:this.invalidationKey(e,n)});throw new Error(`File not found '${e}'`)}async getInvalidationKey(e){const n=this.files.get(e.toString());if(n!==void 0)return Promise.resolve(this.invalidationKey(e,n));throw new Error(`File not found '${e}'`)}invalidationKey(e,n){return RS(e.toString())?null:nY(n)}}we.InMemoryURLReader=w7e;class AS{constructor(e,n){this.connections=e,this.defaultConnectionName=n}async getConnection(e){if(e===void 0)if(this.defaultConnectionName!==void 0)e=this.defaultConnectionName;else throw new Error("No default connection.");const n=this.connections.get(e);if(n!==void 0)return Promise.resolve(n);throw new Error(`No connection found with name ${e}.`)}listConnections(){return Array.from(this.connections.values())}async lookupConnection(e){return this.getConnection(e)}static fromArray(e){return new AS(new Map(e.map(n=>[n.name,n])))}}we.FixedConnectionMap=AS;var qV;(function(t){t.Nested="nested",t.BaseTable="base_table",t.Cross="cross",t.One="one",t.Many="many",t.Inline="inline"})(qV||(we.SourceRelationship=qV={}));class GF{constructor(e,n,r){this._name=e,this._parent=n,this._source=r}get source(){return this.source}get name(){return this._name}get sourceClasses(){const e=[];return this.source&&e.push(this.source.name),e.push(this.name),e}get fieldPath(){const e=[this.name];let n=this._parent;for(;n;)e.unshift(n.name),n=n._parent;return e}hasParentExplore(){return this._parent!==void 0}isExplore(){return this instanceof Ds}isQuery(){return this instanceof ZF}}class Ds extends GF{constructor(e,n,r){super(e.as||e.name,n,r),this._structDef=e,this._parentExplore=n,this.sourceExplore=r}get source(){return this.sourceExplore}isIntrinsic(){return(0,ar.isAtomicFieldType)(this._structDef.type)?!("e"in this._structDef):!1}isExploreField(){return!1}tagParse(e){return(0,On.annotationToTag)(this._structDef.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this._structDef.annotation,e)}get modelTag(){return this.parsedModelTag||(this.parsedModelTag=(0,On.annotationToTag)(this._structDef.modelAnnotation).tag),this.parsedModelTag}get name(){return this.structDef.as||this.structDef.name}getQueryByName(e){const n=this.sourceStructDef;if(!n)throw new Error(`Cannot get query by name from a struct of type ${this.structDef.type}`);const r={type:"query",structRef:n,pipeline:[{type:"reduce",queryFields:[{type:"fieldref",path:[e]}]}]};return new Kh(r,this.modelDef,[],e)}get modelDef(){if(!(0,ar.isSourceDef)(this.structDef))throw new Error(`Cannot create pseudo model for struct type ${this.structDef.type}`);return{name:"generated_model",exports:[],contents:{[this.structDef.name]:this.structDef},queryList:[],dependencies:{}}}getSingleExploreModel(){return new Yh(this.modelDef,[],[])}get fieldMap(){var e;if(this._fieldMap===void 0){const n=((e=this.source)===null||e===void 0?void 0:e.fieldMap)||new Map;this._fieldMap=new Map(this.structDef.fields.map(r=>{const i=r.as||r.name,s=n.get(r.name);if((0,ar.isJoined)(r))return[i,new e8(r,this,s)];if(r.type==="turtle")return[i,new ZF(r,this,s)];if(r.type==="string")return[i,new XF(r,this,s)];if(r.type==="number")return[i,new vS(r,this,s)];if(r.type==="date")return r.timeframe&&["day_of_month","day_of_week","day_of_year"].includes(r.timeframe)?[i,new vS({...r,type:"number"},this,s)]:[i,new WF(r,this,s)];if(r.type==="timestamp")return[i,new VF(r,this,s)];if(r.type==="boolean")return[i,new YF(r,this,s)];if(r.type==="json")return[i,new KF(r,this,s)];if(r.type==="sql native")return[i,new JF(r,this,s)]}))}return this._fieldMap}get allFields(){return[...this.fieldMap.values()]}get allFieldsWithOrder(){var e,n,r;if(!this._allFieldsWithOrder){const i=[...((r=(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.orderBy)===null||r===void 0?void 0:r.map(o=>{if(typeof o.field=="string")return{field:this.fieldMap.get(o.field),dir:o.dir};throw new Error("Does not support mapping order by from number.")}))||[]],s=new Set(i.map(o=>o.field.name));this._allFieldsWithOrder=[...i,...this.allFields.filter(o=>!s.has(o.name)).map(o=>({field:o,dir:"asc"}))]}return this._allFieldsWithOrder}get intrinsicFields(){return[...this.fieldMap.values()].filter(e=>e.isIntrinsic())}get dimensions(){return[...this.allFieldsWithOrder].filter(e=>e.field.isAtomicField()&&e.field.sourceWasDimension())}getFieldByName(e){const n=this.fieldMap.get(e);if(n===void 0)throw new Error(`No such field ${e}.`);return n}getFieldByNameIfExists(e){return this.fieldMap.get(e)}get primaryKey(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.primaryKey}get parentExplore(){return this._parentExplore}hasParentExplore(){return this instanceof e8}get filters(){var e;return(0,ar.isSourceDef)(this.structDef)?((e=this.structDef.resultMetadata)===null||e===void 0?void 0:e.filterList)||[]:[]}get limit(){var e,n;return(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.limit}get structDef(){return this._structDef}get queryTimezone(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.queryTimezone}get sourceStructDef(){if((0,ar.isSourceDef)(this.structDef))return this.structDef}toJSON(){var e,n;return{_structDef:this._structDef,sourceExplore:(e=this.sourceExplore)===null||e===void 0?void 0:e.toJSON(),_parentExplore:(n=this._parentExplore)===null||n===void 0?void 0:n.toJSON()}}static fromJSON(e){const n=e._parentExplore!==void 0?Ds.fromJSON(e._parentExplore):void 0,r=e.sourceExplore!==void 0?Ds.fromJSON(e.sourceExplore):void 0;return new Ds(e._structDef,n,r)}get location(){return this.structDef.location}}we.Explore=Ds;var Gu;(function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.Date="date",t.Timestamp="timestamp",t.Json="json",t.NativeUnsupported="sql native",t.Error="error"})(Gu||(we.AtomicFieldType=Gu={}));class W0 extends GF{constructor(e,n,r){super(e.as||e.name,n,r),this.fieldTypeDef=e,this.parent=n}get type(){switch(this.fieldTypeDef.type){case"string":return Gu.String;case"boolean":return Gu.Boolean;case"date":return Gu.Date;case"timestamp":return Gu.Timestamp;case"number":return Gu.Number;case"json":return Gu.Json;case"sql native":return Gu.NativeUnsupported;case"error":return Gu.Error;case"record":case"array":throw new Error(`MTOY TODO IMPLEMENT Atomic ${this.fieldTypeDef.type}`);default:{const e=this.fieldTypeDef;throw new Error(`Can't make an atomic field from ${e}`)}}}tagParse(e){return e=(0,On.addModelScope)(e,this.parent.modelTag),(0,On.annotationToTag)(this.fieldTypeDef.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this.fieldTypeDef.annotation,e)}isIntrinsic(){return(0,ar.fieldIsIntrinsic)(this.fieldTypeDef)}isQueryField(){return!1}isExploreField(){return!1}isAtomicField(){return!0}isCalculation(){return(0,ar.expressionIsCalculation)(this.fieldTypeDef.expressionType)}get sourceField(){throw new Error}get sourceClasses(){const e=this.fieldTypeDef.name||this.fieldTypeDef.as;return e?[e]:[]}get referenceId(){var e;return(e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.referenceId}sourceWasMeasure(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"}sourceWasMeasureLike(){var e,n;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"||((n=this.fieldTypeDef.resultMetadata)===null||n===void 0?void 0:n.fieldKind)==="struct"}sourceWasDimension(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="dimension"}hasParentExplore(){return!0}isString(){return this instanceof XF}isNumber(){return this instanceof vS}isDate(){return this instanceof WF}isBoolean(){return this instanceof YF}isJSON(){return this instanceof KF}isTimestamp(){return this instanceof VF}isUnsupported(){return this instanceof JF}get parentExplore(){return this.parent}get expression(){const e=".",n=this.fieldTypeDef.resultMetadata;return(n==null?void 0:n.sourceExpression)||(n!=null&&n.sourceField.includes(e)?n==null?void 0:n.sourceField:this.name)}get location(){return this.fieldTypeDef.location}}we.AtomicField=W0;var Jf;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year"})(Jf||(we.DateTimeframe=Jf={}));var Wu;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year",t.Second="second",t.Hour="hour",t.Minute="minute"})(Wu||(we.TimestampTimeframe=Wu={}));class WF extends W0{constructor(e,n,r){super(e,n,r),this.fieldDateDef=e}get timeframe(){if(this.fieldDateDef.timeframe!==void 0)switch(this.fieldDateDef.timeframe){case"day":return Jf.Day;case"week":return Jf.Week;case"month":return Jf.Month;case"quarter":return Jf.Quarter;case"year":return Jf.Year}}}we.DateField=WF;class VF extends W0{constructor(e,n,r){super(e,n,r),this.fieldTimestampDef=e}get timeframe(){if(this.fieldTimestampDef.timeframe!==void 0)switch(this.fieldTimestampDef.timeframe){case"day":return Wu.Day;case"week":return Wu.Week;case"month":return Wu.Month;case"quarter":return Wu.Quarter;case"year":return Wu.Year;case"second":return Wu.Second;case"hour":return Wu.Hour;case"minute":return Wu.Minute}}}we.TimestampField=VF;class vS extends W0{constructor(e,n,r){super(e,n,r),this.fieldNumberDef=e}}we.NumberField=vS;class YF extends W0{constructor(e,n,r){super(e,n,r),this.fieldBooleanDef=e}}we.BooleanField=YF;class KF extends W0{constructor(e,n,r){super(e,n,r),this.fieldJSONDef=e}}we.JSONField=KF;class JF extends W0{constructor(e,n,r){super(e,n,r),this.fieldUnsupportedDef=e}get rawType(){return this.fieldUnsupportedDef.rawType}}we.UnsupportedField=JF;class XF extends W0{constructor(e,n,r){super(e,n,r),this.fieldStringDef=e}}we.StringField=XF;class HV extends GF{constructor(e,n,r){super(e.as||e.name,n,r),this.turtleDef=e}get source(){return this.sourceQuery}isIntrinsic(){return!1}get location(){return this.turtleDef.location}}we.Query=HV;class ZF extends HV{constructor(e,n,r){super(e,n,r),this.parent=n}tagParse(e){return e=(0,On.addModelScope)(e,this.parent.modelTag),(0,On.annotationToTag)(this.turtleDef.annotation,e)}getTaglines(e){return(0,On.annotationToTaglines)(this.turtleDef.annotation,e)}isQueryField(){return!0}isExploreField(){return!1}isAtomicField(){return!1}get sourceClasses(){const e=this.turtleDef.name||this.turtleDef.as;return e?[e]:[]}hasParentExplore(){return!0}get parentExplore(){return this.parent}get expression(){return this.name}}we.QueryField=ZF;var Xh;(function(t){t.OneToOne="one_to_one",t.OneToMany="one_to_many",t.ManyToOne="many_to_one"})(Xh||(we.JoinRelationship=Xh={}));class e8 extends Ds{constructor(e,n,r){super(e,n,r),this._parentExplore=n}get joinRelationship(){if((0,ar.isJoined)(this.structDef))switch(this.structDef.join){case"one":return Xh.OneToOne;case"many":case"cross":return Xh.ManyToOne}throw new Error("A source field must have a join relationship.")}get isRecord(){return this.joinRelationship===Xh.OneToOne}get isArray(){return this.joinRelationship!==Xh.OneToOne}tagParse(e){return e=(0,On.addModelScope)(e,this._parentExplore.modelTag),(0,On.annotationToTag)(this._structDef.annotation,e)}isQueryField(){return!1}isExploreField(){return!0}isAtomicField(){return!1}get parentExplore(){return this._parentExplore}get sourceClasses(){const e=this.structDef.name||this.structDef.as;return e?[e]:[]}}we.ExploreField=e8;class t8{constructor({urlReader:e,connections:n,connection:r,eventStream:i,cacheManager:s}){if(this.isTestRuntime=!1,n===void 0){if(r===void 0)throw new Error("A LookupConnection<Connection> or Connection is required.");n={lookupConnection:()=>Promise.resolve(r)}}e===void 0&&(e=new jV),this._urlReader=e,this._connections=n,this._eventStream=i,this._cacheManager=s}get cacheManager(){return this._cacheManager}get urlReader(){return this._urlReader}get connections(){return this._connections}get eventStream(){return this._eventStream}loadModel(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};this.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0});const s=e instanceof URL?{url:e}:{source:e};return new wm(this,async()=>Wi.compile({...s,urlReader:this.urlReader,connections:this.connections,refreshSchemaCache:r,noThrowOnError:i,eventStream:this.eventStream,replaceMaterializedReferences:n==null?void 0:n.replaceMaterializedReferences,materializedTablePrefix:n==null?void 0:n.materializedTablePrefix,importBaseURL:n==null?void 0:n.importBaseURL,testEnvironment:n==null?void 0:n.testEnvironment,cacheManager:this.cacheManager}),n)}_loadModelFromModelDef(e,n){return new wm(this,async()=>new Yh(e,[],[]),n)}loadQuery(e,n){return this.loadModel(e,n).loadFinalQuery()}loadQueryByIndex(e,n,r){return this.loadModel(e,r).loadQueryByIndex(n,r)}loadQueryByName(e,n,r){return this.loadModel(e,r).loadQueryByName(n,r)}getModel(e,n){return this.loadModel(e,n).getModel()}getQuery(e,n){return this.loadQuery(e,n).getPreparedQuery()}getQueryByIndex(e,n,r){return this.loadQueryByIndex(e,n,r).getPreparedQuery()}getQueryByName(e,n,r){return this.loadQueryByName(e,n,r).getPreparedQuery()}}we.Runtime=t8;class N7e extends t8{constructor({urlReader:e,connections:n}){super({connections:AS.fromArray(n),urlReader:e}),this.rawConnections=n}}we.ConnectionRuntime=N7e;class L7e extends t8{constructor({urlReader:e,connection:n,eventStream:r,cacheManager:i}){super({urlReader:e,eventStream:r,cacheManager:i,connection:n}),this.connection=n}get supportsNesting(){return(0,zF.getDialect)(this.connection.dialectName).supportsNesting}quote(e){return(0,zF.getDialect)(this.connection.dialectName).sqlMaybeQuoteIdentifier(e)}get dialect(){return(0,zF.getDialect)(this.connection.dialectName)}getQuoter(){return e=>this.quote(e.toString())}}we.SingleConnectionRuntime=L7e;class _S{constructor(e,n){this.runtime=e,this._materialize=n}materialize(){return this.materialized===void 0?this.rematerialize():this.materialized}rematerialize(){return this.materialized=this._materialize(),this.materialized}makeQueryMaterializer(e,n){return new zV(this.runtime,e,n)}makeExploreMaterializer(e,n){return new GV(this.runtime,e,n)}makePreparedResultMaterializer(e){return new QV(this.runtime,e)}}class wm extends _S{constructor(e,n,r){super(e,n),this.runtime=e,this.compileQueryOptions=r}loadFinalQuery(e){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQuery(),{...this.compileQueryOptions,...e})}loadQueryByIndex(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByIndex(e),{...this.compileQueryOptions,...n})}loadQueryByName(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByName(e),{...this.compileQueryOptions,...n})}loadQuery(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.makeQueryMaterializer(async()=>{const s=this.runtime.urlReader,o=this.runtime.connections;this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0});const u=e instanceof URL?{url:e}:{source:e},a=await this.getModel();return(await Wi.compile({...u,urlReader:s,connections:o,model:a,refreshSchemaCache:r,noThrowOnError:i,importBaseURL:n==null?void 0:n.importBaseURL,testEnvironment:n==null?void 0:n.testEnvironment,...this.compileQueryOptions})).preparedQuery})}extendModel(e,n){return this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new wm(this.runtime,async()=>{const r=this.runtime.urlReader,i=this.runtime.connections,s=e instanceof URL?{url:e}:{source:e},o=await this.getModel();return await Wi.compile({...s,urlReader:r,connections:i,model:o,refreshSchemaCache:n==null?void 0:n.refreshSchemaCache,noThrowOnError:n==null?void 0:n.noThrowOnError,importBaseURL:n==null?void 0:n.importBaseURL,testEnvironment:n==null?void 0:n.testEnvironment,...this.compileQueryOptions})},n)}async search(e,n,r=1e3,i=void 0,s){const o=await this.materialize(),u=new ar.QueryModel(o._modelDef,s),a=o.getExploreByName(e).structDef;if(!(0,ar.isSourceDef)(a))throw new Error("Source to be searched was unexpectedly, not a source");const l=a.connection,c=await this.runtime.connections.lookupConnection(l);return await u.searchIndex(c,e,n,r,i)}async searchValueMap(e,n=10,r){const s=(await this.materialize()).getExploreByName(e);if(!(0,ar.isSourceDef)(s.structDef))throw new Error("Source to be searched was unexpectedly, not a source");let o="{index: *}";s.getFieldByNameIfExists("search_index")&&(o="search_index");const u=`
1276
1276
  run: ${e}
1277
1277
  -> ${o}
@@ -1293,7 +1293,7 @@ ${R}`,b)}else{if(S.urls)for(const R of S.urls)try{if(RS(R))throw new Error("In o
1293
1293
  `)}}this.stream.write(`
1294
1294
  ]
1295
1295
  `),this.stream.close()}}we.JSONWriter=$7e;class k7e extends n8{constructor(){super(...arguments),this.columnSeparator=",",this.rowSeparator=`
1296
- `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=k7e;class M7e{constructor(e){this.modelCache=e,this.modelDependencies=new Map,this.modelInvalidationKeys=new Map}async getCachedModelDef(e,n){const r=this.modelDependencies.get(n);if(r===void 0)return;const i=[n,...bS(r)],s={};for(const u of i){const a=this.modelInvalidationKeys.get(u);if(a==null)return;s[u]=a}for(const u of i)if(await r8(e,new URL(u))!==s[u])return;const o=await this.modelCache.getModel(new URL(n));if(o!==void 0){for(const u of i)if(o.invalidationKeys[u]!==s[u])return;return{modelDef:o.modelDef,invalidationKeys:s}}}async setCachedModelDef(e,n){this.modelDependencies.set(e,n.modelDef.dependencies);const r={};for(const s of[e,...bS(n.modelDef.dependencies)]){if(n.invalidationKeys[s]===null)return!1;if(n.invalidationKeys[s]===void 0)throw new Error(`Missing invalidation key for dependency ${s}`);this.modelInvalidationKeys.set(s,n.invalidationKeys[s]),r[s]=n.invalidationKeys[s]}return!!await this.modelCache.setModel(new URL(e),{modelDef:n.modelDef,invalidationKeys:r})}}we.CacheManager=M7e;function bS(t){return[...Object.keys(t),...Object.values(t).map(bS).flat()]}class P7e{constructor(){this.models=new Map}async getModel(e){return Promise.resolve(this.models.get(e.toString()))}async setModel(e,n){return this.models.set(e.toString(),n),Promise.resolve(!0)}}we.InMemoryModelCache=P7e;function nY(t){return(0,F7e.v5)(t,"76c17e9d-f3ce-5f2d-bfde-98ad3d2a37f6")}async function TS(t,e){const n=await t.readURL(e),{contents:r,invalidationKey:i}=typeof n=="string"?{contents:n,invalidationKey:void 0}:n;return{contents:r,invalidationKey:RS(e.toString())?null:i??nY(r)}}async function r8(t,e){return RS(e.toString())?null:t.getInvalidationKey!==void 0?await t.getInvalidationKey(e):(await TS(t,e)).invalidationKey}function RS(t){return t.startsWith("internal://")}var DS={};Object.defineProperty(DS,"__esModule",{value:!0}),DS.toAsyncGenerator=void 0;async function*U7e(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}DS.toAsyncGenerator=U7e;var OS={};Object.defineProperty(OS,"__esModule",{value:!0}),OS.modelDefToModelInfo=void 0;const fl=Ui,rY=Qs;function j7e(t){const e={entries:[],anonymous_queries:[]};for(const[n,r]of Object.entries(t.contents))if(t.exports.includes(n)){if((0,fl.isSourceDef)(r)){const i={kind:"source",name:n,schema:{fields:FS(r,r.fields)}};e.entries.push(i)}else if(r.type==="query"){const i=(0,rY.getResultStructDefForQuery)(t,r),s={kind:"source",name:n,schema:{fields:FS(i,i.fields)}};e.entries.push(s)}}return e}OS.modelDefToModelInfo=j7e;function FS(t,e){var n,r,i;const s=[];for(const o of e)if((0,fl.isTurtle)(o)){const u=(0,rY.getResultStructDefForView)(t,o),a={kind:"view",name:(n=o.as)!==null&&n!==void 0?n:o.name,schema:{fields:FS(u,u.fields)}};s.push(a)}else if((0,fl.isAtomic)(o)){const u=(0,fl.expressionIsAggregate)(o.expressionType),a=(0,fl.expressionIsScalar)(o.expressionType);if(!u&&!a||o.type==="error")continue;const l={kind:u?"measure":"dimension",name:(r=o.as)!==null&&r!==void 0?r:o.name,type:i8(o)};s.push(l)}else if((0,fl.isJoinedSource)(o)){const u={kind:"join",name:(i=o.as)!==null&&i!==void 0?i:o.name,schema:{fields:FS(o,o.fields)},relationship:o.join};s.push(u)}return s}function i8(t){if((0,fl.isLeafAtomic)(t))switch(t.type){case"string":return{kind:"string_type"};case"number":return{kind:"number_type",subtype:t.numberType==="float"?"decimal":t.numberType==="integer"?"integer":void 0};case"boolean":return{kind:"boolean_type"};case"date":return{kind:"date_type",timeframe:q7e(t.timeframe)};case"timestamp":return{kind:"timestamp_type",timeframe:t.timeframe};case"json":return{kind:"json_type"};case"sql native":return{kind:"sql_native_type",sql_type:t.rawType};case"error":throw new Error("Error type is not supported in stable interface")}else{if((0,fl.isRepeatedRecord)(t))return{kind:"array_type",element_type:iY(t)};if(t.type==="record")return iY(t);if(t.type==="array")return{kind:"array_type",element_type:i8(t.elementTypeDef)}}throw new Error("Unexpected field type")}function iY(t){return{kind:"record_type",fields:t.fields.map(e=>{if((0,fl.isAtomic)(e))return{name:e.name,type:i8(e)};throw new Error("Expected record type to not have a table as its child")})}}function q7e(t){switch(t){case void 0:return;case"day":case"week":case"month":case"year":case"quarter":return t;default:throw new Error("Invalid date timeframe")}}function jft(t){return t}function qft(t){return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.annotationToTag=t.modelDefToModelInfo=t.toAsyncGenerator=t.CacheManager=t.InMemoryModelCache=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=Ad;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=Ui;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=JD;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}}),Object.defineProperty(t,"InMemoryModelCache",{enumerable:!0,get:function(){return i.InMemoryModelCache}}),Object.defineProperty(t,"CacheManager",{enumerable:!0,get:function(){return i.CacheManager}});var s=DS;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=OS;Object.defineProperty(t,"modelDefToModelInfo",{enumerable:!0,get:function(){return o.modelDefToModelInfo}});var u=ps;Object.defineProperty(t,"annotationToTag",{enumerable:!0,get:function(){return u.annotationToTag}})})(dM);function sY(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function Im(t){return t.parentExplore?sY(t)===t.parentExplore.allFields.length-1:!0}function Bm(t){return sY(t)===0}function oY(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function H7e(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function uY(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function z7e(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function s8(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function to(t){return JSON.stringify(t.fieldPath)}function o8(t){return t[1]-t[0]+1}var wS=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(wS||{}),Wn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Wn||{});function Q7e(t){return Object.values(Wn).includes(t)}var aY={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",P=w.length-1;P>=0;)$+=w.charAt(P--);return $}function o(w,$){for(var P="";P.length<$;)P+=w;return P}function u(w,$){var P=""+w;return P.length>=$?P:o("0",$-P.length)+P}function a(w,$){var P=""+w;return P.length>=$?P:o(" ",$-P.length)+P}function l(w,$){var P=""+w;return P.length>=$?P:P+o(" ",$-P.length)}function c(w,$){var P=""+Math.round(w);return P.length>=$?P:o("0",$-P.length)+P}function f(w,$){var P=""+w;return P.length>=$?P:o("0",$-P.length)+P}var d=Math.pow(2,32);function h(w,$){if(w>d||w<-d)return c(w,$);var P=Math.round(w);return f(P,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function C(w,$,P){for(var G=w<0?-1:1,B=w*G,z=0,U=1,X=0,fe=1,ae=0,Z=0,ce=Math.floor(B);ae<$&&(ce=Math.floor(B),X=ce*U+z,Z=ce*ae+fe,!(B-ce<5e-8));)B=1/(B-ce),z=U,U=X,fe=ae,ae=Z;if(Z>$&&(ae>$?(Z=fe,X=z):(Z=ae,X=U)),!P)return[0,G*X,Z];var De=Math.floor(G*X/Z);return[De,G*X-De*Z,Z]}function S(w,$,P){if(w>2958465||w<0)return null;var G=w|0,B=Math.floor(86400*(w-G)),z=0,U=[],X={D:G,T:B,u:86400*(w-G)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(X.u)<1e-6&&(X.u=0),$&&$.date1904&&(G+=1462),X.u>.9999&&(X.u=0,++B==86400&&(X.T=B=0,++G,++X.D)),G===60)U=P?[1317,10,29]:[1900,2,29],z=3;else if(G===0)U=P?[1317,8,29]:[1900,1,0],z=6;else{G>60&&--G;var fe=new Date(1900,0,1);fe.setDate(fe.getDate()+G-1),U=[fe.getFullYear(),fe.getMonth()+1,fe.getDate()],z=fe.getDay(),G<60&&(z=(z+6)%7),P&&(z=Q(fe,U))}return X.y=U[0],X.m=U[1],X.d=U[2],X.S=B%60,B=Math.floor(B/60),X.M=B%60,B=Math.floor(B/60),X.H=B,X.q=z,X}i.parse_date_code=S;var b=new Date(1899,11,31,0,0,0),R=b.getTime(),I=new Date(1900,2,1,0,0,0);function L(w,$){var P=w.getTime();return $?P-=1262304e5:w>=I&&(P+=864e5),(P-(R+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function M(w){return w.toString(10)}i._general_int=M;var j=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function P(ae){return ae.indexOf(".")==-1?ae:ae.replace($,"$1")}var G=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(ae){return ae.indexOf("E")==-1?ae:ae.replace(G,"$1E").replace(B,"$10$2")}function U(ae){var Z=ae<0?12:11,ce=P(ae.toFixed(12));return ce.length<=Z||(ce=ae.toPrecision(10),ce.length<=Z)?ce:ae.toExponential(5)}function X(ae){var Z=P(ae.toFixed(11));return Z.length>(ae<0?12:11)||Z==="0"||Z==="-0"?ae.toPrecision(6):Z}function fe(ae){var Z=Math.floor(Math.log(Math.abs(ae))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=ae.toPrecision(10+Z):Math.abs(Z)<=9?ce=U(ae):Z===10?ce=ae.toFixed(10).substr(0,12):ce=X(ae),P(z(ce.toUpperCase()))}return fe}();i._general_num=j;function J(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):j(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,L(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=J;function Q(w,$){$[0]-=581;var P=w.getDay();return w<60&&(P=(P+6)%7),P}function ne(w,$,P,G){var B="",z=0,U=0,X=P.y,fe,ae=0;switch(w){case 98:X=P.y+543;case 121:switch($.length){case 1:case 2:fe=X%100,ae=2;break;default:fe=X%1e4,ae=4;break}break;case 109:switch($.length){case 1:case 2:fe=P.m,ae=$.length;break;case 3:return g[P.m-1][1];case 5:return g[P.m-1][0];default:return g[P.m-1][2]}break;case 100:switch($.length){case 1:case 2:fe=P.d,ae=$.length;break;case 3:return m[P.q][0];default:return m[P.q][1]}break;case 104:switch($.length){case 1:case 2:fe=1+(P.H+11)%12,ae=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:fe=P.H,ae=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:fe=P.M,ae=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return P.u===0&&($=="s"||$=="ss")?u(P.S,$.length):(G>=2?U=G===3?1e3:100:U=G===1?10:1,z=Math.round(U*(P.S+P.u)),z>=60*U&&(z=0),$==="s"?z===0?"0":""+z/U:(B=u(z,2+G),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":fe=P.D*24+P.H;break;case"[m]":case"[mm]":fe=(P.D*24+P.H)*60+P.M;break;case"[s]":case"[ss]":fe=((P.D*24+P.H)*60+P.M)*60+Math.round(P.S+P.u);break;default:throw"bad abstime format: "+$}ae=$.length===3?1:2;break;case 101:fe=X,ae=1;break}var Z=ae>0?u(fe,ae):"";return Z}function me(w){var $=3;if(w.length<=$)return w;for(var P=w.length%$,G=w.substr(0,P);P!=w.length;P+=$)G+=(G.length>0?",":"")+w.substr(P,$);return G}var ge=function(){var $=/%/g;function P(re,V,ie){var Re=V.replace($,""),K=V.length-Re.length;return ge(re,Re,ie*Math.pow(10,2*K))+o("%",K)}function G(re,V,ie){for(var Re=V.length-1;V.charCodeAt(Re-1)===44;)--Re;return ge(re,V.substr(0,Re),ie/Math.pow(10,3*(V.length-Re)))}function B(re,V){var ie,Re=re.indexOf("E")-re.indexOf(".")-1;if(re.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(re,-V);var K=re.indexOf(".");K===-1&&(K=re.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),ie=(V/Math.pow(10,de)).toPrecision(Re+1+(K+de)%K),ie.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(ie.indexOf(".")===-1?ie=ie.charAt(0)+"."+ie.substr(1)+"E+"+(Le-ie.length+de):ie+="E+"+(Le-de);ie.substr(0,2)==="0.";)ie=ie.charAt(0)+ie.substr(2,K)+"."+ie.substr(2+K),ie=ie.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");ie=ie.replace(/\+-/,"-")}ie=ie.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(ze,at,St,lt){return at+St+lt.substr(0,(K+de)%K)+"."+lt.substr(de)+"E"})}else ie=V.toExponential(Re);return re.match(/E\+00$/)&&ie.match(/e[+-]\d$/)&&(ie=ie.substr(0,ie.length-1)+"0"+ie.charAt(ie.length-1)),re.match(/E\-/)&&ie.match(/e\+/)&&(ie=ie.replace(/e\+/,"e")),ie.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function U(re,V,ie){var Re=parseInt(re[4],10),K=Math.round(V*Re),de=Math.floor(K/Re),Le=K-de*Re,ze=Re;return ie+(de===0?"":""+de)+" "+(Le===0?o(" ",re[1].length+1+re[4].length):a(Le,re[1].length)+re[2]+"/"+re[3]+u(ze,re[4].length))}function X(re,V,ie){return ie+(V===0?"":""+V)+o(" ",re[1].length+2+re[4].length)}var fe=/^#*0*\.([0#]+)/,ae=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(re){for(var V="",ie,Re=0;Re!=re.length;++Re)switch(ie=re.charCodeAt(Re)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(ie)}return V}function De(re,V){var ie=Math.pow(10,V);return""+Math.round(re*ie)/ie}function Me(re,V){var ie=re-Math.floor(re),Re=Math.pow(10,V);return V<(""+Math.round(ie*Re)).length?0:Math.round(ie*Re)}function Ke(re,V){return V<(""+Math.round((re-Math.floor(re))*Math.pow(10,V))).length?1:0}function Y(re){return re<2147483647&&re>-2147483648?""+(re>=0?re|0:re-1|0):""+Math.floor(re)}function ee(re,V,ie){if(re.charCodeAt(0)===40&&!V.match(ae)){var Re=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return ie>=0?ee("n",Re,ie):"("+ee("n",Re,-ie)+")"}if(V.charCodeAt(V.length-1)===44)return G(re,V,ie);if(V.indexOf("%")!==-1)return P(re,V,ie);if(V.indexOf("E")!==-1)return B(V,ie);if(V.charCodeAt(0)===36)return"$"+ee(re,V.substr(V.charAt(1)==" "?2:1),ie);var K,de,Le,ze,at=Math.abs(ie),St=ie<0?"-":"";if(V.match(/^00+$/))return St+h(at,V.length);if(V.match(/^[#?]+$/))return K=h(ie,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return U(de,at,St);if(V.match(/^#+0+$/))return St+h(at,V.length-V.indexOf("0"));if(de=V.match(fe))return K=De(ie,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Us,yE){return"."+yE+o("0",ce(de[1]).length-yE.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return St+De(at,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return St+me(h(at,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return ie<0?"-"+ee(re,V,-ie):me(""+(Math.floor(ie)+Ke(ie,de[1].length)))+"."+u(Me(ie,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(re,V.replace(/^#,#*,/,""),ie);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(re,V.replace(/[\\-]/g,""),ie)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Us){return Le<K.length?K.charAt(Le++):Us==="0"?"0":""}));if(V.match(Z))return K=ee(re,"##########",ie),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var lt="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),ze=C(at,Math.pow(10,Le)-1,!1),K=""+St,lt=ge("n",de[1],ze[1]),lt.charAt(lt.length-1)==" "&&(lt=lt.substr(0,lt.length-1)+"0"),K+=lt+de[2]+"/"+de[3],lt=l(ze[2],Le),lt.length<de[4].length&&(lt=ce(de[4].substr(de[4].length-lt.length))+lt),K+=lt,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),ze=C(at,Math.pow(10,Le)-1,!0),St+(ze[0]||(ze[1]?"":"0"))+" "+(ze[1]?a(ze[1],Le)+de[2]+"/"+de[3]+l(ze[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(ie,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+ie.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var vr=V.indexOf(".")-Le,Vc=V.length-K.length-vr;return ce(V.substr(0,vr)+K+V.substr(V.length-Vc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=Me(ie,de[1].length),ie<0?"-"+ee(re,V,-ie):me(Y(ie)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Us){return"00,"+(Us.length<3?u(0,3-Us.length):"")+Us})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(re,"#,##0.00",ie);case"###,###":case"##,###":case"#,###":var mE=me(h(at,0));return mE!=="0"?St+mE:"";case"###,###.00":return ee(re,"###,##0.00",ie).replace(/^0\./,".");case"#,###.00":return ee(re,"#,##0.00",ie).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function be(re,V,ie){for(var Re=V.length-1;V.charCodeAt(Re-1)===44;)--Re;return ge(re,V.substr(0,Re),ie/Math.pow(10,3*(V.length-Re)))}function Ue(re,V,ie){var Re=V.replace($,""),K=V.length-Re.length;return ge(re,Re,ie*Math.pow(10,2*K))+o("%",K)}function Pe(re,V){var ie,Re=re.indexOf("E")-re.indexOf(".")-1;if(re.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(re,-V);var K=re.indexOf(".");K===-1&&(K=re.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),ie=(V/Math.pow(10,de)).toPrecision(Re+1+(K+de)%K),!ie.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);ie.indexOf(".")===-1?ie=ie.charAt(0)+"."+ie.substr(1)+"E+"+(Le-ie.length+de):ie+="E+"+(Le-de),ie=ie.replace(/\+-/,"-")}ie=ie.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(ze,at,St,lt){return at+St+lt.substr(0,(K+de)%K)+"."+lt.substr(de)+"E"})}else ie=V.toExponential(Re);return re.match(/E\+00$/)&&ie.match(/e[+-]\d$/)&&(ie=ie.substr(0,ie.length-1)+"0"+ie.charAt(ie.length-1)),re.match(/E\-/)&&ie.match(/e\+/)&&(ie=ie.replace(/e\+/,"e")),ie.replace("e","E")}function q(re,V,ie){if(re.charCodeAt(0)===40&&!V.match(ae)){var Re=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return ie>=0?q("n",Re,ie):"("+q("n",Re,-ie)+")"}if(V.charCodeAt(V.length-1)===44)return be(re,V,ie);if(V.indexOf("%")!==-1)return Ue(re,V,ie);if(V.indexOf("E")!==-1)return Pe(V,ie);if(V.charCodeAt(0)===36)return"$"+q(re,V.substr(V.charAt(1)==" "?2:1),ie);var K,de,Le,ze,at=Math.abs(ie),St=ie<0?"-":"";if(V.match(/^00+$/))return St+u(at,V.length);if(V.match(/^[#?]+$/))return K=""+ie,ie===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return X(de,at,St);if(V.match(/^#+0+$/))return St+u(at,V.length-V.indexOf("0"));if(de=V.match(fe))return K=(""+ie).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Us,yE){return"."+yE+o("0",ce(de[1]).length-yE.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return St+(""+at).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return St+me(""+at);if(de=V.match(/^#,##0\.([#0]*0)$/))return ie<0?"-"+q(re,V,-ie):me(""+ie)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return q(re,V.replace(/^#,#*,/,""),ie);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(q(re,V.replace(/[\\-]/g,""),ie)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Us){return Le<K.length?K.charAt(Le++):Us==="0"?"0":""}));if(V.match(Z))return K=q(re,"##########",ie),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var lt="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),ze=C(at,Math.pow(10,Le)-1,!1),K=""+St,lt=ge("n",de[1],ze[1]),lt.charAt(lt.length-1)==" "&&(lt=lt.substr(0,lt.length-1)+"0"),K+=lt+de[2]+"/"+de[3],lt=l(ze[2],Le),lt.length<de[4].length&&(lt=ce(de[4].substr(de[4].length-lt.length))+lt),K+=lt,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),ze=C(at,Math.pow(10,Le)-1,!0),St+(ze[0]||(ze[1]?"":"0"))+" "+(ze[1]?a(ze[1],Le)+de[2]+"/"+de[3]+l(ze[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+ie,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+ie.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var vr=V.indexOf(".")-Le,Vc=V.length-K.length-vr;return ce(V.substr(0,vr)+K+V.substr(V.length-Vc))}if(de=V.match(/^00,000\.([#0]*0)$/))return ie<0?"-"+q(re,V,-ie):me(""+ie).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Us){return"00,"+(Us.length<3?u(0,3-Us.length):"")+Us})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var mE=me(""+at);return mE!=="0"?St+mE:"";default:if(V.match(/\.[0#?]*$/))return q(re,V.slice(0,V.lastIndexOf(".")),ie)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,ie,Re){return(Re|0)===Re?q(V,ie,Re):ee(V,ie,Re)}}();function ue(w){for(var $=[],P=!1,G=0,B=0;G<w.length;++G)switch(w.charCodeAt(G)){case 34:P=!P;break;case 95:case 42:case 92:++G;break;case 59:$[$.length]=w.substr(B,G-B),B=G+1}if($[$.length]=w.substr(B),P===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ue;var xe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function se(w){for(var $=0,P="",G="";$<w.length;)switch(P=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(G=P;w.charAt($++)!=="]"&&$<w.length;)G+=w.charAt($);if(G.match(xe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(P=w.charAt(++$))>-1||P=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===P;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=se;function oe(w,$,P,G){for(var B=[],z="",U=0,X="",fe="t",ae,Z,ce,De="H";U<w.length;)switch(X=w.charAt(U)){case"G":if(!p(w,U))throw new Error("unrecognized character "+X+" in "+w);B[B.length]={t:"G",v:"General"},U+=7;break;case'"':for(z="";(ce=w.charCodeAt(++U))!==34&&U<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++U;break;case"\\":var Me=w.charAt(++U),Ke=Me==="("||Me===")"?Me:"t";B[B.length]={t:Ke,v:Me},++U;break;case"_":B[B.length]={t:"t",v:" "},U+=2;break;case"@":B[B.length]={t:"T",v:$},++U;break;case"B":case"b":if(w.charAt(U+1)==="1"||w.charAt(U+1)==="2"){if(ae==null&&(ae=S($,P,w.charAt(U+1)==="2"),ae==null))return"";B[B.length]={t:"X",v:w.substr(U,2)},fe=X,U+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":X=X.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||ae==null&&(ae=S($,P),ae==null))return"";for(z=X;++U<w.length&&w.charAt(U).toLowerCase()===X;)z+=X;X==="m"&&fe.toLowerCase()==="h"&&(X="M"),X==="h"&&(X=De),B[B.length]={t:X,v:z},fe=X;break;case"A":case"a":case"上":var Y={t:X,v:X};if(ae==null&&(ae=S($,P)),w.substr(U,3).toUpperCase()==="A/P"?(ae!=null&&(Y.v=ae.H>=12?"P":"A"),Y.t="T",De="h",U+=3):w.substr(U,5).toUpperCase()==="AM/PM"?(ae!=null&&(Y.v=ae.H>=12?"PM":"AM"),Y.t="T",U+=5,De="h"):w.substr(U,5).toUpperCase()==="上午/下午"?(ae!=null&&(Y.v=ae.H>=12?"下午":"上午"),Y.t="T",U+=5,De="h"):(Y.t="t",++U),ae==null&&Y.t==="T")return"";B[B.length]=Y,fe=X;break;case"[":for(z=X;w.charAt(U++)!=="]"&&U<w.length;)z+=w.charAt(U);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(xe)){if(ae==null&&(ae=S($,P),ae==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},fe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",se(w)||(B[B.length]={t:"t",v:z}));break;case".":if(ae!=null){for(z=X;++U<w.length&&(X=w.charAt(U))==="0";)z+=X;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=X;++U<w.length&&"0#?.,E+-%".indexOf(X=w.charAt(U))>-1;)z+=X;B[B.length]={t:"n",v:z};break;case"?":for(z=X;w.charAt(++U)===X;)z+=X;B[B.length]={t:X,v:z},fe=X;break;case"*":++U,(w.charAt(U)==" "||w.charAt(U)=="*")&&++U;break;case"(":case")":B[B.length]={t:G===1?"t":X,v:X},++U;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=X;U<w.length&&"0123456789".indexOf(w.charAt(++U))>-1;)z+=w.charAt(U);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:X,v:X},++U;break;case"$":B[B.length]={t:"t",v:"$"},++U;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(X)===-1)throw new Error("unrecognized character "+X+" in "+w);B[B.length]={t:"t",v:X},++U;break}var ee=0,be=0,Ue;for(U=B.length-1,fe="t";U>=0;--U)switch(B[U].t){case"h":case"H":B[U].t=De,fe="h",ee<1&&(ee=1);break;case"s":(Ue=B[U].v.match(/\.0+$/))&&(be=Math.max(be,Ue[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":fe=B[U].t;break;case"m":fe==="s"&&(B[U].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[U].v.match(/[Hh]/)&&(ee=1),ee<2&&B[U].v.match(/[Mm]/)&&(ee=2),ee<3&&B[U].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:ae.u>=.5&&(ae.u=0,++ae.S),ae.S>=60&&(ae.S=0,++ae.M),ae.M>=60&&(ae.M=0,++ae.H);break;case 2:ae.u>=.5&&(ae.u=0,++ae.S),ae.S>=60&&(ae.S=0,++ae.M);break}var Pe="",q;for(U=0;U<B.length;++U)switch(B[U].t){case"t":case"T":case" ":case"D":break;case"X":B[U].v="",B[U].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[U].v=ne(B[U].t.charCodeAt(0),B[U].v,ae,be),B[U].t="t";break;case"n":case"?":for(q=U+1;B[q]!=null&&((X=B[q].t)==="?"||X==="D"||(X===" "||X==="t")&&B[q+1]!=null&&(B[q+1].t==="?"||B[q+1].t==="t"&&B[q+1].v==="/")||B[U].t==="("&&(X===" "||X==="n"||X===")")||X==="t"&&(B[q].v==="/"||B[q].v===" "&&B[q+1]!=null&&B[q+1].t=="?"));)B[U].v+=B[q].v,B[q]={v:"",t:";"},++q;Pe+=B[U].v,U=q-1;break;case"G":B[U].t="t",B[U].v=J($,P);break}var re="",V,ie;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,ie=ge("n",Pe,V)):(V=$<0&&G>1?-$:$,ie=ge("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(ie=ie.substr(1),B[0].v="-"+B[0].v)),q=ie.length-1;var Re=B.length;for(U=0;U<B.length;++U)if(B[U]!=null&&B[U].t!="t"&&B[U].v.indexOf(".")>-1){Re=U;break}var K=B.length;if(Re===B.length&&ie.indexOf("E")===-1){for(U=B.length-1;U>=0;--U)B[U]==null||"n?".indexOf(B[U].t)===-1||(q>=B[U].v.length-1?(q-=B[U].v.length,B[U].v=ie.substr(q+1,B[U].v.length)):q<0?B[U].v="":(B[U].v=ie.substr(0,q+1),q=-1),B[U].t="t",K=U);q>=0&&K<B.length&&(B[K].v=ie.substr(0,q+1)+B[K].v)}else if(Re!==B.length&&ie.indexOf("E")===-1){for(q=ie.indexOf(".")-1,U=Re;U>=0;--U)if(!(B[U]==null||"n?".indexOf(B[U].t)===-1)){for(Z=B[U].v.indexOf(".")>-1&&U===Re?B[U].v.indexOf(".")-1:B[U].v.length-1,re=B[U].v.substr(Z+1);Z>=0;--Z)q>=0&&(B[U].v.charAt(Z)==="0"||B[U].v.charAt(Z)==="#")&&(re=ie.charAt(q--)+re);B[U].v=re,B[U].t="t",K=U}for(q>=0&&K<B.length&&(B[K].v=ie.substr(0,q+1)+B[K].v),q=ie.indexOf(".")+1,U=Re;U<B.length;++U)if(!(B[U]==null||"n?(".indexOf(B[U].t)===-1&&U!==Re)){for(Z=B[U].v.indexOf(".")>-1&&U===Re?B[U].v.indexOf(".")+1:0,re=B[U].v.substr(0,Z);Z<B[U].v.length;++Z)q<ie.length&&(re+=ie.charAt(q++));B[U].v=re,B[U].t="t",K=U}}}for(U=0;U<B.length;++U)B[U]!=null&&"n?".indexOf(B[U].t)>-1&&(V=G>1&&$<0&&U>0&&B[U-1].v==="-"?-$:$,B[U].v=ge(B[U].t,B[U].v,V),B[U].t="t");var de="";for(U=0;U!==B.length;++U)B[U]!=null&&(de+=B[U].v);return de}i._eval=oe;var F=/\[[=<>]/,D=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var P=parseFloat($[2]);switch($[1]){case"=":if(w==P)return!0;break;case">":if(w>P)return!0;break;case"<":if(w<P)return!0;break;case"<>":if(w!=P)return!0;break;case">=":if(w>=P)return!0;break;case"<=":if(w<=P)return!0;break}return!1}function k(w,$){var P=ue(w),G=P.length,B=P[G-1].indexOf("@");if(G<4&&B>-1&&--G,P.length>4)throw new Error("cannot find right format for |"+P.join("|")+"|");if(typeof $!="number")return[4,P.length===4||B>-1?P[P.length-1]:"@"];switch(P.length){case 1:P=B>-1?["General","General","General",P[0]]:[P[0],P[0],P[0],"@"];break;case 2:P=B>-1?[P[0],P[0],P[0],P[1]]:[P[0],P[1],P[0],"@"];break;case 3:P=B>-1?[P[0],P[1],P[0],P[2]]:[P[0],P[1],P[2],"@"];break}var z=$>0?P[0]:$<0?P[1]:P[2];if(P[0].indexOf("[")===-1&&P[1].indexOf("[")===-1)return[G,z];if(P[0].match(F)!=null||P[1].match(F)!=null){var U=P[0].match(D),X=P[1].match(D);return O($,U)?[G,P[0]]:O($,X)?[G,P[1]]:[G,P[U!=null&&X!=null?2:1]]}return[G,z]}function W(w,$,P){P==null&&(P={});var G="";switch(typeof w){case"string":w=="m/d/yy"&&P.dateNF?G=P.dateNF:G=w;break;case"number":w==14&&P.dateNF?G=P.dateNF:G=(P.table!=null?P.table:E)[w],G==null&&(G=P.table&&P.table[A[w]]||E[A[w]]),G==null&&(G=_[w]||"General");break}if(p(G,0))return J($,P);$ instanceof Date&&($=L($,P.date1904));var B=k(G,$);if(p(B[1]))return J($,P);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return oe(B[1],$,P,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var P=0;P<392;++P){if(E[P]==null){$<0&&($=P);continue}if(E[P]==w){$=P;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var P=0;P!=392;++P)$[P]!==void 0&&H($[P],P)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(aY);var NS=aY.exports;function G7e(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var W7e=G7e;function V7e(t){return function(e){return t==null?void 0:t[e]}}var Y7e=V7e,K7e=Y7e,J7e={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},X7e=K7e(J7e),Z7e=X7e,eFe=typeof T=="object"&&T&&T.Object===Object&&T,tFe=eFe,nFe=tFe,rFe=typeof self=="object"&&self&&self.Object===Object&&self,iFe=nFe||rFe||Function("return this")(),sFe=iFe,oFe=sFe,uFe=oFe.Symbol,u8=uFe;function aFe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var lFe=aFe,cFe=Array.isArray,fFe=cFe,lY=u8,cY=Object.prototype,xFe=cY.hasOwnProperty,dFe=cY.toString,$m=lY?lY.toStringTag:void 0;function hFe(t){var e=xFe.call(t,$m),n=t[$m];try{t[$m]=void 0;var r=!0}catch{}var i=dFe.call(t);return r&&(e?t[$m]=n:delete t[$m]),i}var pFe=hFe,gFe=Object.prototype,mFe=gFe.toString;function yFe(t){return mFe.call(t)}var EFe=yFe,fY=u8,AFe=pFe,vFe=EFe,_Fe="[object Null]",CFe="[object Undefined]",xY=fY?fY.toStringTag:void 0;function SFe(t){return t==null?t===void 0?CFe:_Fe:xY&&xY in Object(t)?AFe(t):vFe(t)}var bFe=SFe;function TFe(t){return t!=null&&typeof t=="object"}var RFe=TFe,DFe=bFe,OFe=RFe,FFe="[object Symbol]";function wFe(t){return typeof t=="symbol"||OFe(t)&&DFe(t)==FFe}var NFe=wFe,dY=u8,LFe=lFe,IFe=fFe,BFe=NFe,$Fe=1/0,hY=dY?dY.prototype:void 0,pY=hY?hY.toString:void 0;function gY(t){if(typeof t=="string")return t;if(IFe(t))return LFe(t,gY)+"";if(BFe(t))return pY?pY.call(t):"";var e=t+"";return e=="0"&&1/t==-$Fe?"-0":e}var kFe=gY,MFe=kFe;function PFe(t){return t==null?"":MFe(t)}var a8=PFe,UFe=Z7e,jFe=a8,qFe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,HFe="\\u0300-\\u036f",zFe="\\ufe20-\\ufe2f",QFe="\\u20d0-\\u20ff",GFe=HFe+zFe+QFe,WFe="["+GFe+"]",VFe=RegExp(WFe,"g");function YFe(t){return t=jFe(t),t&&t.replace(qFe,UFe).replace(VFe,"")}var KFe=YFe,JFe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function XFe(t){return t.match(JFe)||[]}var ZFe=XFe,e8e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function t8e(t){return e8e.test(t)}var n8e=t8e,mY="\\ud800-\\udfff",r8e="\\u0300-\\u036f",i8e="\\ufe20-\\ufe2f",s8e="\\u20d0-\\u20ff",o8e=r8e+i8e+s8e,yY="\\u2700-\\u27bf",EY="a-z\\xdf-\\xf6\\xf8-\\xff",u8e="\\xac\\xb1\\xd7\\xf7",a8e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",l8e="\\u2000-\\u206f",c8e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",AY="A-Z\\xc0-\\xd6\\xd8-\\xde",f8e="\\ufe0e\\ufe0f",vY=u8e+a8e+l8e+c8e,_Y="['’]",CY="["+vY+"]",x8e="["+o8e+"]",SY="\\d+",d8e="["+yY+"]",bY="["+EY+"]",TY="[^"+mY+vY+SY+yY+EY+AY+"]",h8e="\\ud83c[\\udffb-\\udfff]",p8e="(?:"+x8e+"|"+h8e+")",g8e="[^"+mY+"]",RY="(?:\\ud83c[\\udde6-\\uddff]){2}",DY="[\\ud800-\\udbff][\\udc00-\\udfff]",Zh="["+AY+"]",m8e="\\u200d",OY="(?:"+bY+"|"+TY+")",y8e="(?:"+Zh+"|"+TY+")",FY="(?:"+_Y+"(?:d|ll|m|re|s|t|ve))?",wY="(?:"+_Y+"(?:D|LL|M|RE|S|T|VE))?",NY=p8e+"?",LY="["+f8e+"]?",E8e="(?:"+m8e+"(?:"+[g8e,RY,DY].join("|")+")"+LY+NY+")*",A8e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",v8e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",_8e=LY+NY+E8e,C8e="(?:"+[d8e,RY,DY].join("|")+")"+_8e,S8e=RegExp([Zh+"?"+bY+"+"+FY+"(?="+[CY,Zh,"$"].join("|")+")",y8e+"+"+wY+"(?="+[CY,Zh+OY,"$"].join("|")+")",Zh+"?"+OY+"+"+FY,Zh+"+"+wY,v8e,A8e,SY,C8e].join("|"),"g");function b8e(t){return t.match(S8e)||[]}var T8e=b8e,R8e=ZFe,D8e=n8e,O8e=a8,F8e=T8e;function w8e(t,e,n){return t=O8e(t),e=n?void 0:e,e===void 0?D8e(t)?F8e(t):R8e(t):t.match(e)||[]}var N8e=w8e,L8e=W7e,I8e=KFe,B8e=N8e,$8e="['’]",k8e=RegExp($8e,"g");function M8e(t){return function(e){return L8e(B8e(I8e(e).replace(k8e,"")),t,"")}}var P8e=M8e;function U8e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var j8e=U8e,q8e=j8e;function H8e(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:q8e(t,e,n)}var z8e=H8e,Q8e="\\ud800-\\udfff",G8e="\\u0300-\\u036f",W8e="\\ufe20-\\ufe2f",V8e="\\u20d0-\\u20ff",Y8e=G8e+W8e+V8e,K8e="\\ufe0e\\ufe0f",J8e="\\u200d",X8e=RegExp("["+J8e+Q8e+Y8e+K8e+"]");function Z8e(t){return X8e.test(t)}var IY=Z8e;function ewe(t){return t.split("")}var twe=ewe,BY="\\ud800-\\udfff",nwe="\\u0300-\\u036f",rwe="\\ufe20-\\ufe2f",iwe="\\u20d0-\\u20ff",swe=nwe+rwe+iwe,owe="\\ufe0e\\ufe0f",uwe="["+BY+"]",l8="["+swe+"]",c8="\\ud83c[\\udffb-\\udfff]",awe="(?:"+l8+"|"+c8+")",$Y="[^"+BY+"]",kY="(?:\\ud83c[\\udde6-\\uddff]){2}",MY="[\\ud800-\\udbff][\\udc00-\\udfff]",lwe="\\u200d",PY=awe+"?",UY="["+owe+"]?",cwe="(?:"+lwe+"(?:"+[$Y,kY,MY].join("|")+")"+UY+PY+")*",fwe=UY+PY+cwe,xwe="(?:"+[$Y+l8+"?",l8,kY,MY,uwe].join("|")+")",dwe=RegExp(c8+"(?="+c8+")|"+xwe+fwe,"g");function hwe(t){return t.match(dwe)||[]}var pwe=hwe,gwe=twe,mwe=IY,ywe=pwe;function Ewe(t){return mwe(t)?ywe(t):gwe(t)}var Awe=Ewe,vwe=z8e,_we=IY,Cwe=Awe,Swe=a8;function bwe(t){return function(e){e=Swe(e);var n=_we(e)?Cwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?vwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Twe=bwe,Rwe=Twe,Dwe=Rwe("toUpperCase"),Owe=Dwe,Fwe=P8e,wwe=Owe,Nwe=Fwe(function(t,e,n){return t+(n?" ":"")+wwe(e)}),Lwe=Nwe;const Iwe=LE(Lwe);function xl(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Bwe(t,e){const n=o_e.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function $we(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function kwe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function Zf(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Iwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Mwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Pwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function jY({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Pwe(r);let o=Mwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class ex{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class qY{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return $we(this.document,i)}if(n===null)return kwe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const O6=class O6 extends ex{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new qY(e)}get rendererName(){}};O6.instance=new O6;let HY=O6;function zY(t,e,n={}){let r=e.toString();return n.terse?r=Uwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?NS.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Uwe=new Map([[Wn.Nanoseconds,"ns"],[Wn.Microseconds,"µs"],[Wn.Milliseconds,"ms"],[Wn.Seconds,"s"],[Wn.Minutes,"m"],[Wn.Hours,"h"],[Wn.Days,"d"]]),jwe=new Map([[Wn.Nanoseconds,1e3],[Wn.Microseconds,1e3],[Wn.Milliseconds,1e3],[Wn.Seconds,60],[Wn.Minutes,60],[Wn.Hours,24],[Wn.Days,Number.MAX_VALUE]]);function QY(t,e,n){const r=n.durationUnit&&Q7e(n.durationUnit)?n.durationUnit:Wn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,d]of jwe)if(f===r&&(c=!0),!!c&&(a=u%d,u=Math.floor(u/=d),a>0&&(l=[zY(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):zY(0,r,{numFormat:s,terse:o})}class qwe extends qY{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return QY(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const F6=class F6 extends ex{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Wn.Seconds},this.rendererName)}create(e,n,r,i,s){return new qwe(e,s)}get rendererName(){return"duration"}};F6.instance=new F6;let GY=F6;function e2(t,e){if(e==null)return gd;let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case wS.Euros:i="€";break;case wS.Pounds:i="£";break;case wS.Dollars:break}n=NS.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=NS.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Wn.Seconds;return QY(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=NS.format(r.text("number")??"#",e):n=e.toLocaleString();return n}var Hwe=At("<a target=_blank>");function zwe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=jY({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=Hwe();return ds(l,"href",u),Ze(l,a),l})()}function Os(t,e,n){return t.fields=e||[],t.fname=n,t}function $n(t){return t==null?null:t.fname}function pi(t){return t==null?null:t.fields}function WY(t){return t.length===1?Qwe(t[0]):Gwe(t)}const Qwe=t=>function(e){return e[t]},Gwe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function Ce(t){throw Error(t)}function dl(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u++),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||Ce("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&Ce("Access path missing closing bracket: "+t),r&&Ce("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function Go(t,e,n){const r=dl(t);return t=r.length===1?r[0]:t,Os((n&&n.get||WY)(r),[t],e||t)}const LS=Go("id"),gi=Os(t=>t,[],"identity"),tx=Os(()=>0,[],"zero"),km=Os(()=>1,[],"one"),Wo=Os(()=>!0,[],"true"),nx=Os(()=>!1,[],"false");function Wwe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const Vwe=0,VY=1,YY=2,Ywe=3,Kwe=4;function KY(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wwe,r=t||Vwe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=VY&&n("error","ERROR",arguments),this},warn(){return r>=YY&&n("warn","WARN",arguments),this},info(){return r>=Ywe&&n("log","INFO",arguments),this},debug(){return r>=Kwe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function Qe(t){return t===Object(t)}const JY=t=>t!=="__proto__";function f8(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=Jwe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;IS(r,s,i[s],o)}return r},{})}function IS(t,e,n,r){if(!JY(e))return;let i,s;if(Qe(n)&&!Se(n)){s=Qe(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?IS(s,i,n[i]):JY(i)&&(s[i]=n[i])}else t[e]=n}function Jwe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Ft(t){return t[t.length-1]}function mi(t){return t==null||t===""?null:+t}const XY=t=>e=>t*Math.exp(e),ZY=t=>e=>Math.log(t*e),eK=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),tK=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,BS=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function $S(t,e,n,r){const i=n(t[0]),s=n(Ft(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function Xwe(t,e){return $S(t,e,mi,gi)}function Zwe(t,e){var n=Math.sign(t[0]);return $S(t,e,ZY(n),XY(n))}function eNe(t,e,n){return $S(t,e,BS(n),BS(1/n))}function tNe(t,e,n){return $S(t,e,eK(n),tK(n))}function kS(t,e,n,r,i){const s=r(t[0]),o=r(Ft(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function nK(t,e,n){return kS(t,e,n,mi,gi)}function rK(t,e,n){const r=Math.sign(t[0]);return kS(t,e,n,ZY(r),XY(r))}function x8(t,e,n,r){return kS(t,e,n,BS(r),BS(1/r))}function iK(t,e,n,r){return kS(t,e,n,eK(r),tK(r))}function nNe(t){return 1+~~(new Date(t).getMonth()/3)}function rNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function je(t){return t!=null?Se(t)?t:[t]:[]}function iNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function Et(t){return typeof t=="function"}const sNe="descending";function sK(t,e,n){n=n||{},e=je(e)||[];const r=[],i=[],s={},o=n.comparator||oNe;return je(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===sNe?-1:1),i.push(u=Et(u)?u:Go(u,null,n)),(pi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:Os(o(i,r),Object.keys(s))}const MS=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),oNe=(t,e)=>t.length===1?uNe(t[0],e[0]):aNe(t,e,t.length),uNe=(t,e)=>function(n,r){return MS(t(n),t(r))*e},aNe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=MS(s(r),s(i));return o*e[u]});function yi(t){return Et(t)?t:()=>t}function oK(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function yt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function hl(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function lNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}function rt(t,e){return Object.hasOwn(t,e)}const PS={};function Mm(t){let e={},n;function r(s){return rt(e,s)&&e[s]!==PS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===PS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=PS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==PS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function cNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Ft(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ie(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),yt(r,n)}function Pm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function t2(t){return typeof t=="boolean"}function rx(t){return Object.prototype.toString.call(t)==="[object Date]"}function fNe(t){return t&&Et(t[Symbol.iterator])}function cn(t){return typeof t=="number"}function xNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function He(t){return typeof t=="string"}function uK(t,e,n){t&&(t=e?je(t).map(u=>u.replace(/\\(.)/g,"$1")):je(t));const r=t&&t.length,i=n&&n.get||WY,s=u=>i(e?[u]:dl(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return Os(o,t,"key")}function dNe(t,e){const n=t[0],r=Ft(t),i=+e;return i?i===1?r:n+i*(r-n):n}const hNe=1e4;function pNe(t){t=+t||hNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>rt(e,o)||rt(n,o),get:o=>rt(e,o)?e[o]:rt(n,o)?s(o,n[o]):void 0,set:(o,u)=>rt(e,o)?e[o]=u:s(o,u)}}function gNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function US(t,e){let n="";for(;--e>=0;)n+=t;return n}function mNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?US(i,o)+s:r==="center"?US(i,~~(o/2))+s+US(i,Math.ceil(o/2)):s+US(i,o)}function jS(t){return t&&Ft(t)-t[0]||0}function Ne(t){return Se(t)?"["+t.map(Ne)+"]":Qe(t)||He(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function aK(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const yNe=t=>cn(t)||rx(t)?t:Date.parse(t);function lK(t,e){return e=e||yNe,t==null||t===""?null:e(t)}function cK(t){return t==null||t===""?null:t+""}function Yu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function ENe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function ix(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var fK={},d8={},h8=34,Um=10,p8=13;function xK(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function ANe(t,e){var n=xK(t);return function(r,i){return e(n(r),i,t)}}function dK(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Vi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function vNe(t){return t<0?"-"+Vi(-t,6):t>9999?"+"+Vi(t,6):Vi(t,4)}function _Ne(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":vNe(t.getUTCFullYear())+"-"+Vi(t.getUTCMonth()+1,2)+"-"+Vi(t.getUTCDate(),2)+(i?"T"+Vi(e,2)+":"+Vi(n,2)+":"+Vi(r,2)+"."+Vi(i,3)+"Z":r?"T"+Vi(e,2)+":"+Vi(n,2)+":"+Vi(r,2)+"Z":n||e?"T"+Vi(e,2)+":"+Vi(n,2)+"Z":"")}function CNe(t){var e=new RegExp('["'+t+`
1296
+ `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=k7e;class M7e{constructor(e){this.modelCache=e,this.modelDependencies=new Map,this.modelInvalidationKeys=new Map}async getCachedModelDef(e,n){const r=this.modelDependencies.get(n);if(r===void 0)return;const i=[n,...bS(r)],s={};for(const u of i){const a=this.modelInvalidationKeys.get(u);if(a==null)return;s[u]=a}for(const u of i)if(await r8(e,new URL(u))!==s[u])return;const o=await this.modelCache.getModel(new URL(n));if(o!==void 0){for(const u of i)if(o.invalidationKeys[u]!==s[u])return;return{modelDef:o.modelDef,invalidationKeys:s}}}async setCachedModelDef(e,n){this.modelDependencies.set(e,n.modelDef.dependencies);const r={};for(const s of[e,...bS(n.modelDef.dependencies)]){if(n.invalidationKeys[s]===null)return!1;if(n.invalidationKeys[s]===void 0)throw new Error(`Missing invalidation key for dependency ${s}`);this.modelInvalidationKeys.set(s,n.invalidationKeys[s]),r[s]=n.invalidationKeys[s]}return!!await this.modelCache.setModel(new URL(e),{modelDef:n.modelDef,invalidationKeys:r})}}we.CacheManager=M7e;function bS(t){return[...Object.keys(t),...Object.values(t).map(bS).flat()]}class P7e{constructor(){this.models=new Map}async getModel(e){return Promise.resolve(this.models.get(e.toString()))}async setModel(e,n){return this.models.set(e.toString(),n),Promise.resolve(!0)}}we.InMemoryModelCache=P7e;function nY(t){return(0,F7e.v5)(t,"76c17e9d-f3ce-5f2d-bfde-98ad3d2a37f6")}async function TS(t,e){const n=await t.readURL(e),{contents:r,invalidationKey:i}=typeof n=="string"?{contents:n,invalidationKey:void 0}:n;return{contents:r,invalidationKey:RS(e.toString())?null:i??nY(r)}}async function r8(t,e){return RS(e.toString())?null:t.getInvalidationKey!==void 0?await t.getInvalidationKey(e):(await TS(t,e)).invalidationKey}function RS(t){return t.startsWith("internal://")}var DS={};Object.defineProperty(DS,"__esModule",{value:!0}),DS.toAsyncGenerator=void 0;async function*U7e(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}DS.toAsyncGenerator=U7e;var OS={};Object.defineProperty(OS,"__esModule",{value:!0}),OS.modelDefToModelInfo=void 0;const fl=Ui,rY=Qs;function j7e(t){const e={entries:[],anonymous_queries:[]};for(const[n,r]of Object.entries(t.contents))if(t.exports.includes(n)){if((0,fl.isSourceDef)(r)){const i={kind:"source",name:n,schema:{fields:FS(r,r.fields)}};e.entries.push(i)}else if(r.type==="query"){const i=(0,rY.getResultStructDefForQuery)(t,r),s={kind:"source",name:n,schema:{fields:FS(i,i.fields)}};e.entries.push(s)}}return e}OS.modelDefToModelInfo=j7e;function FS(t,e){var n,r,i;const s=[];for(const o of e)if((0,fl.isTurtle)(o)){const u=(0,rY.getResultStructDefForView)(t,o),a={kind:"view",name:(n=o.as)!==null&&n!==void 0?n:o.name,schema:{fields:FS(u,u.fields)}};s.push(a)}else if((0,fl.isAtomic)(o)){const u=(0,fl.expressionIsAggregate)(o.expressionType),a=(0,fl.expressionIsScalar)(o.expressionType);if(!u&&!a||o.type==="error")continue;const l={kind:u?"measure":"dimension",name:(r=o.as)!==null&&r!==void 0?r:o.name,type:i8(o)};s.push(l)}else if((0,fl.isJoinedSource)(o)){const u={kind:"join",name:(i=o.as)!==null&&i!==void 0?i:o.name,schema:{fields:FS(o,o.fields)},relationship:o.join};s.push(u)}return s}function i8(t){if((0,fl.isLeafAtomic)(t))switch(t.type){case"string":return{kind:"string_type"};case"number":return{kind:"number_type",subtype:t.numberType==="float"?"decimal":t.numberType==="integer"?"integer":void 0};case"boolean":return{kind:"boolean_type"};case"date":return{kind:"date_type",timeframe:q7e(t.timeframe)};case"timestamp":return{kind:"timestamp_type",timeframe:t.timeframe};case"json":return{kind:"json_type"};case"sql native":return{kind:"sql_native_type",sql_type:t.rawType};case"error":throw new Error("Error type is not supported in stable interface")}else{if((0,fl.isRepeatedRecord)(t))return{kind:"array_type",element_type:iY(t)};if(t.type==="record")return iY(t);if(t.type==="array")return{kind:"array_type",element_type:i8(t.elementTypeDef)}}throw new Error("Unexpected field type")}function iY(t){return{kind:"record_type",fields:t.fields.map(e=>{if((0,fl.isAtomic)(e))return{name:e.name,type:i8(e)};throw new Error("Expected record type to not have a table as its child")})}}function q7e(t){switch(t){case void 0:return;case"day":case"week":case"month":case"year":case"quarter":return t;default:throw new Error("Invalid date timeframe")}}function jft(t){return t}function qft(t){return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.annotationToTaglines=t.annotationToTag=t.modelDefToModelInfo=t.toAsyncGenerator=t.CacheManager=t.InMemoryModelCache=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=Ad;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=Ui;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=JD;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}}),Object.defineProperty(t,"InMemoryModelCache",{enumerable:!0,get:function(){return i.InMemoryModelCache}}),Object.defineProperty(t,"CacheManager",{enumerable:!0,get:function(){return i.CacheManager}});var s=DS;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=OS;Object.defineProperty(t,"modelDefToModelInfo",{enumerable:!0,get:function(){return o.modelDefToModelInfo}});var u=ps;Object.defineProperty(t,"annotationToTag",{enumerable:!0,get:function(){return u.annotationToTag}}),Object.defineProperty(t,"annotationToTaglines",{enumerable:!0,get:function(){return u.annotationToTaglines}})})(dM);function sY(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function Im(t){return t.parentExplore?sY(t)===t.parentExplore.allFields.length-1:!0}function Bm(t){return sY(t)===0}function oY(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function H7e(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function uY(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function z7e(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function s8(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function to(t){return JSON.stringify(t.fieldPath)}function o8(t){return t[1]-t[0]+1}var wS=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(wS||{}),Wn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Wn||{});function Q7e(t){return Object.values(Wn).includes(t)}var aY={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",P=w.length-1;P>=0;)$+=w.charAt(P--);return $}function o(w,$){for(var P="";P.length<$;)P+=w;return P}function u(w,$){var P=""+w;return P.length>=$?P:o("0",$-P.length)+P}function a(w,$){var P=""+w;return P.length>=$?P:o(" ",$-P.length)+P}function l(w,$){var P=""+w;return P.length>=$?P:P+o(" ",$-P.length)}function c(w,$){var P=""+Math.round(w);return P.length>=$?P:o("0",$-P.length)+P}function f(w,$){var P=""+w;return P.length>=$?P:o("0",$-P.length)+P}var d=Math.pow(2,32);function h(w,$){if(w>d||w<-d)return c(w,$);var P=Math.round(w);return f(P,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function C(w,$,P){for(var G=w<0?-1:1,B=w*G,z=0,U=1,X=0,fe=1,ae=0,Z=0,ce=Math.floor(B);ae<$&&(ce=Math.floor(B),X=ce*U+z,Z=ce*ae+fe,!(B-ce<5e-8));)B=1/(B-ce),z=U,U=X,fe=ae,ae=Z;if(Z>$&&(ae>$?(Z=fe,X=z):(Z=ae,X=U)),!P)return[0,G*X,Z];var De=Math.floor(G*X/Z);return[De,G*X-De*Z,Z]}function S(w,$,P){if(w>2958465||w<0)return null;var G=w|0,B=Math.floor(86400*(w-G)),z=0,U=[],X={D:G,T:B,u:86400*(w-G)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(X.u)<1e-6&&(X.u=0),$&&$.date1904&&(G+=1462),X.u>.9999&&(X.u=0,++B==86400&&(X.T=B=0,++G,++X.D)),G===60)U=P?[1317,10,29]:[1900,2,29],z=3;else if(G===0)U=P?[1317,8,29]:[1900,1,0],z=6;else{G>60&&--G;var fe=new Date(1900,0,1);fe.setDate(fe.getDate()+G-1),U=[fe.getFullYear(),fe.getMonth()+1,fe.getDate()],z=fe.getDay(),G<60&&(z=(z+6)%7),P&&(z=Q(fe,U))}return X.y=U[0],X.m=U[1],X.d=U[2],X.S=B%60,B=Math.floor(B/60),X.M=B%60,B=Math.floor(B/60),X.H=B,X.q=z,X}i.parse_date_code=S;var b=new Date(1899,11,31,0,0,0),R=b.getTime(),I=new Date(1900,2,1,0,0,0);function L(w,$){var P=w.getTime();return $?P-=1262304e5:w>=I&&(P+=864e5),(P-(R+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function M(w){return w.toString(10)}i._general_int=M;var j=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function P(ae){return ae.indexOf(".")==-1?ae:ae.replace($,"$1")}var G=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(ae){return ae.indexOf("E")==-1?ae:ae.replace(G,"$1E").replace(B,"$10$2")}function U(ae){var Z=ae<0?12:11,ce=P(ae.toFixed(12));return ce.length<=Z||(ce=ae.toPrecision(10),ce.length<=Z)?ce:ae.toExponential(5)}function X(ae){var Z=P(ae.toFixed(11));return Z.length>(ae<0?12:11)||Z==="0"||Z==="-0"?ae.toPrecision(6):Z}function fe(ae){var Z=Math.floor(Math.log(Math.abs(ae))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=ae.toPrecision(10+Z):Math.abs(Z)<=9?ce=U(ae):Z===10?ce=ae.toFixed(10).substr(0,12):ce=X(ae),P(z(ce.toUpperCase()))}return fe}();i._general_num=j;function J(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):j(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,L(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=J;function Q(w,$){$[0]-=581;var P=w.getDay();return w<60&&(P=(P+6)%7),P}function ne(w,$,P,G){var B="",z=0,U=0,X=P.y,fe,ae=0;switch(w){case 98:X=P.y+543;case 121:switch($.length){case 1:case 2:fe=X%100,ae=2;break;default:fe=X%1e4,ae=4;break}break;case 109:switch($.length){case 1:case 2:fe=P.m,ae=$.length;break;case 3:return g[P.m-1][1];case 5:return g[P.m-1][0];default:return g[P.m-1][2]}break;case 100:switch($.length){case 1:case 2:fe=P.d,ae=$.length;break;case 3:return m[P.q][0];default:return m[P.q][1]}break;case 104:switch($.length){case 1:case 2:fe=1+(P.H+11)%12,ae=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:fe=P.H,ae=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:fe=P.M,ae=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return P.u===0&&($=="s"||$=="ss")?u(P.S,$.length):(G>=2?U=G===3?1e3:100:U=G===1?10:1,z=Math.round(U*(P.S+P.u)),z>=60*U&&(z=0),$==="s"?z===0?"0":""+z/U:(B=u(z,2+G),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":fe=P.D*24+P.H;break;case"[m]":case"[mm]":fe=(P.D*24+P.H)*60+P.M;break;case"[s]":case"[ss]":fe=((P.D*24+P.H)*60+P.M)*60+Math.round(P.S+P.u);break;default:throw"bad abstime format: "+$}ae=$.length===3?1:2;break;case 101:fe=X,ae=1;break}var Z=ae>0?u(fe,ae):"";return Z}function me(w){var $=3;if(w.length<=$)return w;for(var P=w.length%$,G=w.substr(0,P);P!=w.length;P+=$)G+=(G.length>0?",":"")+w.substr(P,$);return G}var ge=function(){var $=/%/g;function P(re,V,ie){var Re=V.replace($,""),K=V.length-Re.length;return ge(re,Re,ie*Math.pow(10,2*K))+o("%",K)}function G(re,V,ie){for(var Re=V.length-1;V.charCodeAt(Re-1)===44;)--Re;return ge(re,V.substr(0,Re),ie/Math.pow(10,3*(V.length-Re)))}function B(re,V){var ie,Re=re.indexOf("E")-re.indexOf(".")-1;if(re.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(re,-V);var K=re.indexOf(".");K===-1&&(K=re.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),ie=(V/Math.pow(10,de)).toPrecision(Re+1+(K+de)%K),ie.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(ie.indexOf(".")===-1?ie=ie.charAt(0)+"."+ie.substr(1)+"E+"+(Le-ie.length+de):ie+="E+"+(Le-de);ie.substr(0,2)==="0.";)ie=ie.charAt(0)+ie.substr(2,K)+"."+ie.substr(2+K),ie=ie.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");ie=ie.replace(/\+-/,"-")}ie=ie.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(ze,at,St,lt){return at+St+lt.substr(0,(K+de)%K)+"."+lt.substr(de)+"E"})}else ie=V.toExponential(Re);return re.match(/E\+00$/)&&ie.match(/e[+-]\d$/)&&(ie=ie.substr(0,ie.length-1)+"0"+ie.charAt(ie.length-1)),re.match(/E\-/)&&ie.match(/e\+/)&&(ie=ie.replace(/e\+/,"e")),ie.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function U(re,V,ie){var Re=parseInt(re[4],10),K=Math.round(V*Re),de=Math.floor(K/Re),Le=K-de*Re,ze=Re;return ie+(de===0?"":""+de)+" "+(Le===0?o(" ",re[1].length+1+re[4].length):a(Le,re[1].length)+re[2]+"/"+re[3]+u(ze,re[4].length))}function X(re,V,ie){return ie+(V===0?"":""+V)+o(" ",re[1].length+2+re[4].length)}var fe=/^#*0*\.([0#]+)/,ae=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(re){for(var V="",ie,Re=0;Re!=re.length;++Re)switch(ie=re.charCodeAt(Re)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(ie)}return V}function De(re,V){var ie=Math.pow(10,V);return""+Math.round(re*ie)/ie}function Me(re,V){var ie=re-Math.floor(re),Re=Math.pow(10,V);return V<(""+Math.round(ie*Re)).length?0:Math.round(ie*Re)}function Ke(re,V){return V<(""+Math.round((re-Math.floor(re))*Math.pow(10,V))).length?1:0}function Y(re){return re<2147483647&&re>-2147483648?""+(re>=0?re|0:re-1|0):""+Math.floor(re)}function ee(re,V,ie){if(re.charCodeAt(0)===40&&!V.match(ae)){var Re=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return ie>=0?ee("n",Re,ie):"("+ee("n",Re,-ie)+")"}if(V.charCodeAt(V.length-1)===44)return G(re,V,ie);if(V.indexOf("%")!==-1)return P(re,V,ie);if(V.indexOf("E")!==-1)return B(V,ie);if(V.charCodeAt(0)===36)return"$"+ee(re,V.substr(V.charAt(1)==" "?2:1),ie);var K,de,Le,ze,at=Math.abs(ie),St=ie<0?"-":"";if(V.match(/^00+$/))return St+h(at,V.length);if(V.match(/^[#?]+$/))return K=h(ie,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return U(de,at,St);if(V.match(/^#+0+$/))return St+h(at,V.length-V.indexOf("0"));if(de=V.match(fe))return K=De(ie,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Us,yE){return"."+yE+o("0",ce(de[1]).length-yE.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return St+De(at,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return St+me(h(at,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return ie<0?"-"+ee(re,V,-ie):me(""+(Math.floor(ie)+Ke(ie,de[1].length)))+"."+u(Me(ie,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(re,V.replace(/^#,#*,/,""),ie);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(re,V.replace(/[\\-]/g,""),ie)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Us){return Le<K.length?K.charAt(Le++):Us==="0"?"0":""}));if(V.match(Z))return K=ee(re,"##########",ie),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var lt="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),ze=C(at,Math.pow(10,Le)-1,!1),K=""+St,lt=ge("n",de[1],ze[1]),lt.charAt(lt.length-1)==" "&&(lt=lt.substr(0,lt.length-1)+"0"),K+=lt+de[2]+"/"+de[3],lt=l(ze[2],Le),lt.length<de[4].length&&(lt=ce(de[4].substr(de[4].length-lt.length))+lt),K+=lt,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),ze=C(at,Math.pow(10,Le)-1,!0),St+(ze[0]||(ze[1]?"":"0"))+" "+(ze[1]?a(ze[1],Le)+de[2]+"/"+de[3]+l(ze[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(ie,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+ie.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var vr=V.indexOf(".")-Le,Vc=V.length-K.length-vr;return ce(V.substr(0,vr)+K+V.substr(V.length-Vc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=Me(ie,de[1].length),ie<0?"-"+ee(re,V,-ie):me(Y(ie)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Us){return"00,"+(Us.length<3?u(0,3-Us.length):"")+Us})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(re,"#,##0.00",ie);case"###,###":case"##,###":case"#,###":var mE=me(h(at,0));return mE!=="0"?St+mE:"";case"###,###.00":return ee(re,"###,##0.00",ie).replace(/^0\./,".");case"#,###.00":return ee(re,"#,##0.00",ie).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function be(re,V,ie){for(var Re=V.length-1;V.charCodeAt(Re-1)===44;)--Re;return ge(re,V.substr(0,Re),ie/Math.pow(10,3*(V.length-Re)))}function Ue(re,V,ie){var Re=V.replace($,""),K=V.length-Re.length;return ge(re,Re,ie*Math.pow(10,2*K))+o("%",K)}function Pe(re,V){var ie,Re=re.indexOf("E")-re.indexOf(".")-1;if(re.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(re,-V);var K=re.indexOf(".");K===-1&&(K=re.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),ie=(V/Math.pow(10,de)).toPrecision(Re+1+(K+de)%K),!ie.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);ie.indexOf(".")===-1?ie=ie.charAt(0)+"."+ie.substr(1)+"E+"+(Le-ie.length+de):ie+="E+"+(Le-de),ie=ie.replace(/\+-/,"-")}ie=ie.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(ze,at,St,lt){return at+St+lt.substr(0,(K+de)%K)+"."+lt.substr(de)+"E"})}else ie=V.toExponential(Re);return re.match(/E\+00$/)&&ie.match(/e[+-]\d$/)&&(ie=ie.substr(0,ie.length-1)+"0"+ie.charAt(ie.length-1)),re.match(/E\-/)&&ie.match(/e\+/)&&(ie=ie.replace(/e\+/,"e")),ie.replace("e","E")}function q(re,V,ie){if(re.charCodeAt(0)===40&&!V.match(ae)){var Re=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return ie>=0?q("n",Re,ie):"("+q("n",Re,-ie)+")"}if(V.charCodeAt(V.length-1)===44)return be(re,V,ie);if(V.indexOf("%")!==-1)return Ue(re,V,ie);if(V.indexOf("E")!==-1)return Pe(V,ie);if(V.charCodeAt(0)===36)return"$"+q(re,V.substr(V.charAt(1)==" "?2:1),ie);var K,de,Le,ze,at=Math.abs(ie),St=ie<0?"-":"";if(V.match(/^00+$/))return St+u(at,V.length);if(V.match(/^[#?]+$/))return K=""+ie,ie===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return X(de,at,St);if(V.match(/^#+0+$/))return St+u(at,V.length-V.indexOf("0"));if(de=V.match(fe))return K=(""+ie).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Us,yE){return"."+yE+o("0",ce(de[1]).length-yE.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return St+(""+at).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return St+me(""+at);if(de=V.match(/^#,##0\.([#0]*0)$/))return ie<0?"-"+q(re,V,-ie):me(""+ie)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return q(re,V.replace(/^#,#*,/,""),ie);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(q(re,V.replace(/[\\-]/g,""),ie)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Us){return Le<K.length?K.charAt(Le++):Us==="0"?"0":""}));if(V.match(Z))return K=q(re,"##########",ie),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var lt="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),ze=C(at,Math.pow(10,Le)-1,!1),K=""+St,lt=ge("n",de[1],ze[1]),lt.charAt(lt.length-1)==" "&&(lt=lt.substr(0,lt.length-1)+"0"),K+=lt+de[2]+"/"+de[3],lt=l(ze[2],Le),lt.length<de[4].length&&(lt=ce(de[4].substr(de[4].length-lt.length))+lt),K+=lt,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),ze=C(at,Math.pow(10,Le)-1,!0),St+(ze[0]||(ze[1]?"":"0"))+" "+(ze[1]?a(ze[1],Le)+de[2]+"/"+de[3]+l(ze[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+ie,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+ie.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var vr=V.indexOf(".")-Le,Vc=V.length-K.length-vr;return ce(V.substr(0,vr)+K+V.substr(V.length-Vc))}if(de=V.match(/^00,000\.([#0]*0)$/))return ie<0?"-"+q(re,V,-ie):me(""+ie).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Us){return"00,"+(Us.length<3?u(0,3-Us.length):"")+Us})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var mE=me(""+at);return mE!=="0"?St+mE:"";default:if(V.match(/\.[0#?]*$/))return q(re,V.slice(0,V.lastIndexOf(".")),ie)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,ie,Re){return(Re|0)===Re?q(V,ie,Re):ee(V,ie,Re)}}();function ue(w){for(var $=[],P=!1,G=0,B=0;G<w.length;++G)switch(w.charCodeAt(G)){case 34:P=!P;break;case 95:case 42:case 92:++G;break;case 59:$[$.length]=w.substr(B,G-B),B=G+1}if($[$.length]=w.substr(B),P===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ue;var xe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function se(w){for(var $=0,P="",G="";$<w.length;)switch(P=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(G=P;w.charAt($++)!=="]"&&$<w.length;)G+=w.charAt($);if(G.match(xe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(P=w.charAt(++$))>-1||P=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===P;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=se;function oe(w,$,P,G){for(var B=[],z="",U=0,X="",fe="t",ae,Z,ce,De="H";U<w.length;)switch(X=w.charAt(U)){case"G":if(!p(w,U))throw new Error("unrecognized character "+X+" in "+w);B[B.length]={t:"G",v:"General"},U+=7;break;case'"':for(z="";(ce=w.charCodeAt(++U))!==34&&U<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++U;break;case"\\":var Me=w.charAt(++U),Ke=Me==="("||Me===")"?Me:"t";B[B.length]={t:Ke,v:Me},++U;break;case"_":B[B.length]={t:"t",v:" "},U+=2;break;case"@":B[B.length]={t:"T",v:$},++U;break;case"B":case"b":if(w.charAt(U+1)==="1"||w.charAt(U+1)==="2"){if(ae==null&&(ae=S($,P,w.charAt(U+1)==="2"),ae==null))return"";B[B.length]={t:"X",v:w.substr(U,2)},fe=X,U+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":X=X.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||ae==null&&(ae=S($,P),ae==null))return"";for(z=X;++U<w.length&&w.charAt(U).toLowerCase()===X;)z+=X;X==="m"&&fe.toLowerCase()==="h"&&(X="M"),X==="h"&&(X=De),B[B.length]={t:X,v:z},fe=X;break;case"A":case"a":case"上":var Y={t:X,v:X};if(ae==null&&(ae=S($,P)),w.substr(U,3).toUpperCase()==="A/P"?(ae!=null&&(Y.v=ae.H>=12?"P":"A"),Y.t="T",De="h",U+=3):w.substr(U,5).toUpperCase()==="AM/PM"?(ae!=null&&(Y.v=ae.H>=12?"PM":"AM"),Y.t="T",U+=5,De="h"):w.substr(U,5).toUpperCase()==="上午/下午"?(ae!=null&&(Y.v=ae.H>=12?"下午":"上午"),Y.t="T",U+=5,De="h"):(Y.t="t",++U),ae==null&&Y.t==="T")return"";B[B.length]=Y,fe=X;break;case"[":for(z=X;w.charAt(U++)!=="]"&&U<w.length;)z+=w.charAt(U);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(xe)){if(ae==null&&(ae=S($,P),ae==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},fe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",se(w)||(B[B.length]={t:"t",v:z}));break;case".":if(ae!=null){for(z=X;++U<w.length&&(X=w.charAt(U))==="0";)z+=X;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=X;++U<w.length&&"0#?.,E+-%".indexOf(X=w.charAt(U))>-1;)z+=X;B[B.length]={t:"n",v:z};break;case"?":for(z=X;w.charAt(++U)===X;)z+=X;B[B.length]={t:X,v:z},fe=X;break;case"*":++U,(w.charAt(U)==" "||w.charAt(U)=="*")&&++U;break;case"(":case")":B[B.length]={t:G===1?"t":X,v:X},++U;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=X;U<w.length&&"0123456789".indexOf(w.charAt(++U))>-1;)z+=w.charAt(U);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:X,v:X},++U;break;case"$":B[B.length]={t:"t",v:"$"},++U;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(X)===-1)throw new Error("unrecognized character "+X+" in "+w);B[B.length]={t:"t",v:X},++U;break}var ee=0,be=0,Ue;for(U=B.length-1,fe="t";U>=0;--U)switch(B[U].t){case"h":case"H":B[U].t=De,fe="h",ee<1&&(ee=1);break;case"s":(Ue=B[U].v.match(/\.0+$/))&&(be=Math.max(be,Ue[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":fe=B[U].t;break;case"m":fe==="s"&&(B[U].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[U].v.match(/[Hh]/)&&(ee=1),ee<2&&B[U].v.match(/[Mm]/)&&(ee=2),ee<3&&B[U].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:ae.u>=.5&&(ae.u=0,++ae.S),ae.S>=60&&(ae.S=0,++ae.M),ae.M>=60&&(ae.M=0,++ae.H);break;case 2:ae.u>=.5&&(ae.u=0,++ae.S),ae.S>=60&&(ae.S=0,++ae.M);break}var Pe="",q;for(U=0;U<B.length;++U)switch(B[U].t){case"t":case"T":case" ":case"D":break;case"X":B[U].v="",B[U].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[U].v=ne(B[U].t.charCodeAt(0),B[U].v,ae,be),B[U].t="t";break;case"n":case"?":for(q=U+1;B[q]!=null&&((X=B[q].t)==="?"||X==="D"||(X===" "||X==="t")&&B[q+1]!=null&&(B[q+1].t==="?"||B[q+1].t==="t"&&B[q+1].v==="/")||B[U].t==="("&&(X===" "||X==="n"||X===")")||X==="t"&&(B[q].v==="/"||B[q].v===" "&&B[q+1]!=null&&B[q+1].t=="?"));)B[U].v+=B[q].v,B[q]={v:"",t:";"},++q;Pe+=B[U].v,U=q-1;break;case"G":B[U].t="t",B[U].v=J($,P);break}var re="",V,ie;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,ie=ge("n",Pe,V)):(V=$<0&&G>1?-$:$,ie=ge("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(ie=ie.substr(1),B[0].v="-"+B[0].v)),q=ie.length-1;var Re=B.length;for(U=0;U<B.length;++U)if(B[U]!=null&&B[U].t!="t"&&B[U].v.indexOf(".")>-1){Re=U;break}var K=B.length;if(Re===B.length&&ie.indexOf("E")===-1){for(U=B.length-1;U>=0;--U)B[U]==null||"n?".indexOf(B[U].t)===-1||(q>=B[U].v.length-1?(q-=B[U].v.length,B[U].v=ie.substr(q+1,B[U].v.length)):q<0?B[U].v="":(B[U].v=ie.substr(0,q+1),q=-1),B[U].t="t",K=U);q>=0&&K<B.length&&(B[K].v=ie.substr(0,q+1)+B[K].v)}else if(Re!==B.length&&ie.indexOf("E")===-1){for(q=ie.indexOf(".")-1,U=Re;U>=0;--U)if(!(B[U]==null||"n?".indexOf(B[U].t)===-1)){for(Z=B[U].v.indexOf(".")>-1&&U===Re?B[U].v.indexOf(".")-1:B[U].v.length-1,re=B[U].v.substr(Z+1);Z>=0;--Z)q>=0&&(B[U].v.charAt(Z)==="0"||B[U].v.charAt(Z)==="#")&&(re=ie.charAt(q--)+re);B[U].v=re,B[U].t="t",K=U}for(q>=0&&K<B.length&&(B[K].v=ie.substr(0,q+1)+B[K].v),q=ie.indexOf(".")+1,U=Re;U<B.length;++U)if(!(B[U]==null||"n?(".indexOf(B[U].t)===-1&&U!==Re)){for(Z=B[U].v.indexOf(".")>-1&&U===Re?B[U].v.indexOf(".")+1:0,re=B[U].v.substr(0,Z);Z<B[U].v.length;++Z)q<ie.length&&(re+=ie.charAt(q++));B[U].v=re,B[U].t="t",K=U}}}for(U=0;U<B.length;++U)B[U]!=null&&"n?".indexOf(B[U].t)>-1&&(V=G>1&&$<0&&U>0&&B[U-1].v==="-"?-$:$,B[U].v=ge(B[U].t,B[U].v,V),B[U].t="t");var de="";for(U=0;U!==B.length;++U)B[U]!=null&&(de+=B[U].v);return de}i._eval=oe;var F=/\[[=<>]/,D=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var P=parseFloat($[2]);switch($[1]){case"=":if(w==P)return!0;break;case">":if(w>P)return!0;break;case"<":if(w<P)return!0;break;case"<>":if(w!=P)return!0;break;case">=":if(w>=P)return!0;break;case"<=":if(w<=P)return!0;break}return!1}function k(w,$){var P=ue(w),G=P.length,B=P[G-1].indexOf("@");if(G<4&&B>-1&&--G,P.length>4)throw new Error("cannot find right format for |"+P.join("|")+"|");if(typeof $!="number")return[4,P.length===4||B>-1?P[P.length-1]:"@"];switch(P.length){case 1:P=B>-1?["General","General","General",P[0]]:[P[0],P[0],P[0],"@"];break;case 2:P=B>-1?[P[0],P[0],P[0],P[1]]:[P[0],P[1],P[0],"@"];break;case 3:P=B>-1?[P[0],P[1],P[0],P[2]]:[P[0],P[1],P[2],"@"];break}var z=$>0?P[0]:$<0?P[1]:P[2];if(P[0].indexOf("[")===-1&&P[1].indexOf("[")===-1)return[G,z];if(P[0].match(F)!=null||P[1].match(F)!=null){var U=P[0].match(D),X=P[1].match(D);return O($,U)?[G,P[0]]:O($,X)?[G,P[1]]:[G,P[U!=null&&X!=null?2:1]]}return[G,z]}function W(w,$,P){P==null&&(P={});var G="";switch(typeof w){case"string":w=="m/d/yy"&&P.dateNF?G=P.dateNF:G=w;break;case"number":w==14&&P.dateNF?G=P.dateNF:G=(P.table!=null?P.table:E)[w],G==null&&(G=P.table&&P.table[A[w]]||E[A[w]]),G==null&&(G=_[w]||"General");break}if(p(G,0))return J($,P);$ instanceof Date&&($=L($,P.date1904));var B=k(G,$);if(p(B[1]))return J($,P);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return oe(B[1],$,P,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var P=0;P<392;++P){if(E[P]==null){$<0&&($=P);continue}if(E[P]==w){$=P;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var P=0;P!=392;++P)$[P]!==void 0&&H($[P],P)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(aY);var NS=aY.exports;function G7e(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var W7e=G7e;function V7e(t){return function(e){return t==null?void 0:t[e]}}var Y7e=V7e,K7e=Y7e,J7e={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},X7e=K7e(J7e),Z7e=X7e,eFe=typeof T=="object"&&T&&T.Object===Object&&T,tFe=eFe,nFe=tFe,rFe=typeof self=="object"&&self&&self.Object===Object&&self,iFe=nFe||rFe||Function("return this")(),sFe=iFe,oFe=sFe,uFe=oFe.Symbol,u8=uFe;function aFe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var lFe=aFe,cFe=Array.isArray,fFe=cFe,lY=u8,cY=Object.prototype,xFe=cY.hasOwnProperty,dFe=cY.toString,$m=lY?lY.toStringTag:void 0;function hFe(t){var e=xFe.call(t,$m),n=t[$m];try{t[$m]=void 0;var r=!0}catch{}var i=dFe.call(t);return r&&(e?t[$m]=n:delete t[$m]),i}var pFe=hFe,gFe=Object.prototype,mFe=gFe.toString;function yFe(t){return mFe.call(t)}var EFe=yFe,fY=u8,AFe=pFe,vFe=EFe,_Fe="[object Null]",CFe="[object Undefined]",xY=fY?fY.toStringTag:void 0;function SFe(t){return t==null?t===void 0?CFe:_Fe:xY&&xY in Object(t)?AFe(t):vFe(t)}var bFe=SFe;function TFe(t){return t!=null&&typeof t=="object"}var RFe=TFe,DFe=bFe,OFe=RFe,FFe="[object Symbol]";function wFe(t){return typeof t=="symbol"||OFe(t)&&DFe(t)==FFe}var NFe=wFe,dY=u8,LFe=lFe,IFe=fFe,BFe=NFe,$Fe=1/0,hY=dY?dY.prototype:void 0,pY=hY?hY.toString:void 0;function gY(t){if(typeof t=="string")return t;if(IFe(t))return LFe(t,gY)+"";if(BFe(t))return pY?pY.call(t):"";var e=t+"";return e=="0"&&1/t==-$Fe?"-0":e}var kFe=gY,MFe=kFe;function PFe(t){return t==null?"":MFe(t)}var a8=PFe,UFe=Z7e,jFe=a8,qFe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,HFe="\\u0300-\\u036f",zFe="\\ufe20-\\ufe2f",QFe="\\u20d0-\\u20ff",GFe=HFe+zFe+QFe,WFe="["+GFe+"]",VFe=RegExp(WFe,"g");function YFe(t){return t=jFe(t),t&&t.replace(qFe,UFe).replace(VFe,"")}var KFe=YFe,JFe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function XFe(t){return t.match(JFe)||[]}var ZFe=XFe,e8e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function t8e(t){return e8e.test(t)}var n8e=t8e,mY="\\ud800-\\udfff",r8e="\\u0300-\\u036f",i8e="\\ufe20-\\ufe2f",s8e="\\u20d0-\\u20ff",o8e=r8e+i8e+s8e,yY="\\u2700-\\u27bf",EY="a-z\\xdf-\\xf6\\xf8-\\xff",u8e="\\xac\\xb1\\xd7\\xf7",a8e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",l8e="\\u2000-\\u206f",c8e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",AY="A-Z\\xc0-\\xd6\\xd8-\\xde",f8e="\\ufe0e\\ufe0f",vY=u8e+a8e+l8e+c8e,_Y="['’]",CY="["+vY+"]",x8e="["+o8e+"]",SY="\\d+",d8e="["+yY+"]",bY="["+EY+"]",TY="[^"+mY+vY+SY+yY+EY+AY+"]",h8e="\\ud83c[\\udffb-\\udfff]",p8e="(?:"+x8e+"|"+h8e+")",g8e="[^"+mY+"]",RY="(?:\\ud83c[\\udde6-\\uddff]){2}",DY="[\\ud800-\\udbff][\\udc00-\\udfff]",Zh="["+AY+"]",m8e="\\u200d",OY="(?:"+bY+"|"+TY+")",y8e="(?:"+Zh+"|"+TY+")",FY="(?:"+_Y+"(?:d|ll|m|re|s|t|ve))?",wY="(?:"+_Y+"(?:D|LL|M|RE|S|T|VE))?",NY=p8e+"?",LY="["+f8e+"]?",E8e="(?:"+m8e+"(?:"+[g8e,RY,DY].join("|")+")"+LY+NY+")*",A8e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",v8e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",_8e=LY+NY+E8e,C8e="(?:"+[d8e,RY,DY].join("|")+")"+_8e,S8e=RegExp([Zh+"?"+bY+"+"+FY+"(?="+[CY,Zh,"$"].join("|")+")",y8e+"+"+wY+"(?="+[CY,Zh+OY,"$"].join("|")+")",Zh+"?"+OY+"+"+FY,Zh+"+"+wY,v8e,A8e,SY,C8e].join("|"),"g");function b8e(t){return t.match(S8e)||[]}var T8e=b8e,R8e=ZFe,D8e=n8e,O8e=a8,F8e=T8e;function w8e(t,e,n){return t=O8e(t),e=n?void 0:e,e===void 0?D8e(t)?F8e(t):R8e(t):t.match(e)||[]}var N8e=w8e,L8e=W7e,I8e=KFe,B8e=N8e,$8e="['’]",k8e=RegExp($8e,"g");function M8e(t){return function(e){return L8e(B8e(I8e(e).replace(k8e,"")),t,"")}}var P8e=M8e;function U8e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var j8e=U8e,q8e=j8e;function H8e(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:q8e(t,e,n)}var z8e=H8e,Q8e="\\ud800-\\udfff",G8e="\\u0300-\\u036f",W8e="\\ufe20-\\ufe2f",V8e="\\u20d0-\\u20ff",Y8e=G8e+W8e+V8e,K8e="\\ufe0e\\ufe0f",J8e="\\u200d",X8e=RegExp("["+J8e+Q8e+Y8e+K8e+"]");function Z8e(t){return X8e.test(t)}var IY=Z8e;function ewe(t){return t.split("")}var twe=ewe,BY="\\ud800-\\udfff",nwe="\\u0300-\\u036f",rwe="\\ufe20-\\ufe2f",iwe="\\u20d0-\\u20ff",swe=nwe+rwe+iwe,owe="\\ufe0e\\ufe0f",uwe="["+BY+"]",l8="["+swe+"]",c8="\\ud83c[\\udffb-\\udfff]",awe="(?:"+l8+"|"+c8+")",$Y="[^"+BY+"]",kY="(?:\\ud83c[\\udde6-\\uddff]){2}",MY="[\\ud800-\\udbff][\\udc00-\\udfff]",lwe="\\u200d",PY=awe+"?",UY="["+owe+"]?",cwe="(?:"+lwe+"(?:"+[$Y,kY,MY].join("|")+")"+UY+PY+")*",fwe=UY+PY+cwe,xwe="(?:"+[$Y+l8+"?",l8,kY,MY,uwe].join("|")+")",dwe=RegExp(c8+"(?="+c8+")|"+xwe+fwe,"g");function hwe(t){return t.match(dwe)||[]}var pwe=hwe,gwe=twe,mwe=IY,ywe=pwe;function Ewe(t){return mwe(t)?ywe(t):gwe(t)}var Awe=Ewe,vwe=z8e,_we=IY,Cwe=Awe,Swe=a8;function bwe(t){return function(e){e=Swe(e);var n=_we(e)?Cwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?vwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Twe=bwe,Rwe=Twe,Dwe=Rwe("toUpperCase"),Owe=Dwe,Fwe=P8e,wwe=Owe,Nwe=Fwe(function(t,e,n){return t+(n?" ":"")+wwe(e)}),Lwe=Nwe;const Iwe=LE(Lwe);function xl(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Bwe(t,e){const n=o_e.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function $we(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function kwe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function Zf(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Iwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Mwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Pwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function jY({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Pwe(r);let o=Mwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class ex{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class qY{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return $we(this.document,i)}if(n===null)return kwe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const O6=class O6 extends ex{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new qY(e)}get rendererName(){}};O6.instance=new O6;let HY=O6;function zY(t,e,n={}){let r=e.toString();return n.terse?r=Uwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?NS.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Uwe=new Map([[Wn.Nanoseconds,"ns"],[Wn.Microseconds,"µs"],[Wn.Milliseconds,"ms"],[Wn.Seconds,"s"],[Wn.Minutes,"m"],[Wn.Hours,"h"],[Wn.Days,"d"]]),jwe=new Map([[Wn.Nanoseconds,1e3],[Wn.Microseconds,1e3],[Wn.Milliseconds,1e3],[Wn.Seconds,60],[Wn.Minutes,60],[Wn.Hours,24],[Wn.Days,Number.MAX_VALUE]]);function QY(t,e,n){const r=n.durationUnit&&Q7e(n.durationUnit)?n.durationUnit:Wn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,d]of jwe)if(f===r&&(c=!0),!!c&&(a=u%d,u=Math.floor(u/=d),a>0&&(l=[zY(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):zY(0,r,{numFormat:s,terse:o})}class qwe extends qY{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return QY(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const F6=class F6 extends ex{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Wn.Seconds},this.rendererName)}create(e,n,r,i,s){return new qwe(e,s)}get rendererName(){return"duration"}};F6.instance=new F6;let GY=F6;function e2(t,e){if(e==null)return gd;let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case wS.Euros:i="€";break;case wS.Pounds:i="£";break;case wS.Dollars:break}n=NS.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=NS.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Wn.Seconds;return QY(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=NS.format(r.text("number")??"#",e):n=e.toLocaleString();return n}var Hwe=At("<a target=_blank>");function zwe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=jY({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=Hwe();return ds(l,"href",u),Ze(l,a),l})()}function Os(t,e,n){return t.fields=e||[],t.fname=n,t}function $n(t){return t==null?null:t.fname}function pi(t){return t==null?null:t.fields}function WY(t){return t.length===1?Qwe(t[0]):Gwe(t)}const Qwe=t=>function(e){return e[t]},Gwe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function Ce(t){throw Error(t)}function dl(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u++),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||Ce("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&Ce("Access path missing closing bracket: "+t),r&&Ce("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function Go(t,e,n){const r=dl(t);return t=r.length===1?r[0]:t,Os((n&&n.get||WY)(r),[t],e||t)}const LS=Go("id"),gi=Os(t=>t,[],"identity"),tx=Os(()=>0,[],"zero"),km=Os(()=>1,[],"one"),Wo=Os(()=>!0,[],"true"),nx=Os(()=>!1,[],"false");function Wwe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const Vwe=0,VY=1,YY=2,Ywe=3,Kwe=4;function KY(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wwe,r=t||Vwe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=VY&&n("error","ERROR",arguments),this},warn(){return r>=YY&&n("warn","WARN",arguments),this},info(){return r>=Ywe&&n("log","INFO",arguments),this},debug(){return r>=Kwe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function Qe(t){return t===Object(t)}const JY=t=>t!=="__proto__";function f8(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=Jwe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;IS(r,s,i[s],o)}return r},{})}function IS(t,e,n,r){if(!JY(e))return;let i,s;if(Qe(n)&&!Se(n)){s=Qe(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?IS(s,i,n[i]):JY(i)&&(s[i]=n[i])}else t[e]=n}function Jwe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Ft(t){return t[t.length-1]}function mi(t){return t==null||t===""?null:+t}const XY=t=>e=>t*Math.exp(e),ZY=t=>e=>Math.log(t*e),eK=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),tK=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,BS=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function $S(t,e,n,r){const i=n(t[0]),s=n(Ft(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function Xwe(t,e){return $S(t,e,mi,gi)}function Zwe(t,e){var n=Math.sign(t[0]);return $S(t,e,ZY(n),XY(n))}function eNe(t,e,n){return $S(t,e,BS(n),BS(1/n))}function tNe(t,e,n){return $S(t,e,eK(n),tK(n))}function kS(t,e,n,r,i){const s=r(t[0]),o=r(Ft(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function nK(t,e,n){return kS(t,e,n,mi,gi)}function rK(t,e,n){const r=Math.sign(t[0]);return kS(t,e,n,ZY(r),XY(r))}function x8(t,e,n,r){return kS(t,e,n,BS(r),BS(1/r))}function iK(t,e,n,r){return kS(t,e,n,eK(r),tK(r))}function nNe(t){return 1+~~(new Date(t).getMonth()/3)}function rNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function je(t){return t!=null?Se(t)?t:[t]:[]}function iNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function Et(t){return typeof t=="function"}const sNe="descending";function sK(t,e,n){n=n||{},e=je(e)||[];const r=[],i=[],s={},o=n.comparator||oNe;return je(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===sNe?-1:1),i.push(u=Et(u)?u:Go(u,null,n)),(pi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:Os(o(i,r),Object.keys(s))}const MS=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),oNe=(t,e)=>t.length===1?uNe(t[0],e[0]):aNe(t,e,t.length),uNe=(t,e)=>function(n,r){return MS(t(n),t(r))*e},aNe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=MS(s(r),s(i));return o*e[u]});function yi(t){return Et(t)?t:()=>t}function oK(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function yt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function hl(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function lNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}function rt(t,e){return Object.hasOwn(t,e)}const PS={};function Mm(t){let e={},n;function r(s){return rt(e,s)&&e[s]!==PS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===PS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=PS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==PS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function cNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Ft(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ie(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),yt(r,n)}function Pm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function t2(t){return typeof t=="boolean"}function rx(t){return Object.prototype.toString.call(t)==="[object Date]"}function fNe(t){return t&&Et(t[Symbol.iterator])}function cn(t){return typeof t=="number"}function xNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function He(t){return typeof t=="string"}function uK(t,e,n){t&&(t=e?je(t).map(u=>u.replace(/\\(.)/g,"$1")):je(t));const r=t&&t.length,i=n&&n.get||WY,s=u=>i(e?[u]:dl(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return Os(o,t,"key")}function dNe(t,e){const n=t[0],r=Ft(t),i=+e;return i?i===1?r:n+i*(r-n):n}const hNe=1e4;function pNe(t){t=+t||hNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>rt(e,o)||rt(n,o),get:o=>rt(e,o)?e[o]:rt(n,o)?s(o,n[o]):void 0,set:(o,u)=>rt(e,o)?e[o]=u:s(o,u)}}function gNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function US(t,e){let n="";for(;--e>=0;)n+=t;return n}function mNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?US(i,o)+s:r==="center"?US(i,~~(o/2))+s+US(i,Math.ceil(o/2)):s+US(i,o)}function jS(t){return t&&Ft(t)-t[0]||0}function Ne(t){return Se(t)?"["+t.map(Ne)+"]":Qe(t)||He(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function aK(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const yNe=t=>cn(t)||rx(t)?t:Date.parse(t);function lK(t,e){return e=e||yNe,t==null||t===""?null:e(t)}function cK(t){return t==null||t===""?null:t+""}function Yu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function ENe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function ix(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var fK={},d8={},h8=34,Um=10,p8=13;function xK(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function ANe(t,e){var n=xK(t);return function(r,i){return e(n(r),i,t)}}function dK(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Vi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function vNe(t){return t<0?"-"+Vi(-t,6):t>9999?"+"+Vi(t,6):Vi(t,4)}function _Ne(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":vNe(t.getUTCFullYear())+"-"+Vi(t.getUTCMonth()+1,2)+"-"+Vi(t.getUTCDate(),2)+(i?"T"+Vi(e,2)+":"+Vi(n,2)+":"+Vi(r,2)+"."+Vi(i,3)+"Z":r?"T"+Vi(e,2)+":"+Vi(n,2)+":"+Vi(r,2)+"Z":n||e?"T"+Vi(e,2)+":"+Vi(n,2)+"Z":"")}function CNe(t){var e=new RegExp('["'+t+`
1297
1297
  \r]`),n=t.charCodeAt(0);function r(f,d){var h,p,m=i(f,function(g,y){if(h)return h(g,y-1);p=g,h=d?ANe(g,d):xK(g)});return m.columns=p||[],m}function i(f,d){var h=[],p=f.length,m=0,g=0,y,E=p<=0,A=!1;f.charCodeAt(p-1)===Um&&--p,f.charCodeAt(p-1)===p8&&--p;function v(){if(E)return d8;if(A)return A=!1,fK;var C,S=m,b;if(f.charCodeAt(S)===h8){for(;m++<p&&f.charCodeAt(m)!==h8||f.charCodeAt(++m)===h8;);return(C=m)>=p?E=!0:(b=f.charCodeAt(m++))===Um?A=!0:b===p8&&(A=!0,f.charCodeAt(m)===Um&&++m),f.slice(S+1,C-1).replace(/""/g,'"')}for(;m<p;){if((b=f.charCodeAt(C=m++))===Um)A=!0;else if(b===p8)A=!0,f.charCodeAt(m)===Um&&++m;else if(b!==n)continue;return f.slice(S,C)}return E=!0,f.slice(S,p)}for(;(y=v())!==d8;){for(var _=[];y!==fK&&y!==d8;)_.push(y),y=v();d&&(_=d(_,g++))==null||h.push(_)}return h}function s(f,d){return f.map(function(h){return d.map(function(p){return c(h[p])}).join(t)})}function o(f,d){return d==null&&(d=dK(f)),[d.map(c).join(t)].concat(s(f,d)).join(`
1298
1298
  `)}function u(f,d){return d==null&&(d=dK(f)),s(f,d).join(`
1299
1299
  `)}function a(f){return f.map(l).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.238",
3
+ "version": "0.0.239-dev250226183425",
4
4
  "license": "MIT",
5
5
  "main": "dist/module/index.umd.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,8 +31,8 @@
31
31
  "build-types": "tsc --build --declaration --emitDeclarationOnly"
32
32
  },
33
33
  "dependencies": {
34
- "@malloydata/malloy": "^0.0.238",
35
- "@malloydata/malloy-tag": "^0.0.238",
34
+ "@malloydata/malloy": "^0.0.239-dev250226183425",
35
+ "@malloydata/malloy-tag": "^0.0.239-dev250226183425",
36
36
  "@tanstack/solid-virtual": "^3.10.4",
37
37
  "component-register": "^0.8.6",
38
38
  "lodash": "^4.17.20",