@toclocoinc/lattice-grid 1.22.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/API.html +231 -10
- package/docs/api-detail.html +56 -1
- package/lattice-grid.d.ts +399 -10
- package/lattice-grid.esm.min.js +1804 -317
- package/lattice-grid.min.cjs +1794 -317
- package/lattice-grid.min.js +1794 -317
- package/modules/charts.esm.min.js +600 -245
- package/modules/devtools.esm.min.js +2 -2
- package/modules/dhtmlx-compat.esm.min.js +4 -4
- package/modules/htmx.esm.min.js +1784 -317
- package/modules/htmx.min.cjs +1784 -317
- package/modules/htmx.min.js +1784 -317
- package/modules/react.esm.min.js +4 -4
- package/modules/svelte.esm.min.js +4 -4
- package/modules/vue.esm.min.js +4 -4
- package/modules/webcomponent.esm.min.js +1794 -317
- package/package.json +1 -1
package/lattice-grid.min.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.24.0, core + DOM renderer
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -54,7 +54,7 @@ Object.defineProperty(__exports,"frameBatched",{enumerable:true,get:function(){r
|
|
|
54
54
|
Object.defineProperty(__exports,"settleDebounce",{enumerable:true,get:function(){return settleDebounce;}});
|
|
55
55
|
Object.defineProperty(__exports,"whenIdle",{enumerable:true,get:function(){return whenIdle;}});
|
|
56
56
|
Object.defineProperty(__exports,"uid",{enumerable:true,get:function(){return uid;}});
|
|
57
|
-
const STAMPED_VERSION="1.
|
|
57
|
+
const STAMPED_VERSION="1.24.0";
|
|
58
58
|
async function resolveVersion(){
|
|
59
59
|
if(STAMPED_VERSION!=='0.0.0-source')return STAMPED_VERSION;
|
|
60
60
|
try{
|
|
@@ -71,7 +71,7 @@ return JSON.parse(text).version||STAMPED_VERSION;
|
|
|
71
71
|
return STAMPED_VERSION;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
const VERSION="1.
|
|
74
|
+
const VERSION="1.24.0";
|
|
75
75
|
const warned=new Set();
|
|
76
76
|
const WARNED_LIMIT=2000;
|
|
77
77
|
function rememberWarned(key){
|
|
@@ -1138,7 +1138,7 @@ const EVENT_NAMES=Object.freeze([
|
|
|
1138
1138
|
'model:changed','rows:changed','rows:queued','rows:deferred','rows:paused',
|
|
1139
1139
|
'rows:resumed','row:received','row:sent','row:copied','row:moved','source:error',
|
|
1140
1140
|
'stream:chunk','stream:end','stream:evicted',
|
|
1141
|
-
'cell:changed','cell:pending','cell:confirmed','cell:reverted','cell:clicked',
|
|
1141
|
+
'cell:changed','cell:pending','cell:confirmed','cell:reverted','cell:conflict','cell:clicked',
|
|
1142
1142
|
'cell:dblclicked','cell:contextmenu','cell:edit:start','cell:edit:end',
|
|
1143
1143
|
'row:edit:start','row:edit:end','row:clicked','row:dblclicked',
|
|
1144
1144
|
'form:opened','form:closed','form:saved','form:error',
|
|
@@ -1146,7 +1146,7 @@ const EVENT_NAMES=Object.freeze([
|
|
|
1146
1146
|
'facet:expanded','facet:failed',
|
|
1147
1147
|
'column:moved','column:resized','column:visible','column:pinned','column:grouped',
|
|
1148
1148
|
'column:pivoted','column:filter:open','column:menu:open','columns:changed',
|
|
1149
|
-
'columns:tagged','header:contextmenu',
|
|
1149
|
+
'columns:tagged','header:contextmenu','pivot:drill',
|
|
1150
1150
|
'selection:changed','range:changed','clipboard:copy','page:changed','scroll',
|
|
1151
1151
|
'scroll:end','size:changed','detail:toggled','toolpanel:focus','highlight:changed',
|
|
1152
1152
|
'tree:loading','tree:loaded','tree:loadFailed','tree:loadAborted',
|
|
@@ -3853,6 +3853,7 @@ other:'Apply {count} held updates',
|
|
|
3853
3853
|
'editor.clearRating':'Clear rating',
|
|
3854
3854
|
'editor.clear':'Clear',
|
|
3855
3855
|
'editor.value':'Value',
|
|
3856
|
+
'editor.currency':'Currency',
|
|
3856
3857
|
'formatting.format':'Format',
|
|
3857
3858
|
'formatting.noRules':'No rules yet. The first one that matches a cell wins.',
|
|
3858
3859
|
'formatting.clearAll':'Clear all',
|
|
@@ -5708,6 +5709,280 @@ ratio:createRatioType({name:'ratio'}),
|
|
|
5708
5709
|
percentRate:createRatioType({name:'percentRate',percent:true}),
|
|
5709
5710
|
});
|
|
5710
5711
|
});
|
|
5712
|
+
__def("packages/core/src/columns/types/currency.js",function(__exports,__req){
|
|
5713
|
+
'use strict';
|
|
5714
|
+
Object.defineProperty(__exports,"MISSING_RATE",{enumerable:true,get:function(){return MISSING_RATE;}});
|
|
5715
|
+
Object.defineProperty(__exports,"normaliseCode",{enumerable:true,get:function(){return normaliseCode;}});
|
|
5716
|
+
Object.defineProperty(__exports,"toMoney",{enumerable:true,get:function(){return toMoney;}});
|
|
5717
|
+
Object.defineProperty(__exports,"parseMoney",{enumerable:true,get:function(){return parseMoney;}});
|
|
5718
|
+
Object.defineProperty(__exports,"rateFunction",{enumerable:true,get:function(){return rateFunction;}});
|
|
5719
|
+
Object.defineProperty(__exports,"convertMoney",{enumerable:true,get:function(){return convertMoney;}});
|
|
5720
|
+
Object.defineProperty(__exports,"formatMoney",{enumerable:true,get:function(){return formatMoney;}});
|
|
5721
|
+
Object.defineProperty(__exports,"moneyToText",{enumerable:true,get:function(){return moneyToText;}});
|
|
5722
|
+
Object.defineProperty(__exports,"moneyComparator",{enumerable:true,get:function(){return moneyComparator;}});
|
|
5723
|
+
Object.defineProperty(__exports,"createCurrencyType",{enumerable:true,get:function(){return createCurrencyType;}});
|
|
5724
|
+
Object.defineProperty(__exports,"CURRENCY_TYPES",{enumerable:true,get:function(){return CURRENCY_TYPES;}});
|
|
5725
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
5726
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
5727
|
+
const isNil=__m0["isNil"];
|
|
5728
|
+
const MISSING_RATE='⚠ no rate';
|
|
5729
|
+
function normaliseCode(code){
|
|
5730
|
+
if(isNil(code))return null;
|
|
5731
|
+
const c=String(code).trim().toUpperCase();
|
|
5732
|
+
return c===''?null:c;
|
|
5733
|
+
}
|
|
5734
|
+
function toMoney(v){
|
|
5735
|
+
if(isNil(v))return null;
|
|
5736
|
+
if(typeof v==='object'&&!Array.isArray(v)){
|
|
5737
|
+
const amount=Number((v).amount);
|
|
5738
|
+
const code=normaliseCode((v).code);
|
|
5739
|
+
if(!code||!Number.isFinite(amount))return null;
|
|
5740
|
+
return{amount,code};
|
|
5741
|
+
}
|
|
5742
|
+
if(Array.isArray(v)&&v.length===2){
|
|
5743
|
+
const amount=Number(v[0]);
|
|
5744
|
+
const code=normaliseCode(v[1]);
|
|
5745
|
+
if(!code||!Number.isFinite(amount))return null;
|
|
5746
|
+
return{amount,code};
|
|
5747
|
+
}
|
|
5748
|
+
return null;
|
|
5749
|
+
}
|
|
5750
|
+
const SYMBOL_CODES=Object.freeze({
|
|
5751
|
+
$:'USD','€':'EUR','£':'GBP','¥':'JPY','₹':'INR',
|
|
5752
|
+
'₩':'KRW','₽':'RUB','₺':'TRY','₴':'UAH','₪':'ILS',
|
|
5753
|
+
});
|
|
5754
|
+
const CODE_SYMBOLS=Object.freeze({
|
|
5755
|
+
USD:'$',EUR:'€',GBP:'£',JPY:'¥',INR:'₹',
|
|
5756
|
+
KRW:'₩',RUB:'₽',TRY:'₺',UAH:'₴',ILS:'₪',
|
|
5757
|
+
});
|
|
5758
|
+
const NUMBER_BODY=/[+-]?[\d\s., ]*\d/;
|
|
5759
|
+
function parseLocaleNumber(text,locale){
|
|
5760
|
+
const raw=String(text).trim();
|
|
5761
|
+
if(raw==='')return null;
|
|
5762
|
+
const decimal=new Intl.NumberFormat(locale||undefined)
|
|
5763
|
+
.formatToParts(1.1).find((p)=>p.type==='decimal')?.value||'.';
|
|
5764
|
+
const group=decimal===','?'.':',';
|
|
5765
|
+
const cleaned=raw
|
|
5766
|
+
.split(group).join('')
|
|
5767
|
+
.split(/[\s ]/).join('')
|
|
5768
|
+
.replace(decimal,'.');
|
|
5769
|
+
const n=Number(cleaned);
|
|
5770
|
+
return Number.isFinite(n)?n:null;
|
|
5771
|
+
}
|
|
5772
|
+
function parseMoney(text,cfg){
|
|
5773
|
+
const opts=cfg||{};
|
|
5774
|
+
const fallback=normaliseCode(opts.code);
|
|
5775
|
+
if(isNil(text))return null;
|
|
5776
|
+
const already=toMoney(text);
|
|
5777
|
+
if(already)return already;
|
|
5778
|
+
if(typeof text==='number'){
|
|
5779
|
+
return Number.isFinite(text)&&fallback?{amount:text,code:fallback}:null;
|
|
5780
|
+
}
|
|
5781
|
+
let s=String(text).trim();
|
|
5782
|
+
if(s==='')return null;
|
|
5783
|
+
let negative=false;
|
|
5784
|
+
if(s.startsWith('(')&&s.endsWith(')')){negative=true;s=s.slice(1,-1).trim();}
|
|
5785
|
+
let code=null;
|
|
5786
|
+
for(const[sym,c]of Object.entries(SYMBOL_CODES)){
|
|
5787
|
+
if(s.startsWith(sym)){code=c;s=s.slice(sym.length).trim();break;}
|
|
5788
|
+
if(s.endsWith(sym)){code=c;s=s.slice(0,-sym.length).trim();break;}
|
|
5789
|
+
}
|
|
5790
|
+
const body=NUMBER_BODY.exec(s);
|
|
5791
|
+
if(!body)return null;
|
|
5792
|
+
const n=parseLocaleNumber(body[0],opts.locale);
|
|
5793
|
+
if(n===null)return null;
|
|
5794
|
+
const rest=(s.slice(0,body.index)+' '+s.slice(body.index+body[0].length)).trim();
|
|
5795
|
+
if(!code&&rest!=='')code=normaliseCode(rest);
|
|
5796
|
+
const finalCode=code||fallback;
|
|
5797
|
+
if(!finalCode)return null;
|
|
5798
|
+
const amount=negative?-n:n;
|
|
5799
|
+
return{amount,code:finalCode};
|
|
5800
|
+
}
|
|
5801
|
+
function rateFunction(rates,base){
|
|
5802
|
+
if(typeof rates==='function'){
|
|
5803
|
+
return(from,to)=>{
|
|
5804
|
+
if(from===to)return 1;
|
|
5805
|
+
const r=rates(from,to);
|
|
5806
|
+
return typeof r==='number'&&Number.isFinite(r)&&r>0?r:null;
|
|
5807
|
+
};
|
|
5808
|
+
}
|
|
5809
|
+
if(rates&&typeof rates==='object'){
|
|
5810
|
+
const table=(rates);
|
|
5811
|
+
return(from,to)=>{
|
|
5812
|
+
if(from===to)return 1;
|
|
5813
|
+
const rf=Number(table[from]);
|
|
5814
|
+
const rt=Number(table[to]);
|
|
5815
|
+
if(!Number.isFinite(rf)||!Number.isFinite(rt)||rf<=0||rt<=0)return null;
|
|
5816
|
+
return rt/rf;
|
|
5817
|
+
};
|
|
5818
|
+
}
|
|
5819
|
+
return(from,to)=>(from===to?1:null);
|
|
5820
|
+
}
|
|
5821
|
+
function convertMoney(money,to,rate){
|
|
5822
|
+
if(!money)return null;
|
|
5823
|
+
if(money.code===to)return money.amount;
|
|
5824
|
+
const r=rate(money.code,to);
|
|
5825
|
+
return r===null?null:money.amount*r;
|
|
5826
|
+
}
|
|
5827
|
+
const formats=new Map();
|
|
5828
|
+
function currencyFormat(locale,code,decimals){
|
|
5829
|
+
const key=`${locale||''}|${code}|${decimals??''}`;
|
|
5830
|
+
let hit=formats.get(key);
|
|
5831
|
+
if(!hit){
|
|
5832
|
+
const opts={style:'currency',currency:code};
|
|
5833
|
+
if(typeof decimals==='number'){
|
|
5834
|
+
opts.minimumFractionDigits=decimals;
|
|
5835
|
+
opts.maximumFractionDigits=decimals;
|
|
5836
|
+
}
|
|
5837
|
+
try{
|
|
5838
|
+
hit={fmt:new Intl.NumberFormat(locale||undefined,opts),currency:true};
|
|
5839
|
+
}catch{
|
|
5840
|
+
hit={
|
|
5841
|
+
fmt:new Intl.NumberFormat(locale||undefined,typeof decimals==='number'
|
|
5842
|
+
?{minimumFractionDigits:decimals,maximumFractionDigits:decimals}:{}),
|
|
5843
|
+
currency:false,
|
|
5844
|
+
};
|
|
5845
|
+
}
|
|
5846
|
+
formats.set(key,hit);
|
|
5847
|
+
}
|
|
5848
|
+
return hit;
|
|
5849
|
+
}
|
|
5850
|
+
function formatMoney(value,cfg){
|
|
5851
|
+
const opts=cfg||{};
|
|
5852
|
+
const blank=opts.nullDisplay??'';
|
|
5853
|
+
const money=toMoney(value);
|
|
5854
|
+
if(!money)return blank;
|
|
5855
|
+
const display=normaliseCode(opts.display)||money.code;
|
|
5856
|
+
let amount=money.amount;
|
|
5857
|
+
let code=money.code;
|
|
5858
|
+
if(display!==money.code){
|
|
5859
|
+
const rate=opts.rateFn||rateFunction(opts.rates,opts.rateBase);
|
|
5860
|
+
const converted=convertMoney(money,display,rate);
|
|
5861
|
+
if(converted===null){
|
|
5862
|
+
return`${opts.missingRate??MISSING_RATE} ${money.code}→${display}`;
|
|
5863
|
+
}
|
|
5864
|
+
amount=converted;
|
|
5865
|
+
code=display;
|
|
5866
|
+
}
|
|
5867
|
+
const{fmt,currency}=currencyFormat(opts.locale,code,opts.decimals);
|
|
5868
|
+
return currency?fmt.format(amount):`${fmt.format(amount)} ${code}`;
|
|
5869
|
+
}
|
|
5870
|
+
function moneyToText(value){
|
|
5871
|
+
const money=toMoney(value);
|
|
5872
|
+
if(!money)return'';
|
|
5873
|
+
return`${money.amount} ${money.code}`;
|
|
5874
|
+
}
|
|
5875
|
+
function moneyComparator(cfg){
|
|
5876
|
+
const opts=cfg||{};
|
|
5877
|
+
const display=normaliseCode(opts.display);
|
|
5878
|
+
const rate=opts.rateFn||rateFunction(opts.rates,opts.rateBase);
|
|
5879
|
+
return(a,b)=>{
|
|
5880
|
+
const ma=toMoney(a);
|
|
5881
|
+
const mb=toMoney(b);
|
|
5882
|
+
if(!ma&&!mb)return 0;
|
|
5883
|
+
if(!ma)return 1;
|
|
5884
|
+
if(!mb)return-1;
|
|
5885
|
+
if(display){
|
|
5886
|
+
const ca=convertMoney(ma,display,rate);
|
|
5887
|
+
const cb=convertMoney(mb,display,rate);
|
|
5888
|
+
if(ca!==null&&cb!==null)return ca===cb?0:ca<cb?-1:1;
|
|
5889
|
+
}
|
|
5890
|
+
if(ma.code===mb.code)return ma.amount===mb.amount?0:ma.amount<mb.amount?-1:1;
|
|
5891
|
+
return ma.code<mb.code?-1:1;
|
|
5892
|
+
};
|
|
5893
|
+
}
|
|
5894
|
+
function reductions(cfg){
|
|
5895
|
+
const opts=cfg||{};
|
|
5896
|
+
const reduce=(values,combine)=>{
|
|
5897
|
+
const monies=[];
|
|
5898
|
+
for(const v of values||[]){
|
|
5899
|
+
const m=toMoney(v);
|
|
5900
|
+
if(m)monies.push(m);
|
|
5901
|
+
}
|
|
5902
|
+
if(!monies.length)return null;
|
|
5903
|
+
const codes=new Set(monies.map((m)=>m.code));
|
|
5904
|
+
if(codes.size===1){
|
|
5905
|
+
const code=monies[0].code;
|
|
5906
|
+
return{amount:combine(monies.map((m)=>m.amount)),code};
|
|
5907
|
+
}
|
|
5908
|
+
const display=normaliseCode(opts.display);
|
|
5909
|
+
if(!display)return`${opts.missingRate??MISSING_RATE}: mixed currencies, no display currency set`;
|
|
5910
|
+
const rate=opts.rateFn||rateFunction(opts.rates,opts.rateBase);
|
|
5911
|
+
const converted=[];
|
|
5912
|
+
for(const m of monies){
|
|
5913
|
+
const c=convertMoney(m,display,rate);
|
|
5914
|
+
if(c===null)return`${opts.missingRate??MISSING_RATE}: ${m.code}→${display}`;
|
|
5915
|
+
converted.push(c);
|
|
5916
|
+
}
|
|
5917
|
+
return{amount:combine(converted),code:display};
|
|
5918
|
+
};
|
|
5919
|
+
const sum=(nums)=>nums.reduce((t,n)=>t+n,0);
|
|
5920
|
+
return{
|
|
5921
|
+
sum:(values)=>reduce(values,sum),
|
|
5922
|
+
avg:(values)=>reduce(values,(nums)=>sum(nums)/nums.length),
|
|
5923
|
+
min:(values)=>reduce(values,(nums)=>Math.min(...nums)),
|
|
5924
|
+
max:(values)=>reduce(values,(nums)=>Math.max(...nums)),
|
|
5925
|
+
};
|
|
5926
|
+
}
|
|
5927
|
+
function createCurrencyType(config){
|
|
5928
|
+
const cfg=Object.freeze({code:'USD',...(config||{})});
|
|
5929
|
+
const rateFn=rateFunction(cfg.rates,cfg.rateBase);
|
|
5930
|
+
const resolved=Object.freeze({...cfg,rateFn});
|
|
5931
|
+
const kernels=reductions(resolved);
|
|
5932
|
+
const comparator=moneyComparator(resolved);
|
|
5933
|
+
const perLocale=new Map([[cfg.locale||'',resolved]]);
|
|
5934
|
+
const forLocale=(locale)=>{
|
|
5935
|
+
const key=locale||'';
|
|
5936
|
+
let hit=perLocale.get(key);
|
|
5937
|
+
if(!hit){
|
|
5938
|
+
hit=Object.freeze({...resolved,locale:locale||undefined});
|
|
5939
|
+
perLocale.set(key,hit);
|
|
5940
|
+
}
|
|
5941
|
+
return hit;
|
|
5942
|
+
};
|
|
5943
|
+
const displaySymbol=CODE_SYMBOLS[normaliseCode(cfg.display||cfg.code)]||'';
|
|
5944
|
+
const decimalMask=typeof cfg.decimals==='number'&&cfg.decimals>0
|
|
5945
|
+
?`.${'0'.repeat(cfg.decimals)}`:'.00';
|
|
5946
|
+
return{
|
|
5947
|
+
base:'object',
|
|
5948
|
+
extends:'object',
|
|
5949
|
+
storage:'object',
|
|
5950
|
+
name:'currency',
|
|
5951
|
+
currencyConfig:resolved,
|
|
5952
|
+
format:(p)=>formatMoney(p.value,p.locale?forLocale(p.locale):resolved),
|
|
5953
|
+
parse:(p)=>parseMoney(p.text,p.locale?forLocale(p.locale):resolved),
|
|
5954
|
+
compare:comparator,
|
|
5955
|
+
defaults:{
|
|
5956
|
+
filter:'number',
|
|
5957
|
+
editor:'currency',
|
|
5958
|
+
align:'end',
|
|
5959
|
+
total:'sum',
|
|
5960
|
+
},
|
|
5961
|
+
totals:{
|
|
5962
|
+
supported:['sum','avg','min','max','count','countValues'],
|
|
5963
|
+
implement:kernels,
|
|
5964
|
+
},
|
|
5965
|
+
excel:cfg.excel||(displaySymbol?`"${displaySymbol}"#,##0${decimalMask}`:`#,##0${decimalMask}`),
|
|
5966
|
+
toStorage:(v)=>{
|
|
5967
|
+
const direct=toMoney(v);
|
|
5968
|
+
if(direct)return direct;
|
|
5969
|
+
if(typeof v==='string')return parseMoney(v,resolved);
|
|
5970
|
+
if(typeof v==='number')return parseMoney(v,resolved);
|
|
5971
|
+
return null;
|
|
5972
|
+
},
|
|
5973
|
+
toClipboard:(v)=>moneyToText(v),
|
|
5974
|
+
fromClipboard:(s)=>parseMoney(s,resolved),
|
|
5975
|
+
};
|
|
5976
|
+
}
|
|
5977
|
+
const CURRENCY_TYPES=Object.freeze({
|
|
5978
|
+
currency:createCurrencyType({code:'USD'}),
|
|
5979
|
+
usd:createCurrencyType({code:'USD'}),
|
|
5980
|
+
eur:createCurrencyType({code:'EUR'}),
|
|
5981
|
+
gbp:createCurrencyType({code:'GBP'}),
|
|
5982
|
+
jpy:createCurrencyType({code:'JPY',decimals:0}),
|
|
5983
|
+
});
|
|
5984
|
+
const __default=createCurrencyType;
|
|
5985
|
+
});
|
|
5711
5986
|
__def("packages/core/src/columns/types/index.js",function(__exports,__req){
|
|
5712
5987
|
'use strict';
|
|
5713
5988
|
Object.defineProperty(__exports,"EXTENDED_TYPES",{enumerable:true,get:function(){return EXTENDED_TYPES;}});
|
|
@@ -5765,6 +6040,17 @@ const parseRadix=__m7["parseRadix"];
|
|
|
5765
6040
|
const formatRadix=__m7["formatRadix"];
|
|
5766
6041
|
const __m8=__req("packages/core/src/columns/types/aggregable.js");
|
|
5767
6042
|
const AGGREGABLE_TYPES=__m8["AGGREGABLE_TYPES"];
|
|
6043
|
+
const __m9=__req("packages/core/src/columns/types/currency.js");
|
|
6044
|
+
const CURRENCY_TYPES=__m9["CURRENCY_TYPES"];
|
|
6045
|
+
const createCurrencyType=__m9["createCurrencyType"];
|
|
6046
|
+
const parseMoney=__m9["parseMoney"];
|
|
6047
|
+
const formatMoney=__m9["formatMoney"];
|
|
6048
|
+
const convertMoney=__m9["convertMoney"];
|
|
6049
|
+
const toMoney=__m9["toMoney"];
|
|
6050
|
+
const rateFunction=__m9["rateFunction"];
|
|
6051
|
+
const moneyComparator=__m9["moneyComparator"];
|
|
6052
|
+
const normaliseCode=__m9["normaliseCode"];
|
|
6053
|
+
const MISSING_RATE=__m9["MISSING_RATE"];
|
|
5768
6054
|
Object.defineProperty(__exports,"findUnit",{enumerable:true,get:function(){return __m3["findUnit"];}});
|
|
5769
6055
|
Object.defineProperty(__exports,"ENGINEERING_TYPES",{enumerable:true,get:function(){return __m4["ENGINEERING_TYPES"];}});
|
|
5770
6056
|
Object.defineProperty(__exports,"circularMean",{enumerable:true,get:function(){return __m4["circularMean"];}});
|
|
@@ -5775,6 +6061,16 @@ Object.defineProperty(__exports,"formatTemperature",{enumerable:true,get:functio
|
|
|
5775
6061
|
Object.defineProperty(__exports,"parseTemperature",{enumerable:true,get:function(){return __m6["parseTemperature"];}});
|
|
5776
6062
|
Object.defineProperty(__exports,"TEMPERATURE_SCALES",{enumerable:true,get:function(){return __m6["TEMPERATURE_SCALES"];}});
|
|
5777
6063
|
Object.defineProperty(__exports,"findScale",{enumerable:true,get:function(){return __m6["findScale"];}});
|
|
6064
|
+
Object.defineProperty(__exports,"CURRENCY_TYPES",{enumerable:true,get:function(){return __m9["CURRENCY_TYPES"];}});
|
|
6065
|
+
Object.defineProperty(__exports,"createCurrencyType",{enumerable:true,get:function(){return __m9["createCurrencyType"];}});
|
|
6066
|
+
Object.defineProperty(__exports,"parseMoney",{enumerable:true,get:function(){return __m9["parseMoney"];}});
|
|
6067
|
+
Object.defineProperty(__exports,"formatMoney",{enumerable:true,get:function(){return __m9["formatMoney"];}});
|
|
6068
|
+
Object.defineProperty(__exports,"convertMoney",{enumerable:true,get:function(){return __m9["convertMoney"];}});
|
|
6069
|
+
Object.defineProperty(__exports,"toMoney",{enumerable:true,get:function(){return __m9["toMoney"];}});
|
|
6070
|
+
Object.defineProperty(__exports,"rateFunction",{enumerable:true,get:function(){return __m9["rateFunction"];}});
|
|
6071
|
+
Object.defineProperty(__exports,"moneyComparator",{enumerable:true,get:function(){return __m9["moneyComparator"];}});
|
|
6072
|
+
Object.defineProperty(__exports,"normaliseCode",{enumerable:true,get:function(){return __m9["normaliseCode"];}});
|
|
6073
|
+
Object.defineProperty(__exports,"MISSING_RATE",{enumerable:true,get:function(){return __m9["MISSING_RATE"];}});
|
|
5778
6074
|
Object.defineProperty(__exports,"TEMPORAL_TYPES",{enumerable:true,get:function(){return __m0["TEMPORAL_TYPES"];}});
|
|
5779
6075
|
Object.defineProperty(__exports,"NETWORK_TYPES",{enumerable:true,get:function(){return __m1["NETWORK_TYPES"];}});
|
|
5780
6076
|
Object.defineProperty(__exports,"STRUCTURED_TYPES",{enumerable:true,get:function(){return __m2["STRUCTURED_TYPES"];}});
|
|
@@ -5820,12 +6116,13 @@ gigabits:createUnitType({system:'bitrate',unit:'Gbps'}),
|
|
|
5820
6116
|
...ENGINEERING_TYPES,
|
|
5821
6117
|
...SI_TYPES,
|
|
5822
6118
|
...TEMPERATURE_TYPES,
|
|
6119
|
+
...CURRENCY_TYPES,
|
|
5823
6120
|
});
|
|
5824
6121
|
{
|
|
5825
6122
|
const seen=new Set();
|
|
5826
6123
|
for(const source of[
|
|
5827
6124
|
TEMPORAL_TYPES,NETWORK_TYPES,STRUCTURED_TYPES,AGGREGABLE_TYPES,
|
|
5828
|
-
ENGINEERING_TYPES,SI_TYPES,TEMPERATURE_TYPES,
|
|
6125
|
+
ENGINEERING_TYPES,SI_TYPES,TEMPERATURE_TYPES,CURRENCY_TYPES,
|
|
5829
6126
|
]){
|
|
5830
6127
|
for(const name of Object.keys(source)){
|
|
5831
6128
|
if(seen.has(name))throw new Error(`[lattice] data type "${name}" is declared twice`);
|
|
@@ -10032,6 +10329,96 @@ return fn(collectValues(handle,list),ctx||{});
|
|
|
10032
10329
|
return null;
|
|
10033
10330
|
}
|
|
10034
10331
|
});
|
|
10332
|
+
__def("packages/core/src/compute/windowed.js",function(__exports,__req){
|
|
10333
|
+
'use strict';
|
|
10334
|
+
Object.defineProperty(__exports,"Window",{enumerable:true,get:function(){return Window;}});
|
|
10335
|
+
Object.defineProperty(__exports,"WINDOW_KINDS",{enumerable:true,get:function(){return WINDOW_KINDS;}});
|
|
10336
|
+
Object.defineProperty(__exports,"openWindow",{enumerable:true,get:function(){return openWindow;}});
|
|
10337
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
10338
|
+
const __m0=__req("packages/core/src/compute/sketch.js");
|
|
10339
|
+
const Welford=__m0["Welford"];
|
|
10340
|
+
class Window{
|
|
10341
|
+
#kind;
|
|
10342
|
+
#span;
|
|
10343
|
+
#ticks=[];
|
|
10344
|
+
#now;
|
|
10345
|
+
#opened;
|
|
10346
|
+
constructor(kind,span=0,now=Date.now){
|
|
10347
|
+
if(kind!=='count'&&kind!=='time'&&kind!=='session'){
|
|
10348
|
+
throw new RangeError(`unknown window kind: ${kind}`);
|
|
10349
|
+
}
|
|
10350
|
+
if((kind==='count'||kind==='time')&&!(span>0)){
|
|
10351
|
+
throw new RangeError(`a ${kind} window needs a positive span`);
|
|
10352
|
+
}
|
|
10353
|
+
this.#kind=kind;
|
|
10354
|
+
this.#span=Math.floor(span);
|
|
10355
|
+
this.#now=now;
|
|
10356
|
+
this.#opened=now();
|
|
10357
|
+
}
|
|
10358
|
+
get size(){return this.#ticks.length;}
|
|
10359
|
+
push(v,t=this.#now()){
|
|
10360
|
+
if(!Number.isFinite(v))return;
|
|
10361
|
+
this.#ticks.push({t,v});
|
|
10362
|
+
this.#evict(t);
|
|
10363
|
+
}
|
|
10364
|
+
#evict(nowT){
|
|
10365
|
+
if(this.#kind==='count'){
|
|
10366
|
+
while(this.#ticks.length>this.#span)this.#ticks.shift();
|
|
10367
|
+
}else if(this.#kind==='time'){
|
|
10368
|
+
const cutoff=nowT-this.#span;
|
|
10369
|
+
while(this.#ticks.length&&this.#ticks[0].t<cutoff)this.#ticks.shift();
|
|
10370
|
+
}
|
|
10371
|
+
}
|
|
10372
|
+
spec(){
|
|
10373
|
+
const span=this.#kind==='session'?this.#now()-this.#opened:this.#span;
|
|
10374
|
+
return{kind:this.#kind,span,size:this.#ticks.length};
|
|
10375
|
+
}
|
|
10376
|
+
values(){return this.#ticks.map((tk)=>tk.v);}
|
|
10377
|
+
aggregate(){
|
|
10378
|
+
const spec=this.spec();
|
|
10379
|
+
if(!this.#ticks.length){
|
|
10380
|
+
return{over:spec,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};
|
|
10381
|
+
}
|
|
10382
|
+
const w=new Welford();
|
|
10383
|
+
let sum=0;
|
|
10384
|
+
let min=Infinity;
|
|
10385
|
+
let max=-Infinity;
|
|
10386
|
+
for(const{v}of this.#ticks){
|
|
10387
|
+
sum+=v;
|
|
10388
|
+
if(v<min)min=v;
|
|
10389
|
+
if(v>max)max=v;
|
|
10390
|
+
w.add(v);
|
|
10391
|
+
}
|
|
10392
|
+
return{
|
|
10393
|
+
over:spec,
|
|
10394
|
+
count:this.#ticks.length,
|
|
10395
|
+
sum,
|
|
10396
|
+
mean:w.mean(),
|
|
10397
|
+
min,
|
|
10398
|
+
max,
|
|
10399
|
+
variance:w.variance(),
|
|
10400
|
+
stddev:w.stddev(),
|
|
10401
|
+
};
|
|
10402
|
+
}
|
|
10403
|
+
reduce(fn){
|
|
10404
|
+
const agg=this.aggregate();
|
|
10405
|
+
const map={
|
|
10406
|
+
sum:agg.sum,avg:agg.mean,mean:agg.mean,min:agg.min,max:agg.max,
|
|
10407
|
+
count:agg.count,variance:agg.variance,stddev:agg.stddev,
|
|
10408
|
+
};
|
|
10409
|
+
if(!(fn in map))throw new RangeError(`unknown windowed aggregate: ${fn}`);
|
|
10410
|
+
return{value:map[fn],over:agg.over};
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
const WINDOW_KINDS=Object.freeze(['count','time','session']);
|
|
10414
|
+
function openWindow(opts,now=Date.now){
|
|
10415
|
+
const span=opts.kind==='time'&&opts.minutes!=null
|
|
10416
|
+
?opts.minutes*60_000
|
|
10417
|
+
:opts.span??0;
|
|
10418
|
+
return new Window(opts.kind,span,now);
|
|
10419
|
+
}
|
|
10420
|
+
const __default={Window,WINDOW_KINDS,openWindow};
|
|
10421
|
+
});
|
|
10035
10422
|
__def("packages/core/src/compute/compare.js",function(__exports,__req){
|
|
10036
10423
|
'use strict';
|
|
10037
10424
|
Object.defineProperty(__exports,"COMPARE_MEASURES",{enumerable:true,get:function(){return COMPARE_MEASURES;}});
|
|
@@ -13210,6 +13597,172 @@ return{bounds,counts:countInto(handle,indices,count,bounds)};
|
|
|
13210
13597
|
}
|
|
13211
13598
|
const __default=facet;
|
|
13212
13599
|
});
|
|
13600
|
+
__def("packages/core/src/compute/pivotmatrix.js",function(__exports,__req){
|
|
13601
|
+
'use strict';
|
|
13602
|
+
Object.defineProperty(__exports,"GRAND_PATH",{enumerable:true,get:function(){return GRAND_PATH;}});
|
|
13603
|
+
Object.defineProperty(__exports,"resolveAxis",{enumerable:true,get:function(){return resolveAxis;}});
|
|
13604
|
+
Object.defineProperty(__exports,"pivotMatrix",{enumerable:true,get:function(){return pivotMatrix;}});
|
|
13605
|
+
Object.defineProperty(__exports,"cellKey",{enumerable:true,get:function(){return cellKey;}});
|
|
13606
|
+
Object.defineProperty(__exports,"marginKey",{enumerable:true,get:function(){return marginKey;}});
|
|
13607
|
+
const __m0=__req("packages/core/src/compute/handle.js");
|
|
13608
|
+
const valueComparator=__m0["valueComparator"];
|
|
13609
|
+
const __m1=__req("packages/core/src/compute/total.js");
|
|
13610
|
+
const total=__m1["total"];
|
|
13611
|
+
const __m2=__req("packages/core/src/compute/group.js");
|
|
13612
|
+
const packKeys=__m2["packKeys"];
|
|
13613
|
+
const __m3=__req("packages/core/src/compute/pivot.js");
|
|
13614
|
+
const joinPath=__m3["joinPath"];
|
|
13615
|
+
const DEFAULT_PATH_SEPARATOR=__m3["DEFAULT_PATH_SEPARATOR"];
|
|
13616
|
+
const DEFAULT_MAX_COLUMNS=__m3["DEFAULT_MAX_COLUMNS"];
|
|
13617
|
+
const GRAND_PATH='';
|
|
13618
|
+
function resolveAxis(handles,leaves,opts={}){
|
|
13619
|
+
const separator=opts.separator||DEFAULT_PATH_SEPARATOR;
|
|
13620
|
+
const list=handles||[];
|
|
13621
|
+
const order=leaves instanceof Uint32Array?leaves:Uint32Array.from(leaves||[]);
|
|
13622
|
+
const n=order.length;
|
|
13623
|
+
if(list.length===0){
|
|
13624
|
+
return{tuples:[[]],paths:[GRAND_PATH],buckets:[order]};
|
|
13625
|
+
}
|
|
13626
|
+
const{keyOf,readers}=packKeys(list,order,0);
|
|
13627
|
+
const seen=new Map();
|
|
13628
|
+
const tuples=[];
|
|
13629
|
+
const rawKeys=[];
|
|
13630
|
+
const rowsByKey=[];
|
|
13631
|
+
for(let i=0;i<n;i++){
|
|
13632
|
+
const row=order[i];
|
|
13633
|
+
const key=keyOf(row);
|
|
13634
|
+
let at=seen.get(key);
|
|
13635
|
+
if(at===undefined){
|
|
13636
|
+
at=tuples.length;
|
|
13637
|
+
seen.set(key,at);
|
|
13638
|
+
rawKeys.push(key);
|
|
13639
|
+
const tuple=new Array(readers.length);
|
|
13640
|
+
for(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);
|
|
13641
|
+
tuples.push(tuple);
|
|
13642
|
+
rowsByKey.push([]);
|
|
13643
|
+
}
|
|
13644
|
+
rowsByKey[at].push(row);
|
|
13645
|
+
}
|
|
13646
|
+
const cmp=valueComparator(opts.locale);
|
|
13647
|
+
const rank=tuples.map((_,i)=>i);
|
|
13648
|
+
rank.sort((a,b)=>{
|
|
13649
|
+
const ta=tuples[a];
|
|
13650
|
+
const tb=tuples[b];
|
|
13651
|
+
for(let j=0;j<ta.length;j++){
|
|
13652
|
+
const c=compareNullable(ta[j],tb[j],cmp);
|
|
13653
|
+
if(c!==0)return c;
|
|
13654
|
+
}
|
|
13655
|
+
return a-b;
|
|
13656
|
+
});
|
|
13657
|
+
const outTuples=new Array(rank.length);
|
|
13658
|
+
const paths=new Array(rank.length);
|
|
13659
|
+
const buckets=new Array(rank.length);
|
|
13660
|
+
for(let position=0;position<rank.length;position++){
|
|
13661
|
+
const from=rank[position];
|
|
13662
|
+
outTuples[position]=tuples[from];
|
|
13663
|
+
paths[position]=joinPath(tuples[from],separator);
|
|
13664
|
+
buckets[position]=Uint32Array.from(rowsByKey[from]);
|
|
13665
|
+
}
|
|
13666
|
+
return{tuples:outTuples,paths,buckets};
|
|
13667
|
+
}
|
|
13668
|
+
function compareNullable(a,b,cmp){
|
|
13669
|
+
const na=a===null||a===undefined;
|
|
13670
|
+
const nb=b===null||b===undefined;
|
|
13671
|
+
if(na||nb)return na&&nb?0:na?1:-1;
|
|
13672
|
+
return cmp(a,b);
|
|
13673
|
+
}
|
|
13674
|
+
function intersect(a,b,bSet){
|
|
13675
|
+
const out=[];
|
|
13676
|
+
for(let i=0;i<a.length;i++){
|
|
13677
|
+
if(bSet.has(a[i]))out.push(a[i]);
|
|
13678
|
+
}
|
|
13679
|
+
return Uint32Array.from(out);
|
|
13680
|
+
}
|
|
13681
|
+
function reduceCell(handle,leaves,fn,ctx){
|
|
13682
|
+
const value=leaves.length?total(handle,leaves,fn,ctx):null;
|
|
13683
|
+
return{value,leaves,count:leaves.length};
|
|
13684
|
+
}
|
|
13685
|
+
function pivotMatrix(input){
|
|
13686
|
+
const opts=(input&&input.opts)||{};
|
|
13687
|
+
const separator=opts.separator||DEFAULT_PATH_SEPARATOR;
|
|
13688
|
+
const ctx=opts.totalContext||{locale:opts.locale};
|
|
13689
|
+
const measures=(input.measures||[]).filter((m)=>m&&m.handle);
|
|
13690
|
+
const leaves=input.leaves instanceof Uint32Array
|
|
13691
|
+
?input.leaves
|
|
13692
|
+
:Uint32Array.from(input.leaves||[]);
|
|
13693
|
+
const rowAxis=resolveAxis(input.rowHandles||[],leaves,{...opts,separator});
|
|
13694
|
+
const columnAxis=resolveAxis(input.columnHandles||[],leaves,{...opts,separator});
|
|
13695
|
+
const maxColumns=opts.maxColumns===undefined?DEFAULT_MAX_COLUMNS:opts.maxColumns;
|
|
13696
|
+
const columns=columnAxis.paths.length*Math.max(1,measures.length);
|
|
13697
|
+
const empty=new Map();
|
|
13698
|
+
if(maxColumns&&columns>maxColumns){
|
|
13699
|
+
return{
|
|
13700
|
+
rowAxis,
|
|
13701
|
+
columnAxis,
|
|
13702
|
+
measures:measures.map((m)=>({colId:m.colId,fn:m.fn})),
|
|
13703
|
+
body:empty,
|
|
13704
|
+
rowMargin:empty,
|
|
13705
|
+
columnMargin:empty,
|
|
13706
|
+
grand:empty,
|
|
13707
|
+
columns,
|
|
13708
|
+
error:{
|
|
13709
|
+
code:'pivot-max-columns',
|
|
13710
|
+
message:`[lattice] pivot would generate ${columns} columns, above pivot.maxColumns of `
|
|
13711
|
+
+`${maxColumns}. Narrow the pivot columns or raise the limit.`,
|
|
13712
|
+
columns,
|
|
13713
|
+
maxColumns,
|
|
13714
|
+
},
|
|
13715
|
+
};
|
|
13716
|
+
}
|
|
13717
|
+
const body=new Map();
|
|
13718
|
+
const rowMargin=new Map();
|
|
13719
|
+
const columnMargin=new Map();
|
|
13720
|
+
const grand=new Map();
|
|
13721
|
+
const columnSets=columnAxis.buckets.map((b)=>new Set(b));
|
|
13722
|
+
for(let c=0;c<columnAxis.paths.length;c++){
|
|
13723
|
+
const columnLeaves=columnAxis.buckets[c];
|
|
13724
|
+
const columnPath=columnAxis.paths[c];
|
|
13725
|
+
for(const m of measures){
|
|
13726
|
+
columnMargin.set(marginKey(columnPath,m.colId),reduceCell(m.handle,columnLeaves,m.fn,ctx));
|
|
13727
|
+
}
|
|
13728
|
+
}
|
|
13729
|
+
for(let r=0;r<rowAxis.paths.length;r++){
|
|
13730
|
+
const rowLeaves=rowAxis.buckets[r];
|
|
13731
|
+
const rowPath=rowAxis.paths[r];
|
|
13732
|
+
for(const m of measures){
|
|
13733
|
+
rowMargin.set(marginKey(rowPath,m.colId),reduceCell(m.handle,rowLeaves,m.fn,ctx));
|
|
13734
|
+
}
|
|
13735
|
+
for(let c=0;c<columnAxis.paths.length;c++){
|
|
13736
|
+
const cellLeaves=intersect(rowLeaves,columnAxis.buckets[c],columnSets[c]);
|
|
13737
|
+
if(cellLeaves.length===0)continue;
|
|
13738
|
+
const columnPath=columnAxis.paths[c];
|
|
13739
|
+
for(const m of measures){
|
|
13740
|
+
body.set(cellKey(rowPath,columnPath,m.colId),reduceCell(m.handle,cellLeaves,m.fn,ctx));
|
|
13741
|
+
}
|
|
13742
|
+
}
|
|
13743
|
+
}
|
|
13744
|
+
for(const m of measures){
|
|
13745
|
+
grand.set(m.colId,reduceCell(m.handle,leaves,m.fn,ctx));
|
|
13746
|
+
}
|
|
13747
|
+
return{
|
|
13748
|
+
rowAxis,
|
|
13749
|
+
columnAxis,
|
|
13750
|
+
measures:measures.map((m)=>({colId:m.colId,fn:m.fn})),
|
|
13751
|
+
body,
|
|
13752
|
+
rowMargin,
|
|
13753
|
+
columnMargin,
|
|
13754
|
+
grand,
|
|
13755
|
+
columns,
|
|
13756
|
+
error:null,
|
|
13757
|
+
};
|
|
13758
|
+
}
|
|
13759
|
+
function cellKey(rowPath,columnPath,colId){
|
|
13760
|
+
return`${rowPath}\u0000${columnPath}\u0000${colId}`;
|
|
13761
|
+
}
|
|
13762
|
+
function marginKey(path,colId){
|
|
13763
|
+
return`${path}\u0000${colId}`;
|
|
13764
|
+
}
|
|
13765
|
+
});
|
|
13213
13766
|
__def("packages/core/src/compute/reference.js",function(__exports,__req){
|
|
13214
13767
|
'use strict';
|
|
13215
13768
|
Object.defineProperty(__exports,"referenceValue",{enumerable:true,get:function(){return referenceValue;}});
|
|
@@ -13334,96 +13887,6 @@ function normaliseNull(v){
|
|
|
13334
13887
|
return v===undefined?null:v;
|
|
13335
13888
|
}
|
|
13336
13889
|
});
|
|
13337
|
-
__def("packages/core/src/compute/windowed.js",function(__exports,__req){
|
|
13338
|
-
'use strict';
|
|
13339
|
-
Object.defineProperty(__exports,"Window",{enumerable:true,get:function(){return Window;}});
|
|
13340
|
-
Object.defineProperty(__exports,"WINDOW_KINDS",{enumerable:true,get:function(){return WINDOW_KINDS;}});
|
|
13341
|
-
Object.defineProperty(__exports,"openWindow",{enumerable:true,get:function(){return openWindow;}});
|
|
13342
|
-
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
13343
|
-
const __m0=__req("packages/core/src/compute/sketch.js");
|
|
13344
|
-
const Welford=__m0["Welford"];
|
|
13345
|
-
class Window{
|
|
13346
|
-
#kind;
|
|
13347
|
-
#span;
|
|
13348
|
-
#ticks=[];
|
|
13349
|
-
#now;
|
|
13350
|
-
#opened;
|
|
13351
|
-
constructor(kind,span=0,now=Date.now){
|
|
13352
|
-
if(kind!=='count'&&kind!=='time'&&kind!=='session'){
|
|
13353
|
-
throw new RangeError(`unknown window kind: ${kind}`);
|
|
13354
|
-
}
|
|
13355
|
-
if((kind==='count'||kind==='time')&&!(span>0)){
|
|
13356
|
-
throw new RangeError(`a ${kind} window needs a positive span`);
|
|
13357
|
-
}
|
|
13358
|
-
this.#kind=kind;
|
|
13359
|
-
this.#span=Math.floor(span);
|
|
13360
|
-
this.#now=now;
|
|
13361
|
-
this.#opened=now();
|
|
13362
|
-
}
|
|
13363
|
-
get size(){return this.#ticks.length;}
|
|
13364
|
-
push(v,t=this.#now()){
|
|
13365
|
-
if(!Number.isFinite(v))return;
|
|
13366
|
-
this.#ticks.push({t,v});
|
|
13367
|
-
this.#evict(t);
|
|
13368
|
-
}
|
|
13369
|
-
#evict(nowT){
|
|
13370
|
-
if(this.#kind==='count'){
|
|
13371
|
-
while(this.#ticks.length>this.#span)this.#ticks.shift();
|
|
13372
|
-
}else if(this.#kind==='time'){
|
|
13373
|
-
const cutoff=nowT-this.#span;
|
|
13374
|
-
while(this.#ticks.length&&this.#ticks[0].t<cutoff)this.#ticks.shift();
|
|
13375
|
-
}
|
|
13376
|
-
}
|
|
13377
|
-
spec(){
|
|
13378
|
-
const span=this.#kind==='session'?this.#now()-this.#opened:this.#span;
|
|
13379
|
-
return{kind:this.#kind,span,size:this.#ticks.length};
|
|
13380
|
-
}
|
|
13381
|
-
values(){return this.#ticks.map((tk)=>tk.v);}
|
|
13382
|
-
aggregate(){
|
|
13383
|
-
const spec=this.spec();
|
|
13384
|
-
if(!this.#ticks.length){
|
|
13385
|
-
return{over:spec,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};
|
|
13386
|
-
}
|
|
13387
|
-
const w=new Welford();
|
|
13388
|
-
let sum=0;
|
|
13389
|
-
let min=Infinity;
|
|
13390
|
-
let max=-Infinity;
|
|
13391
|
-
for(const{v}of this.#ticks){
|
|
13392
|
-
sum+=v;
|
|
13393
|
-
if(v<min)min=v;
|
|
13394
|
-
if(v>max)max=v;
|
|
13395
|
-
w.add(v);
|
|
13396
|
-
}
|
|
13397
|
-
return{
|
|
13398
|
-
over:spec,
|
|
13399
|
-
count:this.#ticks.length,
|
|
13400
|
-
sum,
|
|
13401
|
-
mean:w.mean(),
|
|
13402
|
-
min,
|
|
13403
|
-
max,
|
|
13404
|
-
variance:w.variance(),
|
|
13405
|
-
stddev:w.stddev(),
|
|
13406
|
-
};
|
|
13407
|
-
}
|
|
13408
|
-
reduce(fn){
|
|
13409
|
-
const agg=this.aggregate();
|
|
13410
|
-
const map={
|
|
13411
|
-
sum:agg.sum,avg:agg.mean,mean:agg.mean,min:agg.min,max:agg.max,
|
|
13412
|
-
count:agg.count,variance:agg.variance,stddev:agg.stddev,
|
|
13413
|
-
};
|
|
13414
|
-
if(!(fn in map))throw new RangeError(`unknown windowed aggregate: ${fn}`);
|
|
13415
|
-
return{value:map[fn],over:agg.over};
|
|
13416
|
-
}
|
|
13417
|
-
}
|
|
13418
|
-
const WINDOW_KINDS=Object.freeze(['count','time','session']);
|
|
13419
|
-
function openWindow(opts,now=Date.now){
|
|
13420
|
-
const span=opts.kind==='time'&&opts.minutes!=null
|
|
13421
|
-
?opts.minutes*60_000
|
|
13422
|
-
:opts.span??0;
|
|
13423
|
-
return new Window(opts.kind,span,now);
|
|
13424
|
-
}
|
|
13425
|
-
const __default={Window,WINDOW_KINDS,openWindow};
|
|
13426
|
-
});
|
|
13427
13890
|
__def("packages/core/src/compute/index.js",function(__exports,__req){
|
|
13428
13891
|
'use strict';
|
|
13429
13892
|
const __m0=__req("packages/core/src/compute/sort.js");
|
|
@@ -13482,42 +13945,48 @@ Object.defineProperty(__exports,"joinPath",{enumerable:true,get:function(){retur
|
|
|
13482
13945
|
Object.defineProperty(__exports,"KEY_DELIMITER",{enumerable:true,get:function(){return __m6["KEY_DELIMITER"];}});
|
|
13483
13946
|
Object.defineProperty(__exports,"DEFAULT_PATH_SEPARATOR",{enumerable:true,get:function(){return __m6["DEFAULT_PATH_SEPARATOR"];}});
|
|
13484
13947
|
Object.defineProperty(__exports,"DEFAULT_MAX_COLUMNS",{enumerable:true,get:function(){return __m6["DEFAULT_MAX_COLUMNS"];}});
|
|
13485
|
-
const __m7=__req("packages/core/src/compute/
|
|
13486
|
-
Object.defineProperty(__exports,"
|
|
13487
|
-
Object.defineProperty(__exports,"
|
|
13488
|
-
Object.defineProperty(__exports,"
|
|
13489
|
-
Object.defineProperty(__exports,"
|
|
13490
|
-
Object.defineProperty(__exports,"
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
Object.defineProperty(__exports,"
|
|
13494
|
-
Object.defineProperty(__exports,"
|
|
13495
|
-
Object.defineProperty(__exports,"
|
|
13496
|
-
Object.defineProperty(__exports,"
|
|
13497
|
-
Object.defineProperty(__exports,"
|
|
13498
|
-
|
|
13499
|
-
Object.defineProperty(__exports,"
|
|
13500
|
-
Object.defineProperty(__exports,"
|
|
13501
|
-
Object.defineProperty(__exports,"
|
|
13502
|
-
Object.defineProperty(__exports,"
|
|
13503
|
-
Object.defineProperty(__exports,"
|
|
13504
|
-
Object.defineProperty(__exports,"
|
|
13505
|
-
|
|
13506
|
-
Object.defineProperty(__exports,"
|
|
13507
|
-
Object.defineProperty(__exports,"
|
|
13508
|
-
Object.defineProperty(__exports,"
|
|
13509
|
-
Object.defineProperty(__exports,"
|
|
13510
|
-
Object.defineProperty(__exports,"
|
|
13511
|
-
|
|
13512
|
-
Object.defineProperty(__exports,"
|
|
13513
|
-
|
|
13514
|
-
Object.defineProperty(__exports,"
|
|
13515
|
-
Object.defineProperty(__exports,"
|
|
13516
|
-
Object.defineProperty(__exports,"
|
|
13517
|
-
|
|
13518
|
-
Object.defineProperty(__exports,"
|
|
13519
|
-
|
|
13520
|
-
Object.defineProperty(__exports,"
|
|
13948
|
+
const __m7=__req("packages/core/src/compute/pivotmatrix.js");
|
|
13949
|
+
Object.defineProperty(__exports,"pivotMatrix",{enumerable:true,get:function(){return __m7["pivotMatrix"];}});
|
|
13950
|
+
Object.defineProperty(__exports,"resolveAxis",{enumerable:true,get:function(){return __m7["resolveAxis"];}});
|
|
13951
|
+
Object.defineProperty(__exports,"cellKey",{enumerable:true,get:function(){return __m7["cellKey"];}});
|
|
13952
|
+
Object.defineProperty(__exports,"marginKey",{enumerable:true,get:function(){return __m7["marginKey"];}});
|
|
13953
|
+
Object.defineProperty(__exports,"GRAND_PATH",{enumerable:true,get:function(){return __m7["GRAND_PATH"];}});
|
|
13954
|
+
const __m8=__req("packages/core/src/compute/reference.js");
|
|
13955
|
+
Object.defineProperty(__exports,"referenceSort",{enumerable:true,get:function(){return __m8["referenceSort"];}});
|
|
13956
|
+
Object.defineProperty(__exports,"referenceFilter",{enumerable:true,get:function(){return __m8["referenceFilter"];}});
|
|
13957
|
+
Object.defineProperty(__exports,"referenceGroup",{enumerable:true,get:function(){return __m8["referenceGroup"];}});
|
|
13958
|
+
Object.defineProperty(__exports,"referenceTotal",{enumerable:true,get:function(){return __m8["referenceTotal"];}});
|
|
13959
|
+
Object.defineProperty(__exports,"referencePasses",{enumerable:true,get:function(){return __m8["referencePasses"];}});
|
|
13960
|
+
Object.defineProperty(__exports,"referenceValue",{enumerable:true,get:function(){return __m8["referenceValue"];}});
|
|
13961
|
+
const __m9=__req("packages/core/src/compute/handle.js");
|
|
13962
|
+
Object.defineProperty(__exports,"identity",{enumerable:true,get:function(){return __m9["identity"];}});
|
|
13963
|
+
Object.defineProperty(__exports,"rowCount",{enumerable:true,get:function(){return __m9["rowCount"];}});
|
|
13964
|
+
Object.defineProperty(__exports,"presenceReader",{enumerable:true,get:function(){return __m9["presenceReader"];}});
|
|
13965
|
+
Object.defineProperty(__exports,"bitReader",{enumerable:true,get:function(){return __m9["bitReader"];}});
|
|
13966
|
+
Object.defineProperty(__exports,"valueReader",{enumerable:true,get:function(){return __m9["valueReader"];}});
|
|
13967
|
+
Object.defineProperty(__exports,"valueComparator",{enumerable:true,get:function(){return __m9["valueComparator"];}});
|
|
13968
|
+
Object.defineProperty(__exports,"numericTotalOrder",{enumerable:true,get:function(){return __m9["numericTotalOrder"];}});
|
|
13969
|
+
Object.defineProperty(__exports,"dictRanks",{enumerable:true,get:function(){return __m9["dictRanks"];}});
|
|
13970
|
+
Object.defineProperty(__exports,"dictSize",{enumerable:true,get:function(){return __m9["dictSize"];}});
|
|
13971
|
+
Object.defineProperty(__exports,"dictValue",{enumerable:true,get:function(){return __m9["dictValue"];}});
|
|
13972
|
+
Object.defineProperty(__exports,"multiValue",{enumerable:true,get:function(){return __m9["multiValue"];}});
|
|
13973
|
+
Object.defineProperty(__exports,"isMissing",{enumerable:true,get:function(){return __m9["isMissing"];}});
|
|
13974
|
+
const __m10=__req("packages/core/src/compute/sketch.js");
|
|
13975
|
+
Object.defineProperty(__exports,"Welford",{enumerable:true,get:function(){return __m10["Welford"];}});
|
|
13976
|
+
Object.defineProperty(__exports,"Reservoir",{enumerable:true,get:function(){return __m10["Reservoir"];}});
|
|
13977
|
+
Object.defineProperty(__exports,"HyperLogLog",{enumerable:true,get:function(){return __m10["HyperLogLog"];}});
|
|
13978
|
+
Object.defineProperty(__exports,"SpaceSaving",{enumerable:true,get:function(){return __m10["SpaceSaving"];}});
|
|
13979
|
+
Object.defineProperty(__exports,"KLL",{enumerable:true,get:function(){return __m10["KLL"];}});
|
|
13980
|
+
Object.defineProperty(__exports,"hash32",{enumerable:true,get:function(){return __m10["hash32"];}});
|
|
13981
|
+
Object.defineProperty(__exports,"SKETCH_BOUNDS",{enumerable:true,get:function(){return __m10["SKETCH_BOUNDS"];}});
|
|
13982
|
+
const __m11=__req("packages/core/src/compute/windowed.js");
|
|
13983
|
+
Object.defineProperty(__exports,"Window",{enumerable:true,get:function(){return __m11["Window"];}});
|
|
13984
|
+
Object.defineProperty(__exports,"WINDOW_KINDS",{enumerable:true,get:function(){return __m11["WINDOW_KINDS"];}});
|
|
13985
|
+
Object.defineProperty(__exports,"openWindow",{enumerable:true,get:function(){return __m11["openWindow"];}});
|
|
13986
|
+
const __m12=__req("packages/core/src/compute/statistics.js");
|
|
13987
|
+
Object.defineProperty(__exports,"MAINTENANCE",{enumerable:true,get:function(){return __m12["MAINTENANCE"];}});
|
|
13988
|
+
Object.defineProperty(__exports,"APPROXIMATE",{enumerable:true,get:function(){return __m12["APPROXIMATE"];}});
|
|
13989
|
+
Object.defineProperty(__exports,"maintenanceOf",{enumerable:true,get:function(){return __m12["maintenanceOf"];}});
|
|
13521
13990
|
});
|
|
13522
13991
|
__def("packages/core/src/source/rows.js",function(__exports,__req){
|
|
13523
13992
|
'use strict';
|
|
@@ -14527,7 +14996,7 @@ mode='memory';
|
|
|
14527
14996
|
static#emptySnapshot(){
|
|
14528
14997
|
return{
|
|
14529
14998
|
slots:[],groupHeadings:EMPTY_HEADINGS,pivot:null,inlineLeaves:null,
|
|
14530
|
-
matchCount:0,grand:null,grandLeaves:0,
|
|
14999
|
+
matchCount:0,grand:null,grandLeaves:0,groupLeaves:null,
|
|
14531
15000
|
};
|
|
14532
15001
|
}
|
|
14533
15002
|
#inflight=new Map();
|
|
@@ -14898,6 +15367,41 @@ pivot(){
|
|
|
14898
15367
|
this.#run();
|
|
14899
15368
|
return this.#pivot;
|
|
14900
15369
|
}
|
|
15370
|
+
pivotMatrix(){
|
|
15371
|
+
this.#run();
|
|
15372
|
+
const leaves=this.#snapshot.groupLeaves;
|
|
15373
|
+
const build=(this.#ctx.compute||{}).pivotMatrix;
|
|
15374
|
+
if(!isFunction(build))return null;
|
|
15375
|
+
const rowDims=this.#state('groupBy',[]);
|
|
15376
|
+
const columnDims=this.#state('pivotBy',[]);
|
|
15377
|
+
if(!rowDims.length&&!columnDims.length)return null;
|
|
15378
|
+
const measures=this.#totalColumns().map((c)=>({
|
|
15379
|
+
colId:c.id,
|
|
15380
|
+
handle:this.#handles.handle(c.id),
|
|
15381
|
+
fn:totalFnFor(c,'group'),
|
|
15382
|
+
})).filter((m)=>m.handle&&m.fn);
|
|
15383
|
+
const config=(this.#ctx.config||{});
|
|
15384
|
+
return build({
|
|
15385
|
+
rowHandles:rowDims.map((id)=>this.#handles.handle(id)).filter(Boolean),
|
|
15386
|
+
columnHandles:columnDims.map((id)=>this.#handles.handle(id)).filter(Boolean),
|
|
15387
|
+
measures,
|
|
15388
|
+
leaves:leaves||new Uint32Array(0),
|
|
15389
|
+
opts:{
|
|
15390
|
+
locale:config.locale,
|
|
15391
|
+
separator:(config.pivot||{}).separator,
|
|
15392
|
+
maxColumns:(config.pivot||{}).maxColumns,
|
|
15393
|
+
},
|
|
15394
|
+
});
|
|
15395
|
+
}
|
|
15396
|
+
keysForLeaves(indices){
|
|
15397
|
+
const out=[];
|
|
15398
|
+
if(!indices)return out;
|
|
15399
|
+
for(let i=0;i<indices.length;i++){
|
|
15400
|
+
const row=this.#leafRow(indices[i]);
|
|
15401
|
+
if(row&&row.key!=null)out.push(String(row.key));
|
|
15402
|
+
}
|
|
15403
|
+
return out;
|
|
15404
|
+
}
|
|
14901
15405
|
#keyOfTarget(target){
|
|
14902
15406
|
return typeof target==='string'?target:this.#rowKeyOf(target);
|
|
14903
15407
|
}
|
|
@@ -15086,6 +15590,7 @@ const leaves=grouped&&grouped.leaves?grouped.leaves.length:this.#snapshot.slots.
|
|
|
15086
15590
|
this.#snapshot.matchCount=leaves;
|
|
15087
15591
|
this.#snapshot.grand=(totalled&&totalled.grand)||null;
|
|
15088
15592
|
this.#snapshot.grandLeaves=grouped&&grouped.leaves?grouped.leaves.length:0;
|
|
15593
|
+
this.#snapshot.groupLeaves=grouped&&grouped.leaves?grouped.leaves:null;
|
|
15089
15594
|
}
|
|
15090
15595
|
#stage(name,keyFn,computeFn){
|
|
15091
15596
|
const entry=this.#stages.get(name);
|
|
@@ -18966,6 +19471,7 @@ note:spec.note||(spec.class==='identical'
|
|
|
18966
19471
|
__def("packages/core/src/source/pushdown.js",function(__exports,__req){
|
|
18967
19472
|
'use strict';
|
|
18968
19473
|
Object.defineProperty(__exports,"NO_CAPABILITIES",{enumerable:true,get:function(){return NO_CAPABILITIES;}});
|
|
19474
|
+
Object.defineProperty(__exports,"resolveMutate",{enumerable:true,get:function(){return resolveMutate;}});
|
|
18969
19475
|
Object.defineProperty(__exports,"capabilitiesOf",{enumerable:true,get:function(){return capabilitiesOf;}});
|
|
18970
19476
|
Object.defineProperty(__exports,"splitFilters",{enumerable:true,get:function(){return splitFilters;}});
|
|
18971
19477
|
Object.defineProperty(__exports,"planQuery",{enumerable:true,get:function(){return planQuery;}});
|
|
@@ -18987,7 +19493,19 @@ quick:false,
|
|
|
18987
19493
|
range:false,
|
|
18988
19494
|
total:false,
|
|
18989
19495
|
group:false,
|
|
19496
|
+
mutate:false,
|
|
18990
19497
|
});
|
|
19498
|
+
function resolveMutate(declared){
|
|
19499
|
+
if(!declared||typeof declared!=='object')return false;
|
|
19500
|
+
const returning=declared.returning==='row'||declared.returning==='key'
|
|
19501
|
+
?declared.returning:'none';
|
|
19502
|
+
return{
|
|
19503
|
+
append:declared.append===true,
|
|
19504
|
+
update:declared.update===true,
|
|
19505
|
+
delete:declared.delete===true,
|
|
19506
|
+
returning,
|
|
19507
|
+
};
|
|
19508
|
+
}
|
|
18991
19509
|
function readPath(row,path){
|
|
18992
19510
|
if(!row||typeof path!=='string')return undefined;
|
|
18993
19511
|
if(!path.includes('.'))return(row)[path];
|
|
@@ -18998,9 +19516,17 @@ cursor=(cursor)[part];
|
|
|
18998
19516
|
}
|
|
18999
19517
|
return cursor;
|
|
19000
19518
|
}
|
|
19519
|
+
function wantsEdit(edit){
|
|
19520
|
+
if(edit===true)return true;
|
|
19521
|
+
if(!edit||typeof edit!=='object')return false;
|
|
19522
|
+
const any=(edit);
|
|
19523
|
+
if(any.enabled===false)return false;
|
|
19524
|
+
return any.enabled===true||isFunction(any.commit);
|
|
19525
|
+
}
|
|
19001
19526
|
function capabilitiesOf(declared){
|
|
19002
19527
|
const caps={...NO_CAPABILITIES,...(declared||{})};
|
|
19003
19528
|
caps.operators=new Set(caps.operators||[]);
|
|
19529
|
+
caps.mutate=resolveMutate(caps.mutate);
|
|
19004
19530
|
return caps;
|
|
19005
19531
|
}
|
|
19006
19532
|
function conditionPushable(condition,caps){
|
|
@@ -19279,8 +19805,36 @@ return{
|
|
|
19279
19805
|
values,engine,client,...(groups!==undefined?{groups}:{}),
|
|
19280
19806
|
};
|
|
19281
19807
|
};
|
|
19808
|
+
const editRequested=wantsEdit(config.edit);
|
|
19809
|
+
const declaredCommit=config.edit&&typeof config.edit==='object'
|
|
19810
|
+
&&isFunction((config.edit).commit);
|
|
19811
|
+
let edit=config.edit;
|
|
19812
|
+
if(editRequested&&!declaredCommit){
|
|
19813
|
+
if(caps.mutate&&caps.mutate.update){
|
|
19814
|
+
const commit=(write)=>{
|
|
19815
|
+
if(!caps.mutate||!caps.mutate.update){
|
|
19816
|
+
throw new Error(
|
|
19817
|
+
`[lattice] the ${name} adapter cannot update rows (mutate.update is not declared), `
|
|
19818
|
+
+'so this edit cannot be persisted. The cell is reverted rather than left looking saved.');
|
|
19819
|
+
}
|
|
19820
|
+
const op={
|
|
19821
|
+
kind:'update',
|
|
19822
|
+
key:String(write.key),
|
|
19823
|
+
patch:{[write.colId]:write.value},
|
|
19824
|
+
};
|
|
19825
|
+
return adapter.mutate(op,write.request||{});
|
|
19826
|
+
};
|
|
19827
|
+
edit={...(config.edit===true?{}:config.edit),commit};
|
|
19828
|
+
}else{
|
|
19829
|
+
warnOnce(`source.pushdown.readonly.${name}`,
|
|
19830
|
+
`edit is enabled but the ${name} adapter declares mutate: ${caps.mutate?'without update':'false'} `
|
|
19831
|
+
+'(read-only by declaration), so no commit is synthesised and the grid stays read-only. '
|
|
19832
|
+
+'Declare `mutate: { update: true }` on the adapter to allow cell edits.');
|
|
19833
|
+
}
|
|
19834
|
+
}
|
|
19282
19835
|
return{
|
|
19283
19836
|
...config,
|
|
19837
|
+
edit,
|
|
19284
19838
|
mode:'remote',
|
|
19285
19839
|
fetch,
|
|
19286
19840
|
aggregate,
|
|
@@ -19342,6 +19896,8 @@ function odataAdapter(options={}){
|
|
|
19342
19896
|
const base=String(options.url||'');
|
|
19343
19897
|
const call=options.fetch||(typeof fetch==='function'?fetch:null);
|
|
19344
19898
|
const wantsCount=options.count!==false;
|
|
19899
|
+
const keyField=ident(options.key||'id');
|
|
19900
|
+
const canEdit=options.edit===true;
|
|
19345
19901
|
return{
|
|
19346
19902
|
name:'odata',
|
|
19347
19903
|
capabilities:{
|
|
@@ -19351,6 +19907,7 @@ sort:'multi',
|
|
|
19351
19907
|
quick:options.search===true,
|
|
19352
19908
|
range:true,
|
|
19353
19909
|
total:wantsCount,
|
|
19910
|
+
mutate:canEdit?{update:true,returning:'row'}:false,
|
|
19354
19911
|
},
|
|
19355
19912
|
urlFor(query){
|
|
19356
19913
|
const parts=[];
|
|
@@ -19391,6 +19948,37 @@ next=body['@odata.nextLink'];
|
|
|
19391
19948
|
}
|
|
19392
19949
|
return{rows,total};
|
|
19393
19950
|
},
|
|
19951
|
+
urlForKey(keyValue){
|
|
19952
|
+
return`${base}(${literal(keyValue)})`;
|
|
19953
|
+
},
|
|
19954
|
+
async mutate(op,request){
|
|
19955
|
+
if(!call)throw new Error('odataAdapter needs a fetch implementation');
|
|
19956
|
+
if(!op||op.kind!=='update'){
|
|
19957
|
+
throw new Error(
|
|
19958
|
+
`odataAdapter: mutation kind "${op&&op.kind}" is not supported `
|
|
19959
|
+
+'(only update is wired in wave 1)');
|
|
19960
|
+
}
|
|
19961
|
+
const url=this.urlForKey(op.key);
|
|
19962
|
+
const headers={
|
|
19963
|
+
Accept:'application/json',
|
|
19964
|
+
'Content-Type':'application/json',
|
|
19965
|
+
...(options.headers||{}),
|
|
19966
|
+
};
|
|
19967
|
+
const signal=request&&request.signal;
|
|
19968
|
+
const response=await call(url,{
|
|
19969
|
+
method:'PATCH',
|
|
19970
|
+
headers,
|
|
19971
|
+
signal,
|
|
19972
|
+
body:JSON.stringify(op.patch||{}),
|
|
19973
|
+
});
|
|
19974
|
+
if(!response.ok){
|
|
19975
|
+
throw new Error(`OData update failed: ${response.status}`);
|
|
19976
|
+
}
|
|
19977
|
+
if(response.status===204)return{ok:true};
|
|
19978
|
+
const body=await response.json();
|
|
19979
|
+
const row=body&&typeof body==='object'&&'value'in body?body.value:body;
|
|
19980
|
+
return row===null||row===undefined?{ok:true}:{ok:true,rows:[row]};
|
|
19981
|
+
},
|
|
19394
19982
|
};
|
|
19395
19983
|
}
|
|
19396
19984
|
});
|
|
@@ -19500,6 +20088,7 @@ sort:false,
|
|
|
19500
20088
|
quick:false,
|
|
19501
20089
|
range:false,
|
|
19502
20090
|
total:true,
|
|
20091
|
+
mutate:false,
|
|
19503
20092
|
},
|
|
19504
20093
|
linesFor(query){
|
|
19505
20094
|
const line={entity,comboKey:keyName,query:prefix,limit:ceiling,tag:'rows'};
|
|
@@ -19564,6 +20153,15 @@ throw new Error(`duckdbAdapter: "${text}" is not a usable column name`);
|
|
|
19564
20153
|
}
|
|
19565
20154
|
return`"${text}"`;
|
|
19566
20155
|
}
|
|
20156
|
+
function isPlainTable(from){
|
|
20157
|
+
const text=String(from).trim();
|
|
20158
|
+
if(!text)return false;
|
|
20159
|
+
const segments=text.split('.');
|
|
20160
|
+
return segments.every((segment)=>/^[A-Za-z_][A-Za-z0-9_$]*$/.test(segment));
|
|
20161
|
+
}
|
|
20162
|
+
function tableRef(from){
|
|
20163
|
+
return String(from).trim().split('.').map(ident).join('.');
|
|
20164
|
+
}
|
|
19567
20165
|
function conditionSql(condition,params){
|
|
19568
20166
|
const col=ident(condition.col);
|
|
19569
20167
|
const op=String(condition.op);
|
|
@@ -19603,6 +20201,10 @@ const from=String(options.from||'');
|
|
|
19603
20201
|
const projection=Array.isArray(options.fields)&&options.fields.length
|
|
19604
20202
|
?options.fields.map(ident).join(', ')
|
|
19605
20203
|
:'*';
|
|
20204
|
+
const keyField=options.keyField||'id';
|
|
20205
|
+
const writable=options.writable===true;
|
|
20206
|
+
const tableTarget=writable&&isPlainTable(from);
|
|
20207
|
+
const returning=options.returning==='none'?'none':'row';
|
|
19606
20208
|
return{
|
|
19607
20209
|
name:'duckdb',
|
|
19608
20210
|
capabilities:{
|
|
@@ -19613,6 +20215,7 @@ quick:false,
|
|
|
19613
20215
|
range:true,
|
|
19614
20216
|
total:true,
|
|
19615
20217
|
aggregates:pushableAggregates(),
|
|
20218
|
+
mutate:tableTarget?{update:true,returning}:false,
|
|
19616
20219
|
},
|
|
19617
20220
|
sqlFor(query){
|
|
19618
20221
|
const params=[];
|
|
@@ -19662,6 +20265,59 @@ return plain;
|
|
|
19662
20265
|
});
|
|
19663
20266
|
return{rows,total:total===null?rows.length:total};
|
|
19664
20267
|
},
|
|
20268
|
+
updateSqlFor(op){
|
|
20269
|
+
if(!tableTarget){
|
|
20270
|
+
throw new Error(
|
|
20271
|
+
`duckdbAdapter: refusing to mutate — "${from}" is not a plain writable table `
|
|
20272
|
+
+'(a read_parquet(...) or subquery FROM is analytical and read-only), or writes were '
|
|
20273
|
+
+'not enabled. Point `from` at a table and set `writable: true` to allow cell updates.');
|
|
20274
|
+
}
|
|
20275
|
+
const patch=op&&op.patch?op.patch:{};
|
|
20276
|
+
const cols=Object.keys(patch);
|
|
20277
|
+
if(!cols.length)throw new Error('duckdbAdapter: an update needs at least one column to set');
|
|
20278
|
+
const params=[];
|
|
20279
|
+
const assignments=cols.map((col)=>{
|
|
20280
|
+
params.push(patch[col]);
|
|
20281
|
+
return`${ident(col)} = ?`;
|
|
20282
|
+
});
|
|
20283
|
+
params.push(op.key);
|
|
20284
|
+
let sql=`UPDATE ${tableRef(from)} SET ${assignments.join(', ')} WHERE ${ident(keyField)} = ?`;
|
|
20285
|
+
if(returning==='row')sql+=' RETURNING *';
|
|
20286
|
+
return{sql,params};
|
|
20287
|
+
},
|
|
20288
|
+
async mutate(op){
|
|
20289
|
+
if(!connection||!isFunction(connection.query)){
|
|
20290
|
+
throw new Error('duckdbAdapter needs a connection with a query function');
|
|
20291
|
+
}
|
|
20292
|
+
if(!op||op.kind!=='update'){
|
|
20293
|
+
throw new Error(
|
|
20294
|
+
`duckdbAdapter: cannot ${op?op.kind:'perform this'} mutation — only cell updates are `
|
|
20295
|
+
+'supported (append/delete are out of scope). The edit is reverted rather than left '
|
|
20296
|
+
+'looking saved.');
|
|
20297
|
+
}
|
|
20298
|
+
const{sql,params}=this.updateSqlFor(op);
|
|
20299
|
+
let result;
|
|
20300
|
+
if(isFunction(connection.prepare)){
|
|
20301
|
+
const statement=await connection.prepare(sql);
|
|
20302
|
+
try{
|
|
20303
|
+
result=await statement.query(...params);
|
|
20304
|
+
}finally{
|
|
20305
|
+
if(isFunction(statement.close))await statement.close();
|
|
20306
|
+
}
|
|
20307
|
+
}else{
|
|
20308
|
+
throw new Error(
|
|
20309
|
+
'duckdbAdapter: this connection has no prepare(), so an update\'s values cannot be bound. '
|
|
20310
|
+
+'The edit is refused rather than interpolated into SQL, and the cell is reverted.');
|
|
20311
|
+
}
|
|
20312
|
+
if(returning!=='row')return{ok:true};
|
|
20313
|
+
const raw=isFunction(result.toArray)?result.toArray():Array.from(result||[]);
|
|
20314
|
+
const rows=raw.map((row)=>{
|
|
20315
|
+
const plain=isFunction(row.toJSON)?row.toJSON():{...row};
|
|
20316
|
+
for(const key of Object.keys(plain))plain[key]=normalise(plain[key]);
|
|
20317
|
+
return plain;
|
|
20318
|
+
});
|
|
20319
|
+
return{ok:true,rows};
|
|
20320
|
+
},
|
|
19665
20321
|
aggregateSqlFor(query,aggregates){
|
|
19666
20322
|
const params=[];
|
|
19667
20323
|
const where=filtersToSql(query.filters,params);
|
|
@@ -19826,6 +20482,7 @@ Object.defineProperty(__exports,"planQuery",{enumerable:true,get:function(){retu
|
|
|
19826
20482
|
Object.defineProperty(__exports,"splitFilters",{enumerable:true,get:function(){return __m6["splitFilters"];}});
|
|
19827
20483
|
Object.defineProperty(__exports,"applyResidual",{enumerable:true,get:function(){return __m6["applyResidual"];}});
|
|
19828
20484
|
Object.defineProperty(__exports,"capabilitiesOf",{enumerable:true,get:function(){return __m6["capabilitiesOf"];}});
|
|
20485
|
+
Object.defineProperty(__exports,"resolveMutate",{enumerable:true,get:function(){return __m6["resolveMutate"];}});
|
|
19829
20486
|
Object.defineProperty(__exports,"NO_CAPABILITIES",{enumerable:true,get:function(){return __m6["NO_CAPABILITIES"];}});
|
|
19830
20487
|
const __m7=__req("packages/core/src/source/adapters/odata.js");
|
|
19831
20488
|
Object.defineProperty(__exports,"odataAdapter",{enumerable:true,get:function(){return __m7["odataAdapter"];}});
|
|
@@ -21976,6 +22633,7 @@ const isFormattingState=__m1["isFormattingState"];
|
|
|
21976
22633
|
const STATE_VERSION=1;
|
|
21977
22634
|
const STATE_KEYS=([
|
|
21978
22635
|
'columns','columnOrder','sort','filters','quick','quickMode','group','pivot',
|
|
22636
|
+
'pivotView',
|
|
21979
22637
|
'formatting','redaction','facets','expanded','selection','pagination','scroll',
|
|
21980
22638
|
]);
|
|
21981
22639
|
function collector(){
|
|
@@ -22019,6 +22677,13 @@ if(mode&&mode!=='contains')state.quickMode=mode;
|
|
|
22019
22677
|
}
|
|
22020
22678
|
if(t.group&&isFunction(t.group.get))state.group=clone(t.group.get())||[];
|
|
22021
22679
|
if(t.pivot&&isFunction(t.pivot.get))state.pivot=clone(t.pivot.get());
|
|
22680
|
+
if(t.pivotView&&isFunction(t.pivotView.get)){
|
|
22681
|
+
const pv=t.pivotView.get();
|
|
22682
|
+
if(pv&&((pv.rowsCollapsed&&pv.rowsCollapsed.length)
|
|
22683
|
+
||(pv.columnsCollapsed&&pv.columnsCollapsed.length))){
|
|
22684
|
+
state.pivotView=clone(pv);
|
|
22685
|
+
}
|
|
22686
|
+
}
|
|
22022
22687
|
if(t.formatting&&isFunction(t.formatting.all))state.formatting=clone(t.formatting.all())||{};
|
|
22023
22688
|
if(t.redaction&&isFunction(t.redaction.list))state.redaction=t.redaction.list();
|
|
22024
22689
|
if(t.facets&&isFunction(t.facets.expanded))state.facets=t.facets.expanded();
|
|
@@ -22063,6 +22728,7 @@ case'quick':return this.#applySimple('quick',value,c,t.filters,'setQuick');
|
|
|
22063
22728
|
case'quickMode':return this.#applySimple('quickMode',value,c,t.filters,'setQuickMode');
|
|
22064
22729
|
case'group':return this.#applyIdList('group',value,known,c,t.group);
|
|
22065
22730
|
case'pivot':return this.#applyPivot(value,known,c,t);
|
|
22731
|
+
case'pivotView':return this.#applySimple('pivotView',value,c,t.pivotView,'set');
|
|
22066
22732
|
case'formatting':return this.#applyFormatting(value,known,c,t);
|
|
22067
22733
|
case'redaction':return this.#applySimple('redaction',value,c,t.redaction,'set');
|
|
22068
22734
|
case'facets':return this.#applySimple('facets',value,c,t.facets,'setExpandedAll');
|
|
@@ -25208,11 +25874,18 @@ this.settle(record.id,false,errorReason(err));
|
|
|
25208
25874
|
return;
|
|
25209
25875
|
}
|
|
25210
25876
|
Promise.resolve(result).then(
|
|
25211
|
-
()=>
|
|
25877
|
+
(value)=>{
|
|
25878
|
+
const reconcile=reconcileFrom(value,record.colId);
|
|
25879
|
+
if(reconcile&&reconcile.rejected){
|
|
25880
|
+
this.settle(record.id,false,reconcile.reason);
|
|
25881
|
+
}else{
|
|
25882
|
+
this.settle(record.id,true,undefined,reconcile||undefined);
|
|
25883
|
+
}
|
|
25884
|
+
},
|
|
25212
25885
|
(err)=>this.settle(record.id,false,errorReason(err)),
|
|
25213
25886
|
);
|
|
25214
25887
|
}
|
|
25215
|
-
settle(id,ok,reason){
|
|
25888
|
+
settle(id,ok,reason,reconcile){
|
|
25216
25889
|
const record=this.#writes.get(id);
|
|
25217
25890
|
if(!record)return false;
|
|
25218
25891
|
if(record.state!=='pending'&&record.state!=='superseded')return false;
|
|
@@ -25221,13 +25894,26 @@ const cell=this.#cells.get(record.cellId);
|
|
|
25221
25894
|
if(cell)cell.open.delete(id);
|
|
25222
25895
|
if(ok){
|
|
25223
25896
|
record.state='confirmed';
|
|
25897
|
+
let confirmedValue=record.value;
|
|
25898
|
+
if(!superseded&&reconcile&&Object.prototype.hasOwnProperty.call(reconcile,'value')){
|
|
25899
|
+
confirmedValue=reconcile.value;
|
|
25900
|
+
if(!Object.is(confirmedValue,record.value)){
|
|
25901
|
+
this.#reconcileWrite(record,confirmedValue);
|
|
25902
|
+
}
|
|
25903
|
+
}
|
|
25224
25904
|
if(cell&&record.seq>cell.confirmedSeq){
|
|
25225
|
-
cell.confirmed=
|
|
25905
|
+
cell.confirmed=confirmedValue;
|
|
25226
25906
|
cell.confirmedSeq=record.seq;
|
|
25227
25907
|
}
|
|
25908
|
+
if(!superseded&&reconcile&&reconcile.conflict){
|
|
25909
|
+
this.#emit('cell:conflict',{
|
|
25910
|
+
row:this.#rowFor(record.key),key:record.key,colId:record.colId,
|
|
25911
|
+
value:confirmedValue,serverRow:reconcile.conflict.serverRow,id,
|
|
25912
|
+
},'api');
|
|
25913
|
+
}
|
|
25228
25914
|
this.#emit('cell:confirmed',{
|
|
25229
25915
|
row:this.#rowFor(record.key),key:record.key,colId:record.colId,
|
|
25230
|
-
value:
|
|
25916
|
+
value:confirmedValue,id,superseded,
|
|
25231
25917
|
},'api');
|
|
25232
25918
|
}else if(superseded){
|
|
25233
25919
|
record.state='reverted';
|
|
@@ -25266,6 +25952,16 @@ warnOnce('pending.revert.throw','rolling back a rejected write threw; the cell m
|
|
|
25266
25952
|
this.#reverting=false;
|
|
25267
25953
|
}
|
|
25268
25954
|
}
|
|
25955
|
+
#reconcileWrite(record,value){
|
|
25956
|
+
this.#reverting=true;
|
|
25957
|
+
try{
|
|
25958
|
+
this.#write(record.key,record.colId,value,record.value);
|
|
25959
|
+
}catch(err){
|
|
25960
|
+
warnOnce('pending.reconcile.throw','writing a server-authoritative value back threw; the cell may still show the optimistic value.',err);
|
|
25961
|
+
}finally{
|
|
25962
|
+
this.#reverting=false;
|
|
25963
|
+
}
|
|
25964
|
+
}
|
|
25269
25965
|
status(key,colId){
|
|
25270
25966
|
const cell=this.#cells.get(cellIdFor(key,colId));
|
|
25271
25967
|
if(!cell)return null;
|
|
@@ -25326,6 +26022,21 @@ this.#writes.clear();
|
|
|
25326
26022
|
this.#cells.clear();
|
|
25327
26023
|
}
|
|
25328
26024
|
}
|
|
26025
|
+
function reconcileFrom(result,colId){
|
|
26026
|
+
if(!result||typeof result!=='object')return null;
|
|
26027
|
+
const res=(result);
|
|
26028
|
+
if(res.ok===false)return{rejected:true,reason:errorReason(res.reason)};
|
|
26029
|
+
const out={};
|
|
26030
|
+
const serverRow=Array.isArray(res.rows)?res.rows[0]:undefined;
|
|
26031
|
+
if(serverRow&&typeof serverRow==='object'
|
|
26032
|
+
&&Object.prototype.hasOwnProperty.call(serverRow,colId)){
|
|
26033
|
+
out.value=(serverRow)[colId];
|
|
26034
|
+
}
|
|
26035
|
+
if(res.conflict&&typeof res.conflict==='object'){
|
|
26036
|
+
out.conflict={serverRow:res.conflict.serverRow};
|
|
26037
|
+
}
|
|
26038
|
+
return(Object.prototype.hasOwnProperty.call(out,'value')||out.conflict)?out:null;
|
|
26039
|
+
}
|
|
25329
26040
|
function errorReason(err){
|
|
25330
26041
|
if(err===undefined||err===null)return null;
|
|
25331
26042
|
if(typeof err==='string')return err;
|
|
@@ -30162,154 +30873,157 @@ const __m9=__req("packages/core/src/compute/total.js");
|
|
|
30162
30873
|
const total=__m9["total"];
|
|
30163
30874
|
const aggregatesFor=__m9["aggregatesFor"];
|
|
30164
30875
|
const aggregateAllowed=__m9["aggregateAllowed"];
|
|
30165
|
-
const __m10=__req("packages/core/src/compute/
|
|
30166
|
-
const
|
|
30167
|
-
const
|
|
30168
|
-
const
|
|
30169
|
-
const
|
|
30170
|
-
const
|
|
30171
|
-
const
|
|
30172
|
-
const
|
|
30173
|
-
const
|
|
30174
|
-
const
|
|
30175
|
-
const
|
|
30176
|
-
const
|
|
30177
|
-
const
|
|
30178
|
-
const
|
|
30179
|
-
const
|
|
30180
|
-
const
|
|
30181
|
-
const
|
|
30182
|
-
const
|
|
30183
|
-
const
|
|
30184
|
-
const
|
|
30185
|
-
const
|
|
30186
|
-
const
|
|
30187
|
-
const
|
|
30188
|
-
const
|
|
30189
|
-
const
|
|
30190
|
-
const
|
|
30191
|
-
const
|
|
30192
|
-
const
|
|
30193
|
-
const __m12
|
|
30194
|
-
const
|
|
30195
|
-
const
|
|
30196
|
-
const
|
|
30197
|
-
const
|
|
30198
|
-
const __m14=__req("packages/core/src/columns/
|
|
30199
|
-
const
|
|
30200
|
-
const
|
|
30201
|
-
const __m15=__req("packages/core/src/columns/
|
|
30202
|
-
const
|
|
30203
|
-
const
|
|
30204
|
-
const
|
|
30205
|
-
const
|
|
30206
|
-
const __m17=__req("packages/core/src/
|
|
30207
|
-
const
|
|
30208
|
-
const
|
|
30209
|
-
const
|
|
30210
|
-
const
|
|
30211
|
-
const
|
|
30212
|
-
const
|
|
30213
|
-
const
|
|
30214
|
-
const
|
|
30215
|
-
const
|
|
30216
|
-
const
|
|
30217
|
-
const __m22=__req("packages/core/src/source/
|
|
30218
|
-
const
|
|
30219
|
-
const
|
|
30220
|
-
const __m23=__req("packages/core/src/
|
|
30221
|
-
const
|
|
30222
|
-
const
|
|
30223
|
-
const
|
|
30224
|
-
const
|
|
30225
|
-
const __m25=__req("packages/core/src/model/
|
|
30226
|
-
const
|
|
30227
|
-
const
|
|
30228
|
-
const
|
|
30229
|
-
const __m26
|
|
30230
|
-
const
|
|
30231
|
-
const
|
|
30232
|
-
const
|
|
30233
|
-
const
|
|
30234
|
-
const __m28=__req("packages/core/src/model/
|
|
30235
|
-
const
|
|
30236
|
-
const
|
|
30237
|
-
const
|
|
30238
|
-
const
|
|
30239
|
-
const
|
|
30240
|
-
const
|
|
30241
|
-
const
|
|
30242
|
-
const
|
|
30243
|
-
const
|
|
30244
|
-
const
|
|
30245
|
-
const
|
|
30246
|
-
const
|
|
30247
|
-
const
|
|
30248
|
-
const
|
|
30249
|
-
const __m34
|
|
30250
|
-
const
|
|
30251
|
-
const
|
|
30252
|
-
const
|
|
30253
|
-
const
|
|
30254
|
-
const __m35
|
|
30255
|
-
const
|
|
30256
|
-
const
|
|
30257
|
-
const
|
|
30258
|
-
const
|
|
30259
|
-
const __m36
|
|
30260
|
-
const
|
|
30261
|
-
const
|
|
30262
|
-
const
|
|
30263
|
-
const
|
|
30264
|
-
const
|
|
30265
|
-
const __m37
|
|
30266
|
-
const
|
|
30267
|
-
const
|
|
30268
|
-
const
|
|
30269
|
-
const __m38
|
|
30270
|
-
const
|
|
30271
|
-
const
|
|
30272
|
-
const
|
|
30273
|
-
const
|
|
30274
|
-
const __m40=__req("packages/core/src/
|
|
30275
|
-
const
|
|
30276
|
-
const
|
|
30277
|
-
const
|
|
30278
|
-
const
|
|
30279
|
-
const
|
|
30280
|
-
const
|
|
30281
|
-
const
|
|
30282
|
-
const __m42
|
|
30283
|
-
const
|
|
30284
|
-
const
|
|
30285
|
-
const
|
|
30286
|
-
const
|
|
30287
|
-
const
|
|
30288
|
-
const __m44
|
|
30289
|
-
const
|
|
30290
|
-
const
|
|
30291
|
-
const
|
|
30292
|
-
const __m45
|
|
30293
|
-
const
|
|
30294
|
-
const
|
|
30295
|
-
const
|
|
30296
|
-
const
|
|
30297
|
-
const
|
|
30298
|
-
const
|
|
30299
|
-
const
|
|
30300
|
-
const
|
|
30301
|
-
const __m49=__req("packages/core/src/formatting/
|
|
30302
|
-
const
|
|
30303
|
-
const
|
|
30304
|
-
const
|
|
30305
|
-
const
|
|
30306
|
-
const
|
|
30307
|
-
const
|
|
30308
|
-
const
|
|
30309
|
-
const
|
|
30310
|
-
const
|
|
30311
|
-
const
|
|
30312
|
-
const
|
|
30876
|
+
const __m10=__req("packages/core/src/compute/windowed.js");
|
|
30877
|
+
const openWindow=__m10["openWindow"];
|
|
30878
|
+
const WINDOW_KINDS=__m10["WINDOW_KINDS"];
|
|
30879
|
+
const __m11=__req("packages/core/src/compute/handle.js");
|
|
30880
|
+
const statValueReader=__m11["valueReader"];
|
|
30881
|
+
const __m12=__req("packages/core/src/compute/statistics.js");
|
|
30882
|
+
const MAINTENANCE=__m12["MAINTENANCE"];
|
|
30883
|
+
const APPROXIMATE=__m12["APPROXIMATE"];
|
|
30884
|
+
const maintenanceOf=__m12["maintenanceOf"];
|
|
30885
|
+
const statCorrelation=__m12["correlation"];
|
|
30886
|
+
const statMoments=__m12["moments"];
|
|
30887
|
+
const countOutside=__m12["countOutside"];
|
|
30888
|
+
const statCapability=__m12["capability"];
|
|
30889
|
+
const statControlLimits=__m12["controlLimits"];
|
|
30890
|
+
const statControlViolations=__m12["controlViolations"];
|
|
30891
|
+
const statMeanInterval=__m12["meanInterval"];
|
|
30892
|
+
const statProportionInterval=__m12["proportionInterval"];
|
|
30893
|
+
const statSlopeInterval=__m12["slopeInterval"];
|
|
30894
|
+
const statCapabilityInterval=__m12["capabilityInterval"];
|
|
30895
|
+
const statCovariance=__m12["covariance"];
|
|
30896
|
+
const statHistogram=__m12["histogram"];
|
|
30897
|
+
const statKendall=__m12["kendall"];
|
|
30898
|
+
const statRegression=__m12["regression"];
|
|
30899
|
+
const statSeries=__m12["seriesStats"];
|
|
30900
|
+
const statSpearman=__m12["spearman"];
|
|
30901
|
+
const statWeightedQuantile=__m12["weightedQuantile"];
|
|
30902
|
+
const statNumbers=__m12["numbers"];
|
|
30903
|
+
const statQuantileSorted=__m12["quantileSorted"];
|
|
30904
|
+
const statWeightedAverage=__m12["weightedAverage"];
|
|
30905
|
+
const statPopulationRead=__m12["populationRead"];
|
|
30906
|
+
const statCompareColumn=__m12["compareColumn"];
|
|
30907
|
+
const __m13=__req("packages/core/src/compute/compare.js");
|
|
30908
|
+
const statCompareDatasets=__m13["compareDatasets"];
|
|
30909
|
+
const __m14=__req("packages/core/src/columns/detailcolumn.js");
|
|
30910
|
+
const createDetailColumn=__m14["createDetailColumn"];
|
|
30911
|
+
const DETAIL_COLUMN_ID=__m14["DETAIL_COLUMN_ID"];
|
|
30912
|
+
const __m15=__req("packages/core/src/columns/treecolumn.js");
|
|
30913
|
+
const createTreeColumn=__m15["createTreeColumn"];
|
|
30914
|
+
const TREE_COLUMN_ID=__m15["TREE_COLUMN_ID"];
|
|
30915
|
+
const __m16=__req("packages/core/src/columns/pivotcolumns.js");
|
|
30916
|
+
const createPivotColumns=__m16["createPivotColumns"];
|
|
30917
|
+
const __m17=__req("packages/core/src/compute/pivot.js");
|
|
30918
|
+
const pivotKey=__m17["pivotKey"];
|
|
30919
|
+
const DEFAULT_PATH_SEPARATOR=__m17["DEFAULT_PATH_SEPARATOR"];
|
|
30920
|
+
const __m18=__req("packages/core/src/columns/value.js");
|
|
30921
|
+
const ValuePipeline=__m18["ValuePipeline"];
|
|
30922
|
+
const __m19=__req("packages/core/src/store/columnstore.js");
|
|
30923
|
+
const ColumnStore=__m19["ColumnStore"];
|
|
30924
|
+
const __m20=__req("packages/core/src/store/pool.js");
|
|
30925
|
+
const MaskPool=__m20["MaskPool"];
|
|
30926
|
+
const __m21=__req("packages/core/src/compute/index.js");
|
|
30927
|
+
const compute=__m21;
|
|
30928
|
+
const __m22=__req("packages/core/src/source/index.js");
|
|
30929
|
+
const createSource=__m22["createSource"];
|
|
30930
|
+
const DERIVED_ROW_KEY=__m22["DERIVED_ROW_KEY"];
|
|
30931
|
+
const __m23=__req("packages/core/src/source/rows.js");
|
|
30932
|
+
const pinnedRow=__m23["pinnedRow"];
|
|
30933
|
+
const DEFAULT_ROW_HEIGHT=__m23["DEFAULT_ROW_HEIGHT"];
|
|
30934
|
+
const __m24=__req("packages/core/src/model/rowkey.js");
|
|
30935
|
+
const createRowKey=__m24["createRowKey"];
|
|
30936
|
+
const __m25=__req("packages/core/src/model/rowmodel.js");
|
|
30937
|
+
const RowModel=__m25["RowModel"];
|
|
30938
|
+
const createRow=__m25["createRow"];
|
|
30939
|
+
const __m26=__req("packages/core/src/model/selection.js");
|
|
30940
|
+
const SelectionModel=__m26["SelectionModel"];
|
|
30941
|
+
const RangeModel=__m26["RangeModel"];
|
|
30942
|
+
const summarise=__m26["summarise"];
|
|
30943
|
+
const __m27=__req("packages/core/src/model/history.js");
|
|
30944
|
+
const HistoryModel=__m27["HistoryModel"];
|
|
30945
|
+
const __m28=__req("packages/core/src/model/diff.js");
|
|
30946
|
+
const DiffModel=__m28["DiffModel"];
|
|
30947
|
+
const readValue=__m28["readValue"];
|
|
30948
|
+
const __m29=__req("packages/core/src/model/views.js");
|
|
30949
|
+
const ViewStore=__m29["ViewStore"];
|
|
30950
|
+
const __m30=__req("packages/core/src/model/highlight.js");
|
|
30951
|
+
const HighlightModel=__m30["HighlightModel"];
|
|
30952
|
+
const __m31=__req("packages/core/src/model/redaction.js");
|
|
30953
|
+
const RedactionModel=__m31["RedactionModel"];
|
|
30954
|
+
const __m32=__req("packages/core/src/model/presentation.js");
|
|
30955
|
+
const PresentationModel=__m32["PresentationModel"];
|
|
30956
|
+
const __m33=__req("packages/core/src/model/timeline.js");
|
|
30957
|
+
const Timeline=__m33["Timeline"];
|
|
30958
|
+
const __m34=__req("packages/core/src/model/facets.js");
|
|
30959
|
+
const FacetModel=__m34["FacetModel"];
|
|
30960
|
+
const DEFAULT_DEBOUNCE=__m34["DEFAULT_DEBOUNCE"];
|
|
30961
|
+
const DEFAULT_ROW_CEILING=__m34["DEFAULT_ROW_CEILING"];
|
|
30962
|
+
const DEFAULT_FACET_HEIGHT=__m34["DEFAULT_FACET_HEIGHT"];
|
|
30963
|
+
const __m35=__req("packages/core/src/model/comments.js");
|
|
30964
|
+
const CommentModel=__m35["CommentModel"];
|
|
30965
|
+
const parseCommentKey=__m35["parseCellKey"];
|
|
30966
|
+
const DEFAULT_INDEX_DEBOUNCE=__m35["DEFAULT_INDEX_DEBOUNCE"];
|
|
30967
|
+
const DEFAULT_INDEX_LIMIT=__m35["DEFAULT_INDEX_LIMIT"];
|
|
30968
|
+
const __m36=__req("packages/core/src/model/diagnostics.js");
|
|
30969
|
+
const Diagnostics=__m36["Diagnostics"];
|
|
30970
|
+
const WARNING_IDS=__m36["WARNING_IDS"];
|
|
30971
|
+
const instrument=__m36["instrument"];
|
|
30972
|
+
const instrumentProvider=__m36["instrumentProvider"];
|
|
30973
|
+
const __m37=__req("packages/core/src/model/presence.js");
|
|
30974
|
+
const PresenceModel=__m37["PresenceModel"];
|
|
30975
|
+
const DEFAULT_THROTTLE_MS=__m37["DEFAULT_THROTTLE_MS"];
|
|
30976
|
+
const DEFAULT_IDLE_MS=__m37["DEFAULT_IDLE_MS"];
|
|
30977
|
+
const DEFAULT_REMOVE_MS=__m37["DEFAULT_REMOVE_MS"];
|
|
30978
|
+
const DEFAULT_LOCK_MS=__m37["DEFAULT_LOCK_MS"];
|
|
30979
|
+
const __m38=__req("packages/core/src/compute/facet.js");
|
|
30980
|
+
const facetKind=__m38["facetKind"];
|
|
30981
|
+
const DEFAULT_BUCKETS=__m38["DEFAULT_BUCKETS"];
|
|
30982
|
+
const DEFAULT_CARDINALITY_LIMIT=__m38["DEFAULT_CARDINALITY_LIMIT"];
|
|
30983
|
+
const __m39=__req("packages/worker/src/host.js");
|
|
30984
|
+
const createWorkerHost=__m39["createWorkerHost"];
|
|
30985
|
+
const __m40=__req("packages/core/src/i18n/index.js");
|
|
30986
|
+
const Messages=__m40["Messages"];
|
|
30987
|
+
const MESSAGE_KEYS=__m40["MESSAGE_KEYS"];
|
|
30988
|
+
const __m41=__req("packages/core/src/model/pending.js");
|
|
30989
|
+
const PendingWrites=__m41["PendingWrites"];
|
|
30990
|
+
const __m42=__req("packages/core/src/registry/licence.js");
|
|
30991
|
+
const setSharedLicence=__m42["setLicence"];
|
|
30992
|
+
const licenceInfo=__m42["licenceInfo"];
|
|
30993
|
+
const licenceWatermark=__m42["watermark"];
|
|
30994
|
+
const licenceState=__m42["licenceState"];
|
|
30995
|
+
const sharedLicence=__m42["sharedLicence"];
|
|
30996
|
+
const __m43=__req("packages/core/src/columns/permissions.js");
|
|
30997
|
+
const PermissionModel=__m43["PermissionModel"];
|
|
30998
|
+
const __m44=__req("packages/core/src/ai/schema.js");
|
|
30999
|
+
const describeGrid=__m44["describeGrid"];
|
|
31000
|
+
const promptText=__m44["promptText"];
|
|
31001
|
+
const toolDefinition=__m44["toolDefinition"];
|
|
31002
|
+
const __m45=__req("packages/core/src/ai/intent.js");
|
|
31003
|
+
const planIntent=__m45["planIntent"];
|
|
31004
|
+
const applyPlan=__m45["applyPlan"];
|
|
31005
|
+
const buildPrompt=__m45["buildPrompt"];
|
|
31006
|
+
const __m46=__req("packages/core/src/model/edit.js");
|
|
31007
|
+
const EditModel=__m46["EditModel"];
|
|
31008
|
+
const __m47=__req("packages/core/src/model/changes.js");
|
|
31009
|
+
const ChangeModel=__m47["ChangeModel"];
|
|
31010
|
+
const __m48=__req("packages/core/src/model/state.js");
|
|
31011
|
+
const StateModel=__m48["StateModel"];
|
|
31012
|
+
const __m49=__req("packages/core/src/formatting/model.js");
|
|
31013
|
+
const FormattingModel=__m49["FormattingModel"];
|
|
31014
|
+
const GRID_SCOPE=__m49["GRID_SCOPE"];
|
|
31015
|
+
const __m50=__req("packages/core/src/formatting/rules.js");
|
|
31016
|
+
const summariseColumn=__m50["summariseColumn"];
|
|
31017
|
+
const __m51=__req("packages/core/src/export/index.js");
|
|
31018
|
+
const exportCsv=__m51["exportCsv"];
|
|
31019
|
+
const exportExcel=__m51["exportExcel"];
|
|
31020
|
+
const copyToClipboard=__m51["copyToClipboard"];
|
|
31021
|
+
const writeClipboardText=__m51["writeClipboardText"];
|
|
31022
|
+
const printGrid=__m51["printGrid"];
|
|
31023
|
+
const buildClipboardText=__m51["buildClipboardText"];
|
|
31024
|
+
const pasteIntoRange=__m51["pasteIntoRange"];
|
|
31025
|
+
const writeHookFor=__m51["writeHookFor"];
|
|
31026
|
+
const parseClipboardText=__m51["parseClipboardText"];
|
|
30313
31027
|
const QUICK_MODES=['contains','words','fuzzy','regex'];
|
|
30314
31028
|
function canonicalise(column,value){
|
|
30315
31029
|
const lookup=column&&column.lookup;
|
|
@@ -30475,7 +31189,7 @@ const KNOWN_CONFIG_KEYS=new Set([
|
|
|
30475
31189
|
'environment','facets','formatting','formulaFunctions','fullWidth','gallery',
|
|
30476
31190
|
'grandTotalRow','gridLines','groupFooter','groupPanel','headerHeight','highlightOnChange',
|
|
30477
31191
|
'historyBar','hostFilter','ingest','licence','locale','maximise','overscan','pagination',
|
|
30478
|
-
'permissions','pinnedBottomRows','pinnedTopRows','pipes','pivot','presence',
|
|
31192
|
+
'permissions','pinnedBottomRows','pinnedTopRows','pipes','pivot','pivotView','presence',
|
|
30479
31193
|
'quickFilterText','rangeChart','recordCard','responsive','rowClass','rowForm','rowHeight','rowKey',
|
|
30480
31194
|
'rowReorder','rowStyle','rowTemplate','rowTransfer','rows','sampleSize',
|
|
30481
31195
|
'selection','sharedMemory','shortcuts','showColumnFunctions','showHeader',
|
|
@@ -30817,7 +31531,13 @@ if(!e||e.key===undefined||e.colId===undefined)return;
|
|
|
30817
31531
|
this.#highlights.add({key:e.key,colId:e.colId},flash);
|
|
30818
31532
|
});
|
|
30819
31533
|
}
|
|
30820
|
-
const
|
|
31534
|
+
const srcCfg=this.#config.source;
|
|
31535
|
+
const isRemoteSource=isObject(srcCfg)
|
|
31536
|
+
&&(srcCfg).mode==='remote';
|
|
31537
|
+
const sourceEdit=isRemoteSource?(srcCfg).edit:undefined;
|
|
31538
|
+
const optimistic=optimisticConfig(
|
|
31539
|
+
this.#config.edit,sourceEdit,isRemoteSource,
|
|
31540
|
+
);
|
|
30821
31541
|
if(optimistic){
|
|
30822
31542
|
this.#pending=new PendingWrites({
|
|
30823
31543
|
commit:instrument(optimistic.commit,'edit.commit',this.#diagnostics),
|
|
@@ -31047,6 +31767,12 @@ pivot:{
|
|
|
31047
31767
|
get:()=>({enabled:this.#query.pivotMode,columns:[...this.#query.pivotBy]}),
|
|
31048
31768
|
set:(v)=>{this.#query.pivotMode=!!(v&&v.enabled);this.columns.pivot((v&&v.columns)||[]);},
|
|
31049
31769
|
},
|
|
31770
|
+
pivotView:{
|
|
31771
|
+
get:()=>(this.#renderer&&isFunction(this.#renderer.pivotState)
|
|
31772
|
+
?this.#renderer.pivotState():{rowsCollapsed:[],columnsCollapsed:[]}),
|
|
31773
|
+
set:(v)=>this.#renderer&&isFunction(this.#renderer.applyPivotState)
|
|
31774
|
+
&&this.#renderer.applyPivotState(v),
|
|
31775
|
+
},
|
|
31050
31776
|
formatting:this.#formatting,
|
|
31051
31777
|
redaction:this.#redaction,
|
|
31052
31778
|
facets:this.#facets,
|
|
@@ -31659,6 +32385,10 @@ formatting:this.#formatting,
|
|
|
31659
32385
|
groupHeadingsAt:(index)=>(isFunction(this.#source.groupHeadingsAt)
|
|
31660
32386
|
?this.#source.groupHeadingsAt(index)
|
|
31661
32387
|
:EMPTY_ROWS),
|
|
32388
|
+
pivotMatrix:()=>(isFunction(this.#source.pivotMatrix)
|
|
32389
|
+
?this.#source.pivotMatrix():null),
|
|
32390
|
+
pivotDrillKeys:(indices)=>(isFunction(this.#source.keysForLeaves)
|
|
32391
|
+
?this.#source.keysForLeaves(indices):[]),
|
|
31662
32392
|
stickyRows:()=>{
|
|
31663
32393
|
const grand=this.#source.grandTotalRow?this.#source.grandTotalRow():null;
|
|
31664
32394
|
const bottom=grand?[grand]:[];
|
|
@@ -32340,6 +33070,25 @@ selection.select(key,{additive:!!mode.additive,range:!!mode.range,origin:'user'}
|
|
|
32340
33070
|
}
|
|
32341
33071
|
this.#renderer?.refresh({force:false});
|
|
32342
33072
|
}
|
|
33073
|
+
get pivotView(){
|
|
33074
|
+
const grid=this;
|
|
33075
|
+
const setNode=(axis,path,collapsed)=>{
|
|
33076
|
+
const r=grid.#renderer;
|
|
33077
|
+
if(!r||!isFunction(r.pivotState)||!isFunction(r.togglePivot))return;
|
|
33078
|
+
const set=axis==='column'
|
|
33079
|
+
?r.pivotState().columnsCollapsed:r.pivotState().rowsCollapsed;
|
|
33080
|
+
const isNow=set.includes(path);
|
|
33081
|
+
if(isNow!==collapsed)r.togglePivot(axis,path);
|
|
33082
|
+
};
|
|
33083
|
+
return{
|
|
33084
|
+
expand:(axis,path)=>setNode(axis,path,false),
|
|
33085
|
+
collapse:(axis,path)=>setNode(axis,path,true),
|
|
33086
|
+
toggle:(axis,path)=>grid.#renderer
|
|
33087
|
+
&&isFunction(grid.#renderer.togglePivot)&&grid.#renderer.togglePivot(axis,path),
|
|
33088
|
+
state:()=>(grid.#renderer&&isFunction(grid.#renderer.pivotState)
|
|
33089
|
+
?grid.#renderer.pivotState():{rowsCollapsed:[],columnsCollapsed:[]}),
|
|
33090
|
+
};
|
|
33091
|
+
}
|
|
32343
33092
|
get rows(){
|
|
32344
33093
|
const grid=this;
|
|
32345
33094
|
return{
|
|
@@ -33841,6 +34590,42 @@ return key===undefined||key===null?null:String(key);
|
|
|
33841
34590
|
maintenance:MAINTENANCE,
|
|
33842
34591
|
approximate:APPROXIMATE,
|
|
33843
34592
|
maintenanceTier(fn){return maintenanceOf(fn);},
|
|
34593
|
+
windowed(colId,fn,opts={}){
|
|
34594
|
+
const kind=opts&&opts.kind;
|
|
34595
|
+
if(!WINDOW_KINDS.includes(kind)){
|
|
34596
|
+
throw new RangeError(`unknown window kind: ${kind}`);
|
|
34597
|
+
}
|
|
34598
|
+
const handle=grid.#handleFor(colId);
|
|
34599
|
+
if(!handle)return null;
|
|
34600
|
+
const needsClock=kind==='time'||kind==='session';
|
|
34601
|
+
const orderHandle=opts.by?grid.#handleFor(opts.by):null;
|
|
34602
|
+
if(needsClock&&!orderHandle){
|
|
34603
|
+
throw new TypeError(`a ${kind} window needs a timestamp column: pass { by }`);
|
|
34604
|
+
}
|
|
34605
|
+
const indices=grid.#statIndices();
|
|
34606
|
+
grid.#warnWindowedStat('windowed',colId,indices.length);
|
|
34607
|
+
const readValue=statValueReader(handle);
|
|
34608
|
+
const readOrder=orderHandle?statValueReader(orderHandle):null;
|
|
34609
|
+
const rows=[];
|
|
34610
|
+
for(let i=0;i<indices.length;i++){
|
|
34611
|
+
const row=indices[i];
|
|
34612
|
+
const v=Number(readValue(row));
|
|
34613
|
+
if(!Number.isFinite(v))continue;
|
|
34614
|
+
let at=i;
|
|
34615
|
+
if(readOrder){
|
|
34616
|
+
const raw=readOrder(row);
|
|
34617
|
+
at=raw instanceof Date?raw.getTime()
|
|
34618
|
+
:(typeof raw==='number'?raw:Date.parse(String(raw)));
|
|
34619
|
+
if(!Number.isFinite(at))continue;
|
|
34620
|
+
}
|
|
34621
|
+
rows.push([at,v]);
|
|
34622
|
+
}
|
|
34623
|
+
if(readOrder)rows.sort((a,b)=>a[0]-b[0]);
|
|
34624
|
+
let clock=rows.length?rows[0][0]:0;
|
|
34625
|
+
const win=openWindow(opts,()=>clock);
|
|
34626
|
+
for(const[at,v]of rows){clock=at;win.push(v,at);}
|
|
34627
|
+
return win.reduce(fn);
|
|
34628
|
+
},
|
|
33844
34629
|
};
|
|
33845
34630
|
}
|
|
33846
34631
|
get formatting(){
|
|
@@ -34091,7 +34876,28 @@ return VERSION;
|
|
|
34091
34876
|
function version(){
|
|
34092
34877
|
return VERSION;
|
|
34093
34878
|
}
|
|
34094
|
-
function optimisticConfig(config){
|
|
34879
|
+
function optimisticConfig(config,sourceEdit,warnIfNoCommit){
|
|
34880
|
+
if(config===true){
|
|
34881
|
+
const fromSource=sourceEdit&&typeof sourceEdit==='object'
|
|
34882
|
+
&&isFunction((sourceEdit).commit)
|
|
34883
|
+
?sourceEdit
|
|
34884
|
+
:null;
|
|
34885
|
+
if(!fromSource){
|
|
34886
|
+
if(warnIfNoCommit){
|
|
34887
|
+
warnOnce(
|
|
34888
|
+
'edit.true.nocommit',
|
|
34889
|
+
'edit: true was set over a remote source but nothing can persist the write: '
|
|
34890
|
+
+'no edit.commit hook and the source synthesised none (a read-only adapter, '
|
|
34891
|
+
+'or one that does not declare mutate.update). Cells would change on screen '
|
|
34892
|
+
+'but never save, with no pending/confirmed/reverted events. Pass '
|
|
34893
|
+
+'`edit: source.edit` from a mutating createPushdownSource, or '
|
|
34894
|
+
+'`edit: { commit }` with your own write hook, to enable optimistic write-back.',
|
|
34895
|
+
);
|
|
34896
|
+
}
|
|
34897
|
+
return null;
|
|
34898
|
+
}
|
|
34899
|
+
config=fromSource;
|
|
34900
|
+
}
|
|
34095
34901
|
if(!config||typeof config!=='object')return null;
|
|
34096
34902
|
const any=(config);
|
|
34097
34903
|
if(!isFunction(any.commit)){
|
|
@@ -34174,6 +34980,12 @@ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){ret
|
|
|
34174
34980
|
Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return UNIT_SYSTEMS;}});
|
|
34175
34981
|
Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return parseUnit;}});
|
|
34176
34982
|
Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return formatUnit;}});
|
|
34983
|
+
Object.defineProperty(__exports,"createCurrencyType",{enumerable:true,get:function(){return createCurrencyType;}});
|
|
34984
|
+
Object.defineProperty(__exports,"parseMoney",{enumerable:true,get:function(){return parseMoney;}});
|
|
34985
|
+
Object.defineProperty(__exports,"formatMoney",{enumerable:true,get:function(){return formatMoney;}});
|
|
34986
|
+
Object.defineProperty(__exports,"convertMoney",{enumerable:true,get:function(){return convertMoney;}});
|
|
34987
|
+
Object.defineProperty(__exports,"rateFunction",{enumerable:true,get:function(){return rateFunction;}});
|
|
34988
|
+
Object.defineProperty(__exports,"MISSING_RATE",{enumerable:true,get:function(){return MISSING_RATE;}});
|
|
34177
34989
|
const __m0=__req("packages/core/src/columns/types/index.js");
|
|
34178
34990
|
const EXTENDED_TYPES=__m0["EXTENDED_TYPES"];
|
|
34179
34991
|
const createRadixType=__m0["createRadixType"];
|
|
@@ -34186,6 +34998,12 @@ const defineUnit=__m0["defineUnit"];
|
|
|
34186
34998
|
const UNIT_SYSTEMS=__m0["UNIT_SYSTEMS"];
|
|
34187
34999
|
const parseUnit=__m0["parseUnit"];
|
|
34188
35000
|
const formatUnit=__m0["formatUnit"];
|
|
35001
|
+
const createCurrencyType=__m0["createCurrencyType"];
|
|
35002
|
+
const parseMoney=__m0["parseMoney"];
|
|
35003
|
+
const formatMoney=__m0["formatMoney"];
|
|
35004
|
+
const convertMoney=__m0["convertMoney"];
|
|
35005
|
+
const rateFunction=__m0["rateFunction"];
|
|
35006
|
+
const MISSING_RATE=__m0["MISSING_RATE"];
|
|
34189
35007
|
const __m1=__req("packages/core/src/columns/model.js");
|
|
34190
35008
|
Object.defineProperty(__exports,"ColumnModel",{enumerable:true,get:function(){return __m1["ColumnModel"];}});
|
|
34191
35009
|
Object.defineProperty(__exports,"expandColumn",{enumerable:true,get:function(){return __m1["expandColumn"];}});
|
|
@@ -34668,6 +35486,7 @@ other:'Appliquer {count} mises à jour en attente',
|
|
|
34668
35486
|
'editor.clearRating':'Effacer la note',
|
|
34669
35487
|
'editor.clear':'Effacer',
|
|
34670
35488
|
'editor.value':'Valeur',
|
|
35489
|
+
'editor.currency':'Devise',
|
|
34671
35490
|
'formatting.format':'Format',
|
|
34672
35491
|
'formatting.noRules':'Aucune règle. La première qui correspond à une cellule l\'emporte.',
|
|
34673
35492
|
'formatting.clearAll':'Tout effacer',
|
|
@@ -35194,6 +36013,7 @@ other:'Applica {count} aggiornamenti in attesa',
|
|
|
35194
36013
|
'editor.clearRating':'Cancella valutazione',
|
|
35195
36014
|
'editor.clear':'Cancella',
|
|
35196
36015
|
'editor.value':'Valore',
|
|
36016
|
+
'editor.currency':'Valuta',
|
|
35197
36017
|
'formatting.format':'Formato',
|
|
35198
36018
|
'formatting.noRules':'Ancora nessuna regola. Vince la prima che corrisponde a una cella.',
|
|
35199
36019
|
'formatting.clearAll':'Cancella tutto',
|
|
@@ -35705,6 +36525,7 @@ other:'Aplicar {count} actualizaciones retenidas',
|
|
|
35705
36525
|
'editor.clearRating':'Borrar valoración',
|
|
35706
36526
|
'editor.clear':'Borrar',
|
|
35707
36527
|
'editor.value':'Valor',
|
|
36528
|
+
'editor.currency':'Moneda',
|
|
35708
36529
|
'formatting.format':'Formato',
|
|
35709
36530
|
'formatting.noRules':'Aún no hay reglas. Gana la primera que coincida con una celda.',
|
|
35710
36531
|
'formatting.clearAll':'Borrar todo',
|
|
@@ -36243,6 +37064,7 @@ other:'Aplicar {count} atualizações retidas',
|
|
|
36243
37064
|
'editor.clearRating':'Limpar avaliação',
|
|
36244
37065
|
'editor.clear':'Limpar',
|
|
36245
37066
|
'editor.value':'Valor',
|
|
37067
|
+
'editor.currency':'Moeda',
|
|
36246
37068
|
'formatting.format':'Formato',
|
|
36247
37069
|
'formatting.noRules':'Ainda não há regras. A primeira que corresponder a uma célula vence.',
|
|
36248
37070
|
'formatting.clearAll':'Limpar tudo',
|
|
@@ -36781,6 +37603,7 @@ other:'{count} zurückgehaltene Aktualisierungen anwenden',
|
|
|
36781
37603
|
'editor.clearRating':'Bewertung löschen',
|
|
36782
37604
|
'editor.clear':'Leeren',
|
|
36783
37605
|
'editor.value':'Wert',
|
|
37606
|
+
'editor.currency':'Währung',
|
|
36784
37607
|
'formatting.format':'Format',
|
|
36785
37608
|
'formatting.noRules':'Noch keine Regeln. Die erste Regel, die auf eine Zelle zutrifft, gewinnt.',
|
|
36786
37609
|
'formatting.clearAll':'Alle löschen',
|
|
@@ -37319,6 +38142,7 @@ other:'{count} vastgehouden updates toepassen',
|
|
|
37319
38142
|
'editor.clearRating':'Beoordeling wissen',
|
|
37320
38143
|
'editor.clear':'Wissen',
|
|
37321
38144
|
'editor.value':'Waarde',
|
|
38145
|
+
'editor.currency':'Valuta',
|
|
37322
38146
|
'formatting.format':'Opmaak',
|
|
37323
38147
|
'formatting.noRules':'Nog geen regels. De eerste die op een cel past, wint.',
|
|
37324
38148
|
'formatting.clearAll':'Alles wissen',
|
|
@@ -37857,6 +38681,7 @@ other:'Tillämpa {count} hållna uppdateringar',
|
|
|
37857
38681
|
'editor.clearRating':'Rensa betyg',
|
|
37858
38682
|
'editor.clear':'Rensa',
|
|
37859
38683
|
'editor.value':'Värde',
|
|
38684
|
+
'editor.currency':'Valuta',
|
|
37860
38685
|
'formatting.format':'Format',
|
|
37861
38686
|
'formatting.noRules':'Inga regler ännu. Den första som matchar en cell vinner.',
|
|
37862
38687
|
'formatting.clearAll':'Rensa alla',
|
|
@@ -38395,6 +39220,7 @@ other:'Anvend {count} tilbageholdte opdateringer',
|
|
|
38395
39220
|
'editor.clearRating':'Ryd bedømmelse',
|
|
38396
39221
|
'editor.clear':'Ryd',
|
|
38397
39222
|
'editor.value':'Værdi',
|
|
39223
|
+
'editor.currency':'Valuta',
|
|
38398
39224
|
'formatting.format':'Format',
|
|
38399
39225
|
'formatting.noRules':'Ingen regler endnu. Den første, der matcher en celle, vinder.',
|
|
38400
39226
|
'formatting.clearAll':'Ryd alle',
|
|
@@ -38933,6 +39759,7 @@ other:'Bruk {count} tilbakeholdte oppdateringer',
|
|
|
38933
39759
|
'editor.clearRating':'Tøm vurdering',
|
|
38934
39760
|
'editor.clear':'Tøm',
|
|
38935
39761
|
'editor.value':'Verdi',
|
|
39762
|
+
'editor.currency':'Valuta',
|
|
38936
39763
|
'formatting.format':'Format',
|
|
38937
39764
|
'formatting.noRules':'Ingen regler ennå. Den første som treffer en celle, vinner.',
|
|
38938
39765
|
'formatting.clearAll':'Tøm alle',
|
|
@@ -39471,6 +40298,7 @@ other:'Ota käyttöön {count} pidätettyä päivitystä',
|
|
|
39471
40298
|
'editor.clearRating':'Tyhjennä arvio',
|
|
39472
40299
|
'editor.clear':'Tyhjennä',
|
|
39473
40300
|
'editor.value':'Arvo',
|
|
40301
|
+
'editor.currency':'Valuutta',
|
|
39474
40302
|
'formatting.format':'Muotoilu',
|
|
39475
40303
|
'formatting.noRules':'Ei vielä sääntöjä. Ensimmäinen soluun osuva voittaa.',
|
|
39476
40304
|
'formatting.clearAll':'Tyhjennä kaikki',
|
|
@@ -40043,6 +40871,7 @@ other:'Zastosuj {count} wstrzymanych aktualizacji',
|
|
|
40043
40871
|
'editor.clearRating':'Wyczyść ocenę',
|
|
40044
40872
|
'editor.clear':'Wyczyść',
|
|
40045
40873
|
'editor.value':'Wartość',
|
|
40874
|
+
'editor.currency':'Waluta',
|
|
40046
40875
|
'formatting.format':'Format',
|
|
40047
40876
|
'formatting.noRules':'Brak reguł. Wygrywa pierwsza pasująca do komórki.',
|
|
40048
40877
|
'formatting.clearAll':'Wyczyść wszystko',
|
|
@@ -40615,6 +41444,7 @@ other:'Použít {count} pozdržených aktualizací',
|
|
|
40615
41444
|
'editor.clearRating':'Vymazat hodnocení',
|
|
40616
41445
|
'editor.clear':'Vymazat',
|
|
40617
41446
|
'editor.value':'Hodnota',
|
|
41447
|
+
'editor.currency':'Měna',
|
|
40618
41448
|
'formatting.format':'Formát',
|
|
40619
41449
|
'formatting.noRules':'Zatím žádná pravidla. Vyhrává první, které odpovídá buňce.',
|
|
40620
41450
|
'formatting.clearAll':'Vymazat vše',
|
|
@@ -41153,6 +41983,7 @@ other:'{count} visszatartott frissítés alkalmazása',
|
|
|
41153
41983
|
'editor.clearRating':'Értékelés törlése',
|
|
41154
41984
|
'editor.clear':'Törlés',
|
|
41155
41985
|
'editor.value':'Érték',
|
|
41986
|
+
'editor.currency':'Pénznem',
|
|
41156
41987
|
'formatting.format':'Formátum',
|
|
41157
41988
|
'formatting.noRules':'Még nincsenek szabályok. Az első nyer, amely illeszkedik egy cellára.',
|
|
41158
41989
|
'formatting.clearAll':'Összes törlése',
|
|
@@ -41708,6 +42539,7 @@ other:'Aplică {count} de actualizări reținute',
|
|
|
41708
42539
|
'editor.clearRating':'Șterge evaluarea',
|
|
41709
42540
|
'editor.clear':'Golește',
|
|
41710
42541
|
'editor.value':'Valoare',
|
|
42542
|
+
'editor.currency':'Monedă',
|
|
41711
42543
|
'formatting.format':'Format',
|
|
41712
42544
|
'formatting.noRules':'Încă nicio regulă. Câștigă prima care se potrivește unei celule.',
|
|
41713
42545
|
'formatting.clearAll':'Șterge tot',
|
|
@@ -42280,6 +43112,7 @@ other:'Застосувати {count} затриманих оновлень',
|
|
|
42280
43112
|
'editor.clearRating':'Очистити оцінку',
|
|
42281
43113
|
'editor.clear':'Очистити',
|
|
42282
43114
|
'editor.value':'Значення',
|
|
43115
|
+
'editor.currency':'Валюта',
|
|
42283
43116
|
'formatting.format':'Формат',
|
|
42284
43117
|
'formatting.noRules':'Ще немає правил. Перемагає перше, що відповідає комірці.',
|
|
42285
43118
|
'formatting.clearAll':'Очистити все',
|
|
@@ -42818,6 +43651,7 @@ other:'Εφαρμογή {count} συγκρατημένων ενημερώσεω
|
|
|
42818
43651
|
'editor.clearRating':'Εκκαθάριση βαθμολογίας',
|
|
42819
43652
|
'editor.clear':'Εκκαθάριση',
|
|
42820
43653
|
'editor.value':'Τιμή',
|
|
43654
|
+
'editor.currency':'Νόμισμα',
|
|
42821
43655
|
'formatting.format':'Μορφή',
|
|
42822
43656
|
'formatting.noRules':'Δεν υπάρχουν κανόνες ακόμη. Κερδίζει ο πρώτος που ταιριάζει σε ένα κελί.',
|
|
42823
43657
|
'formatting.clearAll':'Εκκαθάριση όλων',
|
|
@@ -43338,6 +44172,7 @@ other:'保留中の更新 {count} 件を適用',
|
|
|
43338
44172
|
'editor.clearRating':'評価をクリア',
|
|
43339
44173
|
'editor.clear':'クリア',
|
|
43340
44174
|
'editor.value':'値',
|
|
44175
|
+
'editor.currency':'通貨',
|
|
43341
44176
|
'formatting.format':'書式',
|
|
43342
44177
|
'formatting.noRules':'ルールがまだありません。セルに最初に一致したルールが適用されます。',
|
|
43343
44178
|
'formatting.clearAll':'すべてクリア',
|
|
@@ -43948,6 +44783,7 @@ other:'تطبيق {count} تحديث معلّق',
|
|
|
43948
44783
|
'editor.clearRating':'مسح التقييم',
|
|
43949
44784
|
'editor.clear':'مسح',
|
|
43950
44785
|
'editor.value':'قيمة',
|
|
44786
|
+
'editor.currency':'العملة',
|
|
43951
44787
|
'formatting.format':'تنسيق',
|
|
43952
44788
|
'formatting.noRules':'لا توجد قواعد بعد. تفوز أول قاعدة تطابق الخلية.',
|
|
43953
44789
|
'formatting.clearAll':'مسح الكل',
|
|
@@ -44270,6 +45106,12 @@ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){ret
|
|
|
44270
45106
|
Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m5["UNIT_SYSTEMS"];}});
|
|
44271
45107
|
Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m5["parseUnit"];}});
|
|
44272
45108
|
Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m5["formatUnit"];}});
|
|
45109
|
+
Object.defineProperty(__exports,"createCurrencyType",{enumerable:true,get:function(){return __m5["createCurrencyType"];}});
|
|
45110
|
+
Object.defineProperty(__exports,"parseMoney",{enumerable:true,get:function(){return __m5["parseMoney"];}});
|
|
45111
|
+
Object.defineProperty(__exports,"formatMoney",{enumerable:true,get:function(){return __m5["formatMoney"];}});
|
|
45112
|
+
Object.defineProperty(__exports,"convertMoney",{enumerable:true,get:function(){return __m5["convertMoney"];}});
|
|
45113
|
+
Object.defineProperty(__exports,"rateFunction",{enumerable:true,get:function(){return __m5["rateFunction"];}});
|
|
45114
|
+
Object.defineProperty(__exports,"MISSING_RATE",{enumerable:true,get:function(){return __m5["MISSING_RATE"];}});
|
|
44273
45115
|
const __m6=__req("packages/core/src/i18n/index.js");
|
|
44274
45116
|
Object.defineProperty(__exports,"Messages",{enumerable:true,get:function(){return __m6["Messages"];}});
|
|
44275
45117
|
Object.defineProperty(__exports,"createMessages",{enumerable:true,get:function(){return __m6["createMessages"];}});
|
|
@@ -44325,6 +45167,14 @@ Object.defineProperty(__exports,"groupByColumns",{enumerable:true,get:function()
|
|
|
44325
45167
|
Object.defineProperty(__exports,"total",{enumerable:true,get:function(){return __m9["total"];}});
|
|
44326
45168
|
Object.defineProperty(__exports,"TOTAL_FNS",{enumerable:true,get:function(){return __m9["TOTAL_FNS"];}});
|
|
44327
45169
|
Object.defineProperty(__exports,"pivot",{enumerable:true,get:function(){return __m9["pivot"];}});
|
|
45170
|
+
Object.defineProperty(__exports,"Window",{enumerable:true,get:function(){return __m9["Window"];}});
|
|
45171
|
+
Object.defineProperty(__exports,"openWindow",{enumerable:true,get:function(){return __m9["openWindow"];}});
|
|
45172
|
+
Object.defineProperty(__exports,"WINDOW_KINDS",{enumerable:true,get:function(){return __m9["WINDOW_KINDS"];}});
|
|
45173
|
+
Object.defineProperty(__exports,"pivotMatrix",{enumerable:true,get:function(){return __m9["pivotMatrix"];}});
|
|
45174
|
+
Object.defineProperty(__exports,"resolveAxis",{enumerable:true,get:function(){return __m9["resolveAxis"];}});
|
|
45175
|
+
Object.defineProperty(__exports,"cellKey",{enumerable:true,get:function(){return __m9["cellKey"];}});
|
|
45176
|
+
Object.defineProperty(__exports,"marginKey",{enumerable:true,get:function(){return __m9["marginKey"];}});
|
|
45177
|
+
Object.defineProperty(__exports,"GRAND_PATH",{enumerable:true,get:function(){return __m9["GRAND_PATH"];}});
|
|
44328
45178
|
const __m10=__req("packages/core/src/source/index.js");
|
|
44329
45179
|
Object.defineProperty(__exports,"createSource",{enumerable:true,get:function(){return __m10["createSource"];}});
|
|
44330
45180
|
Object.defineProperty(__exports,"createMemorySource",{enumerable:true,get:function(){return __m10["createMemorySource"];}});
|
|
@@ -44338,6 +45188,7 @@ Object.defineProperty(__exports,"planQuery",{enumerable:true,get:function(){retu
|
|
|
44338
45188
|
Object.defineProperty(__exports,"splitFilters",{enumerable:true,get:function(){return __m10["splitFilters"];}});
|
|
44339
45189
|
Object.defineProperty(__exports,"applyResidual",{enumerable:true,get:function(){return __m10["applyResidual"];}});
|
|
44340
45190
|
Object.defineProperty(__exports,"capabilitiesOf",{enumerable:true,get:function(){return __m10["capabilitiesOf"];}});
|
|
45191
|
+
Object.defineProperty(__exports,"resolveMutate",{enumerable:true,get:function(){return __m10["resolveMutate"];}});
|
|
44341
45192
|
Object.defineProperty(__exports,"NO_CAPABILITIES",{enumerable:true,get:function(){return __m10["NO_CAPABILITIES"];}});
|
|
44342
45193
|
Object.defineProperty(__exports,"odataAdapter",{enumerable:true,get:function(){return __m10["odataAdapter"];}});
|
|
44343
45194
|
Object.defineProperty(__exports,"filtersToOData",{enumerable:true,get:function(){return __m10["filtersToOData"];}});
|
|
@@ -47597,6 +48448,10 @@ Object.defineProperty(__exports,"DEFAULT_GALLERY_TILE_HEIGHT",{enumerable:true,g
|
|
|
47597
48448
|
Object.defineProperty(__exports,"DEFAULT_RECORD_HEIGHT",{enumerable:true,get:function(){return DEFAULT_RECORD_HEIGHT;}});
|
|
47598
48449
|
Object.defineProperty(__exports,"DEFAULT_LANE_WIDTH",{enumerable:true,get:function(){return DEFAULT_LANE_WIDTH;}});
|
|
47599
48450
|
Object.defineProperty(__exports,"DEFAULT_BOARD_CARD_HEIGHT",{enumerable:true,get:function(){return DEFAULT_BOARD_CARD_HEIGHT;}});
|
|
48451
|
+
Object.defineProperty(__exports,"DEFAULT_PIVOT_CELL_WIDTH",{enumerable:true,get:function(){return DEFAULT_PIVOT_CELL_WIDTH;}});
|
|
48452
|
+
Object.defineProperty(__exports,"DEFAULT_PIVOT_CELL_HEIGHT",{enumerable:true,get:function(){return DEFAULT_PIVOT_CELL_HEIGHT;}});
|
|
48453
|
+
Object.defineProperty(__exports,"DEFAULT_PIVOT_HEADER_WIDTH",{enumerable:true,get:function(){return DEFAULT_PIVOT_HEADER_WIDTH;}});
|
|
48454
|
+
Object.defineProperty(__exports,"DEFAULT_PIVOT_BREAKPOINT",{enumerable:true,get:function(){return DEFAULT_PIVOT_BREAKPOINT;}});
|
|
47600
48455
|
Object.defineProperty(__exports,"buildRecordTemplate",{enumerable:true,get:function(){return buildRecordTemplate;}});
|
|
47601
48456
|
Object.defineProperty(__exports,"buildGalleryTemplate",{enumerable:true,get:function(){return buildGalleryTemplate;}});
|
|
47602
48457
|
Object.defineProperty(__exports,"DEFAULT_CARD_HEIGHT",{enumerable:true,get:function(){return DEFAULT_CARD_HEIGHT;}});
|
|
@@ -47605,6 +48460,7 @@ Object.defineProperty(__exports,"resolveRowTemplate",{enumerable:true,get:functi
|
|
|
47605
48460
|
Object.defineProperty(__exports,"resolveGallery",{enumerable:true,get:function(){return resolveGallery;}});
|
|
47606
48461
|
Object.defineProperty(__exports,"resolveRecordCard",{enumerable:true,get:function(){return resolveRecordCard;}});
|
|
47607
48462
|
Object.defineProperty(__exports,"resolveBoard",{enumerable:true,get:function(){return resolveBoard;}});
|
|
48463
|
+
Object.defineProperty(__exports,"resolvePivotView",{enumerable:true,get:function(){return resolvePivotView;}});
|
|
47608
48464
|
Object.defineProperty(__exports,"guardedFields",{enumerable:true,get:function(){return guardedFields;}});
|
|
47609
48465
|
Object.defineProperty(__exports,"dataViewFor",{enumerable:true,get:function(){return dataViewFor;}});
|
|
47610
48466
|
Object.defineProperty(__exports,"paintCardContent",{enumerable:true,get:function(){return paintCardContent;}});
|
|
@@ -47623,6 +48479,10 @@ const DEFAULT_GALLERY_TILE_HEIGHT=180;
|
|
|
47623
48479
|
const DEFAULT_RECORD_HEIGHT=200;
|
|
47624
48480
|
const DEFAULT_LANE_WIDTH=280;
|
|
47625
48481
|
const DEFAULT_BOARD_CARD_HEIGHT=120;
|
|
48482
|
+
const DEFAULT_PIVOT_CELL_WIDTH=120;
|
|
48483
|
+
const DEFAULT_PIVOT_CELL_HEIGHT=32;
|
|
48484
|
+
const DEFAULT_PIVOT_HEADER_WIDTH=200;
|
|
48485
|
+
const DEFAULT_PIVOT_BREAKPOINT=640;
|
|
47626
48486
|
function escapeMarkup(value){
|
|
47627
48487
|
return String(value==null?'':value)
|
|
47628
48488
|
.replace(/&/g,'&')
|
|
@@ -47807,6 +48667,35 @@ resolved.laneGap=Number.isFinite(laneGap)&&laneGap>=0?laneGap:16;
|
|
|
47807
48667
|
}
|
|
47808
48668
|
return resolved;
|
|
47809
48669
|
}
|
|
48670
|
+
function resolvePivotView(config,context){
|
|
48671
|
+
if(!config)return null;
|
|
48672
|
+
const spec=config===true?{}:config;
|
|
48673
|
+
if(typeof spec!=='object')return null;
|
|
48674
|
+
const cellWidth=Number(spec.cellWidth);
|
|
48675
|
+
const cellHeight=Number(spec.cellHeight??spec.rowHeight);
|
|
48676
|
+
const headerWidth=Number(spec.headerWidth);
|
|
48677
|
+
const maxWidth=Number(spec.maxWidth);
|
|
48678
|
+
const fallbackTemplate=spec.fallbackTemplate??spec.template
|
|
48679
|
+
??buildRecordTemplate(context&&context.columns);
|
|
48680
|
+
const fallback=fallbackTemplate
|
|
48681
|
+
?resolveRowTemplate(
|
|
48682
|
+
typeof fallbackTemplate==='string'?{template:fallbackTemplate}:fallbackTemplate,
|
|
48683
|
+
context,
|
|
48684
|
+
)
|
|
48685
|
+
:null;
|
|
48686
|
+
return{
|
|
48687
|
+
flavor:'pivot',
|
|
48688
|
+
className:spec.className||null,
|
|
48689
|
+
role:spec.role??'grid',
|
|
48690
|
+
cellWidth:Number.isFinite(cellWidth)&&cellWidth>0?cellWidth:DEFAULT_PIVOT_CELL_WIDTH,
|
|
48691
|
+
cellHeight:Number.isFinite(cellHeight)&&cellHeight>0
|
|
48692
|
+
?cellHeight:DEFAULT_PIVOT_CELL_HEIGHT,
|
|
48693
|
+
headerWidth:Number.isFinite(headerWidth)&&headerWidth>0
|
|
48694
|
+
?headerWidth:DEFAULT_PIVOT_HEADER_WIDTH,
|
|
48695
|
+
maxWidth:Number.isFinite(maxWidth)&&maxWidth>0?maxWidth:DEFAULT_PIVOT_BREAKPOINT,
|
|
48696
|
+
fallback,
|
|
48697
|
+
};
|
|
48698
|
+
}
|
|
47810
48699
|
function guardedFields(compiled,isProtected){
|
|
47811
48700
|
const fields=[];
|
|
47812
48701
|
if(isFunction(isProtected)){
|
|
@@ -48263,6 +49152,361 @@ this.#root=null;
|
|
|
48263
49152
|
}
|
|
48264
49153
|
}
|
|
48265
49154
|
});
|
|
49155
|
+
__def("packages/dom/src/renderer/pivot.js",function(__exports,__req){
|
|
49156
|
+
'use strict';
|
|
49157
|
+
Object.defineProperty(__exports,"PIVOT_CLASS",{enumerable:true,get:function(){return PIVOT_CLASS;}});
|
|
49158
|
+
Object.defineProperty(__exports,"PIVOT_CORNER_CLASS",{enumerable:true,get:function(){return PIVOT_CORNER_CLASS;}});
|
|
49159
|
+
Object.defineProperty(__exports,"PIVOT_COLHEAD_CLASS",{enumerable:true,get:function(){return PIVOT_COLHEAD_CLASS;}});
|
|
49160
|
+
Object.defineProperty(__exports,"PIVOT_ROWHEAD_CLASS",{enumerable:true,get:function(){return PIVOT_ROWHEAD_CLASS;}});
|
|
49161
|
+
Object.defineProperty(__exports,"PIVOT_CELL_CLASS",{enumerable:true,get:function(){return PIVOT_CELL_CLASS;}});
|
|
49162
|
+
Object.defineProperty(__exports,"PIVOT_TOTAL_CLASS",{enumerable:true,get:function(){return PIVOT_TOTAL_CLASS;}});
|
|
49163
|
+
Object.defineProperty(__exports,"axisEntries",{enumerable:true,get:function(){return axisEntries;}});
|
|
49164
|
+
Object.defineProperty(__exports,"PivotLayer",{enumerable:true,get:function(){return PivotLayer;}});
|
|
49165
|
+
const __m0=__req("packages/core/src/internal/util.js");
|
|
49166
|
+
const isFunction=__m0["isFunction"];
|
|
49167
|
+
const __m1=__req("packages/core/src/compute/pivotmatrix.js");
|
|
49168
|
+
const cellKey=__m1["cellKey"];
|
|
49169
|
+
const marginKey=__m1["marginKey"];
|
|
49170
|
+
const GRAND_PATH=__m1["GRAND_PATH"];
|
|
49171
|
+
const PIVOT_CLASS='lat-pivot';
|
|
49172
|
+
const PIVOT_CORNER_CLASS='lat-pivot-corner';
|
|
49173
|
+
const PIVOT_COLHEAD_CLASS='lat-pivot-colhead';
|
|
49174
|
+
const PIVOT_ROWHEAD_CLASS='lat-pivot-rowhead';
|
|
49175
|
+
const PIVOT_CELL_CLASS='lat-pivot-cell';
|
|
49176
|
+
const PIVOT_TOTAL_CLASS='lat-pivot-total';
|
|
49177
|
+
const OVERSCAN=2;
|
|
49178
|
+
function axisEntries(axis,separator,isCollapsed){
|
|
49179
|
+
const tuples=axis.tuples||[];
|
|
49180
|
+
const paths=axis.paths||[];
|
|
49181
|
+
const seen=new Set();
|
|
49182
|
+
const nodes=[];
|
|
49183
|
+
for(let i=0;i<tuples.length;i++){
|
|
49184
|
+
const tuple=tuples[i];
|
|
49185
|
+
let prefix='';
|
|
49186
|
+
for(let d=0;d<tuple.length;d++){
|
|
49187
|
+
const seg=tuple[d]===null||tuple[d]===undefined?'':String(tuple[d]);
|
|
49188
|
+
prefix=d===0?seg:`${prefix}${separator}${seg}`;
|
|
49189
|
+
if(!seen.has(prefix)){
|
|
49190
|
+
seen.add(prefix);
|
|
49191
|
+
nodes.push({fullPath:prefix,level:d,label:seg,leafPath:paths[i]});
|
|
49192
|
+
}
|
|
49193
|
+
}
|
|
49194
|
+
}
|
|
49195
|
+
const withChildren=new Set();
|
|
49196
|
+
for(const node of nodes){
|
|
49197
|
+
const parent=parentPath(node.fullPath,separator);
|
|
49198
|
+
if(parent!==null)withChildren.add(parent);
|
|
49199
|
+
}
|
|
49200
|
+
const out=[];
|
|
49201
|
+
for(const node of nodes){
|
|
49202
|
+
if(hiddenByCollapse(node.fullPath,separator,isCollapsed))continue;
|
|
49203
|
+
const hasChildren=withChildren.has(node.fullPath);
|
|
49204
|
+
const collapsed=hasChildren&&isCollapsed(node.fullPath);
|
|
49205
|
+
out.push({
|
|
49206
|
+
path:node.fullPath,
|
|
49207
|
+
label:node.label,
|
|
49208
|
+
level:node.level,
|
|
49209
|
+
leaf:!hasChildren||collapsed,
|
|
49210
|
+
fullPath:node.fullPath,
|
|
49211
|
+
hasChildren,
|
|
49212
|
+
});
|
|
49213
|
+
}
|
|
49214
|
+
return out;
|
|
49215
|
+
}
|
|
49216
|
+
function parentPath(path,separator){
|
|
49217
|
+
const at=path.lastIndexOf(separator);
|
|
49218
|
+
return at<0?null:path.slice(0,at);
|
|
49219
|
+
}
|
|
49220
|
+
function hiddenByCollapse(path,separator,isCollapsed){
|
|
49221
|
+
let parent=parentPath(path,separator);
|
|
49222
|
+
while(parent!==null){
|
|
49223
|
+
if(isCollapsed(parent))return true;
|
|
49224
|
+
parent=parentPath(parent,separator);
|
|
49225
|
+
}
|
|
49226
|
+
return false;
|
|
49227
|
+
}
|
|
49228
|
+
class PivotLayer{
|
|
49229
|
+
#viewport;
|
|
49230
|
+
#spec=null;
|
|
49231
|
+
#root=null;
|
|
49232
|
+
#cells=[];
|
|
49233
|
+
#cellsUsed=0;
|
|
49234
|
+
#colHeads=[];
|
|
49235
|
+
#colHeadsUsed=0;
|
|
49236
|
+
#rowHeads=[];
|
|
49237
|
+
#rowHeadsUsed=0;
|
|
49238
|
+
#corner=null;
|
|
49239
|
+
constructor(opts){
|
|
49240
|
+
this.#viewport=opts.viewport;
|
|
49241
|
+
}
|
|
49242
|
+
get active(){
|
|
49243
|
+
return this.#spec!==null;
|
|
49244
|
+
}
|
|
49245
|
+
get flavor(){
|
|
49246
|
+
return this.#spec?this.#spec.flavor:null;
|
|
49247
|
+
}
|
|
49248
|
+
get element(){
|
|
49249
|
+
return this.#root;
|
|
49250
|
+
}
|
|
49251
|
+
configure(config){
|
|
49252
|
+
const next=config&&typeof config==='object'&&config.flavor==='pivot'?config:null;
|
|
49253
|
+
this.#spec=next;
|
|
49254
|
+
if(next===null)this.clear();
|
|
49255
|
+
}
|
|
49256
|
+
layout(pass){
|
|
49257
|
+
if(!this.#spec||!pass.matrix)return{rows:[],cols:[],width:0,height:0};
|
|
49258
|
+
const matrix=pass.matrix;
|
|
49259
|
+
const separator=pass.separator||'/';
|
|
49260
|
+
const measures=pass.measures||matrix.measures||[];
|
|
49261
|
+
const rows=axisEntries(matrix.rowAxis,separator,pass.isRowCollapsed||(()=>false));
|
|
49262
|
+
const cols=axisEntries(matrix.columnAxis,separator,pass.isColumnCollapsed||(()=>false));
|
|
49263
|
+
const perColumn=Math.max(1,measures.length);
|
|
49264
|
+
const width=this.#spec.headerWidth
|
|
49265
|
+
+(cols.length+1)*perColumn*this.#spec.cellWidth;
|
|
49266
|
+
const height=this.#colHeadHeight()+(rows.length+1)*this.#spec.cellHeight;
|
|
49267
|
+
return{rows,cols,width,height};
|
|
49268
|
+
}
|
|
49269
|
+
measure(pass){
|
|
49270
|
+
const{width,height}=this.layout(pass);
|
|
49271
|
+
return{width,height};
|
|
49272
|
+
}
|
|
49273
|
+
#colHeadHeight(){
|
|
49274
|
+
return this.#spec.cellHeight;
|
|
49275
|
+
}
|
|
49276
|
+
update(_window,pass){
|
|
49277
|
+
this.#cellsUsed=0;
|
|
49278
|
+
this.#colHeadsUsed=0;
|
|
49279
|
+
this.#rowHeadsUsed=0;
|
|
49280
|
+
if(!this.#spec)return;
|
|
49281
|
+
const root=this.#ensure();
|
|
49282
|
+
if(!root||!pass.matrix)return;
|
|
49283
|
+
const{rows,cols}=this.layout(pass);
|
|
49284
|
+
const doc=this.#viewport.root.ownerDocument;
|
|
49285
|
+
const measures=pass.measures||pass.matrix.measures||[];
|
|
49286
|
+
const perColumn=Math.max(1,measures.length);
|
|
49287
|
+
const cellW=this.#spec.cellWidth;
|
|
49288
|
+
const cellH=this.#spec.cellHeight;
|
|
49289
|
+
const gutter=this.#spec.headerWidth;
|
|
49290
|
+
const headH=this.#colHeadHeight();
|
|
49291
|
+
const scrollLeft=Math.max(0,pass.scrollLeft||0);
|
|
49292
|
+
const scrollTop=Math.max(0,pass.scrollTop||0);
|
|
49293
|
+
const viewW=Math.max(0,pass.width||0);
|
|
49294
|
+
const viewH=Math.max(0,pass.viewportHeight||0);
|
|
49295
|
+
const groupW=perColumn*cellW;
|
|
49296
|
+
const totalCols=cols.length+1;
|
|
49297
|
+
const totalRows=rows.length+1;
|
|
49298
|
+
const firstCol=Math.max(0,Math.floor((scrollLeft)/groupW)-OVERSCAN);
|
|
49299
|
+
const lastCol=Math.min(totalCols-1,Math.ceil((scrollLeft+viewW)/groupW)+OVERSCAN);
|
|
49300
|
+
const bodyTop=scrollTop-headH;
|
|
49301
|
+
const firstRow=Math.max(0,Math.floor(bodyTop/cellH)-OVERSCAN);
|
|
49302
|
+
const lastRow=Math.min(totalRows-1,Math.ceil((bodyTop+viewH)/cellH)+OVERSCAN);
|
|
49303
|
+
this.#paintCorner(doc,gutter,headH,pass);
|
|
49304
|
+
for(let ci=firstCol;ci<=lastCol;ci++){
|
|
49305
|
+
const grand=ci===cols.length;
|
|
49306
|
+
const col=grand?null:cols[ci];
|
|
49307
|
+
const x=gutter+ci*groupW-scrollLeft;
|
|
49308
|
+
this.#paintColHead(doc,col,grand,x,groupW,headH,measures,pass);
|
|
49309
|
+
}
|
|
49310
|
+
for(let ri=firstRow;ri<=lastRow;ri++){
|
|
49311
|
+
const grand=ri===rows.length;
|
|
49312
|
+
const row=grand?null:rows[ri];
|
|
49313
|
+
const y=headH+ri*cellH-scrollTop;
|
|
49314
|
+
this.#paintRowHead(doc,row,grand,y,gutter,cellH,pass);
|
|
49315
|
+
}
|
|
49316
|
+
for(let ri=firstRow;ri<=lastRow;ri++){
|
|
49317
|
+
const rowGrand=ri===rows.length;
|
|
49318
|
+
const row=rowGrand?null:rows[ri];
|
|
49319
|
+
const y=headH+ri*cellH-scrollTop;
|
|
49320
|
+
for(let ci=firstCol;ci<=lastCol;ci++){
|
|
49321
|
+
const colGrand=ci===cols.length;
|
|
49322
|
+
const col=colGrand?null:cols[ci];
|
|
49323
|
+
for(let mi=0;mi<perColumn;mi++){
|
|
49324
|
+
const measure=measures[mi]||pass.matrix.measures[mi]||null;
|
|
49325
|
+
const x=gutter+ci*groupW+mi*cellW-scrollLeft;
|
|
49326
|
+
this.#paintCell(doc,row,col,measure,rowGrand,colGrand,x,y,cellW,cellH,pass);
|
|
49327
|
+
}
|
|
49328
|
+
}
|
|
49329
|
+
}
|
|
49330
|
+
for(let i=this.#cellsUsed;i<this.#cells.length;i++)this.#cells[i].style.display='none';
|
|
49331
|
+
for(let i=this.#colHeadsUsed;i<this.#colHeads.length;i++)this.#colHeads[i].style.display='none';
|
|
49332
|
+
for(let i=this.#rowHeadsUsed;i<this.#rowHeads.length;i++)this.#rowHeads[i].style.display='none';
|
|
49333
|
+
}
|
|
49334
|
+
#lookup(matrix,row,col,colId){
|
|
49335
|
+
const rowPath=row?row.path:null;
|
|
49336
|
+
const colPath=col?col.path:null;
|
|
49337
|
+
if(rowPath===null&&colPath===null)return matrix.grand.get(colId)||null;
|
|
49338
|
+
if(rowPath===null)return matrix.columnMargin.get(marginKey(colPath,colId))||null;
|
|
49339
|
+
if(colPath===null)return matrix.rowMargin.get(marginKey(rowPath,colId))||null;
|
|
49340
|
+
return matrix.body.get(cellKey(rowPath,colPath,colId))
|
|
49341
|
+
||matrix.rowMargin.get(marginKey(rowPath,colId))
|
|
49342
|
+
||null;
|
|
49343
|
+
}
|
|
49344
|
+
#paintCorner(doc,gutter,headH,pass){
|
|
49345
|
+
if(!this.#corner){
|
|
49346
|
+
const el=doc.createElement('div');
|
|
49347
|
+
el.className=`${PIVOT_CORNER_CLASS} ${PIVOT_TOTAL_CLASS}`;
|
|
49348
|
+
el.setAttribute('role','columnheader');
|
|
49349
|
+
this.#root.appendChild(el);
|
|
49350
|
+
this.#corner=el;
|
|
49351
|
+
}
|
|
49352
|
+
const el=this.#corner;
|
|
49353
|
+
el.style.display='';
|
|
49354
|
+
el.style.position='absolute';
|
|
49355
|
+
el.style.insetInlineStart='0px';
|
|
49356
|
+
el.style.insetBlockStart='0px';
|
|
49357
|
+
el.style.width=`${Math.round(gutter)}px`;
|
|
49358
|
+
el.style.height=`${Math.round(headH)}px`;
|
|
49359
|
+
const label=isFunction(pass.cornerLabel)?pass.cornerLabel():'';
|
|
49360
|
+
if(el.textContent!==label)el.textContent=label;
|
|
49361
|
+
}
|
|
49362
|
+
#paintColHead(doc,col,grand,x,width,height,measures,pass){
|
|
49363
|
+
let el=this.#colHeads[this.#colHeadsUsed];
|
|
49364
|
+
if(!el){
|
|
49365
|
+
el=doc.createElement('div');
|
|
49366
|
+
el.setAttribute('role','columnheader');
|
|
49367
|
+
this.#root.appendChild(el);
|
|
49368
|
+
this.#colHeads.push(el);
|
|
49369
|
+
}
|
|
49370
|
+
this.#colHeadsUsed+=1;
|
|
49371
|
+
el.className=grand?`${PIVOT_COLHEAD_CLASS} ${PIVOT_TOTAL_CLASS}`:PIVOT_COLHEAD_CLASS;
|
|
49372
|
+
el.style.display='';
|
|
49373
|
+
el.style.position='absolute';
|
|
49374
|
+
el.style.insetInlineStart=`${Math.round(x)}px`;
|
|
49375
|
+
el.style.insetBlockStart='0px';
|
|
49376
|
+
el.style.width=`${Math.round(width)}px`;
|
|
49377
|
+
el.style.height=`${Math.round(height)}px`;
|
|
49378
|
+
if(grand){
|
|
49379
|
+
el.removeAttribute('data-col-path');
|
|
49380
|
+
el.removeAttribute('data-expandable');
|
|
49381
|
+
const label=isFunction(pass.grandLabel)?pass.grandLabel():'Total';
|
|
49382
|
+
if(el.textContent!==label)el.textContent=label;
|
|
49383
|
+
return;
|
|
49384
|
+
}
|
|
49385
|
+
el.setAttribute('data-col-path',col.path);
|
|
49386
|
+
el.style.paddingInlineStart=`${col.level*12}px`;
|
|
49387
|
+
if(col.hasChildren){
|
|
49388
|
+
el.setAttribute('data-expandable','column');
|
|
49389
|
+
el.setAttribute('aria-expanded',String(!col.leaf));
|
|
49390
|
+
}else{
|
|
49391
|
+
el.removeAttribute('data-expandable');
|
|
49392
|
+
el.removeAttribute('aria-expanded');
|
|
49393
|
+
}
|
|
49394
|
+
const label=isFunction(pass.label)?pass.label(col.path,col.label,'column'):col.label;
|
|
49395
|
+
if(el.textContent!==label)el.textContent=label;
|
|
49396
|
+
}
|
|
49397
|
+
#paintRowHead(doc,row,grand,y,width,height,pass){
|
|
49398
|
+
let el=this.#rowHeads[this.#rowHeadsUsed];
|
|
49399
|
+
if(!el){
|
|
49400
|
+
el=doc.createElement('div');
|
|
49401
|
+
el.setAttribute('role','rowheader');
|
|
49402
|
+
this.#root.appendChild(el);
|
|
49403
|
+
this.#rowHeads.push(el);
|
|
49404
|
+
}
|
|
49405
|
+
this.#rowHeadsUsed+=1;
|
|
49406
|
+
el.className=grand?`${PIVOT_ROWHEAD_CLASS} ${PIVOT_TOTAL_CLASS}`:PIVOT_ROWHEAD_CLASS;
|
|
49407
|
+
el.style.display='';
|
|
49408
|
+
el.style.position='absolute';
|
|
49409
|
+
el.style.insetInlineStart='0px';
|
|
49410
|
+
el.style.transform=`translateY(${Math.round(y)}px)`;
|
|
49411
|
+
el.style.width=`${Math.round(width)}px`;
|
|
49412
|
+
el.style.height=`${Math.round(height)}px`;
|
|
49413
|
+
if(grand){
|
|
49414
|
+
el.removeAttribute('data-row-path');
|
|
49415
|
+
el.removeAttribute('data-expandable');
|
|
49416
|
+
const label=isFunction(pass.grandLabel)?pass.grandLabel():'Total';
|
|
49417
|
+
if(el.textContent!==label)el.textContent=label;
|
|
49418
|
+
return;
|
|
49419
|
+
}
|
|
49420
|
+
el.setAttribute('data-row-path',row.path);
|
|
49421
|
+
el.style.paddingInlineStart=`${row.level*12}px`;
|
|
49422
|
+
if(row.hasChildren){
|
|
49423
|
+
el.setAttribute('data-expandable','row');
|
|
49424
|
+
el.setAttribute('aria-expanded',String(!row.leaf));
|
|
49425
|
+
}else{
|
|
49426
|
+
el.removeAttribute('data-expandable');
|
|
49427
|
+
el.removeAttribute('aria-expanded');
|
|
49428
|
+
}
|
|
49429
|
+
const label=isFunction(pass.label)?pass.label(row.path,row.label,'row'):row.label;
|
|
49430
|
+
if(el.textContent!==label)el.textContent=label;
|
|
49431
|
+
}
|
|
49432
|
+
#paintCell(doc,row,col,measure,rowGrand,colGrand,x,y,width,height,pass){
|
|
49433
|
+
const el=this.#cell(doc);
|
|
49434
|
+
const total=rowGrand||colGrand||(row&&row.hasChildren&&row.leaf)
|
|
49435
|
+
||(col&&col.hasChildren&&col.leaf);
|
|
49436
|
+
el.className=total
|
|
49437
|
+
?`lat-row ${PIVOT_CELL_CLASS} ${PIVOT_TOTAL_CLASS}`
|
|
49438
|
+
:`lat-row ${PIVOT_CELL_CLASS}`;
|
|
49439
|
+
el.style.display='';
|
|
49440
|
+
el.style.position='absolute';
|
|
49441
|
+
el.style.insetInlineStart=`${Math.round(x)}px`;
|
|
49442
|
+
el.style.transform=`translateY(${Math.round(y)}px)`;
|
|
49443
|
+
el.style.width=`${Math.round(width)}px`;
|
|
49444
|
+
el.style.height=`${Math.round(height)}px`;
|
|
49445
|
+
const colId=measure?measure.colId:null;
|
|
49446
|
+
const cell=colId?this.#lookup(pass.matrix,row,col,colId):null;
|
|
49447
|
+
const value=cell?cell.value:null;
|
|
49448
|
+
const text=isFunction(pass.format)?pass.format(value,colId):formatDefault(value);
|
|
49449
|
+
if(el.textContent!==text)el.textContent=text;
|
|
49450
|
+
el.setAttribute('data-row-path',row?row.path:GRAND_PATH);
|
|
49451
|
+
el.setAttribute('data-col-path',col?col.path:GRAND_PATH);
|
|
49452
|
+
if(colId)el.setAttribute('data-measure',colId);
|
|
49453
|
+
if(cell&&cell.leaves&&cell.leaves.length&&isFunction(pass.keysOf)){
|
|
49454
|
+
const keys=pass.keysOf(cell.leaves);
|
|
49455
|
+
el.setAttribute('data-drill',keys.join(','));
|
|
49456
|
+
}else{
|
|
49457
|
+
el.removeAttribute('data-drill');
|
|
49458
|
+
}
|
|
49459
|
+
}
|
|
49460
|
+
#cell(doc){
|
|
49461
|
+
let el=this.#cells[this.#cellsUsed];
|
|
49462
|
+
if(!el){
|
|
49463
|
+
el=doc.createElement('div');
|
|
49464
|
+
el.setAttribute('role','gridcell');
|
|
49465
|
+
this.#root.appendChild(el);
|
|
49466
|
+
this.#cells.push(el);
|
|
49467
|
+
}
|
|
49468
|
+
this.#cellsUsed+=1;
|
|
49469
|
+
return el;
|
|
49470
|
+
}
|
|
49471
|
+
#ensure(){
|
|
49472
|
+
if(this.#root)return this.#root;
|
|
49473
|
+
const host=this.#viewport.surface||this.#viewport.canvas;
|
|
49474
|
+
if(!host||!isFunction(host.appendChild))return null;
|
|
49475
|
+
const doc=host.ownerDocument;
|
|
49476
|
+
const el=doc.createElement('div');
|
|
49477
|
+
el.className=this.#spec.className
|
|
49478
|
+
?`${PIVOT_CLASS} ${this.#spec.className}`:PIVOT_CLASS;
|
|
49479
|
+
el.setAttribute('role',this.#spec.role||'grid');
|
|
49480
|
+
host.appendChild(el);
|
|
49481
|
+
this.#root=el;
|
|
49482
|
+
return el;
|
|
49483
|
+
}
|
|
49484
|
+
clear(){
|
|
49485
|
+
const drop=(el)=>{if(el&&el.parentNode)el.parentNode.removeChild(el);};
|
|
49486
|
+
for(const el of this.#cells)drop(el);
|
|
49487
|
+
for(const el of this.#colHeads)drop(el);
|
|
49488
|
+
for(const el of this.#rowHeads)drop(el);
|
|
49489
|
+
drop(this.#corner);
|
|
49490
|
+
this.#cells=[];
|
|
49491
|
+
this.#colHeads=[];
|
|
49492
|
+
this.#rowHeads=[];
|
|
49493
|
+
this.#corner=null;
|
|
49494
|
+
this.#cellsUsed=0;
|
|
49495
|
+
this.#colHeadsUsed=0;
|
|
49496
|
+
this.#rowHeadsUsed=0;
|
|
49497
|
+
if(this.#root&&this.#root.parentNode)this.#root.parentNode.removeChild(this.#root);
|
|
49498
|
+
this.#root=null;
|
|
49499
|
+
}
|
|
49500
|
+
}
|
|
49501
|
+
function formatDefault(value){
|
|
49502
|
+
if(value===null||value===undefined)return'';
|
|
49503
|
+
if(typeof value==='number'){
|
|
49504
|
+
if(Number.isNaN(value))return'';
|
|
49505
|
+
return Number.isInteger(value)?String(value):String(Math.round(value*100)/100);
|
|
49506
|
+
}
|
|
49507
|
+
return String(value);
|
|
49508
|
+
}
|
|
49509
|
+
});
|
|
48266
49510
|
__def("packages/dom/src/renderer/overlays.js",function(__exports,__req){
|
|
48267
49511
|
'use strict';
|
|
48268
49512
|
Object.defineProperty(__exports,"Overlays",{enumerable:true,get:function(){return Overlays;}});
|
|
@@ -48824,25 +50068,28 @@ const resolveResponsive=__m12["resolveResponsive"];
|
|
|
48824
50068
|
const resolveGallery=__m12["resolveGallery"];
|
|
48825
50069
|
const resolveRecordCard=__m12["resolveRecordCard"];
|
|
48826
50070
|
const resolveBoard=__m12["resolveBoard"];
|
|
50071
|
+
const resolvePivotView=__m12["resolvePivotView"];
|
|
48827
50072
|
const __m13=__req("packages/dom/src/renderer/board.js");
|
|
48828
50073
|
const BoardLayer=__m13["BoardLayer"];
|
|
48829
|
-
const __m14=__req("packages/dom/src/renderer/
|
|
48830
|
-
const
|
|
48831
|
-
const __m15=__req("packages/dom/src/renderer/
|
|
48832
|
-
const
|
|
48833
|
-
const __m16=__req("packages/dom/src/renderer/
|
|
48834
|
-
const
|
|
48835
|
-
const __m17=__req("packages/
|
|
48836
|
-
const
|
|
48837
|
-
const __m18=__req("packages/core/src/columns/
|
|
48838
|
-
const
|
|
48839
|
-
const __m19=__req("packages/
|
|
48840
|
-
const
|
|
48841
|
-
const
|
|
48842
|
-
const
|
|
48843
|
-
const
|
|
48844
|
-
const __m20
|
|
48845
|
-
const
|
|
50074
|
+
const __m14=__req("packages/dom/src/renderer/pivot.js");
|
|
50075
|
+
const PivotLayer=__m14["PivotLayer"];
|
|
50076
|
+
const __m15=__req("packages/dom/src/renderer/overlays.js");
|
|
50077
|
+
const Overlays=__m15["Overlays"];
|
|
50078
|
+
const __m16=__req("packages/dom/src/renderer/a11y.js");
|
|
50079
|
+
const Accessibility=__m16["Accessibility"];
|
|
50080
|
+
const __m17=__req("packages/dom/src/renderer/keyboard.js");
|
|
50081
|
+
const KeyboardController=__m17["KeyboardController"];
|
|
50082
|
+
const __m18=__req("packages/core/src/columns/selectcolumn.js");
|
|
50083
|
+
const SELECT_COLUMN_ID=__m18["SELECT_COLUMN_ID"];
|
|
50084
|
+
const __m19=__req("packages/core/src/columns/detailcolumn.js");
|
|
50085
|
+
const DETAIL_COLUMN_ID=__m19["DETAIL_COLUMN_ID"];
|
|
50086
|
+
const __m20=__req("packages/dom/src/renderer/scaled.js");
|
|
50087
|
+
const scaleFor=__m20["scaleFor"];
|
|
50088
|
+
const anchor=__m20["anchor"];
|
|
50089
|
+
const anchorAt=__m20["anchorAt"];
|
|
50090
|
+
const rowAtContent=__m20["rowAtContent"];
|
|
50091
|
+
const __m21=__req("packages/dom/src/detailhost.js");
|
|
50092
|
+
const insideDetail=__m21["insideDetail"];
|
|
48846
50093
|
function resolveGroupHeadingDepth(config){
|
|
48847
50094
|
if(config===false||config===undefined||config===null)return 0;
|
|
48848
50095
|
if(config===true)return 2;
|
|
@@ -48896,6 +50143,10 @@ class DomRenderer{
|
|
|
48896
50143
|
#fullWidth;
|
|
48897
50144
|
#cards;
|
|
48898
50145
|
#board;
|
|
50146
|
+
#pivot;
|
|
50147
|
+
#pivotRowsCollapsed=new Set();
|
|
50148
|
+
#pivotColsCollapsed=new Set();
|
|
50149
|
+
#pivotMatrixCache=undefined;
|
|
48899
50150
|
#collapsed=null;
|
|
48900
50151
|
#overlays;
|
|
48901
50152
|
#a11y;
|
|
@@ -48972,6 +50223,7 @@ this.#fullWidth=new FullWidthLayer({viewport:this.#viewport});
|
|
|
48972
50223
|
this.#fullWidth.configure(host.config?.fullWidth);
|
|
48973
50224
|
this.#cards=new RowTemplateLayer({viewport:this.#viewport});
|
|
48974
50225
|
this.#board=new BoardLayer({viewport:this.#viewport});
|
|
50226
|
+
this.#pivot=new PivotLayer({viewport:this.#viewport});
|
|
48975
50227
|
this.#configurePresentation();
|
|
48976
50228
|
this.#stickyGroupDepth=resolveGroupHeadingDepth(host.config?.stickyGroupHeaders);
|
|
48977
50229
|
this.#header=new HeaderView({
|
|
@@ -49060,6 +50312,7 @@ this.#cellPool.clear();
|
|
|
49060
50312
|
this.#fullWidth.destroy();
|
|
49061
50313
|
this.#cards.clear();
|
|
49062
50314
|
this.#board.clear();
|
|
50315
|
+
this.#pivot.clear();
|
|
49063
50316
|
this.#viewport.destroy();
|
|
49064
50317
|
this.#host=null;
|
|
49065
50318
|
this.#element=null;
|
|
@@ -49461,6 +50714,7 @@ return tallest+ROW_BORDER;
|
|
|
49461
50714
|
}
|
|
49462
50715
|
#writePhase(ctx){
|
|
49463
50716
|
this.#stats.paints++;
|
|
50717
|
+
this.#pivotMatrixCache=undefined;
|
|
49464
50718
|
this.#host.beginPass?.();
|
|
49465
50719
|
const count=this.#host.rowCount();
|
|
49466
50720
|
if(count!==this.#heights.count){
|
|
@@ -49487,6 +50741,11 @@ const extent=this.#board.measure(this.#boardPass(count,ctx));
|
|
|
49487
50741
|
spacerHeight=extent.height;
|
|
49488
50742
|
spacerWidth=extent.width;
|
|
49489
50743
|
}
|
|
50744
|
+
if(this.#pivot.active){
|
|
50745
|
+
const extent=this.#pivot.measure(this.#pivotPass(ctx));
|
|
50746
|
+
spacerHeight=extent.height;
|
|
50747
|
+
spacerWidth=extent.width;
|
|
50748
|
+
}
|
|
49490
50749
|
this.#viewport.setSpacer(spacerHeight,spacerWidth);
|
|
49491
50750
|
this.#viewport.setSurfaceHeight(this.#size.height);
|
|
49492
50751
|
this.#viewport.setHorizontal(
|
|
@@ -49528,7 +50787,10 @@ grid:this.#host.grid,
|
|
|
49528
50787
|
}
|
|
49529
50788
|
if(isFunction(this.#host.hint))this.#host.hint(window.first,window.last);
|
|
49530
50789
|
const tHint=now();
|
|
49531
|
-
if(this.#
|
|
50790
|
+
if(this.#pivot.active){
|
|
50791
|
+
this.#pivot.update(window,this.#pivotPass(ctx));
|
|
50792
|
+
this.#releaseMountedRows();
|
|
50793
|
+
}else if(this.#board.active){
|
|
49532
50794
|
this.#board.update(window,this.#boardPass(count,ctx));
|
|
49533
50795
|
this.#releaseMountedRows();
|
|
49534
50796
|
}else if(this.#cards.active){
|
|
@@ -49829,6 +51091,14 @@ if(isFunction(columns.visible))return columns.visible();
|
|
|
49829
51091
|
if(isFunction(columns.all))return columns.all();
|
|
49830
51092
|
return Array.isArray(columns)?columns:[];
|
|
49831
51093
|
}
|
|
51094
|
+
#dataColumns(){
|
|
51095
|
+
const columns=this.#host.columns;
|
|
51096
|
+
const all=columns&&isFunction(columns.all)
|
|
51097
|
+
?columns.all()
|
|
51098
|
+
:this.#visibleColumns();
|
|
51099
|
+
return(all||[]).filter((c)=>c&&typeof c.id==='string'
|
|
51100
|
+
&&c.field!=null&&!String(c.id).startsWith('__lattice'));
|
|
51101
|
+
}
|
|
49832
51102
|
#allSlots(){
|
|
49833
51103
|
return this.#layout.slotsFor({from:0,to:this.#layout.centre.length});
|
|
49834
51104
|
}
|
|
@@ -49902,6 +51172,27 @@ this.#scroll.request('focus');
|
|
|
49902
51172
|
const target=event&&event.target;
|
|
49903
51173
|
if(!target||!isFunction(target.closest))return;
|
|
49904
51174
|
if(insideDetail(target,this.#viewport.root))return;
|
|
51175
|
+
if(this.#pivot.active&&suffix==='clicked'){
|
|
51176
|
+
const expander=target.closest('[data-expandable]');
|
|
51177
|
+
if(expander){
|
|
51178
|
+
const axis=expander.getAttribute('data-expandable');
|
|
51179
|
+
const path=expander.getAttribute(axis==='column'?'data-col-path':'data-row-path');
|
|
51180
|
+
if(path!=null){this.togglePivot(axis,path);return;}
|
|
51181
|
+
}
|
|
51182
|
+
const drillCell=target.closest('[data-drill]');
|
|
51183
|
+
if(drillCell){
|
|
51184
|
+
const keys=(drillCell.getAttribute('data-drill')||'').split(',').filter(Boolean);
|
|
51185
|
+
this.#host.emit('pivot:drill',{
|
|
51186
|
+
keys,
|
|
51187
|
+
rowPath:drillCell.getAttribute('data-row-path'),
|
|
51188
|
+
colPath:drillCell.getAttribute('data-col-path'),
|
|
51189
|
+
measure:drillCell.getAttribute('data-measure'),
|
|
51190
|
+
event,
|
|
51191
|
+
},'user');
|
|
51192
|
+
return;
|
|
51193
|
+
}
|
|
51194
|
+
}
|
|
51195
|
+
if(this.#pivot.active)return;
|
|
49905
51196
|
const rowEl=target.closest(`.${CLASS.row}`);
|
|
49906
51197
|
if(!rowEl)return;
|
|
49907
51198
|
const index=displayIndexOf(rowEl);
|
|
@@ -50001,6 +51292,7 @@ const narrow=!!responsive&&this.#size.width>0&&this.#size.width<=responsive.maxW
|
|
|
50001
51292
|
this.#collapsed=responsive?narrow:false;
|
|
50002
51293
|
let spec=null;
|
|
50003
51294
|
let boardSpec=null;
|
|
51295
|
+
let pivotSpec=null;
|
|
50004
51296
|
if(config.rowTemplate){
|
|
50005
51297
|
spec=config.rowTemplate;
|
|
50006
51298
|
}else if(config.gallery){
|
|
@@ -50009,12 +51301,25 @@ spec=resolveGallery(config.gallery,context);
|
|
|
50009
51301
|
spec=resolveRecordCard(config.recordCard,context);
|
|
50010
51302
|
}else if(config.board){
|
|
50011
51303
|
boardSpec=resolveBoard(config.board,context);
|
|
51304
|
+
}else if(config.pivotView){
|
|
51305
|
+
const resolvedPivot=resolvePivotView(config.pivotView,{
|
|
51306
|
+
...context,columns:this.#dataColumns(),
|
|
51307
|
+
});
|
|
51308
|
+
const pivotNarrow=!!resolvedPivot&&this.#size.width>0
|
|
51309
|
+
&&this.#size.width<=resolvedPivot.maxWidth;
|
|
51310
|
+
if(resolvedPivot&&pivotNarrow){
|
|
51311
|
+
spec=resolvedPivot.fallback;
|
|
51312
|
+
this.#collapsed=true;
|
|
51313
|
+
}else{
|
|
51314
|
+
pivotSpec=resolvedPivot;
|
|
51315
|
+
}
|
|
50012
51316
|
}else if(narrow){
|
|
50013
51317
|
spec=responsive.template;
|
|
50014
51318
|
}
|
|
50015
51319
|
this.#warnPresentationConflict(config);
|
|
50016
51320
|
this.#cards.configure(spec,context);
|
|
50017
51321
|
this.#board.configure(boardSpec);
|
|
51322
|
+
this.#pivot.configure(pivotSpec);
|
|
50018
51323
|
const configured=Number(config.rowHeight);
|
|
50019
51324
|
const fallback=Number.isFinite(configured)&&configured>0?configured:DEFAULT_ROW_HEIGHT;
|
|
50020
51325
|
let height=fallback;
|
|
@@ -50029,12 +51334,12 @@ this.#heights.setRowHeight(height);
|
|
|
50029
51334
|
this.#markPresentation();
|
|
50030
51335
|
}
|
|
50031
51336
|
#warnPresentationConflict(config){
|
|
50032
|
-
const set=['rowTemplate','gallery','recordCard','board'].filter((k)=>config[k]);
|
|
51337
|
+
const set=['rowTemplate','gallery','recordCard','board','pivotView'].filter((k)=>config[k]);
|
|
50033
51338
|
if(set.length>1){
|
|
50034
51339
|
warnOnce(
|
|
50035
51340
|
'presentation.conflict',
|
|
50036
51341
|
`More than one card presentation is set (${set.join(', ')}); only ${set[0]} draws.`,
|
|
50037
|
-
'Set exactly one of rowTemplate, gallery, recordCard or
|
|
51342
|
+
'Set exactly one of rowTemplate, gallery, recordCard, board or pivotView.',
|
|
50038
51343
|
);
|
|
50039
51344
|
}
|
|
50040
51345
|
}
|
|
@@ -50045,7 +51350,10 @@ return messages&&isFunction(messages.t)?messages.t(key):key;
|
|
|
50045
51350
|
#markPresentation(){
|
|
50046
51351
|
const root=this.#viewport?.root;
|
|
50047
51352
|
if(!root||!isFunction(root.setAttribute))return;
|
|
50048
|
-
if(this.#
|
|
51353
|
+
if(this.#pivot.active){
|
|
51354
|
+
root.setAttribute('data-presentation','pivot');
|
|
51355
|
+
if(isFunction(root.removeAttribute))root.removeAttribute('data-card-mode');
|
|
51356
|
+
}else if(this.#cards.active||this.#board.active){
|
|
50049
51357
|
root.setAttribute('data-presentation','cards');
|
|
50050
51358
|
const flavor=this.#board.active?this.#board.flavor:this.#cards.flavor;
|
|
50051
51359
|
if(flavor&&flavor!=='cards')root.setAttribute('data-card-mode',flavor);
|
|
@@ -50089,6 +51397,58 @@ return heading.groupValue==null?'':String(heading.groupValue);
|
|
|
50089
51397
|
},
|
|
50090
51398
|
};
|
|
50091
51399
|
}
|
|
51400
|
+
#pivotPass(ctx){
|
|
51401
|
+
const grid=this.#host.grid;
|
|
51402
|
+
if(this.#pivotMatrixCache===undefined){
|
|
51403
|
+
this.#pivotMatrixCache=isFunction(this.#host.pivotMatrix)
|
|
51404
|
+
?this.#host.pivotMatrix():null;
|
|
51405
|
+
}
|
|
51406
|
+
const matrix=this.#pivotMatrixCache;
|
|
51407
|
+
const separator=this.#host.config?.pivot?.separator||'/';
|
|
51408
|
+
return{
|
|
51409
|
+
matrix,
|
|
51410
|
+
measures:matrix?matrix.measures:[],
|
|
51411
|
+
separator,
|
|
51412
|
+
width:this.#size.width,
|
|
51413
|
+
viewportHeight:this.#size.height,
|
|
51414
|
+
scrollTop:ctx.top,
|
|
51415
|
+
scrollLeft:ctx.left,
|
|
51416
|
+
grid,
|
|
51417
|
+
isRowCollapsed:(path)=>this.#pivotRowsCollapsed.has(path),
|
|
51418
|
+
isColumnCollapsed:(path)=>this.#pivotColsCollapsed.has(path),
|
|
51419
|
+
format:(value,colId)=>{
|
|
51420
|
+
if(value===null||value===undefined)return'';
|
|
51421
|
+
const column=colId&&this.#host.columns.get(colId);
|
|
51422
|
+
if(column&&isFunction(this.#host.cellText)){
|
|
51423
|
+
const text=this.#host.cellText({data:{[column.field??colId]:value}},column);
|
|
51424
|
+
if(text!=null&&text!=='')return String(text);
|
|
51425
|
+
}
|
|
51426
|
+
return typeof value==='number'
|
|
51427
|
+
?String(Number.isInteger(value)?value:Math.round(value*100)/100)
|
|
51428
|
+
:String(value);
|
|
51429
|
+
},
|
|
51430
|
+
keysOf:(leaves)=>(isFunction(this.#host.pivotDrillKeys)
|
|
51431
|
+
?this.#host.pivotDrillKeys(leaves):[]),
|
|
51432
|
+
grandLabel:()=>'Total',
|
|
51433
|
+
cornerLabel:()=>'',
|
|
51434
|
+
};
|
|
51435
|
+
}
|
|
51436
|
+
togglePivot(axis,path){
|
|
51437
|
+
const set=axis==='column'?this.#pivotColsCollapsed:this.#pivotRowsCollapsed;
|
|
51438
|
+
if(set.has(path))set.delete(path);else set.add(path);
|
|
51439
|
+
this.invalidate();
|
|
51440
|
+
}
|
|
51441
|
+
pivotState(){
|
|
51442
|
+
return{
|
|
51443
|
+
rowsCollapsed:[...this.#pivotRowsCollapsed],
|
|
51444
|
+
columnsCollapsed:[...this.#pivotColsCollapsed],
|
|
51445
|
+
};
|
|
51446
|
+
}
|
|
51447
|
+
applyPivotState(state){
|
|
51448
|
+
this.#pivotRowsCollapsed=new Set(Array.isArray(state?.rowsCollapsed)?state.rowsCollapsed:[]);
|
|
51449
|
+
this.#pivotColsCollapsed=new Set(Array.isArray(state?.columnsCollapsed)?state.columnsCollapsed:[]);
|
|
51450
|
+
this.invalidate();
|
|
51451
|
+
}
|
|
50092
51452
|
get messages(){
|
|
50093
51453
|
const host=this.#host;
|
|
50094
51454
|
return(host&&host.messages)||defaultMessages;
|
|
@@ -59483,6 +60843,109 @@ super.destroy();
|
|
|
59483
60843
|
}
|
|
59484
60844
|
const __default=TemperatureEditor;
|
|
59485
60845
|
});
|
|
60846
|
+
__def("packages/dom/src/editors/currency.js",function(__exports,__req){
|
|
60847
|
+
'use strict';
|
|
60848
|
+
Object.defineProperty(__exports,"presentAmount",{enumerable:true,get:function(){return presentAmount;}});
|
|
60849
|
+
Object.defineProperty(__exports,"CurrencyEditor",{enumerable:true,get:function(){return CurrencyEditor;}});
|
|
60850
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
60851
|
+
const __m0=__req("packages/dom/src/editors/common.js");
|
|
60852
|
+
const BaseEditor=__m0["BaseEditor"];
|
|
60853
|
+
const CLS=__m0["CLS"];
|
|
60854
|
+
const el=__m0["el"];
|
|
60855
|
+
const on=__m0["on"];
|
|
60856
|
+
const __m1=__req("packages/core/src/internal/util.js");
|
|
60857
|
+
const isFunction=__m1["isFunction"];
|
|
60858
|
+
const __m2=__req("packages/core/src/columns/types/currency.js");
|
|
60859
|
+
const parseMoney=__m2["parseMoney"];
|
|
60860
|
+
const toMoney=__m2["toMoney"];
|
|
60861
|
+
const normaliseCode=__m2["normaliseCode"];
|
|
60862
|
+
const DEFAULT_CODES=['USD','EUR','GBP','JPY','CHF','CAD','AUD','CNY'];
|
|
60863
|
+
function presentAmount(value){
|
|
60864
|
+
const money=toMoney(value);
|
|
60865
|
+
return money?String(money.amount):'';
|
|
60866
|
+
}
|
|
60867
|
+
class CurrencyEditor extends BaseEditor{
|
|
60868
|
+
input=null;
|
|
60869
|
+
picker=null;
|
|
60870
|
+
opts=null;
|
|
60871
|
+
#off=[];
|
|
60872
|
+
buildOptions(){
|
|
60873
|
+
const type=(this.params.column&&this.params.column.dataType)||null;
|
|
60874
|
+
const config=(type&&type.currencyConfig)||{};
|
|
60875
|
+
const initial=toMoney(this.params.value);
|
|
60876
|
+
const code=normaliseCode(this.props.code)
|
|
60877
|
+
||(initial&&initial.code)
|
|
60878
|
+
||normaliseCode(config.code)
|
|
60879
|
+
||'USD';
|
|
60880
|
+
let codes=this.props.codes||config.codes||DEFAULT_CODES;
|
|
60881
|
+
codes=codes.map((c)=>normaliseCode(c)).filter(Boolean);
|
|
60882
|
+
if(!codes.includes(code))codes=[code,...codes];
|
|
60883
|
+
return{code,codes,locale:this.params.locale};
|
|
60884
|
+
}
|
|
60885
|
+
build(){
|
|
60886
|
+
const props=this.props;
|
|
60887
|
+
this.opts=this.buildOptions();
|
|
60888
|
+
const input=(el(this.doc,'input',{
|
|
60889
|
+
class:CLS.input,
|
|
60890
|
+
attrs:{
|
|
60891
|
+
type:'text',
|
|
60892
|
+
inputmode:'decimal',
|
|
60893
|
+
autocomplete:'off',
|
|
60894
|
+
spellcheck:'false',
|
|
60895
|
+
placeholder:props.placeholder??null,
|
|
60896
|
+
'aria-label':(this.params.column&&this.params.column.title)||'Amount',
|
|
60897
|
+
},
|
|
60898
|
+
}));
|
|
60899
|
+
input.value=presentAmount(this.params.value);
|
|
60900
|
+
if(this.params.key&&/^[0-9.,+-]$/.test(this.params.key))input.value=this.params.key;
|
|
60901
|
+
this.input=input;
|
|
60902
|
+
const picker=(el(this.doc,'select',{
|
|
60903
|
+
class:`${CLS.editor}__suffix`,
|
|
60904
|
+
attrs:{'aria-label':this.t('editor.currency')},
|
|
60905
|
+
}));
|
|
60906
|
+
for(const c of this.opts.codes){
|
|
60907
|
+
const option=el(this.doc,'option',{text:c,attrs:{value:c}});
|
|
60908
|
+
if(c===this.opts.code)(option).selected=true;
|
|
60909
|
+
picker.appendChild(option);
|
|
60910
|
+
}
|
|
60911
|
+
this.picker=picker;
|
|
60912
|
+
return el(this.doc,'div',{class:`${CLS.editor}__unit`,children:[input,picker]});
|
|
60913
|
+
}
|
|
60914
|
+
focusTarget(){return this.input;}
|
|
60915
|
+
attached(){
|
|
60916
|
+
super.attached();
|
|
60917
|
+
const input=this.input;
|
|
60918
|
+
if(!input)return;
|
|
60919
|
+
if(!this.params.key&&this.props.selectOnFocus!==false&&isFunction(input.select))input.select();
|
|
60920
|
+
}
|
|
60921
|
+
readValue(){
|
|
60922
|
+
const text=this.input?String(this.input.value).trim():'';
|
|
60923
|
+
if(text==='')return null;
|
|
60924
|
+
const picked=this.picker?this.picker.value:this.opts.code;
|
|
60925
|
+
const money=parseMoney(text,{...this.opts,code:picked});
|
|
60926
|
+
return money===null?Number.NaN:money;
|
|
60927
|
+
}
|
|
60928
|
+
checkValue(value){
|
|
60929
|
+
if(value===null)return true;
|
|
60930
|
+
if(!value||typeof value!=='object'||!Number.isFinite((value).amount)){
|
|
60931
|
+
return'Enter an amount';
|
|
60932
|
+
}
|
|
60933
|
+
const amount=(value).amount;
|
|
60934
|
+
const{min,max}=this.props;
|
|
60935
|
+
if(typeof min==='number'&&amount<min)return`Must be ${min} or more`;
|
|
60936
|
+
if(typeof max==='number'&&amount>max)return`Must be ${max} or less`;
|
|
60937
|
+
return true;
|
|
60938
|
+
}
|
|
60939
|
+
destroy(){
|
|
60940
|
+
for(const off of this.#off)off();
|
|
60941
|
+
this.#off=[];
|
|
60942
|
+
this.input=null;
|
|
60943
|
+
this.picker=null;
|
|
60944
|
+
super.destroy();
|
|
60945
|
+
}
|
|
60946
|
+
}
|
|
60947
|
+
const __default=CurrencyEditor;
|
|
60948
|
+
});
|
|
59486
60949
|
__def("packages/dom/src/editors/index.js",function(__exports,__req){
|
|
59487
60950
|
'use strict';
|
|
59488
60951
|
Object.defineProperty(__exports,"TextEditor",{enumerable:true,get:function(){return TextEditor;}});
|
|
@@ -59508,6 +60971,7 @@ Object.defineProperty(__exports,"TreeSelectEditor",{enumerable:true,get:function
|
|
|
59508
60971
|
Object.defineProperty(__exports,"ObjectPickerEditor",{enumerable:true,get:function(){return ObjectPickerEditor;}});
|
|
59509
60972
|
Object.defineProperty(__exports,"IconPickerEditor",{enumerable:true,get:function(){return IconPickerEditor;}});
|
|
59510
60973
|
Object.defineProperty(__exports,"TemperatureEditor",{enumerable:true,get:function(){return TemperatureEditor;}});
|
|
60974
|
+
Object.defineProperty(__exports,"CurrencyEditor",{enumerable:true,get:function(){return CurrencyEditor;}});
|
|
59511
60975
|
Object.defineProperty(__exports,"editors",{enumerable:true,get:function(){return editors;}});
|
|
59512
60976
|
Object.defineProperty(__exports,"editorByType",{enumerable:true,get:function(){return editorByType;}});
|
|
59513
60977
|
Object.defineProperty(__exports,"editorFor",{enumerable:true,get:function(){return editorFor;}});
|
|
@@ -59559,13 +61023,15 @@ const __m21=__req("packages/dom/src/editors/iconpicker.js");
|
|
|
59559
61023
|
const IconPickerEditor=__m21["IconPickerEditor"];
|
|
59560
61024
|
const __m22=__req("packages/dom/src/editors/temperature.js");
|
|
59561
61025
|
const TemperatureEditor=__m22["TemperatureEditor"];
|
|
59562
|
-
const __m23=__req("packages/
|
|
59563
|
-
const
|
|
59564
|
-
const
|
|
59565
|
-
const
|
|
59566
|
-
const __m24
|
|
59567
|
-
|
|
59568
|
-
|
|
61026
|
+
const __m23=__req("packages/dom/src/editors/currency.js");
|
|
61027
|
+
const CurrencyEditor=__m23["CurrencyEditor"];
|
|
61028
|
+
const __m24=__req("packages/core/src/internal/util.js");
|
|
61029
|
+
const isCtor=__m24["isCtor"];
|
|
61030
|
+
const isFunction=__m24["isFunction"];
|
|
61031
|
+
const warnOnce=__m24["warnOnce"];
|
|
61032
|
+
const __m25=__req("packages/dom/src/editors/common.js");
|
|
61033
|
+
for(const __k of Object.keys(__m25)){
|
|
61034
|
+
if(__k!=='default')Object.defineProperty(__exports,__k,{enumerable:true,get:function(){return __m25[__k];}});
|
|
59569
61035
|
}
|
|
59570
61036
|
const editors=Object.freeze({
|
|
59571
61037
|
text:TextEditor,
|
|
@@ -59576,6 +61042,7 @@ checkbox:CheckboxEditor,
|
|
|
59576
61042
|
select:SelectEditor,
|
|
59577
61043
|
multiSelect:MultiSelectEditor,
|
|
59578
61044
|
temperature:TemperatureEditor,
|
|
61045
|
+
currency:CurrencyEditor,
|
|
59579
61046
|
time:TimeEditor,
|
|
59580
61047
|
datetime:DateTimeEditor,
|
|
59581
61048
|
duration:DurationEditor,
|
|
@@ -71121,6 +72588,12 @@ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){ret
|
|
|
71121
72588
|
Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m4["UNIT_SYSTEMS"];}});
|
|
71122
72589
|
Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m4["parseUnit"];}});
|
|
71123
72590
|
Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m4["formatUnit"];}});
|
|
72591
|
+
Object.defineProperty(__exports,"createCurrencyType",{enumerable:true,get:function(){return __m4["createCurrencyType"];}});
|
|
72592
|
+
Object.defineProperty(__exports,"parseMoney",{enumerable:true,get:function(){return __m4["parseMoney"];}});
|
|
72593
|
+
Object.defineProperty(__exports,"formatMoney",{enumerable:true,get:function(){return __m4["formatMoney"];}});
|
|
72594
|
+
Object.defineProperty(__exports,"convertMoney",{enumerable:true,get:function(){return __m4["convertMoney"];}});
|
|
72595
|
+
Object.defineProperty(__exports,"rateFunction",{enumerable:true,get:function(){return __m4["rateFunction"];}});
|
|
72596
|
+
Object.defineProperty(__exports,"MISSING_RATE",{enumerable:true,get:function(){return __m4["MISSING_RATE"];}});
|
|
71124
72597
|
Object.defineProperty(__exports,"Messages",{enumerable:true,get:function(){return __m4["Messages"];}});
|
|
71125
72598
|
Object.defineProperty(__exports,"createMessages",{enumerable:true,get:function(){return __m4["createMessages"];}});
|
|
71126
72599
|
Object.defineProperty(__exports,"auditCatalogue",{enumerable:true,get:function(){return __m4["auditCatalogue"];}});
|
|
@@ -71166,6 +72639,9 @@ Object.defineProperty(__exports,"groupByColumns",{enumerable:true,get:function()
|
|
|
71166
72639
|
Object.defineProperty(__exports,"total",{enumerable:true,get:function(){return __m4["total"];}});
|
|
71167
72640
|
Object.defineProperty(__exports,"TOTAL_FNS",{enumerable:true,get:function(){return __m4["TOTAL_FNS"];}});
|
|
71168
72641
|
Object.defineProperty(__exports,"pivot",{enumerable:true,get:function(){return __m4["pivot"];}});
|
|
72642
|
+
Object.defineProperty(__exports,"Window",{enumerable:true,get:function(){return __m4["Window"];}});
|
|
72643
|
+
Object.defineProperty(__exports,"openWindow",{enumerable:true,get:function(){return __m4["openWindow"];}});
|
|
72644
|
+
Object.defineProperty(__exports,"WINDOW_KINDS",{enumerable:true,get:function(){return __m4["WINDOW_KINDS"];}});
|
|
71169
72645
|
Object.defineProperty(__exports,"evaluateFormula",{enumerable:true,get:function(){return __m4["evaluateFormula"];}});
|
|
71170
72646
|
Object.defineProperty(__exports,"parseFormula",{enumerable:true,get:function(){return __m4["parseFormula"];}});
|
|
71171
72647
|
Object.defineProperty(__exports,"referencesOf",{enumerable:true,get:function(){return __m4["referencesOf"];}});
|
|
@@ -71186,6 +72662,7 @@ Object.defineProperty(__exports,"planQuery",{enumerable:true,get:function(){retu
|
|
|
71186
72662
|
Object.defineProperty(__exports,"splitFilters",{enumerable:true,get:function(){return __m4["splitFilters"];}});
|
|
71187
72663
|
Object.defineProperty(__exports,"applyResidual",{enumerable:true,get:function(){return __m4["applyResidual"];}});
|
|
71188
72664
|
Object.defineProperty(__exports,"capabilitiesOf",{enumerable:true,get:function(){return __m4["capabilitiesOf"];}});
|
|
72665
|
+
Object.defineProperty(__exports,"resolveMutate",{enumerable:true,get:function(){return __m4["resolveMutate"];}});
|
|
71189
72666
|
Object.defineProperty(__exports,"NO_CAPABILITIES",{enumerable:true,get:function(){return __m4["NO_CAPABILITIES"];}});
|
|
71190
72667
|
Object.defineProperty(__exports,"odataAdapter",{enumerable:true,get:function(){return __m4["odataAdapter"];}});
|
|
71191
72668
|
Object.defineProperty(__exports,"filtersToOData",{enumerable:true,get:function(){return __m4["filtersToOData"];}});
|
|
@@ -71287,7 +72764,7 @@ createLocalViewStorage,
|
|
|
71287
72764
|
const __default=LatticeGrid;
|
|
71288
72765
|
});
|
|
71289
72766
|
try{
|
|
71290
|
-
__req("packages/worker/src/inline.js").setWorkerSource("(function(root){\n'use strict';\nvar __mods=Object.create(null);\nvar __cache=Object.create(null);\nfunction __def(id,fn){__mods[id]=fn;}\nfunction __req(id){\nvar hit=__cache[id];\nif(hit)return hit;\nvar exports=Object.create(null);\n__cache[id]=exports;\nvar fn=__mods[id];\nif(!fn)throw new Error('[lattice] missing module: '+id);\nfn(exports,__req);\nreturn exports;\n}\n__def(\"packages/core/src/internal/util.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"VERSION\",{enumerable:true,get:function(){return VERSION;}});\nObject.defineProperty(__exports,\"reportedWarnings\",{enumerable:true,get:function(){return reportedWarnings;}});\nObject.defineProperty(__exports,\"warnOnce\",{enumerable:true,get:function(){return warnOnce;}});\nObject.defineProperty(__exports,\"infoOnce\",{enumerable:true,get:function(){return infoOnce;}});\nObject.defineProperty(__exports,\"resetWarnings\",{enumerable:true,get:function(){return resetWarnings;}});\nObject.defineProperty(__exports,\"fail\",{enumerable:true,get:function(){return fail;}});\nObject.defineProperty(__exports,\"invariant\",{enumerable:true,get:function(){return invariant;}});\nObject.defineProperty(__exports,\"DEV\",{enumerable:true,get:function(){return DEV;}});\nObject.defineProperty(__exports,\"isObject\",{enumerable:true,get:function(){return isObject;}});\nObject.defineProperty(__exports,\"isFunction\",{enumerable:true,get:function(){return isFunction;}});\nObject.defineProperty(__exports,\"isNil\",{enumerable:true,get:function(){return isNil;}});\nObject.defineProperty(__exports,\"isBlank\",{enumerable:true,get:function(){return isBlank;}});\nObject.defineProperty(__exports,\"isCtor\",{enumerable:true,get:function(){return isCtor;}});\nObject.defineProperty(__exports,\"pathGetter\",{enumerable:true,get:function(){return pathGetter;}});\nObject.defineProperty(__exports,\"pathSetter\",{enumerable:true,get:function(){return pathSetter;}});\nObject.defineProperty(__exports,\"getPath\",{enumerable:true,get:function(){return getPath;}});\nObject.defineProperty(__exports,\"setPath\",{enumerable:true,get:function(){return setPath;}});\nObject.defineProperty(__exports,\"humanise\",{enumerable:true,get:function(){return humanise;}});\nObject.defineProperty(__exports,\"escapeHtml\",{enumerable:true,get:function(){return escapeHtml;}});\nObject.defineProperty(__exports,\"titleCase\",{enumerable:true,get:function(){return titleCase;}});\nObject.defineProperty(__exports,\"expand\",{enumerable:true,get:function(){return expand;}});\nObject.defineProperty(__exports,\"toArray\",{enumerable:true,get:function(){return toArray;}});\nObject.defineProperty(__exports,\"merge\",{enumerable:true,get:function(){return merge;}});\nObject.defineProperty(__exports,\"mergeRow\",{enumerable:true,get:function(){return mergeRow;}});\nObject.defineProperty(__exports,\"Lru\",{enumerable:true,get:function(){return Lru;}});\nObject.defineProperty(__exports,\"collator\",{enumerable:true,get:function(){return collator;}});\nObject.defineProperty(__exports,\"defaultCompare\",{enumerable:true,get:function(){return defaultCompare;}});\nObject.defineProperty(__exports,\"now\",{enumerable:true,get:function(){return now;}});\nObject.defineProperty(__exports,\"nextFrame\",{enumerable:true,get:function(){return nextFrame;}});\nObject.defineProperty(__exports,\"cancelFrame\",{enumerable:true,get:function(){return cancelFrame;}});\nObject.defineProperty(__exports,\"frameBatched\",{enumerable:true,get:function(){return frameBatched;}});\nObject.defineProperty(__exports,\"settleDebounce\",{enumerable:true,get:function(){return settleDebounce;}});\nObject.defineProperty(__exports,\"whenIdle\",{enumerable:true,get:function(){return whenIdle;}});\nObject.defineProperty(__exports,\"uid\",{enumerable:true,get:function(){return uid;}});\nconst STAMPED_VERSION=\"1.22.0\";\nasync function resolveVersion(){\nif(STAMPED_VERSION!=='0.0.0-source')return STAMPED_VERSION;\ntry{\nif(typeof process==='undefined'||!process.versions||!process.versions.node){\nreturn STAMPED_VERSION;\n}\nconst mod=await import('node:'+'module');\nconst req=mod.createRequire((typeof document!=='undefined'&&document.currentScript?document.currentScript.src:''));\nconst fs=req('node:'+'fs');\nconst url=new URL('../../../../package.json',(typeof document!=='undefined'&&document.currentScript?document.currentScript.src:''));\nconst text=fs.readFileSync(url,'utf8');\nreturn JSON.parse(text).version||STAMPED_VERSION;\n}catch{\nreturn STAMPED_VERSION;\n}\n}\nconst VERSION=\"1.22.0\";\nconst warned=new Set();\nconst WARNED_LIMIT=2000;\nfunction rememberWarned(key){\nwarned.add(key);\nif(warned.size>WARNED_LIMIT){\nconst oldest=warned.values().next().value;\nif(oldest!==undefined)warned.delete(oldest);\n}\n}\nconst reported=[];\nconst REPORT_LIMIT=500;\nfunction record(key,level,message){\nreported.push({\nkey,\nlevel,\nmessage:message.map((m)=>(typeof m==='string'?m:safeString(m))).join(' '),\nat:Date.now(),\n});\nif(reported.length>REPORT_LIMIT)reported.shift();\n}\nfunction safeString(value){\nif(value instanceof Error)return value.message;\ntry{return JSON.stringify(value);}catch{return String(value);}\n}\nfunction reportedWarnings(){return reported.map((r)=>({...r}));}\nfunction warnOnce(key,...message){\nif(warned.has(key))return;\nrememberWarned(key);\nrecord(key,'warn',message);\nconsole.warn('[lattice]',...message);\n}\nfunction infoOnce(key,...message){\nif(warned.has(key))return;\nrememberWarned(key);\nrecord(key,'info',message);\nconsole.info('[lattice]',...message);\n}\nfunction resetWarnings(){\nwarned.clear();\nreported.length=0;\n}\nfunction fail(message,extra){\nconst err=new Error(`[lattice] ${message}`);\nif(extra!==undefined)err.cause=extra;\nthrow err;\n}\nfunction invariant(condition,message){\nif(!condition)fail(message);\n}\nconst DEV=(()=>{\ntry{\nreturn!(typeof process!=='undefined'&&process.env\n&&process.env.NODE_ENV==='production');\n}catch{\nreturn true;\n}\n})();\nfunction isObject(v){\nreturn v!==null&&typeof v==='object'&&!Array.isArray(v);\n}\nfunction isFunction(v){\nreturn typeof v==='function';\n}\nfunction isNil(v){\nreturn v===null||v===undefined;\n}\nfunction isBlank(v){\nreturn v===null||v===undefined||v==='';\n}\nfunction isCtor(v){\nif(typeof v!=='function')return false;\nif(/^class[\\s{]/.test(Function.prototype.toString.call(v)))return true;\nreturn!!(v.prototype&&Object.getOwnPropertyNames(v.prototype).length>1);\n}\nconst pathCache=new Map();\nfunction pathGetter(path){\nlet fn=pathCache.get(path);\nif(fn)return fn;\nif(!path.includes('.')){\nfn=(o)=>(o==null?undefined:o[path]);\n}else{\nconst parts=path.split('.');\nconst n=parts.length;\nfn=(o)=>{\nlet cur=o;\nfor(let i=0;i<n;i++){\nif(cur==null)return undefined;\ncur=cur[parts[i]];\n}\nreturn cur;\n};\n}\npathCache.set(path,fn);\nreturn fn;\n}\nconst setterCache=new Map();\nfunction pathSetter(path){\nlet fn=setterCache.get(path);\nif(fn)return fn;\nif(!path.includes('.')){\nfn=(o,v)=>{if(o!=null)o[path]=v;};\n}else{\nconst parts=path.split('.');\nconst last=parts.length-1;\nfn=(o,v)=>{\nlet cur=o;\nfor(let i=0;i<last;i++){\nif(cur==null)return;\nconst k=parts[i];\nif(cur[k]==null)cur[k]={};\ncur=cur[k];\n}\nif(cur!=null)cur[parts[last]]=v;\n};\n}\nsetterCache.set(path,fn);\nreturn fn;\n}\nfunction getPath(obj,path){\nreturn pathGetter(path)(obj);\n}\nfunction setPath(obj,path,value){\npathSetter(path)(obj,value);\n}\nfunction humanise(field){\nif(!field)return'';\nconst leaf=field.includes('.')?field.slice(field.lastIndexOf('.')+1):field;\nreturn leaf\n.replace(/[_-]+/g,' ')\n.replace(/([a-z0-9])([A-Z])/g,'$1 $2')\n.replace(/([A-Z]+)([A-Z][a-z])/g,'$1 $2')\n.replace(/\\s+/g,' ')\n.trim()\n.replace(/^./,(c)=>c.toUpperCase());\n}\nconst ESCAPES={'&':'&','<':'<','>':'>','\"':'"',\"'\":'''};\nfunction escapeHtml(s){\nconst str=s==null?'':String(s);\nreturn/[&<>\"']/.test(str)?str.replace(/[&<>\"']/g,(c)=>ESCAPES[c]):str;\n}\nfunction titleCase(s){\nreturn String(s).replace(/\\w\\S*/g,(t)=>t[0].toUpperCase()+t.slice(1).toLowerCase());\n}\nfunction expand(value,key,whenTrue){\nif(value===undefined)return undefined;\nif(value===true)return{enabled:true,...whenTrue};\nif(value===false)return{enabled:false};\nif(isObject(value))return value;\nreturn{[key]:value,enabled:true};\n}\nfunction toArray(v){\nif(v===undefined||v===null)return[];\nreturn Array.isArray(v)?v:[v];\n}\nconst MERGE_FORBIDDEN_KEYS=Object.freeze(new Set(['__proto__','constructor','prototype']));\nfunction merge(a,b){\nif(!isObject(a))return isObject(b)?{...b}:b;\nif(!isObject(b))return b===undefined?a:b;\nconst out={...a};\nfor(const k of Object.keys(b)){\nif(MERGE_FORBIDDEN_KEYS.has(k))continue;\nconst bv=b[k];\nif(bv===undefined)continue;\nout[k]=isObject(bv)&&isObject(out[k])?merge(out[k],bv):bv;\n}\nreturn out;\n}\nfunction mergeRow(previous,patch){\nif(!isObject(previous)||!isObject(patch)||previous===patch)return patch;\nconst out=Object.create(Object.getPrototypeOf(previous));\nObject.assign(out,previous,patch);\nreturn out;\n}\nclass Lru{\n#max;\n#map=new Map();\n#onEvict;\nconstructor(max=256,onEvict=null){\nthis.#max=max;\nthis.#onEvict=onEvict;\n}\nget size(){\nreturn this.#map.size;\n}\nget max(){\nreturn this.#max;\n}\nset max(v){\nthis.#max=v;\nthis.#trim();\n}\nhas(k){\nreturn this.#map.has(k);\n}\nget(k){\nconst m=this.#map;\nif(!m.has(k))return undefined;\nconst v=m.get(k);\nm.delete(k);\nm.set(k,v);\nreturn v;\n}\npeek(k){\nreturn this.#map.get(k);\n}\nset(k,v){\nconst m=this.#map;\nif(m.has(k))m.delete(k);\nm.set(k,v);\nthis.#trim();\nreturn v;\n}\ndelete(k){\nconst v=this.#map.get(k);\nif(this.#map.delete(k)&&this.#onEvict)this.#onEvict(v,k);\nreturn v;\n}\nclear(){\nif(this.#onEvict)for(const[k,v]of this.#map)this.#onEvict(v,k);\nthis.#map.clear();\n}\nkeys(){\nreturn this.#map.keys();\n}\nvalues(){\nreturn this.#map.values();\n}\n#trim(){\nconst m=this.#map;\nwhile(m.size>this.#max){\nconst oldest=m.keys().next().value;\nconst v=m.get(oldest);\nm.delete(oldest);\nif(this.#onEvict)this.#onEvict(v,oldest);\n}\n}\n}\nconst collators=new Map();\nfunction collator(locale,opts){\nconst key=`${locale||''}|${opts?JSON.stringify(opts):''}`;\nlet c=collators.get(key);\nif(!c){\nc=new Intl.Collator(locale||undefined,{\nnumeric:true,sensitivity:'variant',...opts,\n});\ncollators.set(key,c);\n}\nreturn c;\n}\nfunction defaultCompare(a,b){\nif(a===b)return 0;\nif(a===null||a===undefined)return 1;\nif(b===null||b===undefined)return-1;\nif(typeof a==='number'&&typeof b==='number'){\nif(Number.isNaN(a))return Number.isNaN(b)?0:1;\nif(Number.isNaN(b))return-1;\nreturn a<b?-1:a>b?1:0;\n}\nconst sa=String(a);\nconst sb=String(b);\nreturn sa<sb?-1:sa>sb?1:0;\n}\nfunction now(){\nreturn typeof performance!=='undefined'&&performance.now\n?performance.now()\n:Date.now();\n}\nconst hasRaf=typeof requestAnimationFrame==='function';\nfunction nextFrame(fn){\nif(hasRaf)return requestAnimationFrame(fn);\nreturn setTimeout(()=>fn(now()),16);\n}\nfunction cancelFrame(handle){\nif(handle==null)return;\nif(hasRaf)cancelAnimationFrame(handle);\nelse clearTimeout(handle);\n}\nfunction frameBatched(fn){\nlet handle=null;\nlet lastArgs=null;\nconst run=()=>{\nhandle=null;\nconst a=lastArgs;\nlastArgs=null;\nfn(...(a||[]));\n};\nconst wrapped=(...args)=>{\nlastArgs=args;\nif(handle===null)handle=nextFrame(run);\n};\nwrapped.cancel=()=>{\ncancelFrame(handle);\nhandle=null;\nlastArgs=null;\n};\nwrapped.flush=()=>{\nif(handle!==null){\ncancelFrame(handle);\nrun();\n}\n};\nreturn wrapped;\n}\nfunction settleDebounce(fn,waitMs){\nlet timer=null;\nlet held=null;\nconst trailing=()=>{\ntimer=null;\nif(held===null)return;\nconst args=held;\nheld=null;\nfn(...args);\narm();\n};\nconst arm=()=>{\ntimer=setTimeout(trailing,waitMs);\nif(typeof timer?.unref==='function')timer.unref();\n};\nconst wrapped=(...args)=>{\nif(timer===null){\nfn(...args);\narm();\n}else{\nheld=args;\nclearTimeout(timer);\narm();\n}\n};\nwrapped.flush=()=>{\nif(timer!==null)clearTimeout(timer);\ntimer=null;\nif(held===null)return;\nconst args=held;\nheld=null;\nfn(...args);\n};\nwrapped.cancel=()=>{\nif(timer!==null)clearTimeout(timer);\ntimer=null;\nheld=null;\n};\nwrapped.pending=()=>timer!==null||held!==null;\nreturn wrapped;\n}\nfunction whenIdle(fn,timeout=50){\nif(typeof requestIdleCallback==='function'){\nreturn requestIdleCallback(fn,{timeout});\n}\nreturn setTimeout(()=>fn({timeRemaining:()=>0,didTimeout:true}),1);\n}\nlet idSeq=0;\nfunction uid(prefix='l'){\nreturn`${prefix}${(++idSeq).toString(36)}`;\n}\n});\n__def(\"packages/worker/src/transport.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"PROTOCOL\",{enumerable:true,get:function(){return PROTOCOL;}});\nObject.defineProperty(__exports,\"OPS\",{enumerable:true,get:function(){return OPS;}});\nObject.defineProperty(__exports,\"CONTROL\",{enumerable:true,get:function(){return CONTROL;}});\nObject.defineProperty(__exports,\"ERRORS\",{enumerable:true,get:function(){return ERRORS;}});\nObject.defineProperty(__exports,\"packHandle\",{enumerable:true,get:function(){return packHandle;}});\nObject.defineProperty(__exports,\"packHandles\",{enumerable:true,get:function(){return packHandles;}});\nObject.defineProperty(__exports,\"TransportedDictionary\",{enumerable:true,get:function(){return TransportedDictionary;}});\nObject.defineProperty(__exports,\"unpackHandle\",{enumerable:true,get:function(){return unpackHandle;}});\nObject.defineProperty(__exports,\"unpackHandles\",{enumerable:true,get:function(){return unpackHandles;}});\nObject.defineProperty(__exports,\"createMaskPool\",{enumerable:true,get:function(){return createMaskPool;}});\nObject.defineProperty(__exports,\"isTransferable\",{enumerable:true,get:function(){return isTransferable;}});\nObject.defineProperty(__exports,\"collectTransfers\",{enumerable:true,get:function(){return collectTransfers;}});\nObject.defineProperty(__exports,\"isPortable\",{enumerable:true,get:function(){return isPortable;}});\nObject.defineProperty(__exports,\"filterColumnIds\",{enumerable:true,get:function(){return filterColumnIds;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst isFunction=__m0[\"isFunction\"];\nconst PROTOCOL=1;\nconst OPS=Object.freeze({\nSORT_COLUMN:'sortColumn',\nSORT_MULTI:'sortMulti',\nEVALUATE_FILTERS:'evaluateFilters',\nCOMPACT:'compact',\nGROUP_BY_COLUMNS:'groupByColumns',\nTOTAL:'total',\nPIVOT:'pivot',\nFACET:'facet',\nCOLUMNIZE:'columnize',\nCOLLATE_STRING_RANKS:'collateStringRanks',\n});\nconst CONTROL=Object.freeze({\nREADY:'ready',\nCANCEL:'cancel',\nPING:'ping',\n});\nconst ERRORS=Object.freeze({\nNO_COMPUTE:'E_NO_COMPUTE',\nNO_KERNEL:'E_NO_KERNEL',\nABORTED:'E_ABORTED',\nKERNEL:'E_KERNEL',\nPROTOCOL:'E_PROTOCOL',\n});\nfunction packHandle(handle){\nif(handle==null)return null;\nconst presence=handle.presence;\nreturn{\nid:handle.id,\nkind:handle.kind,\nnullable:!!handle.nullable,\nvalues:handle.values??null,\npresence:presence?(presence.words??presence):null,\npresenceBits:presence?(presence.size??(presence.words??presence).length*8):0,\ndict:handle.dict?sliceDictionary(handle.dict):null,\noffsets:handle.offsets??null,\nversion:handle.version??0,\n};\n}\nfunction sliceDictionary(dict){\nif(Array.isArray(dict))return dict;\nif(isFunction(dict.values))return dict.values();\nreturn[];\n}\nfunction packHandles(handles){\nconst out=new Array(handles.length);\nfor(let i=0;i<handles.length;i++)out[i]=packHandle(handles[i]);\nreturn out;\n}\nclass TransportedBitset{\n#words;\n#bits;\nconstructor(words,bits){\nthis.#words=words;\nthis.#bits=bits;\n}\nget words(){return this.#words;}\nget size(){return this.#bits;}\nget(i){return(this.#words[i>>>3]&(1<<(i&7)))!==0;}\ncount(){\nconst w=this.#words;\nlet n=0;\nfor(let i=0;i<w.length;i++){\nlet v=w[i];\nwhile(v){v&=v-1;n++;}\n}\nreturn n;\n}\n}\nclass TransportedDictionary{\n#values;\n#index=null;\n#version=0;\n#ranks=new Map();\nconstructor(values){\nthis.#values=values||[];\n}\nget size(){return this.#values.length;}\nget version(){return this.#version;}\ncodeOf(value){\nif(this.#index===null){\nthis.#index=new Map();\nfor(let i=0;i<this.#values.length;i++)this.#index.set(this.#values[i],i);\n}\nconst found=this.#index.get(value);\nif(found!==undefined)return found;\nconst code=this.#values.length;\nthis.#values.push(value);\nthis.#index.set(value,code);\nthis.#version++;\nreturn code;\n}\nvalueOf(code){return this.#values[code];}\nvalues(){return this.#values;}\nranks(locale){\nconst key=locale||'';\nconst cached=this.#ranks.get(key);\nif(cached&&cached.version===this.#version)return cached.ranks;\nconst n=this.#values.length;\nconst order=new Uint32Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\nconst cmp=collator(locale).compare;\nconst vals=this.#values;\nconst sorted=Array.from(order).sort((a,b)=>{\nconst av=vals[a];\nconst bv=vals[b];\nif(av===bv)return 0;\nif(av===null||av===undefined)return 1;\nif(bv===null||bv===undefined)return-1;\nreturn cmp(String(av),String(bv));\n});\nconst ranks=new Uint32Array(n);\nfor(let r=0;r<sorted.length;r++)ranks[sorted[r]]=r;\nthis.#ranks.set(key,{version:this.#version,ranks});\nreturn ranks;\n}\n}\nfunction unpackHandle(packed){\nif(packed==null)return null;\nconst presence=packed.presence\n?new TransportedBitset(packed.presence,packed.presenceBits||packed.presence.length*8)\n:null;\nconst dict=packed.dict?new TransportedDictionary(packed.dict):null;\nconst values=packed.values;\nconst offsets=packed.offsets??null;\nconst kind=packed.kind;\nconst get=(physical)=>{\nif(presence&&!presence.get(physical))return null;\nswitch(kind){\ncase'dictionary':\nreturn dict?dict.valueOf(values[physical]):values[physical];\ncase'bitset':\nreturn(values[physical>>>3]&(1<<(physical&7)))!==0;\ncase'multi':{\nif(!offsets)return null;\nconst from=offsets[physical];\nconst to=offsets[physical+1];\nconst out=new Array(to-from);\nfor(let i=from;i<to;i++)out[i-from]=dict?dict.valueOf(values[i]):values[i];\nreturn out;\n}\ndefault:\nreturn values[physical];\n}\n};\nreturn{\nid:packed.id,\nkind,\nnullable:packed.nullable,\nvalues,\npresence,\ndict,\noffsets,\nget,\nversion:packed.version,\n};\n}\nfunction unpackHandles(packed){\nconst out=new Array(packed.length);\nfor(let i=0;i<packed.length;i++)out[i]=unpackHandle(packed[i]);\nreturn out;\n}\nfunction createMaskPool(){\nconst masks=[];\nconst indices=[];\nreturn{\nmask(n){\nfor(let i=0;i<masks.length;i++){\nif(masks[i].length>=n){\nconst buf=masks.splice(i,1)[0].subarray(0,n);\nbuf.fill(0);\nreturn buf;\n}\n}\nreturn new Uint8Array(n);\n},\nindices(n){\nfor(let i=0;i<indices.length;i++){\nif(indices[i].length>=n)return indices.splice(i,1)[0].subarray(0,n);\n}\nreturn new Uint32Array(n);\n},\nrelease(buf){\nif(!buf)return;\nif(buf instanceof Uint8Array)masks.push(buf);\nelse if(buf instanceof Uint32Array)indices.push(buf);\n},\nclear(){masks.length=0;indices.length=0;},\n};\n}\nfunction isTransferable(v){\nif(!ArrayBuffer.isView(v))return false;\nconst buf=(v).buffer;\nif(!buf)return false;\nreturn typeof SharedArrayBuffer==='undefined'||!(buf instanceof SharedArrayBuffer);\n}\nfunction collectTransfers(value,out=[]){\nconst add=(v)=>{\nif(!isTransferable(v))return;\nconst buf=(v).buffer;\nif(!out.includes(buf))out.push(buf);\n};\nif(value==null)return out;\nif(ArrayBuffer.isView(value)){add(value);return out;}\nif(Array.isArray(value)){\nfor(const item of value)add(item);\nreturn out;\n}\nif(typeof value==='object'){\nfor(const key of Object.keys(value)){\nconst item=(value)[key];\nif(Array.isArray(item))for(const sub of item)add(sub);\nelse add(item);\n}\n}\nreturn out;\n}\nfunction isPortable(value,depth=0){\nif(value==null)return true;\nconst t=typeof value;\nif(t==='function'||t==='symbol')return false;\nif(t!=='object')return true;\nif(depth>4)return true;\nif(ArrayBuffer.isView(value)||value instanceof ArrayBuffer||value instanceof Date)return true;\nif(Array.isArray(value)){\nfor(const item of value)if(!isPortable(item,depth+1))return false;\nreturn true;\n}\nfor(const key of Object.keys(value)){\nif(!isPortable((value)[key],depth+1))return false;\n}\nreturn true;\n}\nfunction filterColumnIds(filters,out=new Set()){\nif(!filters||typeof filters!=='object')return out;\nconst node=(filters);\nif(typeof node.col==='string')out.add(node.col);\nconst conditions=node.conditions;\nif(Array.isArray(conditions))for(const child of conditions)filterColumnIds(child,out);\nreturn out;\n}\n});\n__def(\"packages/core/src/store/bitset.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Bitset\",{enumerable:true,get:function(){return Bitset;}});\nconst WORD_BITS=8;\nclass Bitset{\nstatic#POP=new Uint8Array(256);\nstatic{\nfor(let i=1;i<256;i++)Bitset.#POP[i]=Bitset.#POP[i>>1]+(i&1);\n}\n#words;\n#bits;\nconstructor(bits=0){\nconst n=Math.max(0,bits|0);\nthis.#bits=n;\nthis.#words=new Uint8Array(Math.ceil(n/WORD_BITS));\n}\nget size(){return this.#bits;}\nget words(){return this.#words;}\nget bytes(){return this.#words?this.#words.byteLength:0;}\nget(i){\nif(i<0||i>=this.#bits)return 0;\nreturn(this.#words[i>>3]>>(i&7))&1;\n}\nset(i){\nif(i>=0&&i<this.#bits)this.#words[i>>3]|=1<<(i&7);\nreturn this;\n}\nclear(i){\nif(i>=0&&i<this.#bits)this.#words[i>>3]&=~(1<<(i&7));\nreturn this;\n}\nassign(i,bit){return bit?this.set(i):this.clear(i);}\nfill(bit=false){\nthis.#words.fill(bit?0xff:0);\nif(bit)this.#maskTail();\nreturn this;\n}\ngrow(bits){\nconst n=Math.max(0,bits|0);\nif(n<=this.#bits)return this;\nconst need=Math.ceil(n/WORD_BITS);\nif(need>this.#words.length){\nconst next=new Uint8Array(need);\nnext.set(this.#words);\nthis.#words=next;\n}\nthis.#bits=n;\nreturn this;\n}\ncount(){\nconst w=this.#words;\nconst pop=Bitset.#POP;\nlet total=0;\nfor(let i=0;i<w.length;i++)total+=pop[w[i]];\nreturn total;\n}\nand(other){\nconst b=other instanceof Bitset?other.words:other;\nconst w=this.#words;\nconst shared=Math.min(w.length,b.length);\nfor(let i=0;i<shared;i++)w[i]&=b[i];\nfor(let i=shared;i<w.length;i++)w[i]=0;\nreturn this;\n}\nor(other){\nconst b=other instanceof Bitset?other.words:other;\nconst w=this.#words;\nconst shared=Math.min(w.length,b.length);\nfor(let i=0;i<shared;i++)w[i]|=b[i];\nreturn this;\n}\nnot(){\nconst w=this.#words;\nfor(let i=0;i<w.length;i++)w[i]=~w[i]&0xff;\nthis.#maskTail();\nreturn this;\n}\nclone(){\nconst out=new Bitset(this.#bits);\nout.words.set(this.#words.subarray(0,out.words.length));\nreturn out;\n}\nrelease(){\nthis.#words=new Uint8Array(0);\nthis.#bits=0;\n}\n#maskTail(){\nconst used=this.#bits&7;\nif(used===0)return;\nconst last=(this.#bits>>3);\nif(last<this.#words.length)this.#words[last]&=(1<<used)-1;\n}\nstatic from(bools){\nconst arr=Array.isArray(bools)?bools:Array.from(bools);\nconst out=new Bitset(arr.length);\nfor(let i=0;i<arr.length;i++)if(arr[i])out.set(i);\nreturn out;\n}\n}\n});\n__def(\"packages/core/src/store/dictionary.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Dictionary\",{enumerable:true,get:function(){return Dictionary;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst defaultCompare=__m0[\"defaultCompare\"];\nclass Dictionary{\n#values;\n#codes=new Map();\n#version=0;\n#ranks=null;\n#ranksVersion=-1;\n#ranksLocale='\\u0000';\nconstructor(values=[]){\nthis.#values=[];\nfor(let i=0;i<values.length;i++){\nconst v=values[i];\nif(this.#codes.has(v))continue;\nthis.#codes.set(v,this.#values.length);\nthis.#values.push(v);\n}\n}\nget size(){return this.#values.length;}\nget version(){return this.#version;}\nget bytes(){\nlet total=this.#values.length*8;\nfor(let i=0;i<this.#values.length;i++){\nconst v=this.#values[i];\nif(typeof v==='string')total+=v.length*2;\ntotal+=16;\n}\nreturn total;\n}\ncodeOf(value){\nconst existing=this.#codes.get(value);\nif(existing!==undefined)return existing;\nconst code=this.#values.length;\nthis.#values.push(value);\nthis.#codes.set(value,code);\nthis.#version++;\nreturn code;\n}\nlookup(value){\nconst code=this.#codes.get(value);\nreturn code===undefined?-1:code;\n}\nhas(value){return this.#codes.has(value);}\nvalueOf(code){return this.#values[code];}\nvalues(){return this.#values;}\nranks(locale){\nconst key=locale||'';\nif(this.#ranks&&this.#ranksVersion===this.#version&&this.#ranksLocale===key){\nreturn this.#ranks;\n}\nconst n=this.#values.length;\nconst order=new Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\nconst cmp=collator(locale).compare;\nconst values=this.#values;\norder.sort((a,b)=>this.#compare(values[a],values[b],cmp));\nconst ranks=new Uint32Array(n);\nfor(let rank=0;rank<n;rank++)ranks[order[rank]]=rank;\nthis.#ranks=ranks;\nthis.#ranksVersion=this.#version;\nthis.#ranksLocale=key;\nreturn ranks;\n}\n#compare(a,b,compare){\nif(typeof a==='string'&&typeof b==='string')return compare(a,b);\nreturn defaultCompare(a,b);\n}\n}\n});\n__def(\"packages/core/src/store/multivalue.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"MultiValue\",{enumerable:true,get:function(){return MultiValue;}});\nclass MultiValue{\n#values;\n#offsets;\n#rows=0;\n#fill=0;\nconstructor(capacity={}){\nconst rows=Math.max(1,capacity.rows??16);\nconst values=Math.max(1,capacity.values??rows);\nthis.#values=new Int32Array(values);\nthis.#offsets=new Uint32Array(rows+1);\n}\nget values(){return this.#values;}\nget offsets(){return this.#offsets;}\nget rows(){return this.#rows;}\nget length(){return this.#fill;}\nget bytes(){return this.#values.byteLength+this.#offsets.byteLength;}\ncount(r){\nif(r<0||r>=this.#rows)return 0;\nreturn this.#offsets[r+1]-this.#offsets[r];\n}\nat(r){\nif(r<0||r>=this.#rows)return this.#values.subarray(0,0);\nreturn this.#values.subarray(this.#offsets[r],this.#offsets[r+1]);\n}\nhas(r,code){\nif(r<0||r>=this.#rows)return false;\nconst v=this.#values;\nconst end=this.#offsets[r+1];\nfor(let i=this.#offsets[r];i<end;i++)if(v[i]===code)return true;\nreturn false;\n}\nhasAny(r,codes){\nfor(let i=0;i<codes.length;i++)if(this.has(r,codes[i]))return true;\nreturn false;\n}\nhasAll(r,codes){\nfor(let i=0;i<codes.length;i++)if(!this.has(r,codes[i]))return false;\nreturn true;\n}\nhasNone(r,codes){return!this.hasAny(r,codes);}\npush(codes){\nconst r=this.#rows;\nconst n=codes.length;\nthis.#ensureRows(r+1);\nthis.#ensureValues(this.#fill+n);\nconst start=this.#fill;\nfor(let i=0;i<n;i++)this.#values[start+i]=codes[i]|0;\nthis.#fill+=n;\nthis.#rows=r+1;\nthis.#offsets[r]=start;\nthis.#offsets[r+1]=this.#fill;\nreturn r;\n}\nwrite(r,codes){\nif(r===this.#rows){this.push(codes);return;}\nif(r<0||r>this.#rows)return;\nconst start=this.#offsets[r];\nconst end=this.#offsets[r+1];\nconst n=codes.length;\nif(end-start===n){\nfor(let i=0;i<n;i++)this.#values[start+i]=codes[i]|0;\nreturn;\n}\nthis.#rebuild(r,codes);\n}\ncompact(remap,liveCount,dead){\nconst oldValues=this.#values;\nconst oldOffsets=this.#offsets;\nconst oldRows=this.#rows;\nconst values=new Int32Array(Math.max(1,this.#fill));\nconst offsets=new Uint32Array(liveCount+1);\nlet w=0;\nfor(let p=0;p<oldRows;p++){\nif(remap[p]===dead)continue;\nconst start=oldOffsets[p];\nconst end=oldOffsets[p+1];\noffsets[remap[p]]=w;\nfor(let i=start;i<end;i++)values[w++]=oldValues[i];\noffsets[remap[p]+1]=w;\n}\nthis.#values=values;\nthis.#offsets=offsets;\nthis.#rows=liveCount;\nthis.#fill=w;\n}\nrelease(){\nthis.#values=new Int32Array(0);\nthis.#offsets=new Uint32Array(1);\nthis.#rows=0;\nthis.#fill=0;\n}\n#ensureRows(rows){\nif(rows+1<=this.#offsets.length)return;\nlet cap=this.#offsets.length-1;\nwhile(cap<rows)cap=cap*2||16;\nconst next=new Uint32Array(cap+1);\nnext.set(this.#offsets);\nthis.#offsets=next;\n}\n#ensureValues(n){\nif(n<=this.#values.length)return;\nlet cap=this.#values.length;\nwhile(cap<n)cap=cap*2||16;\nconst next=new Int32Array(cap);\nnext.set(this.#values);\nthis.#values=next;\n}\n#rebuild(r,codes){\nconst oldValues=this.#values;\nconst oldOffsets=this.#offsets;\nconst rows=this.#rows;\nconst delta=codes.length-(oldOffsets[r+1]-oldOffsets[r]);\nconst values=new Int32Array(Math.max(1,this.#fill+delta));\nconst offsets=new Uint32Array(oldOffsets.length);\nlet w=0;\nfor(let p=0;p<rows;p++){\noffsets[p]=w;\nif(p===r){\nfor(let i=0;i<codes.length;i++)values[w++]=codes[i]|0;\n}else{\nfor(let i=oldOffsets[p];i<oldOffsets[p+1];i++)values[w++]=oldValues[i];\n}\noffsets[p+1]=w;\n}\nthis.#values=values;\nthis.#offsets=offsets;\nthis.#fill=w;\n}\n}\n});\n__def(\"packages/core/src/compute/handle.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"identity\",{enumerable:true,get:function(){return identity;}});\nObject.defineProperty(__exports,\"rowCount\",{enumerable:true,get:function(){return rowCount;}});\nObject.defineProperty(__exports,\"bitReader\",{enumerable:true,get:function(){return bitReader;}});\nObject.defineProperty(__exports,\"presenceReader\",{enumerable:true,get:function(){return presenceReader;}});\nObject.defineProperty(__exports,\"dictSize\",{enumerable:true,get:function(){return dictSize;}});\nObject.defineProperty(__exports,\"dictValue\",{enumerable:true,get:function(){return dictValue;}});\nObject.defineProperty(__exports,\"multiValue\",{enumerable:true,get:function(){return multiValue;}});\nObject.defineProperty(__exports,\"valueReader\",{enumerable:true,get:function(){return valueReader;}});\nObject.defineProperty(__exports,\"numericTotalOrder\",{enumerable:true,get:function(){return numericTotalOrder;}});\nObject.defineProperty(__exports,\"valueComparator\",{enumerable:true,get:function(){return valueComparator;}});\nObject.defineProperty(__exports,\"dictRanks\",{enumerable:true,get:function(){return dictRanks;}});\nObject.defineProperty(__exports,\"isMissing\",{enumerable:true,get:function(){return isMissing;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst defaultCompare=__m0[\"defaultCompare\"];\nconst warnOnce=__m0[\"warnOnce\"];\nfunction identity(n){\nconst out=new Uint32Array(n);\nfor(let i=0;i<n;i++)out[i]=i;\nreturn out;\n}\nfunction rowCount(handle,opts){\nif(opts&&typeof opts.count==='number')return opts.count;\nif(!handle)return 0;\nif(typeof handle.count==='number')return handle.count;\nif(typeof handle.length==='number')return handle.length;\nconst values=handle.values;\nif(handle.kind==='multi'&&handle.offsets)return Math.max(0,handle.offsets.length-1);\nif(!values)return handle.presence&&typeof handle.presence.size==='number'?handle.presence.size:0;\nif(handle.kind==='bitset'){\nif(typeof values.size==='number')return values.size;\nif(handle.presence&&typeof handle.presence.size==='number')return handle.presence.size;\nwarnOnce(`count:${handle.id}`,`column \"${handle.id}\" is bitset-backed with no declared row count; assuming ${values.length*8}`);\nreturn values.length*8;\n}\nreturn values.length;\n}\nconst bitOrders=new WeakMap();\nfunction bitOrderOf(bitset){\nconst ctor=bitset.constructor;\nif(!ctor)return'unknown';\nconst cached=bitOrders.get(ctor);\nif(cached)return cached;\nlet order='unknown';\ntry{\nlet probe=null;\nif(typeof ctor.from==='function')probe=ctor.from([false,true]);\nelse{\nprobe=new ctor(8);\nprobe.set(1);\n}\nconst words=probe&&probe.words;\nif(words&&words.length){\nif(words[0]===0x02)order='lsb';\nelse if(words[0]===0x40)order='msb';\n}\n}catch{\norder='unknown';\n}\nbitOrders.set(ctor,order);\nreturn order;\n}\nfunction bitReader(bits){\nif(!bits)return()=>0;\nconst raw=bits instanceof Uint8Array?bits:bits.words;\nif(raw instanceof Uint8Array){\nconst order=bits instanceof Uint8Array?'lsb':bitOrderOf(bits);\nif(order==='lsb')return(i)=>(raw[i>>>3]>>>(i&7))&1;\nif(order==='msb')return(i)=>(raw[i>>>3]>>>(7-(i&7)))&1;\n}\nif(typeof bits.get==='function')return(i)=>(bits.get(i)?1:0);\nreturn()=>0;\n}\nfunction presenceReader(handle){\nif(!handle||!handle.presence)return null;\nreturn bitReader(handle.presence);\n}\nfunction dictSize(dict){\nif(!dict)return 0;\nif(typeof dict.size==='number')return dict.size;\nif(typeof dict.values==='function')return dict.values().length;\nreturn 0;\n}\nfunction dictValue(dict,code){\nif(!dict)return null;\nif(typeof dict.valueOf==='function')return dict.valueOf(code);\nif(typeof dict.values==='function')return dict.values()[code];\nreturn null;\n}\nfunction multiValue(handle,i){\nconst offsets=handle.offsets;\nconst values=handle.values;\nif(!offsets||!values)return[];\nconst from=offsets[i];\nconst to=offsets[i+1];\nif(!(to>from))return[];\nconst dict=handle.dict;\nconst out=new Array(to-from);\nfor(let k=from;k<to;k++)out[k-from]=dict?dictValue(dict,values[k]):values[k];\nreturn out;\n}\nfunction valueReader(handle){\nif(!handle)return()=>undefined;\nconst values=handle.values;\nconst present=presenceReader(handle);\nconst kind=handle.kind;\nif(kind==='dictionary'){\nconst dict=handle.dict;\nif(present)return(i)=>(present(i)?dictValue(dict,values[i]):null);\nreturn(i)=>dictValue(dict,values[i]);\n}\nif(kind==='bitset'){\nconst bit=bitReader(values);\nif(present)return(i)=>(present(i)?bit(i)===1:null);\nreturn(i)=>bit(i)===1;\n}\nif(kind==='multi'){\nif(present)return(i)=>(present(i)?multiValue(handle,i):null);\nreturn(i)=>multiValue(handle,i);\n}\nif(!values&&typeof handle.get==='function'){\nconst get=handle.get.bind(handle);\nreturn(i)=>{\nconst v=get(i);\nreturn v===undefined?null:v;\n};\n}\nif(present){\nreturn(i)=>{\nif(!present(i))return null;\nconst v=values[i];\nreturn v===undefined?null:v;\n};\n}\nreturn(i)=>{\nconst v=values[i];\nreturn v===undefined?null:v;\n};\n}\nfunction numericTotalOrder(a,b){\nif(a<b)return-1;\nif(a>b)return 1;\nif(a===b){\nconst na=Object.is(a,-0);\nconst nb=Object.is(b,-0);\nif(na===nb)return 0;\nreturn na?-1:1;\n}\nconst an=Number.isNaN(a);\nconst bn=Number.isNaN(b);\nif(an&&bn)return 0;\nreturn an?1:-1;\n}\nfunction valueComparator(locale){\nconst coll=collator(locale);\nreturn(a,b)=>{\nif(a===b)return 0;\nconst ta=typeof a;\nconst tb=typeof b;\nif(ta==='string'&&tb==='string')return coll.compare(a,b);\nif(ta==='number'&&tb==='number')return numericTotalOrder(a,b);\nif(ta==='boolean'&&tb==='boolean')return a===b?0:a?1:-1;\nif(a instanceof Date||b instanceof Date){\nconst na=a instanceof Date?a.getTime():Number(a);\nconst nb=b instanceof Date?b.getTime():Number(b);\nreturn numericTotalOrder(na,nb);\n}\nreturn defaultCompare(a,b);\n};\n}\nfunction dictRanks(dict,locale){\nif(dict&&typeof dict.ranks==='function')return dict.ranks(locale);\nconst table=dict&&typeof dict.values==='function'?dict.values():[];\nconst n=table.length;\nconst cmp=valueComparator(locale);\nconst order=new Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\norder.sort((a,b)=>cmp(table[a],table[b])||a-b);\nconst ranks=new Uint32Array(n);\nfor(let r=0;r<n;r++)ranks[order[r]]=r;\nreturn ranks;\n}\nfunction isMissing(v){\nreturn v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v));\n}\n});\n__def(\"packages/core/src/compute/sort.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"radixSortFloat64\",{enumerable:true,get:function(){return radixSortFloat64;}});\nObject.defineProperty(__exports,\"radixSortInt32\",{enumerable:true,get:function(){return radixSortInt32;}});\nObject.defineProperty(__exports,\"rankSortDictionary\",{enumerable:true,get:function(){return rankSortDictionary;}});\nObject.defineProperty(__exports,\"mergeSortComparator\",{enumerable:true,get:function(){return mergeSortComparator;}});\nObject.defineProperty(__exports,\"rankSortStrings\",{enumerable:true,get:function(){return rankSortStrings;}});\nObject.defineProperty(__exports,\"collateStringRanks\",{enumerable:true,get:function(){return collateStringRanks;}});\nObject.defineProperty(__exports,\"sortColumn\",{enumerable:true,get:function(){return sortColumn;}});\nObject.defineProperty(__exports,\"sortMulti\",{enumerable:true,get:function(){return sortMulti;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst bitReader=__m0[\"bitReader\"];\nconst dictRanks=__m0[\"dictRanks\"];\nconst dictSize=__m0[\"dictSize\"];\nconst identity=__m0[\"identity\"];\nconst isMissing=__m0[\"isMissing\"];\nconst presenceReader=__m0[\"presenceReader\"];\nconst rowCount=__m0[\"rowCount\"];\nconst valueComparator=__m0[\"valueComparator\"];\nconst valueReader=__m0[\"valueReader\"];\nconst EMPTY_INDICES=new Uint32Array(0);\nconst SCRATCH=new ArrayBuffer(8);\nconst SCRATCH_F64=new Float64Array(SCRATCH);\nconst SCRATCH_U32=new Uint32Array(SCRATCH);\nconst HI=(()=>{\nSCRATCH_F64[0]=-1;\nreturn(SCRATCH_U32[1]&0x80000000)!==0?1:0;\n})();\nconst LO=HI===1?0:1;\nfunction transformDouble(value,out){\nSCRATCH_F64[0]=value;\nlet hi=SCRATCH_U32[HI];\nlet lo=SCRATCH_U32[LO];\nif((hi&0x80000000)!==0){\nhi=~hi>>>0;\nlo=~lo>>>0;\n}else{\nhi=(hi^0x80000000)>>>0;\n}\nout[0]=lo;\nout[1]=hi;\n}\nfunction radixLsd64(idx,lo,hi,n){\nif(n<2)return idx;\nconst hist=new Uint32Array(256*8);\nfor(let i=0;i<n;i++){\nconst l=lo[i];\nconst h=hi[i];\nhist[l&0xff]++;\nhist[256+((l>>>8)&0xff)]++;\nhist[512+((l>>>16)&0xff)]++;\nhist[768+((l>>>24)&0xff)]++;\nhist[1024+(h&0xff)]++;\nhist[1280+((h>>>8)&0xff)]++;\nhist[1536+((h>>>16)&0xff)]++;\nhist[1792+((h>>>24)&0xff)]++;\n}\nlet srcIdx=idx;\nlet srcLo=lo;\nlet srcHi=hi;\nlet dstIdx=new Uint32Array(n);\nlet dstLo=new Uint32Array(n);\nlet dstHi=new Uint32Array(n);\nconst offset=new Uint32Array(256);\nfor(let pass=0;pass<8;pass++){\nconst base=pass<<8;\nconst shift=(pass&3)<<3;\nconst useHi=pass>=4;\nlet skip=false;\nfor(let b=0;b<256;b++){\nif(hist[base+b]===n){skip=true;break;}\n}\nif(skip)continue;\nlet sum=0;\nfor(let b=0;b<256;b++){\noffset[b]=sum;\nsum+=hist[base+b];\n}\nfor(let i=0;i<n;i++){\nconst l=srcLo[i];\nconst h=srcHi[i];\nconst digit=((useHi?h:l)>>>shift)&0xff;\nconst p=offset[digit]++;\ndstIdx[p]=srcIdx[i];\ndstLo[p]=l;\ndstHi[p]=h;\n}\nlet t=srcIdx;srcIdx=dstIdx;dstIdx=t;\nt=srcLo;srcLo=dstLo;dstLo=t;\nt=srcHi;srcHi=dstHi;dstHi=t;\n}\nreturn srcIdx;\n}\nfunction radixLsd32(idx,keys,n){\nif(n<2)return idx;\nconst hist=new Uint32Array(256*4);\nfor(let i=0;i<n;i++){\nconst k=keys[i];\nhist[k&0xff]++;\nhist[256+((k>>>8)&0xff)]++;\nhist[512+((k>>>16)&0xff)]++;\nhist[768+((k>>>24)&0xff)]++;\n}\nlet srcIdx=idx;\nlet srcKeys=keys;\nlet dstIdx=new Uint32Array(n);\nlet dstKeys=new Uint32Array(n);\nconst offset=new Uint32Array(256);\nfor(let pass=0;pass<4;pass++){\nconst base=pass<<8;\nconst shift=pass<<3;\nlet skip=false;\nfor(let b=0;b<256;b++){\nif(hist[base+b]===n){skip=true;break;}\n}\nif(skip)continue;\nlet sum=0;\nfor(let b=0;b<256;b++){\noffset[b]=sum;\nsum+=hist[base+b];\n}\nfor(let i=0;i<n;i++){\nconst k=srcKeys[i];\nconst p=offset[(k>>>shift)&0xff]++;\ndstIdx[p]=srcIdx[i];\ndstKeys[p]=k;\n}\nlet t=srcIdx;srcIdx=dstIdx;dstIdx=t;\nt=srcKeys;srcKeys=dstKeys;dstKeys=t;\n}\nreturn srcIdx;\n}\nfunction countingSort(idx,keys,n,radix){\nconst counts=new Uint32Array(radix+1);\nfor(let i=0;i<n;i++)counts[keys[i]]++;\nlet sum=0;\nfor(let k=0;k<=radix;k++){\nconst c=counts[k];\ncounts[k]=sum;\nsum+=c;\n}\nconst out=new Uint32Array(n);\nfor(let i=0;i<n;i++)out[counts[keys[i]]++]=idx[i];\nreturn out;\n}\nfunction sortUint32Keys(idx,keys,n,radix){\nif(n<2)return idx;\nif(radix<=65536||radix<=n*2)return countingSort(idx,keys,n,radix);\nreturn radixLsd32(idx,keys,n);\n}\nfunction exact(buffer,n){\nif(buffer.length===n&&buffer.byteOffset===0)return buffer;\nreturn Uint32Array.prototype.slice.call(buffer,0,n);\n}\nfunction radixSortFloat64(values,order,descending=false){\nconst src=order||identity(values.length);\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst idx=new Uint32Array(n);\nconst lo=new Uint32Array(n);\nconst hi=new Uint32Array(n);\nconst nans=new Uint32Array(n);\nconst pair=new Uint32Array(2);\nlet m=0;\nlet nanCount=0;\nfor(let i=0;i<n;i++){\nconst row=src[i];\nconst v=values[row];\nif(Number.isNaN(v)){nans[nanCount++]=row;continue;}\ntransformDouble(v,pair);\nif(descending){\nlo[m]=~pair[0]>>>0;\nhi[m]=~pair[1]>>>0;\n}else{\nlo[m]=pair[0];\nhi[m]=pair[1];\n}\nidx[m++]=row;\n}\nconst sorted=radixLsd64(idx.subarray(0,m),lo.subarray(0,m),hi.subarray(0,m),m);\nif(nanCount===0)return exact(sorted,m);\nconst out=new Uint32Array(n);\nout.set(sorted.subarray(0,m),0);\nout.set(nans.subarray(0,nanCount),m);\nreturn out;\n}\nfunction radixSortInt32(values,order,descending=false){\nconst src=order||identity(values.length);\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst idx=Uint32Array.from(src);\nconst keys=new Uint32Array(n);\nfor(let i=0;i<n;i++){\nconst k=(values[idx[i]]^0x80000000)>>>0;\nkeys[i]=descending?(~k>>>0):k;\n}\nreturn exact(radixLsd32(idx,keys,n),n);\n}\nfunction rankSortDictionary(handle,order,opts={}){\nconst src=order||identity(rowCount(handle,opts));\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst ranks=dictRanks(handle.dict,opts.locale);\nconst codes=handle.values;\nconst present=presenceReader(handle);\nconst size=Math.max(dictSize(handle.dict),ranks.length);\nconst absentRank=size;\nconst idx=Uint32Array.from(src);\nconst keys=new Uint32Array(n);\nconst descending=!!opts.descending;\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nlet rank=present&&present(row)===0?absentRank:ranks[codes[row]];\nif(rank===undefined)rank=absentRank;\nkeys[i]=descending?absentRank-rank:rank;\n}\nreturn exact(sortUint32Keys(idx,keys,n,size+1),n);\n}\nfunction mergeSortComparator(values,order,compare){\nconst n=order.length;\nlet src=Uint32Array.from(order);\nif(n<2)return src;\nlet dst=new Uint32Array(n);\nfor(let width=1;width<n;width<<=1){\nfor(let start=0;start<n;start+=width<<1){\nconst mid=Math.min(start+width,n);\nconst end=Math.min(start+(width<<1),n);\nlet i=start;\nlet j=mid;\nlet k=start;\nwhile(i<mid&&j<end){\ndst[k++]=compare(values[src[i]],values[src[j]])<=0?src[i++]:src[j++];\n}\nwhile(i<mid)dst[k++]=src[i++];\nwhile(j<end)dst[k++]=src[j++];\n}\nconst t=src;src=dst;dst=t;\n}\nreturn src;\n}\nfunction sortBitsetColumn(handle,idx,descending){\nconst bit=bitReader(handle.values);\nconst n=idx.length;\nconst out=new Uint32Array(n);\nconst first=descending?1:0;\nlet k=0;\nfor(let i=0;i<n;i++)if(bit(idx[i])===first)out[k++]=idx[i];\nfor(let i=0;i<n;i++)if(bit(idx[i])!==first)out[k++]=idx[i];\nreturn out;\n}\nfunction indexableValues(handle,idx){\nconst values=handle.values;\nconst kind=handle.kind;\nconst direct=(kind==='object'||kind===undefined)&&(Array.isArray(values)||ArrayBuffer.isView(values));\nif(direct&&!handle.presence)return values;\nconst reader=valueReader(handle);\nconst materialised=new Array(rowCount(handle)||0);\nfor(let i=0;i<idx.length;i++){\nconst row=idx[i];\nmaterialised[row]=reader(row);\n}\nreturn materialised;\n}\nfunction allStrings(values,idx){\nfor(let i=0;i<idx.length;i++){\nif(typeof values[idx[i]]!=='string')return false;\n}\nreturn true;\n}\nfunction rankSortStrings(idx,codes,ranks,d,descending){\nconst n=idx.length;\nconst idxOut=Uint32Array.from(idx);\nif(n<2||d<1)return idxOut;\nconst keys=new Uint32Array(n);\nconst top=d-1;\nfor(let i=0;i<n;i++){\nconst rank=ranks[codes[i]];\nkeys[i]=descending?top-rank:rank;\n}\nreturn exact(sortUint32Keys(idxOut,keys,n,d),n);\n}\nfunction collateStringRanks(table,d,locale){\nconst compare=valueComparator(locale);\nconst order=new Array(d);\nfor(let i=0;i<d;i++)order[i]=i;\norder.sort((a,b)=>compare(table[a],table[b])||a-b);\nconst ranks=new Uint32Array(d);\nfor(let r=0;r<d;r++)ranks[order[r]]=r;\nreturn ranks;\n}\nfunction keyedSortStrings(values,idx,opts){\nconst n=idx.length;\nconst codeOf=new Map();\nconst table=[];\nconst codes=new Uint32Array(n);\nfor(let i=0;i<n;i++){\nconst v=values[idx[i]];\nlet c=codeOf.get(v);\nif(c===undefined){c=table.length;codeOf.set(v,c);table.push(v);}\ncodes[i]=c;\n}\nconst d=table.length;\nconst ranks=collateStringRanks(table,d,opts.locale);\nreturn rankSortStrings(idx,codes,ranks,d,!!opts.descending);\n}\nfunction sortByComparator(handle,idx,opts){\nconst values=indexableValues(handle,idx);\nif(idx.length>=2&&allStrings(values,idx)){\nconst index=handle.stringRank;\nif(index&&index.version===handle.version&&index.usable(idx,values,opts.locale)){\nreturn index.sort(idx,opts);\n}\nreturn keyedSortStrings(values,idx,opts);\n}\nconst base=valueComparator(opts.locale);\nconst compare=opts.descending?(a,b)=>base(b,a):base;\nreturn mergeSortComparator(values,idx,compare);\n}\nfunction sortByCompare(handle,idx,opts){\nconst values=indexableValues(handle,idx);\nconst user=opts.compare;\nconst descending=!!opts.descending;\nconst compare=descending\n?(a,b)=>-user(a,b,undefined,undefined,true)\n:(a,b)=>user(a,b,undefined,undefined,false);\nreturn mergeSortComparator(values,idx,compare);\n}\nfunction partitionPresent(handle,idx){\nconst n=idx.length;\nconst present=presenceReader(handle);\nconst values=handle.values;\nconst checkNaN=handle.kind==='float64'&&!!values;\nconst looseKind=handle.kind==='object'||handle.kind==='multi'||handle.kind===undefined;\nif(!present&&!checkNaN&&!looseKind)return{present:idx,absent:EMPTY_INDICES};\nconst keep=new Uint32Array(n);\nconst drop=new Uint32Array(n);\nlet p=0;\nlet a=0;\nif(present&&checkNaN){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(present(row)===1&&!Number.isNaN(values[row]))keep[p++]=row;else drop[a++]=row;\n}\n}else if(checkNaN&&!present){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(!Number.isNaN(values[row]))keep[p++]=row;else drop[a++]=row;\n}\n}else if(present&&!looseKind){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(present(row)===1)keep[p++]=row;else drop[a++]=row;\n}\n}else{\nconst reader=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(!isMissing(reader(row)))keep[p++]=row;else drop[a++]=row;\n}\n}\nif(a===0)return{present:idx,absent:EMPTY_INDICES};\nreturn{present:keep.subarray(0,p),absent:drop.subarray(0,a)};\n}\nfunction joinRuns(sorted,absent,nullsFirst){\nif(absent.length===0)return sorted;\nconst out=new Uint32Array(sorted.length+absent.length);\nif(nullsFirst){\nout.set(absent,0);\nout.set(sorted,absent.length);\n}else{\nout.set(sorted,0);\nout.set(absent,sorted.length);\n}\nreturn out;\n}\nfunction sortColumn(handle,order,opts={}){\nconst src=order||identity(rowCount(handle,opts));\nif(!handle||src.length<2)return Uint32Array.from(src);\nconst{present,absent}=partitionPresent(handle,src);\nif(present.length===0)return Uint32Array.from(src);\nconst descending=!!opts.descending;\nlet sorted;\nif(typeof opts.compare==='function'){\nsorted=sortByCompare(handle,present,opts);\n}else{\nswitch(handle.kind){\ncase'float64':\nsorted=radixSortFloat64(handle.values,present,descending);\nbreak;\ncase'int32':\nsorted=radixSortInt32(handle.values,present,descending);\nbreak;\ncase'dictionary':\nsorted=rankSortDictionary(handle,present,opts);\nbreak;\ncase'bitset':\nsorted=sortBitsetColumn(handle,present,descending);\nbreak;\ndefault:\nsorted=sortByComparator(handle,present,opts);\nbreak;\n}\n}\nreturn joinRuns(sorted,absent,!!opts.nullsFirst);\n}\nfunction sortMulti(handles,entries,order,opts={}){\nconst list=entries||[];\nconst first=(list.length&&(list[0].handle||byId(handles,list[0].col)))||(handles&&handles[0]);\nlet current=order||identity(rowCount(first,opts));\nfor(let i=list.length-1;i>=0;i--){\nconst entry=list[i];\nconst handle=entry.handle||byId(handles,entry.col)||(handles&&handles[i]);\nif(!handle)continue;\ncurrent=sortColumn(handle,current,{\ndescending:entry.descending!==undefined?!!entry.descending:entry.dir==='desc',\nnullsFirst:!!entry.nullsFirst,\nlocale:entry.locale!==undefined?entry.locale:opts.locale,\ncompare:entry.compare,\n});\n}\nreturn current instanceof Uint32Array?current:Uint32Array.from(current);\n}\nfunction byId(handles,id){\nif(!handles||id===undefined)return undefined;\nfor(let i=0;i<handles.length;i++)if(handles[i]&&handles[i].id===id)return handles[i];\nreturn undefined;\n}\n});\n__def(\"packages/core/src/store/stringrank.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"DEFAULT_MAX_DISTINCT\",{enumerable:true,get:function(){return DEFAULT_MAX_DISTINCT;}});\nObject.defineProperty(__exports,\"StringRankIndex\",{enumerable:true,get:function(){return StringRankIndex;}});\nconst __m0=__req(\"packages/core/src/compute/sort.js\");\nconst collateStringRanks=__m0[\"collateStringRanks\"];\nconst rankSortStrings=__m0[\"rankSortStrings\"];\nconst DEFAULT_MAX_DISTINCT=100000;\nclass StringRankIndex{\n#table=[];\n#codeOf=new Map();\n#codeByRow;\n#length=0;\n#generation=0;\n#stamp=-1;\n#maxDistinct;\n#capped=false;\n#ranks=null;\n#ranksGeneration=-1;\n#ranksLocale='\\u0000';\nconstructor(maxDistinct=DEFAULT_MAX_DISTINCT){\nthis.#maxDistinct=maxDistinct>0?maxDistinct:DEFAULT_MAX_DISTINCT;\nthis.#codeByRow=new Uint32Array(0);\n}\nget version(){return this.#stamp;}\nset version(version){this.#stamp=version;}\nget generation(){return this.#generation;}\nget size(){return this.#table.length;}\nget capped(){return this.#capped;}\nget length(){return this.#length;}\nget bytes(){\nlet total=this.#codeByRow.byteLength;\nconst table=this.#table;\nfor(let i=0;i<table.length;i++)total+=table[i].length*2+24;\nreturn total;\n}\n#intern(value,capOnGrowth){\nconst existing=this.#codeOf.get(value);\nif(existing!==undefined)return existing;\nif(this.#capped)return-1;\nif(capOnGrowth&&this.#table.length>=this.#maxDistinct){\nthis.#capped=true;\nreturn-1;\n}\nconst code=this.#table.length;\nthis.#table.push(value);\nthis.#codeOf.set(value,code);\nthis.#generation++;\nreturn code;\n}\nbuild(values,count){\nconst n=count|0;\nthis.#table=[];\nthis.#codeOf=new Map();\nthis.#generation=0;\nthis.#capped=false;\nthis.#ranks=null;\nthis.#ranksGeneration=-1;\nthis.#codeByRow=new Uint32Array(n);\nfor(let row=0;row<n;row++){\nconst v=values[row];\nconst code=typeof v==='string'?this.#intern(v,false):-1;\nthis.#codeByRow[row]=code<0?0:code;\n}\nthis.#length=n;\n}\nappend(values,from,count){\nconst to=(from|0)+(count|0);\nif(to>this.#codeByRow.length){\nconst next=new Uint32Array(to);\nnext.set(this.#codeByRow.subarray(0,this.#length));\nthis.#codeByRow=next;\n}\nfor(let row=from|0;row<to;row++){\nconst v=values[row];\nconst code=typeof v==='string'?this.#intern(v,true):-1;\nthis.#codeByRow[row]=code<0?0:code;\n}\nthis.#length=Math.max(this.#length,to);\n}\nranks(locale){\nconst key=locale||'';\nif(this.#ranks&&this.#ranksGeneration===this.#generation&&this.#ranksLocale===key){\nreturn this.#ranks;\n}\nconst ranks=collateStringRanks(this.#table,this.#table.length,locale);\nthis.#ranks=ranks;\nthis.#ranksGeneration=this.#generation;\nthis.#ranksLocale=key;\nreturn ranks;\n}\nusable(idx,values,locale){\nif(this.#capped||this.#table.length===0)return false;\nconst codeByRow=this.#codeByRow;\nconst table=this.#table;\nconst covered=this.#length;\nfor(let i=0;i<idx.length;i++){\nconst row=idx[i];\nif(row>=covered)return false;\nif(table[codeByRow[row]]!==values[row])return false;\n}\nreturn true;\n}\nsort(idx,opts){\nconst ranks=this.ranks(opts.locale);\nconst d=this.#table.length;\nconst n=idx.length;\nconst codes=new Uint32Array(n);\nconst codeByRow=this.#codeByRow;\nfor(let i=0;i<n;i++)codes[i]=codeByRow[idx[i]];\nreturn rankSortStrings(idx,codes,ranks,d,!!opts.descending);\n}\n}\n});\n__def(\"packages/core/src/store/columnstore.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"REMOVED\",{enumerable:true,get:function(){return REMOVED;}});\nObject.defineProperty(__exports,\"toFloat\",{enumerable:true,get:function(){return toFloat;}});\nObject.defineProperty(__exports,\"ColumnHandle\",{enumerable:true,get:function(){return ColumnHandle;}});\nObject.defineProperty(__exports,\"ColumnStore\",{enumerable:true,get:function(){return ColumnStore;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst warnOnce=__m0[\"warnOnce\"];\nconst isFunction=__m0[\"isFunction\"];\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/bitset.js\");\nconst Bitset=__m1[\"Bitset\"];\nconst __m2=__req(\"packages/core/src/store/dictionary.js\");\nconst Dictionary=__m2[\"Dictionary\"];\nconst __m3=__req(\"packages/core/src/store/multivalue.js\");\nconst MultiValue=__m3[\"MultiValue\"];\nconst __m4=__req(\"packages/core/src/store/stringrank.js\");\nconst StringRankIndex=__m4[\"StringRankIndex\"];\nconst REMOVED=0xFFFFFFFF;\nconst DEFAULT_CAPACITY=1024;\nconst DEFAULT_COLUMNAR_BELOW=5000;\nconst DEFAULT_COMPACT_RATIO=0.2;\nconst KINDS=new Set(['float64','int32','bitset','dictionary','object','multi']);\nfunction absent(v){return v===null||v===undefined;}\nfunction toFloat(v){\nif(typeof v==='number')return v;\nif(v instanceof Date)return v.getTime();\nif(typeof v==='boolean')return v?1:0;\nconst n=Number(v);\nreturn Number.isNaN(n)&&typeof v==='string'?Date.parse(v):n;\n}\nfunction toInt(v){\nconst n=toFloat(v);\nreturn Number.isFinite(n)?n|0:0;\n}\nfunction toMembers(v){\nif(absent(v))return[];\nreturn Array.isArray(v)?v:[v];\n}\nfunction decodeFrom(old,p){\nswitch(old.kind){\ncase'float64':\ncase'int32':return old.buf[p];\ncase'bitset':return old.bits.get(p)===1;\ncase'dictionary':return old.dict.valueOf(old.buf[p]);\ncase'multi':{\nconst codes=old.mv.at(p);\nconst out=new Array(codes.length);\nfor(let i=0;i<codes.length;i++)out[i]=old.dict.valueOf(codes[i]);\nreturn out;\n}\ndefault:return old.buf[p];\n}\n}\nfunction decodePacked(frag,i){\nswitch(frag.kind){\ncase'float64':\ncase'int32':return frag.values[i];\ncase'bitset':return(frag.values[i>>3]&(1<<(i&7)))!==0;\ncase'dictionary':return(frag.table||[])[frag.values[i]];\ncase'multi':{\nconst start=frag.offsets[i];\nconst end=frag.offsets[i+1];\nconst table=frag.table||[];\nconst out=new Array(end-start);\nfor(let k=start;k<end;k++)out[k-start]=table[frag.values[k]];\nreturn out;\n}\ndefault:return frag.values[i];\n}\n}\nclass ColumnHandle{\n#id;\n#kind;\n#target;\n#nullable;\n#read;\n#host;\n#seed;\n#columnar=false;\n#buf=null;\n#bits=null;\n#mv=null;\n#dict=null;\n#stringRank=null;\n#stringRankOn;\n#stringRankMax;\n#stringRankVersion=-1;\n#presence=null;\n#capacity=0;\n#version=0;\n#overlay=null;\n#cache=null;\n#released=false;\nconstructor(schema,host){\nthis.#id=schema.id;\nconst kind=KINDS.has(schema.kind)?schema.kind:'object';\nif(schema.kind&&!KINDS.has(schema.kind)){\nwarnOnce(`store.kind.${schema.id}`,\n`column \"${schema.id}\" declares unknown storage kind \"${schema.kind}\"; falling back to object`);\n}\nthis.#target=kind;\nthis.#kind=kind;\nthis.#nullable=schema.nullable!==false;\nthis.#seed=schema.dictionary??null;\nthis.#host=host;\nthis.#read=isFunction(schema.read)\n?schema.read\n:pathGetter(schema.field||schema.id);\nthis.#stringRankOn=schema.stringRankIndex!=='off';\nthis.#stringRankMax=typeof schema.stringRankMaxDistinct==='number'\n?schema.stringRankMaxDistinct\n:0;\nthis.#overlay=new Map();\n}\nget id(){return this.#id;}\nget kind(){return this.#columnar?this.#kind:'object';}\nget target(){return this.#target;}\nget nullable(){return this.#nullable;}\nget values(){\nif(this.#released)return null;\nif(!this.#columnar)return this.#lazy().values;\nif(this.#kind==='bitset')return this.#bits.words;\nif(this.#kind==='multi')return this.#mv.values;\nreturn this.#buf;\n}\nget presence(){\nif(this.#released||!this.#nullable)return null;\nreturn this.#columnar?this.#presence:this.#lazy().presence;\n}\nget dict(){\nif(this.#released||!this.#columnar)return null;\nreturn this.#kind==='dictionary'||this.#kind==='multi'?this.#dict:null;\n}\nget stringRank(){\nif(this.#released||!this.#stringRankOn)return null;\nif(this.kind!=='object')return null;\nconst values=this.values;\nconst n=this.#host.physical();\nif(!values||n===0)return null;\nif(this.#stringRank===null){\nif(typeof values[0]!=='string')return null;\nconst index=new StringRankIndex(this.#resolveStringRankMax());\nindex.build(values,n);\nindex.version=this.#version;\nthis.#stringRank=index;\nthis.#stringRankVersion=this.#version;\nreturn index.capped?null:index;\n}\nif(this.#stringRank.length<n){\nthis.#stringRank.append(values,this.#stringRank.length,n-this.#stringRank.length);\n}\nthis.#stringRank.version=this.#version;\nthis.#stringRankVersion=this.#version;\nreturn this.#stringRank.capped?null:this.#stringRank;\n}\n#resolveStringRankMax(){return this.#stringRankMax;}\n#dropStringRank(){\nthis.#stringRank=null;\nthis.#stringRankVersion=-1;\n}\nget offsets(){\nif(this.#released||!this.#columnar||this.#kind!=='multi')return null;\nreturn this.#mv.offsets;\n}\nget version(){return this.#version;}\nget bytes(){\nlet total=0;\nif(this.#buf)total+=this.#buf.byteLength??this.#buf.length*8;\nif(this.#bits)total+=this.#bits.bytes;\nif(this.#mv)total+=this.#mv.bytes;\nif(this.#presence)total+=this.#presence.bytes;\nif(this.#dict)total+=this.#dict.bytes;\nif(this.#overlay)total+=this.#overlay.size*24;\nreturn total;\n}\nget(physical){\nif(this.#released)return undefined;\nif(physical<0||physical>=this.#host.physical())return undefined;\nif(!this.#columnar)return this.#rowValue(physical);\nif(this.#nullable&&this.#presence.get(physical)===0)return null;\nswitch(this.#kind){\ncase'float64':\ncase'int32':return this.#buf[physical];\ncase'bitset':return this.#bits.get(physical)===1;\ncase'dictionary':return this.#dict.valueOf(this.#buf[physical]);\ncase'multi':{\nconst codes=this.#mv.at(physical);\nconst out=new Array(codes.length);\nfor(let i=0;i<codes.length;i++)out[i]=this.#dict.valueOf(codes[i]);\nreturn out;\n}\ndefault:return this.#buf[physical];\n}\n}\nset(physical,value){\nif(this.#released)return;\nif(this.#columnar)this.#writeValue(physical,value);\nelse this.#overlay.set(physical,value===undefined?null:value);\nif(this.#stringRank)this.#dropStringRank();\nthis.#version++;\n}\nread(row){return this.#read(row);}\nappendColumn(objects,from,n){\nif(this.#released||n<=0)return;\nif(!this.#columnar){this.#version++;return;}\nconst read=this.#read;\nconst nullable=this.#nullable;\nconst presence=this.#presence;\nlet sawAbsent=false;\nswitch(this.#kind){\ncase'float64':{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nif(typeof v==='number'){\nif(nullable)presence.set(from+i);\nbuf[from+i]=v;\ncontinue;\n}\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?NaN:toFloat(v);\n}\nbreak;\n}\ncase'int32':{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?0:toInt(v);\n}\nbreak;\n}\ncase'bitset':{\nconst bits=this.#bits;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbits.assign(from+i,!gone&&!!v);\n}\nbreak;\n}\ncase'dictionary':{\nconst buf=this.#buf;\nconst dict=this.#dict;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?0:dict.codeOf(v);\n}\nbreak;\n}\ncase'multi':{\nconst mv=this.#mv;\nconst dict=this.#dict;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nconst members=toMembers(v);\nconst codes=new Array(members.length);\nfor(let k=0;k<members.length;k++)codes[k]=dict.codeOf(members[k]);\nmv.write(from+i,codes);\n}\nbreak;\n}\ndefault:{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?null:v;\n}\nbreak;\n}\n}\nif(sawAbsent){\nwarnOnce(`store.null.${this.#id}`,\n`column \"${this.#id}\" is declared non-nullable but received null; storing a filler value`);\n}\nif(this.#stringRank&&this.#kind==='object'){\nthis.#stringRank.append(this.#buf,from,n);\nthis.#stringRank.version=this.#version+1;\nthis.#stringRankVersion=this.#version+1;\n}\nthis.#version++;\n}\nappendPacked(frag,from,n){\nif(this.#released||n<=0||!frag)return;\nif(!this.#columnar){this.#version++;return;}\nconst presence=this.#presence;\nconst fragPresence=frag.presence;\nif(presence){\nif(fragPresence){\nfor(let i=0;i<n;i++)presence.assign(from+i,(fragPresence[i>>3]&(1<<(i&7)))!==0);\n}else{\nfor(let i=0;i<n;i++)presence.set(from+i);\n}\n}\nconst kindsAgree=frag.kind===this.#kind;\nif(kindsAgree&&(this.#kind==='float64'||this.#kind==='int32')){\nthis.#buf.set(frag.values,from);\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='bitset'){\nconst words=frag.values;\nfor(let i=0;i<n;i++)this.#bits.assign(from+i,(words[i>>3]&(1<<(i&7)))!==0);\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='dictionary'){\nconst table=frag.table||[];\nconst remap=new Uint32Array(table.length);\nfor(let t=0;t<table.length;t++)remap[t]=this.#dict.codeOf(table[t]);\nconst codes=frag.values;\nconst buf=this.#buf;\nconst pres=presence;\nfor(let i=0;i<n;i++){\nif(pres&&(fragPresence?(fragPresence[i>>3]&(1<<(i&7)))===0:false)){buf[from+i]=0;continue;}\nbuf[from+i]=remap[codes[i]]??0;\n}\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='multi'){\nconst table=frag.table||[];\nconst remap=new Uint32Array(table.length);\nfor(let t=0;t<table.length;t++)remap[t]=this.#dict.codeOf(table[t]);\nconst flat=frag.values;\nconst offsets=frag.offsets;\nfor(let i=0;i<n;i++){\nconst start=offsets[i];\nconst end=offsets[i+1];\nconst codes=new Array(end-start);\nfor(let k=start;k<end;k++)codes[k-start]=remap[flat[k]]??0;\nthis.#mv.write(from+i,codes);\n}\nthis.#version++;\nreturn;\n}\nfor(let i=0;i<n;i++){\nconst gone=fragPresence\n?(fragPresence[i>>3]&(1<<(i&7)))===0\n:(frag.kind==='object'?frag.values[i]===null:false);\nthis.#writeValue(from+i,gone?null:decodePacked(frag,i));\n}\nthis.#version++;\n}\ntouch(){this.#version++;}\ncolumnarise(capacity,fill){\nif(this.#columnar||this.#released)return;\nconst values=new Array(fill);\nfor(let p=0;p<fill;p++)values[p]=this.#rowValue(p);\nthis.#kind=this.#target;\nthis.#columnar=true;\nthis.#alloc(capacity);\nfor(let p=0;p<fill;p++)this.#writeValue(p,values[p]);\nthis.#overlay.clear();\nthis.#cache=null;\nthis.#dropStringRank();\nthis.#version++;\n}\ngrow(capacity){\nif(!this.#columnar||this.#released||capacity<=this.#capacity)return;\nswitch(this.#kind){\ncase'float64':case'int32':case'dictionary':{\nconst next=new this.#buf.constructor(capacity);\nnext.set(this.#buf);\nthis.#buf=next;\nbreak;\n}\ncase'bitset':this.#bits.grow(capacity);break;\ncase'multi':break;\ndefault:this.#buf.length=capacity;break;\n}\nif(this.#presence)this.#presence.grow(capacity);\nthis.#capacity=capacity;\nthis.#version++;\n}\nconvert(kind){\nif(this.#released||!KINDS.has(kind))return false;\nthis.#target=kind;\nif(!this.#columnar||kind===this.#kind)return false;\nconst old={kind:this.#kind,buf:this.#buf,bits:this.#bits,mv:this.#mv,dict:this.#dict};\nconst n=this.#host.physical();\nconst presence=this.#presence;\nthis.#kind=kind;\nthis.#alloc(this.#capacity);\nfor(let p=0;p<n;p++){\nconst gone=presence!==null&&presence.get(p)===0;\nif(gone&&kind!=='multi')continue;\nthis.#writeValue(p,gone?null:decodeFrom(old,p));\n}\nthis.#dropStringRank();\nthis.#version++;\nreturn true;\n}\ncompact(remap,oldFill,liveCount){\nif(this.#released)return;\nthis.#dropStringRank();\nif(!this.#columnar){\nconst overlay=this.#overlay;\nif(overlay.size){\nconst next=new Map();\nfor(const[p,v]of overlay)if(remap[p]!==REMOVED)next.set(remap[p],v);\nthis.#overlay=next;\n}\nthis.#cache=null;\nthis.#version++;\nreturn;\n}\nswitch(this.#kind){\ncase'float64':case'int32':case'dictionary':case'object':{\nconst buf=this.#buf;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)buf[remap[p]]=buf[p];\nif(this.#kind==='object')for(let p=liveCount;p<oldFill;p++)buf[p]=undefined;\nbreak;\n}\ncase'bitset':{\nconst bits=this.#bits;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)bits.assign(remap[p],bits.get(p)===1);\nfor(let p=liveCount;p<oldFill;p++)bits.clear(p);\nbreak;\n}\ncase'multi':this.#mv.compact(remap,liveCount,REMOVED);break;\ndefault:break;\n}\nif(this.#presence){\nconst pres=this.#presence;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)pres.assign(remap[p],pres.get(p)===1);\nfor(let p=liveCount;p<oldFill;p++)pres.clear(p);\n}\nthis.#version++;\n}\nrelease(){\nif(this.#released)return;\nthis.#released=true;\nthis.#buf=null;\nif(this.#bits)this.#bits.release();\nthis.#bits=null;\nif(this.#mv)this.#mv.release();\nthis.#mv=null;\nif(this.#presence)this.#presence.release();\nthis.#presence=null;\nthis.#dict=null;\nthis.#stringRank=null;\nthis.#overlay=new Map();\nthis.#cache=null;\nthis.#capacity=0;\nthis.#version++;\n}\n#alloc(capacity){\nconst cap=Math.max(1,capacity);\nthis.#buf=null;\nthis.#bits=null;\nthis.#mv=null;\nswitch(this.#kind){\ncase'float64':this.#buf=new Float64Array(cap);break;\ncase'int32':this.#buf=new Int32Array(cap);break;\ncase'bitset':this.#bits=new Bitset(cap);break;\ncase'dictionary':\nthis.#buf=new Uint32Array(cap);\nthis.#dict=this.#dict??new Dictionary(this.#seed??[]);\nbreak;\ncase'multi':\nthis.#mv=new MultiValue({rows:cap,values:cap});\nthis.#dict=this.#dict??new Dictionary(this.#seed??[]);\nbreak;\ndefault:this.#buf=new Array(cap);break;\n}\nif(this.#kind!=='dictionary'&&this.#kind!=='multi')this.#dict=null;\nif(this.#nullable){\nif(this.#presence)this.#presence.grow(cap);\nelse this.#presence=new Bitset(cap);\n}\nthis.#capacity=cap;\n}\n#writeValue(p,value){\nconst gone=absent(value);\nif(this.#nullable)this.#presence.assign(p,!gone);\nelse if(gone){\nwarnOnce(`store.null.${this.#id}`,\n`column \"${this.#id}\" is declared non-nullable but received null; storing a filler value`);\n}\nswitch(this.#kind){\ncase'float64':this.#buf[p]=gone?NaN:toFloat(value);break;\ncase'int32':this.#buf[p]=gone?0:toInt(value);break;\ncase'bitset':this.#bits.assign(p,!gone&&!!value);break;\ncase'dictionary':this.#buf[p]=gone?0:this.#dict.codeOf(value);break;\ncase'multi':{\nconst members=toMembers(value);\nconst codes=new Array(members.length);\nfor(let i=0;i<members.length;i++)codes[i]=this.#dict.codeOf(members[i]);\nthis.#mv.write(p,codes);\nbreak;\n}\ndefault:this.#buf[p]=gone?null:value;break;\n}\n}\n#rowValue(p){\nif(this.#overlay.has(p))return this.#overlay.get(p);\nconst v=this.#read(this.#host.rowAt(p));\nreturn v===undefined?null:v;\n}\n#lazy(){\nif(this.#cache&&this.#cache.version===this.#version)return this.#cache;\nconst n=this.#host.physical();\nconst values=new Array(n);\nconst presence=this.#nullable?new Bitset(n):null;\nfor(let p=0;p<n;p++){\nconst v=this.#rowValue(p);\nvalues[p]=v;\nif(presence&&!absent(v))presence.set(p);\n}\nthis.#cache={version:this.#version,values,presence};\nreturn this.#cache;\n}\n}\nclass ColumnStore{\n#schema;\n#handles=new Map();\n#list=[];\n#rows=[];\n#fill=0;\n#capacity=0;\n#live=0;\n#dead=0;\n#tombs=new Bitset(0);\n#columnar=false;\n#retainSource=true;\n#columnarBelow;\n#initial;\n#ratio;\n#destroyed=false;\nconstructor(schema,opts={}){\nthis.#schema=Array.isArray(schema)?schema:[];\nthis.#initial=Math.max(1,opts.initialCapacity??DEFAULT_CAPACITY);\nthis.#retainSource=opts.retainSource!==false;\nthis.#columnarBelow=this.#retainSource?(opts.columnarBelow??DEFAULT_COLUMNAR_BELOW):0;\nthis.#ratio=opts.compactRatio??DEFAULT_COMPACT_RATIO;\nconst host={\nrowAt:(p)=>this.#rows[p],\nphysical:()=>this.#fill,\n};\nfor(const entry of this.#schema){\nif(!entry||!entry.id)continue;\nif(this.#handles.has(entry.id)){\nwarnOnce(`store.dup.${entry.id}`,`duplicate column id \"${entry.id}\" in the store schema; ignoring the second`);\ncontinue;\n}\nconst handle=new ColumnHandle(entry,host);\nthis.#handles.set(entry.id,handle);\nthis.#list.push(handle);\n}\nif(this.#columnarBelow<=0)this.#columnarise();\n}\nget count(){return this.#live;}\nget physical(){return this.#fill;}\nget capacity(){return this.#columnar?this.#capacity:this.#rows.length;}\nget tombstones(){return this.#dead;}\nget columnar(){return this.#columnar;}\nget destroyed(){return this.#destroyed;}\nget bytes(){\nlet total=this.#tombs.bytes+this.#rows.length*8;\nfor(const h of this.#list)total+=h.bytes;\nreturn total;\n}\nappend(objects){\nconst from=this.#fill;\nif(this.#destroyed||!objects)return{from,to:from};\nconst n=objects.length|0;\nif(n===0)return{from,to:from};\nif(this.#retainSource)for(let i=0;i<n;i++)this.#rows[from+i]=objects[i];\nthis.#fill=from+n;\nthis.#live+=n;\nthis.#tombs.grow(this.#fill);\nif(!this.#columnar){\nif(this.#fill>=this.#columnarBelow)this.#columnarise();\nelse for(const h of this.#list)h.touch();\nreturn{from,to:this.#fill};\n}\nthis.#ensure(this.#fill);\nconst cols=this.#list;\nfor(let c=0;c<cols.length;c++)cols[c].appendColumn(objects,from,n);\nreturn{from,to:this.#fill};\n}\nappendPacked(chunk,objects){\nconst from=this.#fill;\nif(this.#destroyed||!chunk)return{from,to:from};\nconst n=chunk.count|0;\nif(n===0)return{from,to:from};\nif(this.#retainSource&&objects){\nfor(let i=0;i<n;i++)this.#rows[from+i]=objects[i];\n}\nthis.#fill=from+n;\nthis.#live+=n;\nthis.#tombs.grow(this.#fill);\nif(!this.#columnar)this.#columnarise();\nthis.#ensure(this.#fill);\nconst byId=new Map();\nfor(const col of chunk.columns)byId.set(col.id,col);\nfor(const h of this.#list){\nconst frag=byId.get(h.id);\nif(frag)h.appendPacked(frag,from,n);\nelse{\nh.grow(this.#capacity);\n}\n}\nreturn{from,to:this.#fill};\n}\nsource(physical){\nif(this.#retainSource)return this.#rows[physical];\nif(physical<0||physical>=this.#fill)return undefined;\nreturn this.#reconstruct(physical);\n}\nsetSource(physical,object){\nif(this.#destroyed)return;\nif(physical<0||physical>=this.#fill)return;\nif(!this.#retainSource)return;\nthis.#rows[physical]=object;\n}\nget(colId,physical){\nconst h=this.#handles.get(colId);\nreturn h?h.get(physical):undefined;\n}\nset(colId,physical,value){\nif(this.#destroyed)return;\nif(physical<0||physical>=this.#fill)return;\nconst h=this.#handles.get(colId);\nif(!h){\nwarnOnce(`store.set.${colId}`,`set() on unknown column \"${colId}\"`);\nreturn;\n}\nh.set(physical,value);\n}\nremove(physical){\nif(this.#destroyed||physical<0||physical>=this.#fill)return false;\nif(this.#tombs.get(physical)===1)return false;\nthis.#tombs.set(physical);\nthis.#dead++;\nthis.#live--;\nreturn true;\n}\nlive(physical){\nif(physical<0||physical>=this.#fill)return false;\nreturn this.#tombs.get(physical)===0;\n}\ncompact(opts={}){\nif(this.#destroyed||this.#dead===0)return null;\nif(!opts.force&&this.#dead/this.#fill<this.#ratio)return null;\nconst oldFill=this.#fill;\nconst remap=new Uint32Array(oldFill);\nlet w=0;\nfor(let p=0;p<oldFill;p++)remap[p]=this.#tombs.get(p)===1?REMOVED:w++;\nfor(const h of this.#list)h.compact(remap,oldFill,w);\nif(this.#retainSource){\nconst rows=this.#rows;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)rows[remap[p]]=rows[p];\nrows.length=w;\n}\nthis.#fill=w;\nthis.#live=w;\nthis.#dead=0;\nthis.#tombs=new Bitset(Math.max(this.#capacity,w));\nreturn remap;\n}\ncolumn(colId){return this.#handles.get(colId);}\ncolumns(){return this.#list.slice();}\nliveIndices(){\nconst out=new Uint32Array(this.#live);\nif(this.#dead===0){\nfor(let p=0;p<this.#fill;p++)out[p]=p;\nreturn out;\n}\nlet k=0;\nfor(let p=0;p<this.#fill;p++)if(this.#tombs.get(p)===0)out[k++]=p;\nreturn out;\n}\nconvert(colId,kind){\nconst h=this.#handles.get(colId);\nreturn h?h.convert(kind):false;\n}\ndestroy(){\nif(this.#destroyed)return;\nthis.#destroyed=true;\nfor(const h of this.#list)h.release();\nthis.#handles.clear();\nthis.#list.length=0;\nthis.#rows.length=0;\nthis.#tombs.release();\nthis.#fill=0;\nthis.#live=0;\nthis.#dead=0;\nthis.#capacity=0;\n}\n#ensure(n){\nif(n<=this.#capacity)return;\nlet cap=this.#capacity||this.#initial;\nwhile(cap<n)cap*=2;\nfor(const h of this.#list)h.grow(cap);\nthis.#tombs.grow(cap);\nthis.#capacity=cap;\n}\n#reconstruct(physical){\nconst out={};\nfor(const h of this.#list)out[h.id]=h.get(physical);\nreturn out;\n}\n#columnarise(){\nif(this.#columnar)return;\nlet cap=this.#initial;\nwhile(cap<this.#fill)cap*=2;\nthis.#columnar=true;\nthis.#capacity=cap;\nthis.#tombs.grow(cap);\nfor(const h of this.#list)h.columnarise(cap,this.#fill);\n}\n}\n});\n__def(\"packages/core/src/store/ingest.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"INGEST_DEFAULTS\",{enumerable:true,get:function(){return INGEST_DEFAULTS;}});\nObject.defineProperty(__exports,\"inferKind\",{enumerable:true,get:function(){return inferKind;}});\nObject.defineProperty(__exports,\"decideText\",{enumerable:true,get:function(){return decideText;}});\nObject.defineProperty(__exports,\"createReaders\",{enumerable:true,get:function(){return createReaders;}});\nObject.defineProperty(__exports,\"Ingest\",{enumerable:true,get:function(){return Ingest;}});\nObject.defineProperty(__exports,\"ingest\",{enumerable:true,get:function(){return ingest;}});\nObject.defineProperty(__exports,\"ingestSync\",{enumerable:true,get:function(){return ingestSync;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst now=__m0[\"now\"];\nconst nextFrame=__m0[\"nextFrame\"];\nconst infoOnce=__m0[\"infoOnce\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst isFunction=__m0[\"isFunction\"];\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/columnstore.js\");\nconst ColumnStore=__m1[\"ColumnStore\"];\nconst INGEST_DEFAULTS=Object.freeze({\nchunkMs:8,\nchunkRows:512,\nsampleSize:100,\ndictionaryRatio:0.1,\ncolumnarBelow:5000,\ninitialCapacity:1024,\n});\nfunction inferKind(samples,hints={}){\nif(hints.multi)return'multi';\nif(samples.length===0)return'object';\nlet numbers=0;let booleans=0;let strings=0;let dates=0;let arrays=0;\nfor(let i=0;i<samples.length;i++){\nconst v=samples[i];\nif(typeof v==='number')numbers++;\nelse if(typeof v==='boolean')booleans++;\nelse if(typeof v==='string')strings++;\nelse if(v instanceof Date)dates++;\nelse if(Array.isArray(v))arrays++;\n}\nconst n=samples.length;\nif(numbers===n)return'float64';\nif(booleans===n)return'bitset';\nif(dates===n)return'float64';\nif(strings===n)return'text';\nif(arrays===n)return'multi';\nreturn'object';\n}\nfunction decideText(distinct,rows,ratio){\nif(rows<=0)return'dictionary';\nreturn distinct<ratio*rows?'dictionary':'object';\n}\nfunction createReaders(columns,computed,context){\nconst readers=new Map();\nconst base=new Map();\nfor(const col of columns){\nif(col.computed)continue;\nconst read=isFunction(col.read)?col.read:pathGetter(col.field||col.id);\nbase.set(col.id,read);\nreaders.set(col.id,read);\n}\nconst order=computed?.order??[];\nconst fns=computed?.fns??{};\nconst deps=computed?.deps??{};\nconst wrapDeps=computed?.wrapDeps??null;\nconst active=order.filter((id)=>isFunction(fns[id]));\nconst wildcard=active.some((id)=>deps[id]==='*');\nlet memo=new WeakMap();\nconst resolve=(data)=>{\nconst values={};\nif(wildcard)for(const[id,read]of base)values[id]=read(data);\nfor(const id of active){\nconst declared=deps[id];\nlet bag;\nif(declared==='*'){\nbag=values;\n}else{\nbag={};\nconst list=declared||[];\nfor(let i=0;i<list.length;i++){\nconst d=list[i];\nbag[d]=d in values?values[d]:base.get(d)?.(data);\n}\n}\nvalues[id]=fns[id](wrapDeps?wrapDeps(bag,id):bag,{\ndata,row:null,column:null,grid:null,context,\n});\n}\nreturn values;\n};\nconst valuesFor=(data)=>{\nif(data===null||(typeof data!=='object'&&typeof data!=='function'))return resolve(data);\nlet v=memo.get(data);\nif(v===undefined){v=resolve(data);memo.set(data,v);}\nreturn v;\n};\nfor(const id of active){\nreaders.set(id,\n(data)=>valuesFor(data)[id]);\n}\nreturn{\nreaders,\nreset(){memo=new WeakMap();},\n};\n}\nclass ColumnPlan{\nspec;\nread;\nkind;\ninferred;\nnullable;\ncandidate=false;\ndistinct=null;\nchange=null;\nreason='';\nconstructor(spec,read){\nthis.spec=spec;\nthis.read=read;\nthis.kind='object';\nthis.inferred=false;\nthis.nullable=spec.nullable!==false;\n}\n}\nclass Ingest{\n#rows;\n#plans=[];\n#store=null;\n#readers;\n#cursor=0;\n#opts;\n#done=false;\n#cancelled=false;\n#elapsed=0;\n#columnar;\nconstructor(rows,plan={},opts={}){\nthis.#rows=Array.isArray(rows)?rows:Array.from(rows||[]);\nthis.#opts={...INGEST_DEFAULTS,...opts};\nconst columns=plan.columns??[];\nthis.#readers=createReaders(columns,plan.computed??null,plan.context);\nthis.#columnar=this.#rows.length>=this.#opts.columnarBelow;\nthis.#planColumns(columns,plan.computed??null);\nthis.#store=new ColumnStore(this.#plans.map((p)=>({\nid:p.spec.id,\nkind:p.kind,\nnullable:p.nullable,\nread:p.read,\ndictionary:p.spec.dictionary,\n})),{\ninitialCapacity:this.#opts.initialCapacity,\ncolumnarBelow:this.#opts.columnarBelow,\n});\n}\nget store(){return this.#store;}\nget done(){return this.#done||this.#cancelled;}\nget progress(){return this.#cursor;}\nslice(){\nif(this.done)return false;\nif(this.#opts.signal?.aborted){this.#cancelled=true;return false;}\nconst started=now();\nconst{chunkMs,chunkRows}=this.#opts;\nconst total=this.#rows.length;\ndo{\nconst end=Math.min(this.#cursor+chunkRows,total);\nthis.#store.append(this.#rows.slice(this.#cursor,end));\nthis.#measure(this.#cursor,end);\nthis.#cursor=end;\nthis.#readers.reset();\nthis.#reviewCardinality(false);\n}while(this.#cursor<total&&now()-started<chunkMs);\nthis.#elapsed+=now()-started;\nthis.#opts.onProgress?.({loaded:this.#cursor,total});\nif(this.#cursor>=total){\nthis.#reviewCardinality(true);\nthis.#done=true;\nreturn false;\n}\nreturn true;\n}\ncancel(){this.#cancelled=true;}\nresult(){\nreturn{\nstore:this.#store,\nschema:this.#plans.map((p)=>({\nid:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,\ndictionary:p.spec.dictionary,\n})),\ndecisions:this.#plans.map((p)=>({\nid:p.spec.id,\nkind:p.kind,\nnullable:p.nullable,\ninferred:p.inferred,\ndistinct:p.candidate||p.change?this.#distinctOf(p):null,\nchange:p.change,\nreason:p.reason,\n})),\ncount:this.#store.count,\nelapsed:this.#elapsed,\ncancelled:this.#cancelled,\n};\n}\n#planColumns(columns,computed){\nconst rows=this.#rows;\nconst sampleN=Math.min(this.#opts.sampleSize,rows.length);\nconst ratio=this.#opts.dictionaryRatio;\nconst pure=computed?.pure instanceof Set\n?computed.pure\n:new Set(computed?.pure??computed?.order??[]);\nfor(const spec of columns){\nif(!spec||!spec.id)continue;\nif(spec.computed&&(spec.pure===false||(computed&&!pure.has(spec.id)))){\nwarnOnce(`ingest.impure.${spec.id}`,\n`column \"${spec.id}\" is an impure computed column and is not materialised into the store`);\ncontinue;\n}\nconst read=this.#readers.readers.get(spec.id)\n??(isFunction(spec.read)?spec.read:pathGetter(spec.field||spec.id));\nconst plan=new ColumnPlan(spec,read);\nif(spec.kind){\nplan.kind=spec.kind;\nplan.reason='declared by the caller';\n}else if(spec.dictionary){\nplan.kind=spec.multi?'multi':'dictionary';\nplan.reason='value table supplied (lookup column)';\n}else{\nconst samples=[];\nfor(let i=0;i<sampleN&&samples.length<this.#opts.sampleSize;i++){\nconst v=read(rows[i]);\nif(v!==null&&v!==undefined)samples.push(v);\n}\nplan.inferred=true;\nconst kind=inferKind(samples,{multi:spec.multi});\nif(kind==='text'){\nconst distinct=new Set(samples).size;\nplan.kind=decideText(distinct,samples.length,ratio);\nplan.candidate=this.#columnar;\nplan.reason=`sampled ${distinct} distinct in ${samples.length}`;\n}else{\nplan.kind=kind;\nplan.reason=`inferred from ${samples.length} sampled values`;\nif(kind==='object'&&samples.length){\ninfoOnce(`ingest.mixed.${spec.id}`,\n`column \"${spec.id}\" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);\n}\n}\nif(plan.kind==='object'&&plan.candidate)plan.distinct=new Set(samples);\n}\nthis.#plans.push(plan);\n}\n}\n#measure(from,to){\nconst rows=this.#rows;\nfor(const plan of this.#plans){\nif(!plan.candidate||!plan.distinct)continue;\nconst set=plan.distinct;\nfor(let i=from;i<to;i++){\nconst v=plan.read(rows[i]);\nif(v!==null&&v!==undefined)set.add(v);\n}\n}\n}\n#distinctOf(plan){\nif(plan.distinct)return plan.distinct.size;\nconst handle=this.#store.column(plan.spec.id);\nreturn handle?.dict?handle.dict.size:0;\n}\n#reviewCardinality(final){\nconst ratio=this.#opts.dictionaryRatio;\nconst total=this.#rows.length;\nfor(const plan of this.#plans){\nif(!plan.candidate)continue;\nconst distinct=this.#distinctOf(plan);\nif(plan.kind==='dictionary'&&distinct>=ratio*total){\nconst handle=this.#store.column(plan.spec.id);\nplan.distinct=new Set(handle?.dict?handle.dict.values():[]);\nthis.#store.convert(plan.spec.id,'object');\nplan.kind='object';\nplan.change='demoted';\nplan.reason=`${distinct} distinct values is at or above ${ratio*100}% of ${total} rows`;\ncontinue;\n}\nif(plan.kind==='object'&&distinct>=ratio*total){\nplan.candidate=false;\nplan.distinct=null;\nplan.reason=`${distinct} distinct values is at or above ${ratio*100}% of ${total} rows`;\ncontinue;\n}\nif(final&&plan.kind==='object'&&distinct<ratio*total){\nthis.#store.convert(plan.spec.id,'dictionary');\nplan.kind='dictionary';\nplan.change=plan.change==='demoted'?null:'promoted';\nplan.reason=`${distinct} distinct values is below ${ratio*100}% of ${total} rows`;\nplan.distinct=null;\n}\nif(final)plan.candidate=false;\n}\n}\n}\nasync function ingest(rows,plan={},opts={}){\nconst run=new Ingest(rows,plan,opts);\nconst frame=opts.scheduler?.frame??nextFrame;\nwhile(run.slice()){\nawait new Promise((resolve)=>{frame(resolve);});\n}\nreturn run.result();\n}\nfunction ingestSync(rows,plan={},opts={}){\nconst run=new Ingest(rows,plan,{...opts,chunkMs:Infinity});\nwhile(run.slice());\nreturn run.result();\n}\n});\n__def(\"packages/core/src/store/columnpack.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"isPortableSchema\",{enumerable:true,get:function(){return isPortableSchema;}});\nObject.defineProperty(__exports,\"packChunk\",{enumerable:true,get:function(){return packChunk;}});\nObject.defineProperty(__exports,\"packedTransfers\",{enumerable:true,get:function(){return packedTransfers;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/ingest.js\");\nconst inferKind=__m1[\"inferKind\"];\nconst decideText=__m1[\"decideText\"];\nconst INGEST_DEFAULTS=__m1[\"INGEST_DEFAULTS\"];\nconst __m2=__req(\"packages/core/src/store/columnstore.js\");\nconst toFloat=__m2[\"toFloat\"];\nconst PORTABLE_KINDS=new Set(['float64','int32','bitset','dictionary','object','multi']);\nfunction isPortableSchema(schema){\nif(!Array.isArray(schema)||schema.length===0)return false;\nfor(const col of schema){\nif(!col||typeof col.id!=='string')return false;\nif(typeof col.field!=='string'||col.field==='')return false;\nif(col.kind&&!PORTABLE_KINDS.has(col.kind))return false;\n}\nreturn true;\n}\nfunction toInt(v){\nconst n=toFloat(v);\nreturn Number.isFinite(n)?n|0:0;\n}\nfunction toMembers(v){\nif(v===null||v===undefined)return[];\nreturn Array.isArray(v)?v:[v];\n}\nfunction resolveKind(col,values,rows,ratio){\nif(col.kind)return col.kind;\nconst samples=[];\nfor(let i=0;i<values.length&&samples.length<INGEST_DEFAULTS.sampleSize;i++){\nconst v=values[i];\nif(v!==null&&v!==undefined)samples.push(v);\n}\nconst kind=inferKind(samples,{multi:col.multi});\nif(kind!=='text')return kind;\nconst distinct=new Set(samples).size;\nreturn decideText(distinct,samples.length,ratio);\n}\nfunction packChunk(schema,rows,opts={}){\nconst n=rows.length|0;\nconst ratio=opts.dictionaryRatio??INGEST_DEFAULTS.dictionaryRatio;\nconst columns=[];\nfor(const col of schema){\nconst read=pathGetter(col.field||col.id);\nconst nullable=col.nullable!==false;\nconst raw=new Array(n);\nfor(let i=0;i<n;i++){\nconst v=read(rows[i]);\nraw[i]=v===undefined?null:v;\n}\nconst kind=resolveKind(col,raw,n,ratio);\nconst presence=nullable?new Uint8Array((n+7)>>3):null;\nconst present=(i)=>{if(presence)presence[i>>3]|=1<<(i&7);};\nlet packed;\nswitch(kind){\ncase'float64':{\nconst values=new Float64Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nvalues[i]=gone?NaN:toFloat(v);\n}\npacked={id:col.id,kind,nullable,values,presence,offsets:null,table:null};\nbreak;\n}\ncase'int32':{\nconst values=new Int32Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nvalues[i]=gone?0:toInt(v);\n}\npacked={id:col.id,kind,nullable,values,presence,offsets:null,table:null};\nbreak;\n}\ncase'bitset':{\nconst words=new Uint8Array((n+7)>>3);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nif(!gone&&!!v)words[i>>3]|=1<<(i&7);\n}\npacked={id:col.id,kind,nullable,values:words,presence,offsets:null,table:null};\nbreak;\n}\ncase'dictionary':{\nconst codes=new Uint32Array(n);\nconst table=[];\nconst index=new Map();\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nif(v===null){codes[i]=0;continue;}\npresent(i);\nlet code=index.get(v);\nif(code===undefined){code=table.length;table.push(v);index.set(v,code);}\ncodes[i]=code;\n}\npacked={id:col.id,kind,nullable,values:codes,presence,offsets:null,table};\nbreak;\n}\ncase'multi':{\nconst table=[];\nconst index=new Map();\nconst offsets=new Uint32Array(n+1);\nconst flat=[];\nfor(let i=0;i<n;i++){\nconst v=raw[i];\noffsets[i]=flat.length;\nconst gone=v===null;\nif(!gone)present(i);\nconst members=toMembers(v);\nfor(let k=0;k<members.length;k++){\nconst m=members[k];\nlet code=index.get(m);\nif(code===undefined){code=table.length;table.push(m);index.set(m,code);}\nflat.push(code);\n}\n}\noffsets[n]=flat.length;\npacked={id:col.id,kind,nullable,values:Int32Array.from(flat),presence,offsets,table};\nbreak;\n}\ndefault:{\nconst values=new Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nif(v!==null)present(i);\nvalues[i]=v;\n}\npacked={id:col.id,kind:'object',nullable,values,presence,offsets:null,table:null};\nbreak;\n}\n}\ncolumns.push(packed);\n}\nreturn{count:n,columns};\n}\nfunction packedTransfers(chunk){\nconst out=[];\nif(!chunk||!Array.isArray(chunk.columns))return out;\nconst add=(v)=>{\nif(ArrayBuffer.isView(v)&&v.buffer&&!out.includes(v.buffer))out.push(v.buffer);\n};\nfor(const col of chunk.columns){\nadd(col.values);\nadd(col.presence);\nadd(col.offsets);\n}\nreturn out;\n}\n});\n__def(\"packages/core/src/compute/sortspec.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"collationDescriptor\",{enumerable:true,get:function(){return collationDescriptor;}});\nObject.defineProperty(__exports,\"isPortableSort\",{enumerable:true,get:function(){return isPortableSort;}});\nObject.defineProperty(__exports,\"isPortableSortSet\",{enumerable:true,get:function(){return isPortableSortSet;}});\nObject.defineProperty(__exports,\"describeSortEntry\",{enumerable:true,get:function(){return describeSortEntry;}});\nObject.defineProperty(__exports,\"describeSort\",{enumerable:true,get:function(){return describeSort;}});\nfunction collationDescriptor(locale){\nreturn{locale:locale===undefined?undefined:String(locale),numeric:true,sensitivity:'variant'};\n}\nfunction isPortableSort(entry){\nreturn!!entry&&typeof entry.compare!=='function';\n}\nfunction isPortableSortSet(entries){\nif(!entries)return true;\nfor(let i=0;i<entries.length;i++)if(!isPortableSort(entries[i]))return false;\nreturn true;\n}\nfunction describeSortEntry(entry,locale){\nconst col=entry.col!==undefined?entry.col:(entry.handle&&entry.handle.id);\nconst chosen=entry.locale!==undefined?entry.locale:locale;\nreturn{\ncol,\ndescending:entry.descending!==undefined?!!entry.descending:entry.dir==='desc',\nnullsFirst:!!entry.nullsFirst,\ncollation:collationDescriptor(chosen),\n};\n}\nfunction describeSort(entries,locale){\nconst list=entries||[];\nconst out=new Array(list.length);\nfor(let i=0;i<list.length;i++)out[i]=describeSortEntry(list[i],locale);\nreturn out;\n}\n});\n__def(\"packages/core/src/format/date.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"scanPattern\",{enumerable:true,get:function(){return scanPattern;}});\nObject.defineProperty(__exports,\"toDate\",{enumerable:true,get:function(){return toDate;}});\nObject.defineProperty(__exports,\"compilePattern\",{enumerable:true,get:function(){return compilePattern;}});\nObject.defineProperty(__exports,\"compileDate\",{enumerable:true,get:function(){return compileDate;}});\nObject.defineProperty(__exports,\"toIsoDate\",{enumerable:true,get:function(){return toIsoDate;}});\nObject.defineProperty(__exports,\"toIsoDateTime\",{enumerable:true,get:function(){return toIsoDateTime;}});\nObject.defineProperty(__exports,\"compareIso\",{enumerable:true,get:function(){return compareIso;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isNil=__m0[\"isNil\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst TOKENS=[\n'yyyy','yy','MMMM','MMM','MM','M','dd','d',\n'EEEE','EEE','HH','H','hh','h','mm','m','ss','s','SSS','a',\n];\nfunction scanPattern(pattern){\nconst out=[];\nlet i=0;\nlet literal='';\nconst flush=()=>{if(literal){out.push({token:null,text:literal});literal='';}};\nwhile(i<pattern.length){\nconst ch=pattern[i];\nif(ch===\"'\"){\nif(pattern[i+1]===\"'\"){literal+=\"'\";i+=2;continue;}\nconst end=pattern.indexOf(\"'\",i+1);\nif(end===-1){literal+=pattern.slice(i+1);i=pattern.length;continue;}\nliteral+=pattern.slice(i+1,end);\ni=end+1;\ncontinue;\n}\nconst token=TOKENS.find((t)=>pattern.startsWith(t,i));\nif(token){flush();out.push({token,text:token});i+=token.length;continue;}\nif(/[A-Za-z]/.test(ch)){\nwarnOnce(\n`date.pattern.token:${ch}`,\n`the date pattern \"${pattern}\" contains '${ch}', which is not a supported token, `\n+'so it is rendered as text. Quote it as a literal to silence this. '\n+`Supported: ${TOKENS.join(' ')}.`,\n);\n}\nliteral+=ch;\ni+=1;\n}\nflush();\nreturn out;\n}\nconst WALL_CLOCK=/^(\\d{4})-(\\d{2})-(\\d{2})(?:[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?(?:\\.\\d+)?)?$/;\nfunction toDate(value){\nif(isNil(value)||value==='')return null;\nif(value instanceof Date)return Number.isNaN(value.getTime())?null:value;\nif(typeof value==='number')return Number.isNaN(value)?null:new Date(value);\nif(typeof value==='string'){\nconst wall=WALL_CLOCK.exec(value.trim());\nif(wall){\nconst[,y,mo,d,h='0',mi='0',sec='0']=wall;\nreturn new Date(+y,+mo-1,+d,+h,+mi,+sec);\n}\nconst d=new Date(value);\nreturn Number.isNaN(d.getTime())?null:d;\n}\nreturn null;\n}\nfunction pad(n,w){return String(n).padStart(w,'0');}\nfunction fieldReader(timeZone){\nif(!timeZone){\nreturn(d)=>({\nyear:d.getFullYear(),month:d.getMonth()+1,day:d.getDate(),\nhour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),\nms:d.getMilliseconds(),weekday:d.getDay(),\n});\n}\nconst zoned=new Intl.DateTimeFormat('en-US',{\ntimeZone,year:'numeric',month:'2-digit',day:'2-digit',\nhour:'2-digit',minute:'2-digit',second:'2-digit',hour12:false,weekday:'short',\n});\nconst days={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};\nreturn(d)=>{\nconst f={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:d.getMilliseconds(),weekday:0};\nfor(const part of zoned.formatToParts(d)){\nswitch(part.type){\ncase'year':f.year=Number(part.value);break;\ncase'month':f.month=Number(part.value);break;\ncase'day':f.day=Number(part.value);break;\ncase'hour':f.hour=Number(part.value)%24;break;\ncase'minute':f.minute=Number(part.value);break;\ncase'second':f.second=Number(part.value);break;\ncase'weekday':f.weekday=days[part.value]??0;break;\ndefault:break;\n}\n}\nreturn f;\n};\n}\nfunction compilePattern(pattern,locale,timeZone){\nconst segments=scanPattern(pattern);\nconst read=fieldReader(timeZone);\nconst used=new Set(segments.filter((s)=>s.token).map((s)=>s.token));\nconst monthShort=used.has('MMM')?new Intl.DateTimeFormat(locale,{month:'short',timeZone}):null;\nconst monthLong=used.has('MMMM')?new Intl.DateTimeFormat(locale,{month:'long',timeZone}):null;\nconst dayShort=used.has('EEE')?new Intl.DateTimeFormat(locale,{weekday:'short',timeZone}):null;\nconst dayLong=used.has('EEEE')?new Intl.DateTimeFormat(locale,{weekday:'long',timeZone}):null;\nreturn(d)=>{\nconst f=read(d);\nlet out='';\nfor(const seg of segments){\nif(!seg.token){out+=seg.text;continue;}\nswitch(seg.token){\ncase'yyyy':out+=pad(f.year,4);break;\ncase'yy':out+=pad(f.year%100,2);break;\ncase'MMMM':out+=monthLong.format(d);break;\ncase'MMM':out+=monthShort.format(d);break;\ncase'MM':out+=pad(f.month,2);break;\ncase'M':out+=String(f.month);break;\ncase'dd':out+=pad(f.day,2);break;\ncase'd':out+=String(f.day);break;\ncase'EEEE':out+=dayLong.format(d);break;\ncase'EEE':out+=dayShort.format(d);break;\ncase'HH':out+=pad(f.hour,2);break;\ncase'H':out+=String(f.hour);break;\ncase'hh':out+=pad(f.hour%12===0?12:f.hour%12,2);break;\ncase'h':out+=String(f.hour%12===0?12:f.hour%12);break;\ncase'mm':out+=pad(f.minute,2);break;\ncase'm':out+=String(f.minute);break;\ncase'ss':out+=pad(f.second,2);break;\ncase's':out+=String(f.second);break;\ncase'SSS':out+=pad(f.ms,3);break;\ncase'a':out+=f.hour<12?'AM':'PM';break;\ndefault:out+=seg.text;break;\n}\n}\nreturn out;\n};\n}\nconst UNITS=[\n['year',365*24*3600e3],\n['month',30*24*3600e3],\n['week',7*24*3600e3],\n['day',24*3600e3],\n['hour',3600e3],\n['minute',60e3],\n['second',1e3],\n];\nfunction compileDate(spec,locale){\nconst s=spec||{};\nconst loc=s.locale||locale||undefined;\nconst nullDisplay=s.nullDisplay??'';\nconst timeZone=s.timeZone;\nlet absolute;\nif(s.pattern){\nabsolute=compilePattern(s.pattern,loc,timeZone);\n}else if(s.dateStyle||s.timeStyle){\nconst opts={timeZone};\nif(s.dateStyle)opts.dateStyle=s.dateStyle;\nif(s.timeStyle)opts.timeStyle=s.timeStyle;\nconst dtf=new Intl.DateTimeFormat(loc,opts);\nabsolute=(d)=>dtf.format(d);\n}else{\nconst dtf=new Intl.DateTimeFormat(loc,{dateStyle:'medium',timeZone});\nabsolute=(d)=>dtf.format(d);\n}\nconst relative=s.relative?new Intl.RelativeTimeFormat(loc,{numeric:'auto'}):null;\nconst thresholdDays=typeof s.relative==='object'&&s.relative\n?(s.relative.threshold??7)\n:7;\nconst thresholdMs=thresholdDays*24*3600e3;\nconst format=(value,params)=>{\nconst d=toDate(value);\nif(!d)return nullDisplay;\nif(relative){\nconst now=params&&typeof params.now==='number'?params.now:Date.now();\nconst delta=d.getTime()-now;\nif(Math.abs(delta)<thresholdMs){\nfor(const[unit,ms]of UNITS){\nif(Math.abs(delta)>=ms||unit==='second'){\nreturn relative.format(Math.round(delta/ms),unit);\n}\n}\n}\n}\nreturn absolute(d);\n};\nformat.spec=s;\nreturn format;\n}\nfunction toIsoDate(value){\nif(isNil(value)||value==='')return null;\nif(typeof value==='string'){\nconst match=/^(\\d{4}-\\d{2}-\\d{2})/.exec(value.trim());\nif(match)return match[1];\nconst parsed=toDate(value);\nreturn parsed?toIsoDate(parsed):null;\n}\nconst date=toDate(value);\nif(!date)return null;\nconst pad=(n)=>String(n).padStart(2,'0');\nreturn`${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())}`;\n}\nfunction toIsoDateTime(value,timeZone){\nif(isNil(value)||value==='')return null;\nif(typeof value==='string'){\nconst text=value.trim();\nif(ZONE_SUFFIX.test(text)){\nconst instant=toDate(text);\nreturn instant?wallClockIn(instant,timeZone):null;\n}\nconst match=/^(\\d{4}-\\d{2}-\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?/.exec(text);\nif(match){\nconst[,day,hour,minute,second]=match;\nreturn`${day}T${hour}:${minute}${second&&second!=='00'?`:${second}`:''}`;\n}\nif(/^\\d{4}-\\d{2}-\\d{2}$/.test(text))return`${text}T00:00`;\nconst parsed=toDate(text);\nreturn parsed?toIsoDateTime(parsed):null;\n}\nconst date=toDate(value);\nif(!date)return null;\nreturn wallClockIn(date,timeZone);\n}\nconst ZONE_SUFFIX=/(?:Z|[+-]\\d{2}:?\\d{2})$/i;\nfunction wallClockIn(date,timeZone){\nconst pad=(n)=>String(n).padStart(2,'0');\nif(timeZone){\ntry{\nconst parts=new Intl.DateTimeFormat('en-CA',{\ntimeZone,\nyear:'numeric',month:'2-digit',day:'2-digit',\nhour:'2-digit',minute:'2-digit',second:'2-digit',\nhour12:false,\n}).formatToParts(date).reduce((out,part)=>{\nif(part.type!=='literal')out[part.type]=part.value;\nreturn out;\n},{});\nconst hour=parts.hour==='24'?'00':parts.hour;\nconst seconds=Number(parts.second);\nreturn`${parts.year}-${parts.month}-${parts.day}T${hour}:${parts.minute}`\n+(seconds?`:${parts.second}`:'');\n}catch{\n}\n}\nconst day=`${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())}`;\nconst seconds=date.getSeconds();\nconst clock=`${pad(date.getHours())}:${pad(date.getMinutes())}${seconds?`:${pad(seconds)}`:''}`;\nreturn`${day}T${clock}`;\n}\nfunction compareIso(a,b){\nconst left=isNil(a)||a===''?null:String(a);\nconst right=isNil(b)||b===''?null:String(b);\nif(left===null)return right===null?0:1;\nif(right===null)return-1;\nreturn left<right?-1:left>right?1:0;\n}\n});\n__def(\"packages/core/src/compute/filter.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"releaseMask\",{enumerable:true,get:function(){return releaseMask;}});\nObject.defineProperty(__exports,\"compilePredicate\",{enumerable:true,get:function(){return compilePredicate;}});\nObject.defineProperty(__exports,\"testValue\",{enumerable:true,get:function(){return testValue;}});\nObject.defineProperty(__exports,\"evaluateCondition\",{enumerable:true,get:function(){return evaluateCondition;}});\nObject.defineProperty(__exports,\"evaluateFilters\",{enumerable:true,get:function(){return evaluateFilters;}});\nObject.defineProperty(__exports,\"pruneColumn\",{enumerable:true,get:function(){return pruneColumn;}});\nObject.defineProperty(__exports,\"mentionsColumn\",{enumerable:true,get:function(){return mentionsColumn;}});\nObject.defineProperty(__exports,\"compact\",{enumerable:true,get:function(){return compact;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isBlank=__m0[\"isBlank\"];\nconst toArray=__m0[\"toArray\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/format/date.js\");\nconst toIsoDate=__m1[\"toIsoDate\"];\nconst __m2=__req(\"packages/core/src/compute/handle.js\");\nconst bitReader=__m2[\"bitReader\"];\nconst dictSize=__m2[\"dictSize\"];\nconst dictValue=__m2[\"dictValue\"];\nconst presenceReader=__m2[\"presenceReader\"];\nconst valueComparator=__m2[\"valueComparator\"];\nconst valueReader=__m2[\"valueReader\"];\nconst ISO_DAY=/^\\d{4}-\\d{2}-\\d{2}$/;\nconst NULL_KEY='\\u0000null\\u0000';\nfunction acquireMask(ctx,n){\nconst pool=ctx&&ctx.pool;\nif(pool){\nconst take=pool.mask||pool.acquireMask||pool.acquire||pool.take;\nif(typeof take==='function'){\nconst mask=take.call(pool,n);\nif(mask&&mask.length>=n)return mask;\n}\n}\nreturn new Uint8Array(n);\n}\nfunction releaseMask(ctx,mask){\nconst pool=ctx&&ctx.pool;\nif(!pool||!mask)return;\nconst give=pool.release||pool.releaseMask||pool.free||pool.recycle;\nif(typeof give==='function')give.call(pool,mask);\n}\nfunction fillMask(mask,n,value){\nmask.fill(value,0,n);\nreturn mask;\n}\nfunction unorderable(v){\nreturn v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v));\n}\nfunction coerceTarget(value,type){\nif(value===null||value===undefined)return value;\nif(type==='number')return typeof value==='number'?value:Number(value);\nif(type==='date'||type==='dateString'){\nconst iso=toIsoDate(value);\nreturn iso===null?toMillis(value):iso;\n}\nif(type==='boolean'){\nif(typeof value==='boolean')return value;\nif(value==='true'||value===1)return true;\nif(value==='false'||value===0)return false;\nreturn!!value;\n}\nreturn value;\n}\nfunction toMillis(value){\nif(value instanceof Date)return value.getTime();\nif(typeof value==='number')return value;\nreturn Date.parse(String(value));\n}\nfunction toNumber(value){\nif(typeof value==='number')return value;\nif(value instanceof Date)return value.getTime();\nif(value===null||value===undefined||value==='')return NaN;\nreturn Number(value);\n}\nfunction textOf(v,caseSensitive){\nconst s=typeof v==='string'?v:String(v);\nreturn caseSensitive?s:s.toLowerCase();\n}\nfunction setKey(v,caseSensitive){\nif(v===null||v===undefined)return NULL_KEY;\nif(typeof v==='string')return caseSensitive?v:v.toLowerCase();\nif(v instanceof Date)return v.getTime();\nreturn v;\n}\nfunction buildSet(value,caseSensitive,type){\nconst set=new Set();\nfor(const raw of toArray(value)){\nconst entry=coerceTarget(raw,type);\nset.add(setKey(entry,caseSensitive));\nif(typeof entry==='string'&&entry!==''&&Number.isFinite(Number(entry)))set.add(Number(entry));\nelse if(typeof entry==='number'&&Number.isFinite(entry))set.add(setKey(String(entry),caseSensitive));\n}\nreturn set;\n}\nfunction valueEquals(a,b,caseSensitive){\nif(a===null||a===undefined||b===null||b===undefined){\nreturn(a===null||a===undefined)&&(b===null||b===undefined);\n}\nconst ta=typeof a;\nconst tb=typeof b;\nif(ta==='string'&&tb==='string')return caseSensitive?a===b:a.toLowerCase()===b.toLowerCase();\nif(a instanceof Date||b instanceof Date)return toMillis(a)===toMillis(b);\nif(ta==='number'&&tb==='number')return a===b||(Number.isNaN(a)&&Number.isNaN(b));\nif(ta==='number'&&tb==='string')return a===Number(b);\nif(ta==='string'&&tb==='number')return Number(a)===b;\nif(ta==='boolean'||tb==='boolean')return a===b;\nif(Array.isArray(a)&&Array.isArray(b)){\nreturn a.length===b.length&&a.every((x,i)=>valueEquals(x,b[i],caseSensitive));\n}\nreturn a===b;\n}\nfunction compileRegExp(value,caseSensitive){\ntry{\nif(value instanceof RegExp){\nconst flags=value.flags.replace(/[gy]/g,'');\nreturn new RegExp(value.source,caseSensitive?flags:flags.includes('i')?flags:`${flags}i`);\n}\nreturn new RegExp(String(value),caseSensitive?'':'i');\n}catch(err){\nwarnOnce(`regex:${String(value)}`,`filter operator \"matches\" received an invalid pattern: ${String(value)}`,err);\nreturn null;\n}\n}\nfunction compilePredicate(condition,locale){\nconst predicate=compileValuePredicate(condition,locale);\nconst type=condition&&condition.type;\nif(type!=='date'&&type!=='dateString')return predicate;\nreturn(v)=>predicate(typeof v==='string'&&ISO_DAY.test(v)?v:(toIsoDate(v)??v));\n}\nfunction compileValuePredicate(condition,locale){\nconst op=condition&&condition.op;\nconst caseSensitive=!!(condition&&condition.caseSensitive);\nconst type=condition&&condition.type;\nconst cmp=valueComparator(locale);\nconst not=(p)=>(v)=>!p(v);\nswitch(op){\ncase'eq':{\nconst target=coerceTarget(condition.value,type);\nreturn(v)=>valueEquals(v,target,caseSensitive);\n}\ncase'ne':{\nconst target=coerceTarget(condition.value,type);\nreturn(v)=>!valueEquals(v,target,caseSensitive);\n}\ncase'lt':case'lte':case'gt':case'gte':{\nconst target=coerceTarget(condition.value,type);\nif(unorderable(target))return()=>false;\nconst want=op==='lt'?-1:op==='lte'?0:op==='gt'?1:2;\nreturn(v)=>{\nif(unorderable(v))return false;\nconst c=cmp(v,target);\nreturn want===-1?c<0:want===0?c<=0:want===1?c>0:c>=0;\n};\n}\ncase'between':case'notBetween':{\nconst pair=toArray(condition.value);\nconst lo=coerceTarget(pair[0],type);\nconst hi=coerceTarget(pair[1],type);\nconst bounds=condition.bounds||'[]';\nconst loInclusive=bounds.charAt(0)!=='(';\nconst hiInclusive=bounds.charAt(1)!==')';\nif(unorderable(lo)||unorderable(hi))return op==='between'?()=>false:()=>true;\nconst inRange=(v)=>{\nif(unorderable(v))return false;\nconst a=cmp(v,lo);\nconst b=cmp(v,hi);\nreturn(loInclusive?a>=0:a>0)&&(hiInclusive?b<=0:b<0);\n};\nreturn op==='between'?inRange:not(inRange);\n}\ncase'in':case'notIn':{\nconst set=buildSet(condition.value,caseSensitive,type);\nconst member=(v)=>set.has(setKey(v,caseSensitive));\nreturn op==='in'?member:not(member);\n}\ncase'contains':case'notContains':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nconst has=(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).includes(needle));\nreturn op==='contains'?has:not(has);\n}\ncase'startsWith':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nreturn(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).startsWith(needle));\n}\ncase'endsWith':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nreturn(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).endsWith(needle));\n}\ncase'matches':{\nconst re=compileRegExp(condition.value,caseSensitive);\nif(!re)return()=>false;\nreturn(v)=>(v===null||v===undefined?false:re.test(String(v)));\n}\ncase'blank':\nreturn(v)=>isBlank(v)||(Array.isArray(v)&&v.length===0);\ncase'notBlank':\nreturn(v)=>!(isBlank(v)||(Array.isArray(v)&&v.length===0));\ncase'containsAny':case'containsNone':{\nconst set=buildSet(condition.value,caseSensitive,type);\nconst any=(v)=>{\nconst list=v===null||v===undefined?[]:toArray(v);\nfor(let i=0;i<list.length;i++)if(set.has(setKey(list[i],caseSensitive)))return true;\nreturn false;\n};\nreturn op==='containsAny'?any:not(any);\n}\ncase'containsAll':{\nconst wanted=toArray(condition.value).map((x)=>setKey(coerceTarget(x,type),caseSensitive));\nreturn(v)=>{\nconst list=v===null||v===undefined?[]:toArray(v);\nif(wanted.length===0)return true;\nconst have=new Set(list.map((x)=>setKey(x,caseSensitive)));\nfor(let i=0;i<wanted.length;i++)if(!have.has(wanted[i]))return false;\nreturn true;\n};\n}\ndefault:\nwarnOnce(`op:${String(op)}`,`unknown filter operator \"${String(op)}\"; the condition passes every row`);\nreturn()=>true;\n}\n}\nfunction testValue(value,condition,locale){\nreturn compilePredicate(condition,locale)(value);\n}\nfunction presenceCondition(handle,wantPresent,mask,count){\nconst present=presenceReader(handle);\nif(present){\nconst target=wantPresent?1:0;\nfor(let i=0;i<count;i++)mask[i]=present(i)===target?1:0;\nreturn mask;\n}\nconst kind=handle.kind;\nif(kind==='float64'||kind==='int32'||kind==='bitset'){\nreturn fillMask(mask,count,wantPresent?1:0);\n}\nconst read=valueReader(handle);\nfor(let i=0;i<count;i++){\nconst v=read(i);\nconst blank=isBlank(v)||(Array.isArray(v)&&v.length===0);\nmask[i]=blank===wantPresent?0:1;\n}\nreturn mask;\n}\nfunction dictionaryCondition(handle,pred,mask,count){\nconst dict=handle.dict;\nconst size=dictSize(dict);\nconst allowed=new Uint8Array(size);\nfor(let code=0;code<size;code++)allowed[code]=pred(dictValue(dict,code))?1:0;\nconst codes=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<count;i++)mask[i]=allowed[codes[i]];\nreturn mask;\n}\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++)mask[i]=present(i)===1?allowed[codes[i]]:absentAnswer;\nreturn mask;\n}\nfunction booleanCondition(handle,pred,mask,count){\nconst bit=bitReader(handle.values);\nconst whenTrue=pred(true)?1:0;\nconst whenFalse=pred(false)?1:0;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<count;i++)mask[i]=bit(i)===1?whenTrue:whenFalse;\nreturn mask;\n}\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++){\nmask[i]=present(i)===0?absentAnswer:(bit(i)===1?whenTrue:whenFalse);\n}\nreturn mask;\n}\nfunction numericCondition(handle,condition,pred,mask,count){\nconst values=handle.values;\nconst type=condition.type;\nconst op=condition.op;\nlet handled=true;\nswitch(op){\ncase'eq':case'ne':{\nconst target=toNumber(coerceTarget(condition.value,type));\nconst wantNaN=typeof condition.value==='number'&&Number.isNaN(condition.value);\nconst invert=op==='ne'?1:0;\nif(wantNaN){\nfor(let i=0;i<count;i++)mask[i]=(Number.isNaN(values[i])?1:0)^invert;\n}else{\nfor(let i=0;i<count;i++)mask[i]=((values[i]===target)?1:0)^invert;\n}\nbreak;\n}\ncase'lt':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]<t?1:0;\nbreak;\n}\ncase'lte':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]<=t?1:0;\nbreak;\n}\ncase'gt':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]>t?1:0;\nbreak;\n}\ncase'gte':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]>=t?1:0;\nbreak;\n}\ncase'between':case'notBetween':{\nconst pair=toArray(condition.value);\nconst lo=toNumber(coerceTarget(pair[0],type));\nconst hi=toNumber(coerceTarget(pair[1],type));\nconst bounds=condition.bounds||'[]';\nconst loInclusive=bounds.charAt(0)!=='(';\nconst hiInclusive=bounds.charAt(1)!==')';\nconst invert=op==='notBetween'?1:0;\nif(loInclusive&&hiInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>=lo)&(values[i]<=hi))?1:0)^invert;\n}else if(loInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>=lo)&(values[i]<hi))?1:0)^invert;\n}else if(hiInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>lo)&(values[i]<=hi))?1:0)^invert;\n}else{\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>lo)&(values[i]<hi))?1:0)^invert;\n}\nbreak;\n}\ncase'in':case'notIn':{\nconst set=new Set();\nfor(const raw of toArray(condition.value)){\nconst n=toNumber(coerceTarget(raw,type));\nif(!Number.isNaN(n))set.add(n);\n}\nconst invert=op==='notIn'?1:0;\nfor(let i=0;i<count;i++)mask[i]=(set.has(values[i])?1:0)^invert;\nbreak;\n}\ndefault:\nhandled=false;\nbreak;\n}\nif(!handled)return false;\nconst present=presenceReader(handle);\nif(present){\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++)if(present(i)===0)mask[i]=absentAnswer;\n}\nreturn true;\n}\nfunction genericCondition(handle,pred,mask,count){\nconst read=valueReader(handle);\nfor(let i=0;i<count;i++)mask[i]=pred(read(i))?1:0;\nreturn mask;\n}\nfunction evaluateCondition(condition,ctx,out){\nconst count=ctx.count|0;\nconst mask=out||acquireMask(ctx,count);\nif(!condition)return fillMask(mask,count,1);\nconst handle=typeof ctx.handle==='function'?ctx.handle(condition.col):undefined;\nconst custom=typeof ctx.custom==='function'?ctx.custom:null;\nif(!handle){\nif(custom){\nfor(let i=0;i<count;i++)mask[i]=custom(condition,i)?1:0;\nreturn mask;\n}\nwarnOnce(`filter:col:${String(condition.col)}`,\n`filter references unknown column \"${String(condition.col)}\"; the condition passes every row`);\nreturn fillMask(mask,count,1);\n}\nconst op=condition.op;\nif(op==='blank'||op==='notBlank')return presenceCondition(handle,op==='notBlank',mask,count);\nconst pred=compilePredicate(condition,ctx.locale);\nswitch(handle.kind){\ncase'dictionary':\nreturn dictionaryCondition(handle,pred,mask,count);\ncase'bitset':\nreturn booleanCondition(handle,pred,mask,count);\ncase'float64':case'int32':\nif(numericCondition(handle,condition,pred,mask,count))return mask;\nreturn genericCondition(handle,pred,mask,count);\ndefault:\nreturn genericCondition(handle,pred,mask,count);\n}\n}\nfunction evaluateNode(node,ctx,count){\nif(!node)return fillMask(acquireMask(ctx,count),count,1);\nif(Array.isArray(node.conditions)){\nconst children=node.conditions.filter((c)=>c!=null);\nconst op=node.op==='or'?'or':node.op==='not'?'not':'and';\nif(children.length===0)return fillMask(acquireMask(ctx,count),count,1);\nconst acc=evaluateNode(children[0],ctx,count);\nfor(let k=1;k<children.length;k++){\nconst rhs=evaluateNode(children[k],ctx,count);\nif(op==='or')for(let i=0;i<count;i++)acc[i]|=rhs[i];\nelse for(let i=0;i<count;i++)acc[i]&=rhs[i];\nreleaseMask(ctx,rhs);\n}\nif(op==='not')for(let i=0;i<count;i++)acc[i]^=1;\nreturn acc;\n}\nreturn evaluateCondition(node,ctx,acquireMask(ctx,count));\n}\nfunction evaluateFilters(filters,ctx){\nreturn evaluateNode(filters,ctx,ctx.count|0);\n}\nfunction pruneColumn(filters,colId){\nif(!filters||!colId)return filters||null;\nconst node=(filters);\nif(Array.isArray(node.conditions)){\nconst op=node.op==='or'?'or':node.op==='not'?'not':'and';\nif(op!=='and'){\nreturn mentionsColumn(node,colId)?null:filters;\n}\nconst kept=[];\nfor(const child of node.conditions){\nconst pruned=pruneColumn(child,colId);\nif(pruned)kept.push(pruned);\n}\nif(!kept.length)return null;\nreturn{...node,op:'and',conditions:kept};\n}\nreturn node.col===colId?null:filters;\n}\nfunction mentionsColumn(filters,colId){\nif(!filters||typeof filters!=='object')return false;\nconst node=(filters);\nif(node.col===colId)return true;\nif(Array.isArray(node.conditions)){\nfor(const child of node.conditions)if(mentionsColumn(child,colId))return true;\n}\nreturn false;\n}\nfunction compact(mask,count,out){\nif(out&&out.length>=count){\nlet k=0;\nfor(let i=0;i<count;i++)if(mask[i])out[k++]=i;\nreturn out.subarray(0,k);\n}\nlet survivors=0;\nfor(let i=0;i<count;i++)survivors+=mask[i]?1:0;\nconst result=new Uint32Array(survivors);\nlet k=0;\nfor(let i=0;i<count;i++)if(mask[i])result[k++]=i;\nreturn result;\n}\n});\n__def(\"packages/core/src/compute/group.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"packKeys\",{enumerable:true,get:function(){return packKeys;}});\nObject.defineProperty(__exports,\"groupByColumns\",{enumerable:true,get:function(){return groupByColumns;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst dictSize=__m0[\"dictSize\"];\nconst identity=__m0[\"identity\"];\nconst presenceReader=__m0[\"presenceReader\"];\nconst rowCount=__m0[\"rowCount\"];\nconst valueReader=__m0[\"valueReader\"];\nconst KEY_SEPARATOR='\\u001F';\nconst NULL_MARKER='\\u0000';\nconst MAX_DIRECT_COUNTS=1<<20;\nfunction packKeys(handles,idx,n){\nconst k=handles.length;\nconst readers=handles.map((h)=>valueReader(h));\nconst allDictionary=k>0&&handles.every((h)=>h&&h.kind==='dictionary'&&h.dict);\nif(allDictionary){\nconst cards=handles.map((h)=>dictSize(h.dict)+1);\nlet product=1;\nfor(let j=0;j<k;j++)product*=cards[j];\nif(product<=Number.MAX_SAFE_INTEGER){\nconst codes=handles.map((h)=>h.values);\nconst presence=handles.map((h)=>presenceReader(h));\nconst keyOf=(row)=>{\nlet key=0;\nfor(let j=0;j<k;j++){\nconst present=presence[j];\nconst code=present&&present(row)===0?cards[j]-1:codes[j][row];\nkey=key*cards[j]+code;\n}\nreturn key;\n};\nconst packed=new Float64Array(n);\nfor(let i=0;i<n;i++)packed[i]=keyOf(idx[i]);\nreturn{packed,strings:null,product,readers,keyOf};\n}\n}\nconst keyOf=(row)=>{\nlet key='';\nfor(let j=0;j<k;j++){\nconst v=readers[j](row);\nkey+=(j===0?'':KEY_SEPARATOR)+(v===null||v===undefined?NULL_MARKER:String(v));\n}\nreturn key;\n};\nconst strings=new Array(n);\nfor(let i=0;i<n;i++)strings[i]=keyOf(idx[i]);\nreturn{packed:null,strings,product:Infinity,readers,keyOf};\n}\nfunction scatterBuckets(idx,ids,n,groups){\nconst offsets=new Uint32Array(groups+1);\nfor(let i=0;i<n;i++)offsets[ids[i]+1]++;\nfor(let g=0;g<groups;g++)offsets[g+1]+=offsets[g];\nconst scattered=new Uint32Array(n);\nconst cursor=offsets.slice(0,groups);\nfor(let i=0;i<n;i++)scattered[cursor[ids[i]]++]=idx[i];\nconst buckets=new Array(groups);\nfor(let g=0;g<groups;g++)buckets[g]=scattered.subarray(offsets[g],offsets[g+1]);\nreturn buckets;\n}\nfunction groupByColumns(handles,order,opts={}){\nconst list=handles||[];\nconst idx=order||identity(rowCount(list[0],opts));\nconst n=idx.length;\nif(list.length===0||n===0)return{keys:[],buckets:[]};\nconst{packed,strings,product,readers}=packKeys(list,idx,n);\nconst ids=new Uint32Array(n);\nlet groups=0;\nlet packedKeys=null;\nif(packed&&product<=Math.max(1024,Math.min(MAX_DIRECT_COUNTS,n*4))){\nconst size=product;\nconst seen=new Int32Array(size).fill(-1);\nfor(let i=0;i<n;i++)seen[packed[i]]=0;\nfor(let key=0;key<size;key++)if(seen[key]===0)seen[key]=groups++;\nfor(let i=0;i<n;i++)ids[i]=seen[packed[i]];\npackedKeys=new Float64Array(groups);\nfor(let key=0;key<size;key++)if(seen[key]>=0)packedKeys[seen[key]]=key;\n}else if(packed){\nconst seen=new Map();\nfor(let i=0;i<n;i++){\nconst key=packed[i];\nlet id=seen.get(key);\nif(id===undefined){id=groups++;seen.set(key,id);}\nids[i]=id;\n}\npackedKeys=new Float64Array(groups);\nfor(const[key,id]of seen)packedKeys[id]=key;\n}else{\nconst seen=new Map();\nfor(let i=0;i<n;i++){\nconst key=strings[i];\nlet id=seen.get(key);\nif(id===undefined){id=groups++;seen.set(key,id);}\nids[i]=id;\n}\n}\nconst buckets=scatterBuckets(idx,ids,n,groups);\nconst keys=new Array(groups);\nfor(let g=0;g<groups;g++){\nconst row=buckets[g][0];\nconst tuple=new Array(readers.length);\nfor(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);\nkeys[g]=tuple;\n}\nconst result={keys,buckets};\nif(packedKeys)result.packed=packedKeys;\nreturn result;\n}\n});\n__def(\"packages/core/src/compute/facet.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"STRATEGIES\",{enumerable:true,get:function(){return STRATEGIES;}});\nObject.defineProperty(__exports,\"GRANULARITIES\",{enumerable:true,get:function(){return GRANULARITIES;}});\nObject.defineProperty(__exports,\"DEFAULT_BUCKETS\",{enumerable:true,get:function(){return DEFAULT_BUCKETS;}});\nObject.defineProperty(__exports,\"DEFAULT_CARDINALITY_LIMIT\",{enumerable:true,get:function(){return DEFAULT_CARDINALITY_LIMIT;}});\nObject.defineProperty(__exports,\"QUANTILE_SAMPLE\",{enumerable:true,get:function(){return QUANTILE_SAMPLE;}});\nObject.defineProperty(__exports,\"facetKind\",{enumerable:true,get:function(){return facetKind;}});\nObject.defineProperty(__exports,\"orderedReader\",{enumerable:true,get:function(){return orderedReader;}});\nObject.defineProperty(__exports,\"toNumeric\",{enumerable:true,get:function(){return toNumeric;}});\nObject.defineProperty(__exports,\"cardinalityOf\",{enumerable:true,get:function(){return cardinalityOf;}});\nObject.defineProperty(__exports,\"pickGranularity\",{enumerable:true,get:function(){return pickGranularity;}});\nObject.defineProperty(__exports,\"floorTo\",{enumerable:true,get:function(){return floorTo;}});\nObject.defineProperty(__exports,\"advance\",{enumerable:true,get:function(){return advance;}});\nObject.defineProperty(__exports,\"computeBounds\",{enumerable:true,get:function(){return computeBounds;}});\nObject.defineProperty(__exports,\"countInto\",{enumerable:true,get:function(){return countInto;}});\nObject.defineProperty(__exports,\"bucketOf\",{enumerable:true,get:function(){return bucketOf;}});\nObject.defineProperty(__exports,\"facet\",{enumerable:true,get:function(){return facet;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m0[\"presenceReader\"];\nconst valueReader=__m0[\"valueReader\"];\nconst dictSize=__m0[\"dictSize\"];\nconst dictValue=__m0[\"dictValue\"];\nconst STRATEGIES=Object.freeze(['equal','quantile','log']);\nconst GRANULARITIES=Object.freeze(['hour','day','week','month','quarter','year']);\nconst DEFAULT_BUCKETS=20;\nconst DEFAULT_CARDINALITY_LIMIT=50;\nconst QUANTILE_SAMPLE=10_000;\nfunction facetKind(handle,type){\nif(!handle)return'none';\nconst base=type&&type.base;\nif(base==='date'||base==='datetime'||base==='time'||base==='dateString')return'date';\nswitch(handle.kind){\ncase'bitset':return'boolean';\ncase'float64':case'int32':return'numeric';\ncase'dictionary':return'category';\ncase'multi':return'category';\ndefault:\nif(base==='number')return'numeric';\nif(base==='boolean')return'boolean';\nif(base==='text')return'category';\nreturn'none';\n}\n}\nfunction orderedReader(handle){\nconst values=handle.values;\nconst kind=handle.kind;\nif((kind==='float64'||kind==='int32')&&values)return(i)=>values[i];\nconst read=valueReader(handle);\nreturn(i)=>toNumeric(read(i));\n}\nfunction toNumeric(v){\nif(typeof v==='number')return v;\nif(v instanceof Date)return v.getTime();\nif(v===null||v===undefined||v==='')return NaN;\nif(typeof v==='boolean')return v?1:0;\nif(typeof v==='string'){\nconst n=Number(v);\nif(Number.isFinite(n))return n;\nconst t=Date.parse(v);\nreturn Number.isFinite(t)?t:NaN;\n}\nreturn NaN;\n}\nfunction cardinalityOf(handle,indices,count,limit=DEFAULT_CARDINALITY_LIMIT){\nif(!handle)return{cardinality:0,exact:true};\nif(handle.dict)return{cardinality:dictSize(handle.dict),exact:true};\nif(handle.kind==='bitset')return{cardinality:2,exact:true};\nconst read=valueReader(handle);\nconst n=indices?indices.length:count;\nconst seen=new Set();\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined)continue;\nseen.add(v);\nif(seen.size>limit)return{cardinality:seen.size,exact:false};\n}\nreturn{cardinality:seen.size,exact:true};\n}\nconst HOUR_MS=3600_000;\nconst DAY_MS=86_400_000;\nfunction pickGranularity(span,target=DEFAULT_BUCKETS){\nconst ms=Number.isFinite(span)&&span>0?span:0;\nconst wide=Math.max(1,target)*2;\nif(ms/HOUR_MS<=wide)return'hour';\nif(ms/DAY_MS<=wide)return'day';\nif(ms/(7*DAY_MS)<=wide)return'week';\nif(ms/(30*DAY_MS)<=wide)return'month';\nif(ms/(91*DAY_MS)<=wide)return'quarter';\nreturn'year';\n}\nfunction floorTo(ms,granularity){\nif(!Number.isFinite(ms))return NaN;\nconst d=new Date(ms);\nswitch(granularity){\ncase'hour':d.setMinutes(0,0,0);return d.getTime();\ncase'day':d.setHours(0,0,0,0);return d.getTime();\ncase'week':{\nd.setHours(0,0,0,0);\nconst back=(d.getDay()+6)%7;\nd.setDate(d.getDate()-back);\nreturn d.getTime();\n}\ncase'month':d.setDate(1);d.setHours(0,0,0,0);return d.getTime();\ncase'quarter':\nd.setMonth(Math.floor(d.getMonth()/3)*3,1);\nd.setHours(0,0,0,0);\nreturn d.getTime();\ndefault:d.setMonth(0,1);d.setHours(0,0,0,0);return d.getTime();\n}\n}\nfunction advance(ms,granularity){\nconst d=new Date(ms);\nswitch(granularity){\ncase'hour':d.setHours(d.getHours()+1);break;\ncase'day':d.setDate(d.getDate()+1);break;\ncase'week':d.setDate(d.getDate()+7);break;\ncase'month':d.setMonth(d.getMonth()+1);break;\ncase'quarter':d.setMonth(d.getMonth()+3);break;\ndefault:d.setFullYear(d.getFullYear()+1);break;\n}\nreturn d.getTime();\n}\nfunction numericExtent(handle,indices,count){\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nconst n=indices?indices.length:count;\nlet min=Infinity;\nlet max=-Infinity;\nlet nulls=0;\nlet finite=0;\nfor(let k=0;k<n;k++){\nconst i=indices?indices[k]:k;\nif(present&&!present(i)){nulls++;continue;}\nconst v=read(i);\nif(!Number.isFinite(v)){nulls++;continue;}\nif(v<min)min=v;\nif(v>max)max=v;\nfinite++;\n}\nreturn{min,max,nulls,finite};\n}\nfunction sortedSample(handle,indices,count,cap){\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nconst n=indices?indices.length:count;\nconst step=n>cap?n/cap:1;\nconst out=[];\nfor(let s=0;s<n;s+=step){\nconst i=indices?indices[Math.floor(s)]:Math.floor(s);\nif(present&&!present(i))continue;\nconst v=read(i);\nif(Number.isFinite(v))out.push(v);\n}\nconst arr=Float64Array.from(out);\narr.sort();\nreturn arr;\n}\nfunction computeBounds(handle,indices,count,opts={}){\nconst kind=opts.kind||facetKind(handle,opts.type);\nif(kind==='none'||!handle)return{kind:'none',buckets:[],suppressed:'type'};\nif(kind==='boolean')return boundsForBoolean(handle,indices,count);\nif(kind==='category')return boundsForCategory(handle,indices,count,opts);\nreturn boundsForOrdered(handle,indices,count,kind,opts);\n}\nfunction boundsForBoolean(handle,indices,count){\nconst present=presenceReader(handle);\nlet nulls=0;\nif(present){\nconst n=indices?indices.length:count;\nfor(let k=0;k<n;k++)if(!present(indices?indices[k]:k))nulls++;\n}\nconst buckets=[{value:false,label:'false'},{value:true,label:'true'}];\nif(nulls>0)buckets.push({null:true,label:'Empty'});\nreturn{kind:'boolean',buckets};\n}\nfunction boundsForCategory(handle,indices,count,opts){\nconst limit=opts.cardinalityLimit??DEFAULT_CARDINALITY_LIMIT;\nconst{cardinality}=cardinalityOf(handle,indices,count,limit);\nif(cardinality>limit&&(opts.aboveLimit||'suppress')==='suppress'){\nreturn{kind:'category',buckets:[],suppressed:'cardinality',cardinality};\n}\nconst read=valueReader(handle);\nconst n=indices?indices.length:count;\nconst tally=new Map();\nlet nulls=0;\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined||v===''){nulls++;continue;}\nif(Array.isArray(v)){\nif(!v.length){nulls++;continue;}\nfor(const m of v)tally.set(m,(tally.get(m)||0)+1);\ncontinue;\n}\ntally.set(v,(tally.get(v)||0)+1);\n}\nlet entries=[...tally.entries()];\nif(opts.order==='alpha'){\nentries.sort((a,b)=>String(a[0]).localeCompare(String(b[0])));\n}else{\nentries.sort((a,b)=>b[1]-a[1]);\n}\nlet remainder=0;\nlet dropped=0;\nif(entries.length>limit){\ndropped=entries.length-limit;\nfor(let i=limit;i<entries.length;i++)remainder+=entries[i][1];\nentries=entries.slice(0,limit);\n}\nconst buckets=entries.map(([value])=>({value,label:String(value)}));\nif(remainder>0)buckets.push({remainder:true,label:`Other (${dropped} values)`});\nif(nulls>0)buckets.push({null:true,label:'Empty'});\nreturn{kind:'category',buckets,cardinality};\n}\nfunction boundsForOrdered(handle,indices,count,kind,opts){\nconst{min,max,nulls,finite}=numericExtent(handle,indices,count);\nif(!finite){\nreturn{kind,buckets:nulls?[{null:true,label:'Empty'}]:[],empty:true};\n}\nconst wanted=Math.max(1,Math.floor(opts.buckets||DEFAULT_BUCKETS));\nlet buckets=[];\nif(kind==='date'){\nconst granularity=GRANULARITIES.includes(opts.granularity)\n?opts.granularity:pickGranularity(max-min,wanted);\nlet edge=floorTo(min,granularity);\nwhile(edge<=max&&buckets.length<4096){\nconst next=advance(edge,granularity);\nif(!(next>edge))break;\nbuckets.push({from:edge,to:next});\nedge=next;\n}\nreturn{kind,buckets:withNull(buckets,nulls),granularity};\n}\nconst strategy=STRATEGIES.includes(opts.strategy)?opts.strategy:'equal';\nif(strategy==='quantile'){\nconst sample=sortedSample(handle,indices,count,QUANTILE_SAMPLE);\nif(sample.length){\nconst edges=[sample[0]];\nfor(let b=1;b<wanted;b++){\nconst v=sample[Math.min(sample.length-1,Math.floor((b/wanted)*sample.length))];\nif(v>edges[edges.length-1])edges.push(v);\n}\nedges.push(max);\nfor(let b=0;b<edges.length-1;b++)buckets.push({from:edges[b],to:edges[b+1]});\n}\n}else if(strategy==='log'&&min>0){\nconst lo=Math.log10(min);\nconst hi=Math.log10(max);\nconst step=(hi-lo)/wanted||1;\nfor(let b=0;b<wanted;b++){\nbuckets.push({from:10**(lo+b*step),to:10**(lo+(b+1)*step)});\n}\n}\nif(!buckets.length){\nconst width=(max-min)/wanted||1;\nfor(let b=0;b<wanted;b++)buckets.push({from:min+b*width,to:min+(b+1)*width});\n}\nbuckets[buckets.length-1].to=max;\nreturn{kind,buckets:withNull(buckets,nulls),strategy,min,max};\n}\nfunction withNull(buckets,nulls){\nreturn nulls>0?[...buckets,{null:true,label:'Empty'}]:buckets;\n}\nfunction countInto(handle,indices,count,bounds,out){\nconst buckets=(bounds&&bounds.buckets)||[];\nconst counts=out&&out.length>=buckets.length?out.subarray(0,buckets.length)\n:new Uint32Array(buckets.length);\ncounts.fill(0);\nif(!handle||!buckets.length)return counts;\nconst nullBucket=buckets.length-1;\nconst hasNull=!!buckets[nullBucket]&&buckets[nullBucket].null===true;\nconst n=indices?indices.length:count;\nif(bounds.kind==='boolean'){\nconst read=valueReader(handle);\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined){if(hasNull)counts[nullBucket]++;continue;}\ncounts[v?1:0]++;\n}\nreturn counts;\n}\nif(bounds.kind==='category'){\nconst slot=new Map();\nfor(let b=0;b<buckets.length;b++){\nif(!buckets[b].null&&!buckets[b].remainder)slot.set(buckets[b].value,b);\n}\nconst remainderAt=buckets.findIndex((b)=>b.remainder);\nconst read=valueReader(handle);\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined||v===''){if(hasNull)counts[nullBucket]++;continue;}\nif(Array.isArray(v)){\nif(!v.length){if(hasNull)counts[nullBucket]++;continue;}\nfor(const m of v){\nconst at=slot.get(m);\nif(at!==undefined)counts[at]++;\nelse if(remainderAt>=0)counts[remainderAt]++;\n}\ncontinue;\n}\nconst at=slot.get(v);\nif(at!==undefined)counts[at]++;\nelse if(remainderAt>=0)counts[remainderAt]++;\n}\nreturn counts;\n}\nconst ordered=hasNull?buckets.length-1:buckets.length;\nconst edges=new Float64Array(ordered+1);\nfor(let b=0;b<ordered;b++)edges[b]=buckets[b].from;\nedges[ordered]=ordered?buckets[ordered-1].to:0;\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nfor(let k=0;k<n;k++){\nconst i=indices?indices[k]:k;\nif(present&&!present(i)){if(hasNull)counts[nullBucket]++;continue;}\nconst v=read(i);\nif(!Number.isFinite(v)){if(hasNull)counts[nullBucket]++;continue;}\nconst at=bucketOf(edges,ordered,v);\nif(at>=0)counts[at]++;\n}\nreturn counts;\n}\nfunction bucketOf(edges,ordered,v){\nif(!ordered)return-1;\nif(v<edges[0])return-1;\nif(v>=edges[ordered])return v===edges[ordered]?ordered-1:-1;\nlet lo=0;\nlet hi=ordered-1;\nwhile(lo<hi){\nconst mid=(lo+hi+1)>>>1;\nif(v>=edges[mid])lo=mid;else hi=mid-1;\n}\nreturn lo;\n}\nfunction facet(handle,indices,count,opts={}){\nconst bounds=opts.bounds||computeBounds(handle,opts.boundsIndices??indices,count,opts);\nreturn{bounds,counts:countInto(handle,indices,count,bounds)};\n}\nconst __default=facet;\n});\n__def(\"packages/core/src/compute/special.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"logGamma\",{enumerable:true,get:function(){return logGamma;}});\nObject.defineProperty(__exports,\"incompleteBeta\",{enumerable:true,get:function(){return incompleteBeta;}});\nObject.defineProperty(__exports,\"normalQuantile\",{enumerable:true,get:function(){return normalQuantile;}});\nObject.defineProperty(__exports,\"normalCdf\",{enumerable:true,get:function(){return normalCdf;}});\nObject.defineProperty(__exports,\"studentT\",{enumerable:true,get:function(){return studentT;}});\nObject.defineProperty(__exports,\"studentTQuantile\",{enumerable:true,get:function(){return studentTQuantile;}});\nconst LANCZOS=Object.freeze([\n676.5203681218851,-1259.1392167224028,771.32342877765313,\n-176.61502916214059,12.507343278686905,-0.13857109526572012,\n9.9843695780195716e-6,1.5056327351493116e-7,\n]);\nconst EPS=3e-12;\nconst TINY=1e-300;\nfunction logGamma(x){\nif(x<0.5)return Math.log(Math.PI/Math.sin(Math.PI*x))-logGamma(1-x);\nconst z=x-1;\nlet a=0.99999999999980993;\nconst t=z+7.5;\nfor(let i=0;i<LANCZOS.length;i++)a+=LANCZOS[i]/(z+i+1);\nreturn 0.5*Math.log(2*Math.PI)+(z+0.5)*Math.log(t)-t+Math.log(a);\n}\nfunction betaContinuedFraction(a,b,x){\nconst qab=a+b;\nconst qap=a+1;\nconst qam=a-1;\nlet c=1;\nlet d=1-(qab*x)/qap;\nif(Math.abs(d)<TINY)d=TINY;\nd=1/d;\nlet h=d;\nfor(let m=1;m<=300;m++){\nconst m2=2*m;\nlet aa=(m*(b-m)*x)/((qam+m2)*(a+m2));\nd=1+aa*d;\nif(Math.abs(d)<TINY)d=TINY;\nc=1+aa/c;\nif(Math.abs(c)<TINY)c=TINY;\nd=1/d;\nh*=d*c;\naa=(-(a+m)*(qab+m)*x)/((a+m2)*(qap+m2));\nd=1+aa*d;\nif(Math.abs(d)<TINY)d=TINY;\nc=1+aa/c;\nif(Math.abs(c)<TINY)c=TINY;\nd=1/d;\nconst step=d*c;\nh*=step;\nif(Math.abs(step-1)<EPS)break;\n}\nreturn h;\n}\nfunction incompleteBeta(a,b,x){\nif(!(a>0)||!(b>0)||!Number.isFinite(x))return Number.NaN;\nif(x<=0)return 0;\nif(x>=1)return 1;\nconst front=Math.exp(\nlogGamma(a+b)-logGamma(a)-logGamma(b)+a*Math.log(x)+b*Math.log(1-x),\n);\nreturn x<(a+1)/(a+b+2)\n?(front*betaContinuedFraction(a,b,x))/a\n:1-(front*betaContinuedFraction(b,a,1-x))/b;\n}\nfunction normalQuantile(p){\nif(!(p>0)||!(p<1))return p===0?-Infinity:(p===1?Infinity:Number.NaN);\nconst a=[-3.969683028665376e+1,2.209460984245205e+2,-2.759285104469687e+2,\n1.383577518672690e+2,-3.066479806614716e+1,2.506628277459239];\nconst b=[-5.447609879822406e+1,1.615858368580409e+2,-1.556989798598866e+2,\n6.680131188771972e+1,-1.328068155288572e+1];\nconst c=[-7.784894002430293e-3,-3.223964580411365e-1,-2.400758277161838,\n-2.549732539343734,4.374664141464968,2.938163982698783];\nconst d=[7.784695709041462e-3,3.224671290700398e-1,2.445134137142996,\n3.754408661907416];\nconst low=0.02425;\nlet q;\nlet r;\nlet x;\nif(p<low){\nq=Math.sqrt(-2*Math.log(p));\nx=(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5])\n/ ((((d[0] * q + d[1]) * q + d[2]) * q + d[3]) * q + 1);\n}else if(p<=1-low){\nq=p-0.5;\nr=q*q;\nx=((((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q)\n/ (((((b[0] * r + b[1]) * r + b[2]) * r + b[3]) * r + b[4]) * r + 1);\n}else{\nq=Math.sqrt(-2*Math.log(1-p));\nx=-(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5])\n/ ((((d[0] * q + d[1]) * q + d[2]) * q + d[3]) * q + 1);\n}\nconst e=0.5*erfc(-x/Math.SQRT2)-p;\nconst u=e*Math.sqrt(2*Math.PI)*Math.exp((x*x)/2);\nreturn x-u/(1+(x*u)/2);\n}\nfunction erfc(x){\nconst z=Math.abs(x);\nconst t=2/(2+z);\nconst ty=4*t-2;\nconst cof=[-1.3026537197817094,6.4196979235649026e-1,1.9476473204185836e-2,\n-9.561514786808631e-3,-9.46595344482036e-4,3.66839497852761e-4,\n4.2523324806907e-5,-2.0278578112534e-5,-1.624290004647e-6,\n1.303655835580e-6,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,\n5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,\n2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,\n3.81e-16,7.106e-15];\nlet dd=0;\nlet dv=0;\nlet tmp;\nfor(let j=cof.length-1;j>0;j--){\ntmp=dv;\ndv=ty*dv-dd+cof[j];\ndd=tmp;\n}\nconst ans=t*Math.exp(-z*z+0.5*(cof[0]+ty*dv)-dd);\nreturn x>=0?ans:2-ans;\n}\nfunction normalCdf(x){\nreturn 0.5*erfc(-x/Math.SQRT2);\n}\nfunction studentT(t,df){\nif(!(df>0)||!Number.isFinite(t))return Number.NaN;\nconst tail=0.5*incompleteBeta(df/2,0.5,df/(df+t*t));\nreturn t>0?1-tail:tail;\n}\nfunction studentTQuantile(p,df){\nif(!(p>0)||!(p<1)||!(df>0))return Number.NaN;\nif(df>1e7)return normalQuantile(p);\nlet lo=-1e4;\nlet hi=1e4;\nlet x=normalQuantile(p);\nconst logBeta=logGamma(df/2)+logGamma(0.5)-logGamma((df+1)/2);\nfor(let i=0;i<60;i++){\nconst cdf=studentT(x,df);\nif(cdf<p)lo=x;else hi=x;\nconst pdf=Math.exp(-((df+1)/2)*Math.log(1+(x*x)/df)-logBeta)\n/ Math.sqrt(df);\nconst step=pdf>0?(cdf-p)/pdf:0;\nif(Math.abs(step)<1e-12)break;\nconst next=x-step;\nx=next>lo&&next<hi&&Number.isFinite(next)?next:(lo+hi)/2;\nif(hi-lo<1e-12)break;\n}\nreturn x;\n}\n});\n__def(\"packages/core/src/compute/sketch.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Welford\",{enumerable:true,get:function(){return Welford;}});\nObject.defineProperty(__exports,\"Reservoir\",{enumerable:true,get:function(){return Reservoir;}});\nObject.defineProperty(__exports,\"hash32\",{enumerable:true,get:function(){return hash32;}});\nObject.defineProperty(__exports,\"HyperLogLog\",{enumerable:true,get:function(){return HyperLogLog;}});\nObject.defineProperty(__exports,\"SpaceSaving\",{enumerable:true,get:function(){return SpaceSaving;}});\nObject.defineProperty(__exports,\"KLL\",{enumerable:true,get:function(){return KLL;}});\nObject.defineProperty(__exports,\"SKETCH_BOUNDS\",{enumerable:true,get:function(){return SKETCH_BOUNDS;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nclass Welford{\n#n=0;\n#mean=0;\n#m2=0;\nstatic get errorBound(){\nreturn Object.freeze({\nkind:'exact',metric:'none',value:0,\nstatement:'mean and variance match a full recompute to float rounding',\n});\n}\nget count(){return this.#n;}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#n++;\nconst delta=x-this.#mean;\nthis.#mean+=delta/this.#n;\nthis.#m2+=delta*(x-this.#mean);\n}\nmerge(other){\nif(other.#n===0)return;\nif(this.#n===0){this.#n=other.#n;this.#mean=other.#mean;this.#m2=other.#m2;return;}\nconst n=this.#n+other.#n;\nconst delta=other.#mean-this.#mean;\nthis.#mean+=delta*(other.#n/n);\nthis.#m2+=other.#m2+delta*delta*(this.#n*other.#n/n);\nthis.#n=n;\n}\nmean(){return this.#n?this.#mean:null;}\nvariance(){return this.#n>1?this.#m2/(this.#n-1):null;}\nvarianceP(){return this.#n?this.#m2/this.#n:null;}\nstddev(){const v=this.variance();return v===null?null:Math.sqrt(v);}\nstddevP(){const v=this.varianceP();return v===null?null:Math.sqrt(v);}\n}\nclass Reservoir{\n#items=[];\n#seen=0;\n#capacity;\n#rng;\nconstructor(capacity,rng=Math.random){\nif(!(capacity>0))throw new RangeError('reservoir capacity must be positive');\nthis.#capacity=Math.floor(capacity);\nthis.#rng=rng;\n}\nstatic get errorBound(){\nreturn Object.freeze({\nkind:'probabilistic',metric:'none',value:0,\nstatement:'uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators',\n});\n}\nget seen(){return this.#seen;}\nget size(){return this.#items.length;}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#seen++;\nif(this.#items.length<this.#capacity){\nthis.#items.push(x);\nreturn;\n}\nconst j=Math.floor(this.#rng()*this.#seen);\nif(j<this.#capacity)this.#items[j]=x;\n}\nsample(){return this.#items.slice();}\nmean(){\nif(!this.#items.length)return null;\nlet s=0;\nfor(const v of this.#items)s+=v;\nreturn s/this.#items.length;\n}\nquantile(p){\nconst n=this.#items.length;\nif(!n)return null;\nconst sorted=this.#items.slice().sort((a,b)=>a-b);\nif(n===1)return sorted[0];\nconst h=(n-1)*Math.min(1,Math.max(0,p));\nconst lo=Math.floor(h);\nconst hi=Math.ceil(h);\nreturn lo===hi?sorted[lo]:sorted[lo]+(h-lo)*(sorted[hi]-sorted[lo]);\n}\n}\nfunction fmix32(h){\nh^=h>>>16;\nh=Math.imul(h,0x85ebca6b);\nh^=h>>>13;\nh=Math.imul(h,0xc2b2ae35);\nh^=h>>>15;\nreturn h>>>0;\n}\nfunction hash32(v){\nif(typeof v==='number'){\nconst buf=new DataView(new ArrayBuffer(8));\nbuf.setFloat64(0,v===0?0:v);\nreturn fmix32(buf.getUint32(0)^buf.getUint32(4));\n}\nconst s=typeof v==='string'?v:String(v);\nlet h=0x811c9dc5;\nfor(let i=0;i<s.length;i++){\nh^=s.charCodeAt(i);\nh=Math.imul(h,0x01000193);\n}\nreturn fmix32(h);\n}\nclass HyperLogLog{\n#p;\n#m;\n#registers;\nconstructor(precision=14){\nconst p=Math.floor(precision);\nif(p<4||p>16)throw new RangeError('HLL precision must be 4..16');\nthis.#p=p;\nthis.#m=1<<p;\nthis.#registers=new Uint8Array(this.#m);\n}\nstatic errorBoundFor(precision=14){\nconst m=1<<Math.floor(precision);\nconst rse=1.04/Math.sqrt(m);\nreturn Object.freeze({\nkind:'probabilistic',metric:'relative',value:rse,\nstatement:`distinct count within ~${(rse*100).toFixed(2)}% relative standard error (m=${m} buckets)`,\n});\n}\nerrorBound(){return HyperLogLog.errorBoundFor(this.#p);}\nadd(v){\nconst h=hash32(v);\nconst idx=h&(this.#m-1);\nconst rest=(h>>>this.#p)|(1<<(32-this.#p));\nlet rank=1;\nlet x=rest;\nwhile((x&1)===0){rank++;x>>>=1;}\nif(rank>this.#registers[idx])this.#registers[idx]=rank;\n}\ncount(){\nconst m=this.#m;\nconst q=32-this.#p;\nconst hist=new Float64Array(q+2);\nfor(let i=0;i<m;i++)hist[this.#registers[i]]++;\nlet z=m*tau(1-hist[q+1]/m);\nfor(let k=q;k>=1;k--)z=0.5*(z+hist[k]);\nz+=m*sigma(hist[0]/m);\nconst estimate=(ERTL_ALPHA_INF*m*m)/z;\nreturn Math.round(estimate);\n}\n}\nconst ERTL_ALPHA_INF=0.5/Math.log(2);\nfunction sigma(x){\nif(x===1)return Infinity;\nlet y=1;\nlet z=x;\nlet prev;\ndo{\nx*=x;\nprev=z;\nz+=x*y;\ny+=y;\n}while(z!==prev);\nreturn z;\n}\nfunction tau(x){\nif(x===0||x===1)return 0;\nlet y=1;\nlet z=1-x;\nlet prev;\ndo{\nx=Math.sqrt(x);\nprev=z;\ny*=0.5;\nz-=(1-x)**2*y;\n}while(z!==prev);\nreturn z/3;\n}\nclass SpaceSaving{\n#counters=new Map();\n#capacity;\n#n=0;\nconstructor(capacity){\nif(!(capacity>0))throw new RangeError('Space-Saving capacity must be positive');\nthis.#capacity=Math.floor(capacity);\n}\nerrorBoundFor(n){\nconst value=n/this.#capacity;\nreturn Object.freeze({\nkind:'deterministic',metric:'absolute',value,\nstatement:`each count overestimates the truth by at most N/m = ${value.toFixed(2)} (N=${n}, m=${this.#capacity})`,\n});\n}\nget seen(){return this.#n;}\nadd(item){\nthis.#n++;\nconst existing=this.#counters.get(item);\nif(existing){existing.count++;return;}\nif(this.#counters.size<this.#capacity){\nthis.#counters.set(item,{count:1,error:0});\nreturn;\n}\nlet minItem;\nlet minCount=Infinity;\nfor(const[k,v]of this.#counters){\nif(v.count<minCount){minCount=v.count;minItem=k;}\n}\nthis.#counters.delete(minItem);\nthis.#counters.set(item,{count:minCount+1,error:minCount});\n}\ntop(k=this.#capacity){\nconst all=[...this.#counters.entries()]\n.map(([item,v])=>({item,count:v.count,error:v.error}))\n.sort((a,b)=>b.count-a.count);\nreturn all.slice(0,Math.max(0,Math.floor(k)));\n}\n}\nclass KLL{\n#k;\n#levels=[[]];\n#n=0;\n#rng;\n#capacityFactor;\nconstructor(k=200,rng=Math.random){\nthis.#k=Math.max(8,Math.floor(k));\nthis.#rng=rng;\nthis.#capacityFactor=2/3;\n}\nstatic errorBoundFor(k=200){\nconst eps=1/Math.max(8,Math.floor(k));\nreturn Object.freeze({\nkind:'probabilistic',metric:'rank',value:eps,\nstatement:`queried quantile's true rank within ~${(eps*100).toFixed(2)}% of N of the requested rank (k=${k})`,\n});\n}\nerrorBound(){return KLL.errorBoundFor(this.#k);}\nget count(){return this.#n;}\n#levelCapacity(height){\nconst top=this.#levels.length-1;\nconst depthFromTop=top-height;\nconst cap=Math.ceil(this.#k*this.#capacityFactor**depthFromTop);\nreturn Math.max(2,cap);\n}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#n++;\nthis.#levels[0].push(x);\nif(this.#levels[0].length>=this.#levelCapacity(0))this.#compact(0);\n}\n#compact(height){\nconst level=this.#levels[height];\nlevel.sort((a,b)=>a-b);\nif(height+1>=this.#levels.length)this.#levels.push([]);\nconst up=this.#levels[height+1];\nconst offset=this.#rng()<0.5?0:1;\nfor(let i=offset;i<level.length;i+=2)up.push(level[i]);\nthis.#levels[height]=[];\nfor(let h=0;h<this.#levels.length;h++){\nif(this.#levels[h].length>=this.#levelCapacity(h)){this.#compact(h);return;}\n}\n}\n#weighted(){\nconst out=[];\nfor(let h=0;h<this.#levels.length;h++){\nconst w=1<<h;\nfor(const v of this.#levels[h])out.push({v,w});\n}\nreturn out;\n}\nquantile(p){\nconst items=this.#weighted();\nif(!items.length)return null;\nitems.sort((a,b)=>a.v-b.v);\nlet totalW=0;\nfor(const it of items)totalW+=it.w;\nconst target=Math.min(1,Math.max(0,p))*totalW;\nlet cum=0;\nfor(const it of items){\ncum+=it.w;\nif(cum>=target)return it.v;\n}\nreturn items[items.length-1].v;\n}\nrank(x){\nlet cum=0;\nfor(let h=0;h<this.#levels.length;h++){\nconst w=1<<h;\nfor(const v of this.#levels[h])if(v<=x)cum+=w;\n}\nreturn cum;\n}\n}\nconst SKETCH_BOUNDS=Object.freeze({\ndistinct:HyperLogLog.errorBoundFor(14),\nmedian:KLL.errorBoundFor(200),\np25:KLL.errorBoundFor(200),\np75:KLL.errorBoundFor(200),\np90:KLL.errorBoundFor(200),\np95:KLL.errorBoundFor(200),\np99:KLL.errorBoundFor(200),\niqr:KLL.errorBoundFor(200),\ntopK:Object.freeze({\nkind:'deterministic',metric:'absolute',value:0,\nstatement:'each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m',\n}),\n});\nconst __default={\nWelford,Reservoir,HyperLogLog,SpaceSaving,KLL,hash32,SKETCH_BOUNDS,\n};\n});\n__def(\"packages/core/src/compute/statistics.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"KENDALL_LIMIT\",{enumerable:true,get:function(){return KENDALL_LIMIT;}});\nObject.defineProperty(__exports,\"MAINTENANCE\",{enumerable:true,get:function(){return MAINTENANCE;}});\nObject.defineProperty(__exports,\"APPROXIMATE\",{enumerable:true,get:function(){return APPROXIMATE;}});\nObject.defineProperty(__exports,\"maintenanceOf\",{enumerable:true,get:function(){return maintenanceOf;}});\nObject.defineProperty(__exports,\"numbers\",{enumerable:true,get:function(){return numbers;}});\nObject.defineProperty(__exports,\"frequencies\",{enumerable:true,get:function(){return frequencies;}});\nObject.defineProperty(__exports,\"herfindahl\",{enumerable:true,get:function(){return herfindahl;}});\nObject.defineProperty(__exports,\"entropy\",{enumerable:true,get:function(){return entropy;}});\nObject.defineProperty(__exports,\"evenness\",{enumerable:true,get:function(){return evenness;}});\nObject.defineProperty(__exports,\"topShare\",{enumerable:true,get:function(){return topShare;}});\nObject.defineProperty(__exports,\"gini\",{enumerable:true,get:function(){return gini;}});\nObject.defineProperty(__exports,\"moments\",{enumerable:true,get:function(){return moments;}});\nObject.defineProperty(__exports,\"quantileSorted\",{enumerable:true,get:function(){return quantileSorted;}});\nObject.defineProperty(__exports,\"quantile\",{enumerable:true,get:function(){return quantile;}});\nObject.defineProperty(__exports,\"STAT_FNS\",{enumerable:true,get:function(){return STAT_FNS;}});\nObject.defineProperty(__exports,\"STAT_LABELS\",{enumerable:true,get:function(){return STAT_LABELS;}});\nObject.defineProperty(__exports,\"weightedAverage\",{enumerable:true,get:function(){return weightedAverage;}});\nObject.defineProperty(__exports,\"extremeRow\",{enumerable:true,get:function(){return extremeRow;}});\nObject.defineProperty(__exports,\"correlation\",{enumerable:true,get:function(){return correlation;}});\nObject.defineProperty(__exports,\"trimmedMean\",{enumerable:true,get:function(){return trimmedMean;}});\nObject.defineProperty(__exports,\"winsorizedMean\",{enumerable:true,get:function(){return winsorizedMean;}});\nObject.defineProperty(__exports,\"modifiedZOutliers\",{enumerable:true,get:function(){return modifiedZOutliers;}});\nObject.defineProperty(__exports,\"jarqueBera\",{enumerable:true,get:function(){return jarqueBera;}});\nObject.defineProperty(__exports,\"weightedQuantile\",{enumerable:true,get:function(){return weightedQuantile;}});\nObject.defineProperty(__exports,\"pairs\",{enumerable:true,get:function(){return pairs;}});\nObject.defineProperty(__exports,\"covariance\",{enumerable:true,get:function(){return covariance;}});\nObject.defineProperty(__exports,\"regression\",{enumerable:true,get:function(){return regression;}});\nObject.defineProperty(__exports,\"spearman\",{enumerable:true,get:function(){return spearman;}});\nObject.defineProperty(__exports,\"kendall\",{enumerable:true,get:function(){return kendall;}});\nObject.defineProperty(__exports,\"seriesStats\",{enumerable:true,get:function(){return seriesStats;}});\nObject.defineProperty(__exports,\"D2_N2\",{enumerable:true,get:function(){return D2_N2;}});\nObject.defineProperty(__exports,\"D4_N2\",{enumerable:true,get:function(){return D4_N2;}});\nObject.defineProperty(__exports,\"movingRanges\",{enumerable:true,get:function(){return movingRanges;}});\nObject.defineProperty(__exports,\"withinSigma\",{enumerable:true,get:function(){return withinSigma;}});\nObject.defineProperty(__exports,\"capability\",{enumerable:true,get:function(){return capability;}});\nObject.defineProperty(__exports,\"controlLimits\",{enumerable:true,get:function(){return controlLimits;}});\nObject.defineProperty(__exports,\"westernElectricViolations\",{enumerable:true,get:function(){return westernElectricViolations;}});\nObject.defineProperty(__exports,\"nelsonViolations\",{enumerable:true,get:function(){return nelsonViolations;}});\nObject.defineProperty(__exports,\"CONTROL_RULE_SETS\",{enumerable:true,get:function(){return CONTROL_RULE_SETS;}});\nObject.defineProperty(__exports,\"controlViolations\",{enumerable:true,get:function(){return controlViolations;}});\nObject.defineProperty(__exports,\"countOutside\",{enumerable:true,get:function(){return countOutside;}});\nObject.defineProperty(__exports,\"histogram\",{enumerable:true,get:function(){return histogram;}});\nObject.defineProperty(__exports,\"DEFAULT_CONFIDENCE\",{enumerable:true,get:function(){return DEFAULT_CONFIDENCE;}});\nObject.defineProperty(__exports,\"meanInterval\",{enumerable:true,get:function(){return meanInterval;}});\nObject.defineProperty(__exports,\"proportionInterval\",{enumerable:true,get:function(){return proportionInterval;}});\nObject.defineProperty(__exports,\"slopeInterval\",{enumerable:true,get:function(){return slopeInterval;}});\nObject.defineProperty(__exports,\"capabilityInterval\",{enumerable:true,get:function(){return capabilityInterval;}});\nObject.defineProperty(__exports,\"standardizedMeanDifference\",{enumerable:true,get:function(){return standardizedMeanDifference;}});\nObject.defineProperty(__exports,\"normalTotalVariation\",{enumerable:true,get:function(){return normalTotalVariation;}});\nObject.defineProperty(__exports,\"frequencyMap\",{enumerable:true,get:function(){return frequencyMap;}});\nObject.defineProperty(__exports,\"categoricalDistance\",{enumerable:true,get:function(){return categoricalDistance;}});\nObject.defineProperty(__exports,\"SUBSET_RELIABILITY_FLOOR\",{enumerable:true,get:function(){return SUBSET_RELIABILITY_FLOOR;}});\nObject.defineProperty(__exports,\"compareColumn\",{enumerable:true,get:function(){return compareColumn;}});\nObject.defineProperty(__exports,\"isNumericColumn\",{enumerable:true,get:function(){return isNumericColumn;}});\nObject.defineProperty(__exports,\"populationRead\",{enumerable:true,get:function(){return populationRead;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m0[\"presenceReader\"];\nconst valueReader=__m0[\"valueReader\"];\nconst __m1=__req(\"packages/core/src/compute/special.js\");\nconst studentTQuantile=__m1[\"studentTQuantile\"];\nconst normalQuantile=__m1[\"normalQuantile\"];\nconst normalCdf=__m1[\"normalCdf\"];\nconst __m2=__req(\"packages/core/src/compute/sketch.js\");\nconst SKETCH_BOUNDS=__m2[\"SKETCH_BOUNDS\"];\nconst KENDALL_LIMIT=5000;\nconst MAINTENANCE=Object.freeze({\nvariance:'rescan',\nvarianceP:'rescan',\nstddev:'rescan',\nstddevP:'rescan',\nsumSquares:'rescan',\nweightedAvg:'rescan',\nmedian:'rescan',\np25:'rescan',\np75:'rescan',\np90:'rescan',\np95:'rescan',\np99:'rescan',\niqr:'rescan',\nmode:'rescan',\ndistinct:'rescan',\nrange:'rescan',\nskewness:'rescan',\nkurtosis:'rescan',\ngeomean:'rescan',\nharmean:'rescan',\nmad:'rescan',\nargmin:'rescan',\nargmax:'rescan',\nhhi:'rescan',\nentropy:'rescan',\nevenness:'rescan',\ntop3Share:'rescan',\ntop10Share:'rescan',\ngini:'rescan',\ntrimmedMean:'rescan',\nwinsorizedMean:'rescan',\nrobustOutliers:'rescan',\njarqueBera:'rescan',\npassRate:'rescan',\nfailureCount:'rescan',\n});\nconst APPROXIMATE=Object.freeze({\ndistinct:Object.freeze({sketch:'HyperLogLog',bound:SKETCH_BOUNDS.distinct}),\nmedian:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.median}),\np25:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p25}),\np75:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p75}),\np90:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p90}),\np95:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p95}),\np99:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p99}),\niqr:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.iqr}),\ntop3Share:Object.freeze({sketch:'SpaceSaving',bound:SKETCH_BOUNDS.topK}),\ntop10Share:Object.freeze({sketch:'SpaceSaving',bound:SKETCH_BOUNDS.topK}),\n});\nfunction maintenanceOf(fn){\nconst exact=fn==='sum'||fn==='avg'||fn==='countValues'||fn==='min'||fn==='max'\n?'maintained'\n:(Object.prototype.hasOwnProperty.call(MAINTENANCE,fn)?MAINTENANCE[fn]:null);\nconst approximate=Object.prototype.hasOwnProperty.call(APPROXIMATE,fn)?APPROXIMATE[fn]:null;\nreturn{stat:fn,exact,approximate};\n}\nfunction numbers(handle,indices){\nconst n=indices.length;\nconst out=new Float64Array(n);\nlet count=0;\nconst numeric=handle&&(handle.kind==='float64'||handle.kind==='int32');\nif(numeric){\nconst values=handle.values;\nconst present=presenceReader(handle);\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present&&present(row)!==1)continue;\nconst v=values[row];\nif(Number.isNaN(v))continue;\nout[count++]=v;\n}\nreturn out.subarray(0,count);\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nconst v=typeof raw==='number'?raw:Number(raw);\nif(!Number.isFinite(v))continue;\nout[count++]=v;\n}\nreturn out.subarray(0,count);\n}\nfunction frequencies(handle,indices){\nconst seen=new Map();\nconst read=valueReader(handle);\nlet total=0;\nfor(let i=0;i<indices.length;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(typeof raw==='number'&&Number.isNaN(raw))continue;\nconst key=typeof raw==='object'?String(raw):raw;\nseen.set(key,(seen.get(key)||0)+1);\ntotal++;\n}\nconst counts=[...seen.values()].sort((a,b)=>b-a);\nreturn{counts,total,distinct:counts.length};\n}\nfunction sharesOf(freq){\nreturn freq.total>0?freq.counts.map((c)=>c/freq.total):[];\n}\nfunction herfindahl(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nlet sum=0;\nfor(const share of sharesOf(freq))sum+=share*share;\nreturn sum;\n}\nfunction entropy(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nlet sum=0;\nfor(const share of sharesOf(freq))if(share>0)sum-=share*Math.log2(share);\nreturn sum;\n}\nfunction evenness(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total||freq.distinct<2)return freq.total?1:null;\nlet sum=0;\nfor(const share of sharesOf(freq))if(share>0)sum-=share*Math.log2(share);\nreturn sum/Math.log2(freq.distinct);\n}\nfunction topShare(handle,indices,n=3){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nconst take=Math.max(1,Math.floor(n));\nlet held=0;\nfor(let i=0;i<Math.min(take,freq.counts.length);i++)held+=freq.counts[i];\nreturn held/freq.total;\n}\nfunction gini(handle,indices){\nconst values=numbers(handle,indices);\nconst n=values.length;\nif(!n)return null;\nconst sorted=values.slice().sort();\nif(sorted[0]<0)return null;\nlet total=0;\nlet weighted=0;\nfor(let i=0;i<n;i++){\ntotal+=sorted[i];\nweighted+=(i+1)*sorted[i];\n}\nif(total===0)return 0;\nreturn(2*weighted)/(n*total)-(n+1)/n;\n}\nfunction moments(values){\nlet n=0;\nlet mean=0;\nlet m2=0;\nfor(let i=0;i<values.length;i++){\nconst x=values[i];\nn++;\nconst delta=x-mean;\nmean+=delta/n;\nm2+=delta*(x-mean);\n}\nreturn{n,mean,m2};\n}\nfunction quantileSorted(sorted,p){\nconst n=sorted.length;\nif(!n)return NaN;\nif(n===1)return sorted[0];\nconst h=(n-1)*Math.min(1,Math.max(0,p));\nconst lo=Math.floor(h);\nconst hi=Math.ceil(h);\nif(lo===hi)return sorted[lo];\nreturn sorted[lo]+(h-lo)*(sorted[hi]-sorted[lo]);\n}\nfunction quantile(values,p){\nif(!values.length)return NaN;\nconst sorted=values.slice().sort();\nreturn quantileSorted(sorted,p);\n}\nfunction specTally(handle,indices){\nconst read=valueReader(handle);\nlet pass=0;\nlet fail=0;\nlet warn=0;\nfor(let k=0;k<indices.length;k++){\nconst raw=read(indices[k]);\nif(raw===null||raw===undefined||raw==='')continue;\nconst token=String(raw).toUpperCase();\nif(token==='PASS')pass++;\nelse if(token==='FAIL')fail++;\nelse if(token==='WARN')warn++;\n}\nreturn{pass:pass+warn,fail,warn,judged:pass+warn+fail};\n}\nconst STAT_FNS=Object.freeze({\nhhi:(h,i)=>herfindahl(h,i),\nentropy:(h,i)=>entropy(h,i),\nevenness:(h,i)=>evenness(h,i),\ntop3Share:(h,i)=>topShare(h,i,3),\ntop10Share:(h,i)=>topShare(h,i,10),\ngini:(h,i)=>gini(h,i),\ntrimmedMean:(h,i)=>trimmedMean(numbers(h,i),0.1),\nwinsorizedMean:(h,i)=>winsorizedMean(numbers(h,i),0.1),\nrobustOutliers:(h,i)=>modifiedZOutliers(numbers(h,i),3.5),\njarqueBera:(h,i)=>jarqueBera(numbers(h,i)),\nvariance:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>1?m2/(n-1):null;\n},\nvarianceP:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>0?m2/n:null;\n},\nstddev:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>1?Math.sqrt(m2/(n-1)):null;\n},\nstddevP:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>0?Math.sqrt(m2/n):null;\n},\nmedian:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.5):null;\n},\np25:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.25):null;\n},\np75:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.75):null;\n},\np90:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.9):null;\n},\np95:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.95):null;\n},\np99:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.99):null;\n},\niqr:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nconst sorted=values.slice().sort();\nreturn quantileSorted(sorted,0.75)-quantileSorted(sorted,0.25);\n},\nmad:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nconst middle=quantile(values,0.5);\nconst deviations=new Float64Array(values.length);\nfor(let k=0;k<values.length;k++)deviations[k]=Math.abs(values[k]-middle);\nreturn quantile(deviations,0.5);\n},\nrange:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet lo=Infinity;\nlet hi=-Infinity;\nfor(let k=0;k<values.length;k++){\nif(values[k]<lo)lo=values[k];\nif(values[k]>hi)hi=values[k];\n}\nreturn hi-lo;\n},\ndistinct:(h,i)=>{\nconst read=valueReader(h);\nconst seen=new Set();\nfor(let k=0;k<i.length;k++){\nconst v=read(i[k]);\nif(v===null||v===undefined||v==='')continue;\nseen.add(v instanceof Date?v.getTime():v);\n}\nreturn seen.size;\n},\nmode:(h,i)=>{\nconst read=valueReader(h);\nconst counts=new Map();\nfor(let k=0;k<i.length;k++){\nconst v=read(i[k]);\nif(v===null||v===undefined||v==='')continue;\nconst id=v instanceof Date?v.getTime():v;\ncounts.set(id,(counts.get(id)||0)+1);\n}\nlet best=null;\nlet most=1;\nfor(const[value,times]of counts){\nif(times>most){\nmost=times;\nbest=value;\n}\n}\nreturn best;\n},\nskewness:(h,i)=>{\nconst values=numbers(h,i);\nconst{n,mean,m2}=moments(values);\nif(n<3||m2<=0)return null;\nconst sd=Math.sqrt(m2/(n-1));\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=((values[k]-mean)/sd)**3;\nreturn(n/((n-1)*(n-2)))*sum;\n},\nkurtosis:(h,i)=>{\nconst values=numbers(h,i);\nconst{n,mean,m2}=moments(values);\nif(n<4||m2<=0)return null;\nconst sd=Math.sqrt(m2/(n-1));\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=((values[k]-mean)/sd)**4;\nconst a=(n*(n+1))/((n-1)*(n-2)*(n-3));\nconst b=(3*(n-1)**2)/((n-2)*(n-3));\nreturn a*sum-b;\n},\ngeomean:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet sum=0;\nfor(let k=0;k<values.length;k++){\nif(values[k]<=0)return null;\nsum+=Math.log(values[k]);\n}\nreturn Math.exp(sum/values.length);\n},\nharmean:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet sum=0;\nfor(let k=0;k<values.length;k++){\nif(values[k]===0)return null;\nsum+=1/values[k];\n}\nreturn values.length/sum;\n},\nsumSquares:(h,i)=>{\nconst values=numbers(h,i);\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=values[k]*values[k];\nreturn sum;\n},\npassRate:(h,i)=>{\nconst{pass,judged}=specTally(h,i);\nreturn judged?pass/judged:null;\n},\nfailureCount:(h,i)=>specTally(h,i).fail,\n});\nconst STAT_LABELS=Object.freeze({\nhhi:'Concentration (HHI)',\nentropy:'Entropy',\nevenness:'Evenness',\ntop3Share:'Top 3 share',\ntop10Share:'Top 10 share',\ngini:'Gini coefficient',\ntrimmedMean:'Trimmed mean',\nwinsorizedMean:'Winsorized mean',\nrobustOutliers:'Outliers (robust)',\njarqueBera:'Jarque–Bera',\nmedian:'Median',\np25:'25th percentile',\np75:'75th percentile',\np90:'90th percentile',\np95:'95th percentile',\np99:'99th percentile',\niqr:'Interquartile range',\nmad:'Median absolute deviation',\nvariance:'Variance',\nvarianceP:'Variance (population)',\nstddev:'Standard deviation',\nstddevP:'Standard deviation (population)',\nrange:'Range',\ndistinct:'Distinct',\nmode:'Mode',\nskewness:'Skewness',\nkurtosis:'Kurtosis',\ngeomean:'Geometric mean',\nharmean:'Harmonic mean',\nsumSquares:'Sum of squares',\nweightedAvg:'Weighted average',\nargmin:'Lowest by',\nargmax:'Highest by',\npassRate:'Pass rate',\nfailureCount:'Failures',\n});\nfunction weightedAverage(handle,weights,indices){\nconst readValue=valueReader(handle);\nconst readWeight=valueReader(weights);\nlet top=0;\nlet bottom=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst value=Number(readValue(row));\nconst weight=Number(readWeight(row));\nif(!Number.isFinite(value)||!Number.isFinite(weight))continue;\ntop+=value*weight;\nbottom+=weight;\n}\nreturn bottom===0?null:top/bottom;\n}\nfunction extremeRow(handle,indices,largest){\nconst read=valueReader(handle);\nlet best=null;\nlet bestValue=largest?-Infinity:Infinity;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst value=Number(read(row));\nif(!Number.isFinite(value))continue;\nif(largest?value>bestValue:value<bestValue){\nbestValue=value;\nbest=row;\n}\n}\nreturn best;\n}\nfunction correlation(a,b,indices){\nconst readA=valueReader(a);\nconst readB=valueReader(b);\nlet n=0;\nlet sx=0;\nlet sy=0;\nlet sxx=0;\nlet syy=0;\nlet sxy=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst x=Number(readA(row));\nconst y=Number(readB(row));\nif(!Number.isFinite(x)||!Number.isFinite(y))continue;\nn++;\nsx+=x;\nsy+=y;\nsxx+=x*x;\nsyy+=y*y;\nsxy+=x*y;\n}\nif(n<2)return null;\nconst top=n*sxy-sx*sy;\nconst bottom=Math.sqrt((n*sxx-sx*sx)*(n*syy-sy*sy));\nif(bottom===0)return null;\nconst r=top/bottom;\nreturn Math.max(-1,Math.min(1,r));\n}\nfunction trimmedMean(values,share=0.1){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst cut=Math.floor(n*Math.min(0.49,Math.max(0,share)));\nconst kept=sorted.slice(cut,n-cut);\nif(!kept.length)return quantileSorted(sorted,0.5);\nlet sum=0;\nfor(const v of kept)sum+=v;\nreturn sum/kept.length;\n}\nfunction winsorizedMean(values,share=0.1){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst cut=Math.floor(n*Math.min(0.49,Math.max(0,share)));\nconst low=sorted[cut];\nconst high=sorted[n-1-cut];\nlet sum=0;\nfor(const v of sorted)sum+=Math.min(high,Math.max(low,v));\nreturn sum/n;\n}\nfunction modifiedZOutliers(values,threshold=3.5){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst middle=quantileSorted(sorted,0.5);\nconst deviations=sorted.map((v)=>Math.abs(v-middle)).sort((a,b)=>a-b);\nconst mad=quantileSorted(deviations,0.5);\nif(mad===0)return null;\nlet count=0;\nfor(const v of sorted)if(Math.abs((0.6745*(v-middle))/mad)>threshold)count++;\nreturn count;\n}\nfunction jarqueBera(values){\nconst n=values.length;\nif(n<8)return null;\nlet mean=0;\nfor(const v of values)mean+=v;\nmean/=n;\nlet m2=0;\nlet m3=0;\nlet m4=0;\nfor(const v of values){\nconst d=v-mean;\nm2+=d*d;\nm3+=d*d*d;\nm4+=d*d*d*d;\n}\nm2/=n;\nm3/=n;\nm4/=n;\nif(m2===0)return null;\nconst skew=m3/m2**1.5;\nconst excess=m4/(m2*m2)-3;\nreturn(n/6)*(skew*skew+(excess*excess)/4);\n}\nfunction weightedQuantile(values,weights,p){\nconst paired=[];\nlet total=0;\nfor(let i=0;i<values.length;i++){\nconst v=Number(values[i]);\nconst w=Number(weights[i]);\nif(!Number.isFinite(v)||!Number.isFinite(w)||w<=0)continue;\npaired.push([v,w]);\ntotal+=w;\n}\nif(!paired.length||total<=0)return null;\npaired.sort((a,b)=>a[0]-b[0]);\nif(paired.length===1)return paired[0][0];\nconst at=[];\nlet seen=0;\nfor(const[,w]of paired){\nat.push((seen+w/2)/total);\nseen+=w;\n}\nconst target=Math.max(0,Math.min(1,p));\nif(target<=at[0])return paired[0][0];\nif(target>=at[at.length-1])return paired[paired.length-1][0];\nfor(let i=1;i<at.length;i++){\nif(target>at[i])continue;\nconst span=at[i]-at[i-1];\nconst within=span>0?(target-at[i-1])/span:0;\nreturn paired[i-1][0]+(paired[i][0]-paired[i-1][0])*within;\n}\nreturn paired[paired.length-1][0];\n}\nfunction pairs(a,b,indices){\nconst readA=valueReader(a);\nconst readB=valueReader(b);\nconst xs=new Float64Array(indices.length);\nconst ys=new Float64Array(indices.length);\nlet n=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst x=Number(readA(row));\nconst y=Number(readB(row));\nif(!Number.isFinite(x)||!Number.isFinite(y))continue;\nxs[n]=x;\nys[n]=y;\nn++;\n}\nreturn{xs:xs.subarray(0,n),ys:ys.subarray(0,n),n};\n}\nfunction covariance(a,b,indices,population=false){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=xs[i];my+=ys[i];}\nmx/=n;\nmy/=n;\nlet sum=0;\nfor(let i=0;i<n;i++)sum+=(xs[i]-mx)*(ys[i]-my);\nreturn sum/(population?n:n-1);\n}\nfunction regression(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=xs[i];my+=ys[i];}\nmx/=n;\nmy/=n;\nlet sxx=0;\nlet sxy=0;\nlet syy=0;\nfor(let i=0;i<n;i++){\nconst dx=xs[i]-mx;\nconst dy=ys[i]-my;\nsxx+=dx*dx;\nsxy+=dx*dy;\nsyy+=dy*dy;\n}\nif(sxx===0)return null;\nconst slope=sxy/sxx;\nconst intercept=my-slope*mx;\nconst r2=syy===0?1:Math.max(0,Math.min(1,(sxy*sxy)/(sxx*syy)));\nconst residual=Math.max(0,syy-slope*sxy);\nconst stdError=n>2?Math.sqrt(residual/(n-2)/sxx):0;\nreturn{slope,intercept,r2,stdError,n};\n}\nfunction ranksOf(values){\nconst n=values.length;\nconst order=Array.from({length:n},(unused,i)=>i)\n.sort((i,j)=>values[i]-values[j]);\nconst ranks=new Float64Array(n);\nlet i=0;\nwhile(i<n){\nlet j=i;\nwhile(j+1<n&&values[order[j+1]]===values[order[i]])j++;\nconst shared=(i+j)/2+1;\nfor(let k=i;k<=j;k++)ranks[order[k]]=shared;\ni=j+1;\n}\nreturn ranks;\n}\nfunction spearman(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nconst rx=ranksOf(xs);\nconst ry=ranksOf(ys);\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=rx[i];my+=ry[i];}\nmx/=n;\nmy/=n;\nlet sxy=0;\nlet sxx=0;\nlet syy=0;\nfor(let i=0;i<n;i++){\nconst dx=rx[i]-mx;\nconst dy=ry[i]-my;\nsxy+=dx*dy;\nsxx+=dx*dx;\nsyy+=dy*dy;\n}\nif(sxx===0||syy===0)return null;\nreturn Math.max(-1,Math.min(1,sxy/Math.sqrt(sxx*syy)));\n}\nfunction kendall(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2||n>KENDALL_LIMIT)return null;\nlet concordant=0;\nlet discordant=0;\nlet tiedXOnly=0;\nlet tiedYOnly=0;\nfor(let i=0;i<n;i++){\nfor(let j=i+1;j<n;j++){\nconst dx=Math.sign(xs[i]-xs[j]);\nconst dy=Math.sign(ys[i]-ys[j]);\nconst product=dx*dy;\nif(product>0)concordant++;\nelse if(product<0)discordant++;\nelse if(dx===0&&dy===0){}\nelse if(dx===0)tiedXOnly++;\nelse tiedYOnly++;\n}\n}\nconst orderedByX=concordant+discordant+tiedYOnly;\nconst orderedByY=concordant+discordant+tiedXOnly;\nif(orderedByX===0||orderedByY===0)return null;\nreturn(concordant-discordant)/Math.sqrt(orderedByX*orderedByY);\n}\nfunction seriesStats(ordered,opts={}){\nconst n=ordered.length;\nif(n<2)return null;\nconst first=ordered[0];\nconst last=ordered[n-1];\nconst returns=[];\nfor(let i=1;i<n;i++){\nconst previous=ordered[i-1];\nif(previous===0)continue;\nreturns.push((ordered[i]-previous)/Math.abs(previous));\n}\nlet volatility=null;\nif(returns.length>1){\nlet mean=0;\nfor(const r of returns)mean+=r;\nmean/=returns.length;\nlet m2=0;\nfor(const r of returns)m2+=(r-mean)**2;\nvolatility=Math.sqrt(m2/(returns.length-1));\n}\nconst periods=Number(opts.periodsPerYear)>0?Number(opts.periodsPerYear):null;\nlet peak=ordered[0];\nlet peakAt=0;\nlet worst=0;\nlet worstFrom=0;\nlet worstTo=0;\nfor(let i=1;i<n;i++){\nif(ordered[i]>peak){peak=ordered[i];peakAt=i;continue;}\nif(peak<=0)continue;\nconst fall=(peak-ordered[i])/peak;\nif(fall>worst){worst=fall;worstFrom=peakAt;worstTo=i;}\n}\nlet autocorrelation=null;\nif(n>2){\nlet mean=0;\nfor(let i=0;i<n;i++)mean+=ordered[i];\nmean/=n;\nlet top=0;\nlet bottom=0;\nfor(let i=0;i<n;i++){\nconst d=ordered[i]-mean;\nbottom+=d*d;\nif(i>0)top+=d*(ordered[i-1]-mean);\n}\nautocorrelation=bottom>0?top/bottom:null;\n}\nlet up=0;\nlet down=0;\nfor(const r of returns){if(r>0)up++;else if(r<0)down++;}\nlet growth=null;\nif(first>0&&last>0){\nconst perPeriod=(last/first)**(1/(n-1))-1;\ngrowth=periods?(1+perPeriod)**periods-1:perPeriod;\n}\nreturn{\nn,\nfirst,\nlast,\nchange:last-first,\nchangePercent:first===0?null:((last-first)/Math.abs(first))*100,\nvolatility,\nannualisedVolatility:volatility!==null&&periods?volatility*Math.sqrt(periods):null,\ngrowth,\nmaxDrawdown:worst,\nmaxDrawdownFrom:worstFrom,\nmaxDrawdownTo:worstTo,\nautocorrelation,\nupDays:up,\ndownDays:down,\n};\n}\nconst D2_N2=1.128;\nconst D4_N2=3.267;\nfunction movingRanges(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nconst ranges=[];\nfor(let i=1;i<n;i++)ranges.push(Math.abs(ordered[i]-ordered[i-1]));\nconst centre=ranges.reduce((t,r)=>t+r,0)/ranges.length;\nreturn{ranges,centre,upper:D4_N2*centre,lower:0};\n}\nfunction withinSigma(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nlet total=0;\nfor(let i=1;i<n;i++)total+=Math.abs(ordered[i]-ordered[i-1]);\nconst meanRange=total/(n-1);\nreturn{sigma:meanRange/D2_N2,meanRange};\n}\nfunction capability(ordered,spec){\nconst n=ordered.length;\nif(n<2||!spec)return null;\nconst lower=Number.isFinite(Number(spec.lower))?Number(spec.lower):null;\nconst upper=Number.isFinite(Number(spec.upper))?Number(spec.upper):null;\nif(lower===null&&upper===null)return null;\nlet mean=0;\nfor(let i=0;i<n;i++)mean+=ordered[i];\nmean/=n;\nlet m2=0;\nfor(let i=0;i<n;i++)m2+=(ordered[i]-mean)**2;\nconst overall=Math.sqrt(m2/(n-1));\nconst within=withinSigma(ordered);\nconst sigmaWithin=within?within.sigma:null;\nconst indices=(sigma)=>{\nif(!sigma||sigma<=0)return{index:null,k:null};\nconst both=lower!==null&&upper!==null;\nconst index=both?(upper-lower)/(6*sigma):null;\nconst upperSide=upper!==null?(upper-mean)/(3*sigma):Infinity;\nconst lowerSide=lower!==null?(mean-lower)/(3*sigma):Infinity;\nreturn{index,k:Math.min(upperSide,lowerSide)};\n};\nconst short=indices(sigmaWithin);\nconst long=indices(overall);\nlet outOfSpec=0;\nfor(let i=0;i<n;i++){\nif(lower!==null&&ordered[i]<lower){outOfSpec++;continue;}\nif(upper!==null&&ordered[i]>upper)outOfSpec++;\n}\nreturn{\nn,\nmean,\nlower,\nupper,\ntarget:Number.isFinite(Number(spec.target))?Number(spec.target):null,\nsigmaWithin,\nsigmaOverall:overall,\ncp:short.index,\ncpk:short.k,\npp:long.index,\nppk:long.k,\noutOfSpec,\ndefectRate:n?outOfSpec/n:null,\n};\n}\nfunction controlLimits(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nconst within=withinSigma(ordered);\nif(!within||!(within.sigma>0))return null;\nlet centre=0;\nfor(let i=0;i<n;i++)centre+=ordered[i];\ncentre/=n;\nreturn{\ncentre,\nsigma:within.sigma,\nupper:centre+3*within.sigma,\nlower:centre-3*within.sigma,\n};\n}\nfunction westernElectricViolations(ordered,limits){\nif(!limits||!(limits.sigma>0))return[];\nconst n=ordered.length;\nconst{centre,sigma}=limits;\nconst z=(i)=>(ordered[i]-centre)/sigma;\nconst out=[];\nfor(let i=0;i<n;i++){\nif(Math.abs(z(i))>3){\nout.push({index:i,rule:1,description:'beyond three sigma'});\n}\nif(i>=2){\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=i-2;k<=i;k++)if(z(k)*side>2)hits++;\nif(hits>=2){\nout.push({index:i,rule:2,description:'two of three past two sigma'});\nbreak;\n}\n}\n}\nif(i>=4){\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=i-4;k<=i;k++)if(z(k)*side>1)hits++;\nif(hits>=4){\nout.push({index:i,rule:3,description:'four of five past one sigma'});\nbreak;\n}\n}\n}\nif(i>=7){\nfor(const side of[1,-1]){\nlet all=true;\nfor(let k=i-7;k<=i;k++)if(z(k)*side<=0){all=false;break;}\nif(all){\nout.push({index:i,rule:4,description:'eight in a row on one side'});\nbreak;\n}\n}\n}\n}\nreturn out;\n}\nfunction nelsonViolations(ordered,limits){\nif(!limits||!(limits.sigma>0))return[];\nconst n=ordered.length;\nconst{centre,sigma}=limits;\nconst z=(i)=>(ordered[i]-centre)/sigma;\nconst oneSide=(from,to,past,need)=>{\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=from;k<=to;k++)if(z(k)*side>past)hits++;\nif(hits>=need)return true;\n}\nreturn false;\n};\nconst out=[];\nfor(let i=0;i<n;i++){\nif(Math.abs(z(i))>3)out.push({index:i,rule:1,description:'beyond three sigma'});\nif(i>=8){\nfor(const side of[1,-1]){\nlet all=true;\nfor(let k=i-8;k<=i;k++)if(z(k)*side<=0){all=false;break;}\nif(all){out.push({index:i,rule:2,description:'nine in a row on one side'});break;}\n}\n}\nif(i>=5){\nfor(const dir of[1,-1]){\nlet all=true;\nfor(let k=i-4;k<=i;k++){\nif((ordered[k]-ordered[k-1])*dir<=0){all=false;break;}\n}\nif(all){\nout.push({index:i,rule:3,description:dir>0?'six rising':'six falling'});\nbreak;\n}\n}\n}\nif(i>=13){\nlet alternating=true;\nfor(let k=i-12;k<=i;k++){\nconst a=ordered[k]-ordered[k-1];\nconst b=ordered[k+1<=i?k+1:k]-ordered[k];\nif(k+1>i)break;\nif(a===0||b===0||(a>0)===(b>0)){alternating=false;break;}\n}\nif(alternating)out.push({index:i,rule:4,description:'fourteen alternating'});\n}\nif(i>=2&&oneSide(i-2,i,2,2)){\nout.push({index:i,rule:5,description:'two of three past two sigma'});\n}\nif(i>=4&&oneSide(i-4,i,1,4)){\nout.push({index:i,rule:6,description:'four of five past one sigma'});\n}\nif(i>=14){\nlet inside=true;\nfor(let k=i-14;k<=i;k++)if(Math.abs(z(k))>=1){inside=false;break;}\nif(inside)out.push({index:i,rule:7,description:'fifteen within one sigma'});\n}\nif(i>=7){\nlet outside=true;\nfor(let k=i-7;k<=i;k++)if(Math.abs(z(k))<=1){outside=false;break;}\nif(outside)out.push({index:i,rule:8,description:'eight beyond one sigma'});\n}\n}\nreturn out;\n}\nconst CONTROL_RULE_SETS=Object.freeze(['westernElectric','nelson']);\nfunction controlViolations(ordered,limits,ruleSet='westernElectric'){\nreturn String(ruleSet)==='nelson'\n?nelsonViolations(ordered,limits)\n:westernElectricViolations(ordered,limits);\n}\nfunction countOutside(values,low,high){\nlet count=0;\nfor(let i=0;i<values.length;i++){\nif(values[i]<low||values[i]>high)count++;\n}\nreturn count;\n}\nfunction histogram(sorted,q1,q3,cap=20){\nconst n=sorted.length;\nif(!n)return[];\nconst min=sorted[0];\nconst max=sorted[n-1];\nif(max===min)return[{from:min,to:max,count:n}];\nconst iqr=q3-q1;\nconst fence=1.5*iqr;\nlet lo=iqr>0?Math.max(min,q1-fence):min;\nlet hi=iqr>0?Math.min(max,q3+fence):max;\nif(!(hi>lo)){lo=min;hi=max;}\nconst width=iqr>0?(2*iqr)/Math.cbrt(n):(hi-lo)/(Math.ceil(Math.log2(n))+1);\nconst count=width>0\n?Math.min(cap,Math.max(1,Math.ceil((hi-lo)/width)))\n:1;\nconst step=(hi-lo)/count;\nconst bins=[];\nfor(let i=0;i<count;i++){\nbins.push({from:lo+i*step,to:lo+(i+1)*step,count:0});\n}\nfor(let i=0;i<n;i++){\nconst at=Math.min(count-1,Math.max(0,Math.floor((sorted[i]-lo)/step)));\nbins[at].count++;\n}\nbins[0].from=min;\nbins[count-1].to=max;\nreturn bins;\n}\nconst DEFAULT_CONFIDENCE=0.95;\nfunction level(conf){\nconst c=Number(conf);\nreturn Number.isFinite(c)&&c>0&&c<1?c:DEFAULT_CONFIDENCE;\n}\nfunction meanInterval(values,conf=DEFAULT_CONFIDENCE){\nconst n=values.length;\nif(n<2)return null;\nlet sum=0;\nfor(let i=0;i<n;i++)sum+=values[i];\nconst mean=sum/n;\nlet ss=0;\nfor(let i=0;i<n;i++){const d=values[i]-mean;ss+=d*d;}\nconst sd=Math.sqrt(ss/(n-1));\nconst c=level(conf);\nconst t=studentTQuantile(1-(1-c)/2,n-1);\nconst margin=(t*sd)/Math.sqrt(n);\nreturn{mean,lower:mean-margin,upper:mean+margin,margin,n,confidence:c};\n}\nfunction proportionInterval(successes,n,conf=DEFAULT_CONFIDENCE){\nconst k=Number(successes);\nconst total=Number(n);\nif(!(total>0)||!(k>=0)||k>total)return null;\nconst c=level(conf);\nconst z=normalQuantile(1-(1-c)/2);\nconst p=k/total;\nconst z2=z*z;\nconst denominator=1+z2/total;\nconst centre=(p+z2/(2*total))/denominator;\nconst half=(z/denominator)\n*Math.sqrt((p*(1-p))/total+z2/(4*total*total));\nreturn{\nproportion:p,\nlower:Math.max(0,centre-half),\nupper:Math.min(1,centre+half),\nn:total,\nconfidence:c,\n};\n}\nfunction slopeInterval(fit,conf=DEFAULT_CONFIDENCE){\nif(!fit||!(fit.n>2)||!Number.isFinite(fit.stdError))return null;\nconst c=level(conf);\nconst t=studentTQuantile(1-(1-c)/2,fit.n-2);\nconst margin=t*fit.stdError;\nreturn{\nslope:fit.slope,\nlower:fit.slope-margin,\nupper:fit.slope+margin,\nmargin,\nconfidence:c,\n};\n}\nfunction capabilityInterval(index,n,conf=DEFAULT_CONFIDENCE){\nconst k=Number(index);\nconst count=Number(n);\nif(!Number.isFinite(k)||!(count>1))return null;\nconst c=level(conf);\nconst z=normalQuantile(1-(1-c)/2);\nconst margin=z*Math.sqrt(1/(9*count)+(k*k)/(2*(count-1)));\nreturn{index:k,lower:k-margin,upper:k+margin,margin,n:count,confidence:c};\n}\nfunction standardizedMeanDifference(population,subsetMean){\nif(!population||!(population.sd>0))return null;\nif(!Number.isFinite(subsetMean)||!Number.isFinite(population.mean))return null;\nreturn(subsetMean-population.mean)/population.sd;\n}\nfunction normalTotalVariation(d){\nif(!Number.isFinite(d))return 0;\nreturn Math.min(1,Math.max(0,2*normalCdf(Math.abs(d)/2)-1));\n}\nfunction frequencyMap(handle,indices){\nconst map=new Map();\nconst read=valueReader(handle);\nlet total=0;\nfor(let i=0;i<indices.length;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(typeof raw==='number'&&Number.isNaN(raw))continue;\nconst key=raw instanceof Date?raw.getTime()\n:(typeof raw==='object'?String(raw):raw);\nmap.set(key,(map.get(key)||0)+1);\ntotal++;\n}\nreturn{map,total};\n}\nfunction categoricalDistance(subset,subsetTotal,population,populationTotal){\nif(!(subsetTotal>0)||!(populationTotal>0))return null;\nlet sum=0;\nconst keys=new Set(subset.keys());\nfor(const k of population.keys())keys.add(k);\nfor(const k of keys){\nconst a=(subset.get(k)||0)/subsetTotal;\nconst b=(population.get(k)||0)/populationTotal;\nsum+=Math.abs(a-b);\n}\nreturn sum/2;\n}\nconst SUBSET_RELIABILITY_FLOOR=10;\nfunction compareColumn(handle,subsetIndices,populationStats){\nconst numeric=populationStats&&populationStats.numeric;\nif(numeric){\nconst values=numbers(handle,subsetIndices);\nconst{n,mean}=moments(values);\nconst d=n>0\n?standardizedMeanDifference(\n{mean:populationStats.mean,sd:populationStats.sd},mean,\n)\n:null;\nreturn{\nmeasure:'standardizedMeanDifference',\nmagnitude:d,\ndistance:d===null?0:normalTotalVariation(d),\ndirection:d===null?0:Math.sign(d),\nsubsetN:n,\npopulationN:populationStats.n||0,\nreliable:n>=SUBSET_RELIABILITY_FLOOR,\n};\n}\nconst{map,total}=frequencyMap(handle,subsetIndices);\nconst tvd=categoricalDistance(map,total,populationStats.map,populationStats.total);\nreturn{\nmeasure:'categoricalTotalVariation',\nmagnitude:tvd,\ndistance:tvd===null?0:tvd,\ndirection:0,\nsubsetN:total,\npopulationN:populationStats.total||0,\nreliable:total>=SUBSET_RELIABILITY_FLOOR,\n};\n}\nfunction isNumericColumn(handle,indices){\nif(handle&&(handle.kind==='float64'||handle.kind==='int32'))return true;\nconst read=valueReader(handle);\nlet seen=0;\nlet numeric=0;\nfor(let i=0;i<indices.length&&seen<200;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(raw instanceof Date)return false;\nseen++;\nconst v=typeof raw==='number'?raw:Number(raw);\nif(Number.isFinite(v))numeric++;\n}\nif(seen===0)return false;\nreturn numeric/seen>=0.9;\n}\nfunction populationRead(handle,populationIndices){\nif(isNumericColumn(handle,populationIndices)){\nconst values=numbers(handle,populationIndices);\nconst{n,mean,m2}=moments(values);\nreturn{numeric:true,mean,sd:n>0?Math.sqrt(m2/n):0,n};\n}\nconst{map,total}=frequencyMap(handle,populationIndices);\nreturn{numeric:false,map,total};\n}\n});\n__def(\"packages/core/src/compute/total.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"TOTAL_FNS\",{enumerable:true,get:function(){return TOTAL_FNS;}});\nObject.defineProperty(__exports,\"TOTAL_LABELS\",{enumerable:true,get:function(){return TOTAL_LABELS;}});\nObject.defineProperty(__exports,\"totalLabel\",{enumerable:true,get:function(){return totalLabel;}});\nObject.defineProperty(__exports,\"aggregatesFor\",{enumerable:true,get:function(){return aggregatesFor;}});\nObject.defineProperty(__exports,\"aggregateAllowed\",{enumerable:true,get:function(){return aggregateAllowed;}});\nObject.defineProperty(__exports,\"collectValues\",{enumerable:true,get:function(){return collectValues;}});\nObject.defineProperty(__exports,\"total\",{enumerable:true,get:function(){return total;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isFunction=__m0[\"isFunction\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m1[\"presenceReader\"];\nconst valueComparator=__m1[\"valueComparator\"];\nconst valueReader=__m1[\"valueReader\"];\nconst __m2=__req(\"packages/core/src/compute/statistics.js\");\nconst STAT_FNS=__m2[\"STAT_FNS\"];\nconst STAT_LABELS=__m2[\"STAT_LABELS\"];\nfunction isNumericBacking(handle){\nreturn!!handle&&(handle.kind==='float64'||handle.kind==='int32');\n}\nfunction sum(handle,indices){\nconst n=indices.length;\nlet acc=0;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<n;i++){\nconst v=values[indices[i]];\nif(!Number.isNaN(v))acc+=v;\n}\nreturn acc;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===1){\nconst v=values[row];\nif(!Number.isNaN(v))acc+=v;\n}\n}\nreturn acc;\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst v=numberOf(read(indices[i]));\nif(v!==null)acc+=v;\n}\nreturn acc;\n}\nsum.kernel=true;\nfunction countValues(handle,indices){\nconst n=indices.length;\nlet count=0;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<n;i++)if(!Number.isNaN(values[indices[i]]))count++;\nreturn count;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===1&&!Number.isNaN(values[row]))count++;\n}\nreturn count;\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst v=read(indices[i]);\nif(v!==null&&v!==undefined&&!(typeof v==='number'&&Number.isNaN(v)))count++;\n}\nreturn count;\n}\ncountValues.kernel=true;\nfunction count(handle,indices){\nreturn indices.length;\n}\ncount.kernel=true;\nfunction avg(handle,indices){\nconst values=countValues(handle,indices);\nif(values===0)return null;\nreturn sum(handle,indices)/values;\n}\navg.kernel=true;\nfunction extreme(handle,indices,direction,locale){\nconst n=indices.length;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nlet best=null;\nif(!present){\nfor(let i=0;i<n;i++){\nconst v=values[indices[i]];\nif(Number.isNaN(v))continue;\nif(best===null||(direction<0?v<best:v>best))best=v;\n}\nreturn best;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===0)continue;\nconst v=values[row];\nif(Number.isNaN(v))continue;\nif(best===null||(direction<0?v<best:v>best))best=v;\n}\nreturn best;\n}\nconst read=valueReader(handle);\nconst cmp=valueComparator(locale);\nlet best=null;\nfor(let i=0;i<n;i++){\nconst v=read(indices[i]);\nif(v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v)))continue;\nif(best===null||(direction<0?cmp(v,best)<0:cmp(v,best)>0))best=v;\n}\nreturn best;\n}\nfunction min(handle,indices,ctx){\nreturn extreme(handle,indices,-1,ctx&&ctx.locale);\n}\nmin.kernel=true;\nfunction max(handle,indices,ctx){\nreturn extreme(handle,indices,1,ctx&&ctx.locale);\n}\nmax.kernel=true;\nfunction first(handle,indices){\nif(indices.length===0)return null;\nreturn valueReader(handle)(indices[0]);\n}\nfirst.kernel=true;\nfunction last(handle,indices){\nif(indices.length===0)return null;\nreturn valueReader(handle)(indices[indices.length-1]);\n}\nlast.kernel=true;\nfunction numberOf(v){\nif(typeof v==='number')return Number.isNaN(v)?null:v;\nif(v===null||v===undefined||v===''||typeof v==='boolean')return null;\nif(v instanceof Date)return v.getTime();\nconst n=Number(v);\nreturn Number.isNaN(n)?null:n;\n}\nconst TOTAL_FNS={\nsum,min,max,avg,count,first,last,countValues,\n...STAT_FNS,\n};\nconst TOTAL_LABELS=Object.freeze({\n...STAT_LABELS,\nsum:'Sum',\navg:'Average',\nmin:'Min',\nmax:'Max',\ncount:'Count',\ncountValues:'Count of values',\nfirst:'First',\nlast:'Last',\n});\nfunction totalLabel(fn){\nif(!fn)return'';\nif(typeof fn==='string')return TOTAL_LABELS[fn]||fn;\nreturn'Total';\n}\nconst CHOOSER_ORDER=Object.freeze([\n'sum','avg','min','max','count','countValues','first','last',\n]);\nfunction aggregatesFor(column){\nconst supported=column&&column.dataType\n&&column.dataType.totals&&column.dataType.totals.supported;\nif(Array.isArray(supported))return supported.slice();\nconst named=CHOOSER_ORDER.filter((name)=>name in TOTAL_FNS);\nfor(const name of Object.keys(TOTAL_FNS))if(!named.includes(name))named.push(name);\nreturn named;\n}\nfunction aggregateAllowed(column,name){\nif(typeof name!=='string')return true;\nreturn aggregatesFor(column).includes(name);\n}\nfunction collectValues(handle,indices){\nconst read=valueReader(handle);\nconst out=[];\nfor(let i=0;i<indices.length;i++){\nconst v=read(indices[i]);\nif(v===null||v===undefined)continue;\nout.push(v);\n}\nreturn out;\n}\nfunction total(handle,indices,fn,ctx){\nconst list=indices||[];\nif(typeof fn==='string'){\nconst kernel=TOTAL_FNS[fn];\nif(!kernel){\nwarnOnce(`total:${fn}`,`unknown total function \"${fn}\"; register it in config.totalFns`);\nreturn null;\n}\nreturn kernel(handle,list,ctx);\n}\nif(isFunction(fn)){\nif(fn.kernel===true)return fn(handle,list,ctx);\nreturn fn(collectValues(handle,list),ctx||{});\n}\nreturn null;\n}\n});\n__def(\"packages/core/src/compute/pivot.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"KEY_DELIMITER\",{enumerable:true,get:function(){return KEY_DELIMITER;}});\nObject.defineProperty(__exports,\"DEFAULT_PATH_SEPARATOR\",{enumerable:true,get:function(){return DEFAULT_PATH_SEPARATOR;}});\nObject.defineProperty(__exports,\"DEFAULT_MAX_COLUMNS\",{enumerable:true,get:function(){return DEFAULT_MAX_COLUMNS;}});\nObject.defineProperty(__exports,\"pivotKey\",{enumerable:true,get:function(){return pivotKey;}});\nObject.defineProperty(__exports,\"joinPath\",{enumerable:true,get:function(){return joinPath;}});\nObject.defineProperty(__exports,\"resolvePivotKeys\",{enumerable:true,get:function(){return resolvePivotKeys;}});\nObject.defineProperty(__exports,\"pivot\",{enumerable:true,get:function(){return pivot;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst valueComparator=__m1[\"valueComparator\"];\nconst __m2=__req(\"packages/core/src/compute/group.js\");\nconst packKeys=__m2[\"packKeys\"];\nconst __m3=__req(\"packages/core/src/compute/total.js\");\nconst total=__m3[\"total\"];\nconst KEY_DELIMITER='|';\nconst DEFAULT_PATH_SEPARATOR='/';\nconst DEFAULT_MAX_COLUMNS=2000;\nfunction pivotKey(groupPath,pivotPath,colId){\nreturn`${groupPath}${KEY_DELIMITER}${pivotPath}${KEY_DELIMITER}${colId}`;\n}\nfunction joinPath(parts,separator){\nlet out='';\nfor(let i=0;i<parts.length;i++){\nconst v=parts[i];\nout+=(i===0?'':separator)+(v===null||v===undefined?'':String(v));\n}\nreturn out;\n}\nfunction resolvePivotKeys(handles,order,opts={}){\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst n=order.length;\nconst{keyOf,readers}=packKeys(handles,order,0);\nconst seen=new Map();\nconst tuples=[];\nconst rawKeys=[];\nfor(let i=0;i<n;i++){\nconst row=order[i];\nconst key=keyOf(row);\nif(seen.has(key))continue;\nseen.set(key,tuples.length);\nrawKeys.push(key);\nconst tuple=new Array(readers.length);\nfor(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);\ntuples.push(tuple);\n}\nconst cmp=valueComparator(opts.locale);\nconst rank=tuples.map((_,i)=>i);\nrank.sort((a,b)=>{\nconst ta=tuples[a];\nconst tb=tuples[b];\nfor(let j=0;j<ta.length;j++){\nconst c=compareNullable(ta[j],tb[j],cmp);\nif(c!==0)return c;\n}\nreturn a-b;\n});\nconst keys=new Array(rank.length);\nconst paths=new Array(rank.length);\nconst idByKey=new Map();\nfor(let position=0;position<rank.length;position++){\nconst from=rank[position];\nkeys[position]=tuples[from];\npaths[position]=joinPath(tuples[from],separator);\nidByKey.set(rawKeys[from],position);\n}\nconst idOf=(row)=>{\nconst id=idByKey.get(keyOf(row));\nreturn id===undefined?-1:id;\n};\nreturn{keys,paths,idOf};\n}\nfunction compareNullable(a,b,cmp){\nconst na=a===null||a===undefined;\nconst nb=b===null||b===undefined;\nif(na||nb)return na&&nb?0:na?1:-1;\nreturn cmp(a,b);\n}\nfunction resolveValueColumns(opts){\nconst declared=opts.values||opts.totals||[];\nif(declared.length&&typeof declared[0]==='object'&&declared[0]!==null){\nreturn declared.filter((entry)=>entry&&entry.handle);\n}\nconst resolve=typeof opts.handle==='function'?opts.handle:null;\nif(!resolve){\nif(declared.length){\nwarnOnce('pivot:handles',\n'pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle.');\n}\nreturn[];\n}\nconst totalOf=typeof opts.totalOf==='function'?opts.totalOf:null;\nconst out=[];\nfor(const colId of declared){\nconst handle=resolve(colId);\nif(!handle)continue;\nout.push({colId,handle,fn:totalOf?totalOf(colId):'sum'});\n}\nreturn out;\n}\nfunction normaliseArgs(a,b,c){\nif(Array.isArray(a)){\nconst opts=c||{};\nreturn{...opts,pivotHandles:a,order:b||null,groups:opts.groups||null};\n}\nreturn a||{};\n}\nfunction pivot(input,orderArg,optsArg){\nconst opts=normaliseArgs(input,orderArg,optsArg);\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst valueColumns=resolveValueColumns(opts);\nconst maxColumns=opts.maxColumns===undefined?DEFAULT_MAX_COLUMNS:opts.maxColumns;\nconst groups=opts.groups&&opts.groups.buckets?opts.groups:null;\nconst buckets=groups?groups.buckets:[opts.order||new Uint32Array(0)];\nconst groupPaths=opts.groupPaths\n||(groups?groups.keys.map((tuple)=>joinPath(tuple,separator)):['']);\nconst scope=concatIndices(buckets);\nconst{keys,paths,idOf}=resolvePivotKeys(opts.pivotHandles||[],scope,opts);\nconst columns=paths.length*Math.max(1,valueColumns.length);\nconst fields=derivedFields(paths,valueColumns,separator);\nif(maxColumns&&columns>maxColumns){\nconst empty=new Map();\nreturn{\nkeys,\npaths,\nfields,\ngroupPaths,\ncolumns,\nvalues:empty,\ncells:empty,\nerror:{\ncode:'pivot-max-columns',\nmessage:`[lattice] pivot would generate ${columns} columns, above pivot.maxColumns of ${maxColumns}. Narrow the pivot columns or raise the limit.`,\ncolumns,\nmaxColumns,\n},\n};\n}\nconst cells=new Map();\nconst keyCount=paths.length;\nfor(let g=0;g<buckets.length;g++){\nconst bucket=buckets[g];\nconst groupPath=groupPaths[g]===undefined?'':groupPaths[g];\nconst n=bucket.length;\nif(n===0)continue;\nconst ids=new Int32Array(n);\nconst counts=new Uint32Array(keyCount+1);\nfor(let i=0;i<n;i++){\nconst id=idOf(bucket[i]);\nids[i]=id;\nif(id>=0)counts[id+1]++;\n}\nfor(let k=0;k<keyCount;k++)counts[k+1]+=counts[k];\nconst scattered=new Uint32Array(n);\nconst cursor=counts.slice(0,keyCount);\nfor(let i=0;i<n;i++){\nconst id=ids[i];\nif(id>=0)scattered[cursor[id]++]=bucket[i];\n}\nfor(let k=0;k<keyCount;k++){\nconst from=counts[k];\nconst to=counts[k+1];\nif(to===from)continue;\nconst slice=scattered.subarray(from,to);\nfor(let c=0;c<valueColumns.length;c++){\nconst column=valueColumns[c];\nconst result=total(column.handle,slice,column.fn,opts.totalContext||{locale:opts.locale});\ncells.set(pivotKey(groupPath,paths[k],column.colId),result);\n}\n}\n}\nreturn{keys,paths,fields,groupPaths,columns,values:cells,cells,error:null};\n}\nfunction derivedFields(paths,valueColumns,separator){\nif(valueColumns.length===0)return paths.slice();\nconst out=[];\nfor(const path of paths){\nfor(const column of valueColumns)out.push(`${path}${separator}${column.colId}`);\n}\nreturn out;\n}\nfunction concatIndices(buckets){\nif(buckets.length===1)return buckets[0]||new Uint32Array(0);\nlet n=0;\nfor(const b of buckets)n+=b?b.length:0;\nconst out=new Uint32Array(n);\nlet at=0;\nfor(const b of buckets){\nif(!b||b.length===0)continue;\nout.set(b,at);\nat+=b.length;\n}\nreturn out;\n}\n});\n__def(\"packages/core/src/compute/reference.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"referenceValue\",{enumerable:true,get:function(){return referenceValue;}});\nObject.defineProperty(__exports,\"referenceSort\",{enumerable:true,get:function(){return referenceSort;}});\nObject.defineProperty(__exports,\"referenceFilter\",{enumerable:true,get:function(){return referenceFilter;}});\nObject.defineProperty(__exports,\"referencePasses\",{enumerable:true,get:function(){return referencePasses;}});\nObject.defineProperty(__exports,\"referenceGroup\",{enumerable:true,get:function(){return referenceGroup;}});\nObject.defineProperty(__exports,\"referenceTotal\",{enumerable:true,get:function(){return referenceTotal;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst getPath=__m0[\"getPath\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst isMissing=__m1[\"isMissing\"];\nconst valueComparator=__m1[\"valueComparator\"];\nconst __m2=__req(\"packages/core/src/compute/filter.js\");\nconst testValue=__m2[\"testValue\"];\nconst KEY_SEPARATOR=String.fromCharCode(0x1f);\nconst NULL_MARKER=String.fromCharCode(0x00);\nfunction referenceValue(row,col){\nconst v=col.includes('.')?getPath(row,col):(row==null?undefined:row[col]);\nreturn v===undefined?null:v;\n}\nfunction referenceSort(rows,entries,opts={}){\nconst list=entries||[];\nlet order=rows.map((_,i)=>i);\nif(list.length===0)return order;\nfor(let e=list.length-1;e>=0;e--){\norder=referenceSortOne(rows,order,list[e],opts);\n}\nreturn order;\n}\nfunction referenceSortOne(rows,order,entry,opts){\nconst locale=entry.locale!==undefined?entry.locale:opts.locale;\nconst base=valueComparator(locale);\nconst descending=entry.descending!==undefined?!!entry.descending:entry.dir==='desc';\nconst present=[];\nconst absent=[];\nfor(const i of order){\nconst v=referenceValue(rows[i],entry.col);\nif(isMissing(v))absent.push(i);else present.push(i);\n}\nconst position=new Map();\nfor(let p=0;p<present.length;p++)position.set(present[p],p);\nconst compare=(a,b)=>{\nconst va=referenceValue(rows[a],entry.col);\nconst vb=referenceValue(rows[b],entry.col);\nlet c;\nif(typeof entry.compare==='function'){\nc=entry.compare(va,vb,rows[a],rows[b],descending);\nif(descending)c=-c;\n}else{\nc=descending?base(vb,va):base(va,vb);\n}\nreturn c!==0?c:position.get(a)-position.get(b);\n};\npresent.sort(compare);\nreturn entry.nullsFirst?absent.concat(present):present.concat(absent);\n}\nfunction referenceFilter(rows,filters,opts={}){\nconst out=[];\nfor(let i=0;i<rows.length;i++){\nif(referencePasses(rows[i],filters,opts,i))out.push(i);\n}\nreturn out;\n}\nfunction referencePasses(row,node,opts,index){\nif(!node)return true;\nif(Array.isArray(node.conditions)){\nconst children=node.conditions.filter((c)=>c!=null);\nif(children.length===0)return true;\nif(node.op==='or')return children.some((c)=>referencePasses(row,c,opts,index));\nconst all=children.every((c)=>referencePasses(row,c,opts,index));\nreturn node.op==='not'?!all:all;\n}\nif(node.col===undefined&&typeof opts.custom==='function')return!!opts.custom(node,row,index);\nreturn testValue(referenceValue(row,node.col),node,opts.locale);\n}\nfunction referenceGroup(rows,cols,order){\nconst source=order||rows.map((_,i)=>i);\nconst seen=new Map();\nconst keys=[];\nconst buckets=[];\nfor(const i of source){\nconst tuple=cols.map((col)=>referenceValue(rows[i],col));\nconst key=tuple\n.map((v)=>(v===null||v===undefined?NULL_MARKER:String(v)))\n.join(KEY_SEPARATOR);\nlet at=seen.get(key);\nif(at===undefined){\nat=keys.length;\nseen.set(key,at);\nkeys.push(tuple);\nbuckets.push([]);\n}\nbuckets[at].push(i);\n}\nreturn{keys,buckets};\n}\nfunction referenceTotal(values,fn,opts={}){\nconst cmp=valueComparator(opts.locale);\nconst live=values.filter((v)=>!isMissing(v));\nconst numbers=live.map(toNumberOrNull).filter((v)=>v!==null);\nswitch(fn){\ncase'count':return values.length;\ncase'countValues':return live.length;\ncase'sum':return numbers.reduce((a,b)=>a+b,0);\ncase'avg':return live.length===0?null:numbers.reduce((a,b)=>a+b,0)/live.length;\ncase'min':return live.length===0?null:live.reduce((a,b)=>(cmp(b,a)<0?b:a));\ncase'max':return live.length===0?null:live.reduce((a,b)=>(cmp(b,a)>0?b:a));\ncase'first':return values.length===0?null:normaliseNull(values[0]);\ncase'last':return values.length===0?null:normaliseNull(values[values.length-1]);\ndefault:return null;\n}\n}\nfunction toNumberOrNull(v){\nif(typeof v==='number')return Number.isNaN(v)?null:v;\nif(v===null||v===undefined||v===''||typeof v==='boolean')return null;\nif(v instanceof Date)return v.getTime();\nconst n=Number(v);\nreturn Number.isNaN(n)?null:n;\n}\nfunction normaliseNull(v){\nreturn v===undefined?null:v;\n}\n});\n__def(\"packages/core/src/compute/windowed.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Window\",{enumerable:true,get:function(){return Window;}});\nObject.defineProperty(__exports,\"WINDOW_KINDS\",{enumerable:true,get:function(){return WINDOW_KINDS;}});\nObject.defineProperty(__exports,\"openWindow\",{enumerable:true,get:function(){return openWindow;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nconst __m0=__req(\"packages/core/src/compute/sketch.js\");\nconst Welford=__m0[\"Welford\"];\nclass Window{\n#kind;\n#span;\n#ticks=[];\n#now;\n#opened;\nconstructor(kind,span=0,now=Date.now){\nif(kind!=='count'&&kind!=='time'&&kind!=='session'){\nthrow new RangeError(`unknown window kind: ${kind}`);\n}\nif((kind==='count'||kind==='time')&&!(span>0)){\nthrow new RangeError(`a ${kind} window needs a positive span`);\n}\nthis.#kind=kind;\nthis.#span=Math.floor(span);\nthis.#now=now;\nthis.#opened=now();\n}\nget size(){return this.#ticks.length;}\npush(v,t=this.#now()){\nif(!Number.isFinite(v))return;\nthis.#ticks.push({t,v});\nthis.#evict(t);\n}\n#evict(nowT){\nif(this.#kind==='count'){\nwhile(this.#ticks.length>this.#span)this.#ticks.shift();\n}else if(this.#kind==='time'){\nconst cutoff=nowT-this.#span;\nwhile(this.#ticks.length&&this.#ticks[0].t<cutoff)this.#ticks.shift();\n}\n}\nspec(){\nconst span=this.#kind==='session'?this.#now()-this.#opened:this.#span;\nreturn{kind:this.#kind,span,size:this.#ticks.length};\n}\nvalues(){return this.#ticks.map((tk)=>tk.v);}\naggregate(){\nconst spec=this.spec();\nif(!this.#ticks.length){\nreturn{over:spec,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};\n}\nconst w=new Welford();\nlet sum=0;\nlet min=Infinity;\nlet max=-Infinity;\nfor(const{v}of this.#ticks){\nsum+=v;\nif(v<min)min=v;\nif(v>max)max=v;\nw.add(v);\n}\nreturn{\nover:spec,\ncount:this.#ticks.length,\nsum,\nmean:w.mean(),\nmin,\nmax,\nvariance:w.variance(),\nstddev:w.stddev(),\n};\n}\nreduce(fn){\nconst agg=this.aggregate();\nconst map={\nsum:agg.sum,avg:agg.mean,mean:agg.mean,min:agg.min,max:agg.max,\ncount:agg.count,variance:agg.variance,stddev:agg.stddev,\n};\nif(!(fn in map))throw new RangeError(`unknown windowed aggregate: ${fn}`);\nreturn{value:map[fn],over:agg.over};\n}\n}\nconst WINDOW_KINDS=Object.freeze(['count','time','session']);\nfunction openWindow(opts,now=Date.now){\nconst span=opts.kind==='time'&&opts.minutes!=null\n?opts.minutes*60_000\n:opts.span??0;\nreturn new Window(opts.kind,span,now);\n}\nconst __default={Window,WINDOW_KINDS,openWindow};\n});\n__def(\"packages/core/src/compute/index.js\",function(__exports,__req){\n'use strict';\nconst __m0=__req(\"packages/core/src/compute/sort.js\");\nObject.defineProperty(__exports,\"sortColumn\",{enumerable:true,get:function(){return __m0[\"sortColumn\"];}});\nObject.defineProperty(__exports,\"sortMulti\",{enumerable:true,get:function(){return __m0[\"sortMulti\"];}});\nObject.defineProperty(__exports,\"radixSortFloat64\",{enumerable:true,get:function(){return __m0[\"radixSortFloat64\"];}});\nObject.defineProperty(__exports,\"radixSortInt32\",{enumerable:true,get:function(){return __m0[\"radixSortInt32\"];}});\nObject.defineProperty(__exports,\"rankSortDictionary\",{enumerable:true,get:function(){return __m0[\"rankSortDictionary\"];}});\nObject.defineProperty(__exports,\"mergeSortComparator\",{enumerable:true,get:function(){return __m0[\"mergeSortComparator\"];}});\nObject.defineProperty(__exports,\"collateStringRanks\",{enumerable:true,get:function(){return __m0[\"collateStringRanks\"];}});\nObject.defineProperty(__exports,\"rankSortStrings\",{enumerable:true,get:function(){return __m0[\"rankSortStrings\"];}});\nconst __m1=__req(\"packages/core/src/compute/sortspec.js\");\nObject.defineProperty(__exports,\"collationDescriptor\",{enumerable:true,get:function(){return __m1[\"collationDescriptor\"];}});\nObject.defineProperty(__exports,\"isPortableSort\",{enumerable:true,get:function(){return __m1[\"isPortableSort\"];}});\nObject.defineProperty(__exports,\"isPortableSortSet\",{enumerable:true,get:function(){return __m1[\"isPortableSortSet\"];}});\nObject.defineProperty(__exports,\"describeSortEntry\",{enumerable:true,get:function(){return __m1[\"describeSortEntry\"];}});\nObject.defineProperty(__exports,\"describeSort\",{enumerable:true,get:function(){return __m1[\"describeSort\"];}});\nconst __m2=__req(\"packages/core/src/compute/filter.js\");\nObject.defineProperty(__exports,\"evaluateFilters\",{enumerable:true,get:function(){return __m2[\"evaluateFilters\"];}});\nObject.defineProperty(__exports,\"evaluateCondition\",{enumerable:true,get:function(){return __m2[\"evaluateCondition\"];}});\nObject.defineProperty(__exports,\"compact\",{enumerable:true,get:function(){return __m2[\"compact\"];}});\nObject.defineProperty(__exports,\"testValue\",{enumerable:true,get:function(){return __m2[\"testValue\"];}});\nObject.defineProperty(__exports,\"compilePredicate\",{enumerable:true,get:function(){return __m2[\"compilePredicate\"];}});\nObject.defineProperty(__exports,\"releaseMask\",{enumerable:true,get:function(){return __m2[\"releaseMask\"];}});\nObject.defineProperty(__exports,\"pruneColumn\",{enumerable:true,get:function(){return __m2[\"pruneColumn\"];}});\nObject.defineProperty(__exports,\"mentionsColumn\",{enumerable:true,get:function(){return __m2[\"mentionsColumn\"];}});\nconst __m3=__req(\"packages/core/src/compute/group.js\");\nObject.defineProperty(__exports,\"groupByColumns\",{enumerable:true,get:function(){return __m3[\"groupByColumns\"];}});\nObject.defineProperty(__exports,\"packKeys\",{enumerable:true,get:function(){return __m3[\"packKeys\"];}});\nconst __m4=__req(\"packages/core/src/compute/facet.js\");\nObject.defineProperty(__exports,\"facet\",{enumerable:true,get:function(){return __m4[\"facet\"];}});\nObject.defineProperty(__exports,\"computeBounds\",{enumerable:true,get:function(){return __m4[\"computeBounds\"];}});\nObject.defineProperty(__exports,\"countInto\",{enumerable:true,get:function(){return __m4[\"countInto\"];}});\nObject.defineProperty(__exports,\"bucketOf\",{enumerable:true,get:function(){return __m4[\"bucketOf\"];}});\nObject.defineProperty(__exports,\"facetKind\",{enumerable:true,get:function(){return __m4[\"facetKind\"];}});\nObject.defineProperty(__exports,\"cardinalityOf\",{enumerable:true,get:function(){return __m4[\"cardinalityOf\"];}});\nObject.defineProperty(__exports,\"pickGranularity\",{enumerable:true,get:function(){return __m4[\"pickGranularity\"];}});\nObject.defineProperty(__exports,\"floorTo\",{enumerable:true,get:function(){return __m4[\"floorTo\"];}});\nObject.defineProperty(__exports,\"advance\",{enumerable:true,get:function(){return __m4[\"advance\"];}});\nObject.defineProperty(__exports,\"STRATEGIES\",{enumerable:true,get:function(){return __m4[\"STRATEGIES\"];}});\nObject.defineProperty(__exports,\"GRANULARITIES\",{enumerable:true,get:function(){return __m4[\"GRANULARITIES\"];}});\nObject.defineProperty(__exports,\"DEFAULT_BUCKETS\",{enumerable:true,get:function(){return __m4[\"DEFAULT_BUCKETS\"];}});\nObject.defineProperty(__exports,\"DEFAULT_CARDINALITY_LIMIT\",{enumerable:true,get:function(){return __m4[\"DEFAULT_CARDINALITY_LIMIT\"];}});\nObject.defineProperty(__exports,\"QUANTILE_SAMPLE\",{enumerable:true,get:function(){return __m4[\"QUANTILE_SAMPLE\"];}});\nconst __m5=__req(\"packages/core/src/compute/total.js\");\nObject.defineProperty(__exports,\"TOTAL_FNS\",{enumerable:true,get:function(){return __m5[\"TOTAL_FNS\"];}});\nObject.defineProperty(__exports,\"TOTAL_LABELS\",{enumerable:true,get:function(){return __m5[\"TOTAL_LABELS\"];}});\nObject.defineProperty(__exports,\"totalLabel\",{enumerable:true,get:function(){return __m5[\"totalLabel\"];}});\nObject.defineProperty(__exports,\"total\",{enumerable:true,get:function(){return __m5[\"total\"];}});\nObject.defineProperty(__exports,\"collectValues\",{enumerable:true,get:function(){return __m5[\"collectValues\"];}});\nconst __m6=__req(\"packages/core/src/compute/pivot.js\");\nObject.defineProperty(__exports,\"pivot\",{enumerable:true,get:function(){return __m6[\"pivot\"];}});\nObject.defineProperty(__exports,\"resolvePivotKeys\",{enumerable:true,get:function(){return __m6[\"resolvePivotKeys\"];}});\nObject.defineProperty(__exports,\"pivotKey\",{enumerable:true,get:function(){return __m6[\"pivotKey\"];}});\nObject.defineProperty(__exports,\"joinPath\",{enumerable:true,get:function(){return __m6[\"joinPath\"];}});\nObject.defineProperty(__exports,\"KEY_DELIMITER\",{enumerable:true,get:function(){return __m6[\"KEY_DELIMITER\"];}});\nObject.defineProperty(__exports,\"DEFAULT_PATH_SEPARATOR\",{enumerable:true,get:function(){return __m6[\"DEFAULT_PATH_SEPARATOR\"];}});\nObject.defineProperty(__exports,\"DEFAULT_MAX_COLUMNS\",{enumerable:true,get:function(){return __m6[\"DEFAULT_MAX_COLUMNS\"];}});\nconst __m7=__req(\"packages/core/src/compute/reference.js\");\nObject.defineProperty(__exports,\"referenceSort\",{enumerable:true,get:function(){return __m7[\"referenceSort\"];}});\nObject.defineProperty(__exports,\"referenceFilter\",{enumerable:true,get:function(){return __m7[\"referenceFilter\"];}});\nObject.defineProperty(__exports,\"referenceGroup\",{enumerable:true,get:function(){return __m7[\"referenceGroup\"];}});\nObject.defineProperty(__exports,\"referenceTotal\",{enumerable:true,get:function(){return __m7[\"referenceTotal\"];}});\nObject.defineProperty(__exports,\"referencePasses\",{enumerable:true,get:function(){return __m7[\"referencePasses\"];}});\nObject.defineProperty(__exports,\"referenceValue\",{enumerable:true,get:function(){return __m7[\"referenceValue\"];}});\nconst __m8=__req(\"packages/core/src/compute/handle.js\");\nObject.defineProperty(__exports,\"identity\",{enumerable:true,get:function(){return __m8[\"identity\"];}});\nObject.defineProperty(__exports,\"rowCount\",{enumerable:true,get:function(){return __m8[\"rowCount\"];}});\nObject.defineProperty(__exports,\"presenceReader\",{enumerable:true,get:function(){return __m8[\"presenceReader\"];}});\nObject.defineProperty(__exports,\"bitReader\",{enumerable:true,get:function(){return __m8[\"bitReader\"];}});\nObject.defineProperty(__exports,\"valueReader\",{enumerable:true,get:function(){return __m8[\"valueReader\"];}});\nObject.defineProperty(__exports,\"valueComparator\",{enumerable:true,get:function(){return __m8[\"valueComparator\"];}});\nObject.defineProperty(__exports,\"numericTotalOrder\",{enumerable:true,get:function(){return __m8[\"numericTotalOrder\"];}});\nObject.defineProperty(__exports,\"dictRanks\",{enumerable:true,get:function(){return __m8[\"dictRanks\"];}});\nObject.defineProperty(__exports,\"dictSize\",{enumerable:true,get:function(){return __m8[\"dictSize\"];}});\nObject.defineProperty(__exports,\"dictValue\",{enumerable:true,get:function(){return __m8[\"dictValue\"];}});\nObject.defineProperty(__exports,\"multiValue\",{enumerable:true,get:function(){return __m8[\"multiValue\"];}});\nObject.defineProperty(__exports,\"isMissing\",{enumerable:true,get:function(){return __m8[\"isMissing\"];}});\nconst __m9=__req(\"packages/core/src/compute/sketch.js\");\nObject.defineProperty(__exports,\"Welford\",{enumerable:true,get:function(){return __m9[\"Welford\"];}});\nObject.defineProperty(__exports,\"Reservoir\",{enumerable:true,get:function(){return __m9[\"Reservoir\"];}});\nObject.defineProperty(__exports,\"HyperLogLog\",{enumerable:true,get:function(){return __m9[\"HyperLogLog\"];}});\nObject.defineProperty(__exports,\"SpaceSaving\",{enumerable:true,get:function(){return __m9[\"SpaceSaving\"];}});\nObject.defineProperty(__exports,\"KLL\",{enumerable:true,get:function(){return __m9[\"KLL\"];}});\nObject.defineProperty(__exports,\"hash32\",{enumerable:true,get:function(){return __m9[\"hash32\"];}});\nObject.defineProperty(__exports,\"SKETCH_BOUNDS\",{enumerable:true,get:function(){return __m9[\"SKETCH_BOUNDS\"];}});\nconst __m10=__req(\"packages/core/src/compute/windowed.js\");\nObject.defineProperty(__exports,\"Window\",{enumerable:true,get:function(){return __m10[\"Window\"];}});\nObject.defineProperty(__exports,\"WINDOW_KINDS\",{enumerable:true,get:function(){return __m10[\"WINDOW_KINDS\"];}});\nObject.defineProperty(__exports,\"openWindow\",{enumerable:true,get:function(){return __m10[\"openWindow\"];}});\nconst __m11=__req(\"packages/core/src/compute/statistics.js\");\nObject.defineProperty(__exports,\"MAINTENANCE\",{enumerable:true,get:function(){return __m11[\"MAINTENANCE\"];}});\nObject.defineProperty(__exports,\"APPROXIMATE\",{enumerable:true,get:function(){return __m11[\"APPROXIMATE\"];}});\nObject.defineProperty(__exports,\"maintenanceOf\",{enumerable:true,get:function(){return __m11[\"maintenanceOf\"];}});\n});\n__def(\"packages/worker/src/kernel.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"loadCompute\",{enumerable:true,get:function(){return loadCompute;}});\nObject.defineProperty(__exports,\"setCompute\",{enumerable:true,get:function(){return setCompute;}});\nObject.defineProperty(__exports,\"dispatch\",{enumerable:true,get:function(){return dispatch;}});\nObject.defineProperty(__exports,\"handleMessage\",{enumerable:true,get:function(){return handleMessage;}});\nObject.defineProperty(__exports,\"installKernel\",{enumerable:true,get:function(){return installKernel;}});\nconst __m0=__req(\"packages/worker/src/transport.js\");\nconst PROTOCOL=__m0[\"PROTOCOL\"];\nconst OPS=__m0[\"OPS\"];\nconst CONTROL=__m0[\"CONTROL\"];\nconst ERRORS=__m0[\"ERRORS\"];\nconst unpackHandle=__m0[\"unpackHandle\"];\nconst unpackHandles=__m0[\"unpackHandles\"];\nconst createMaskPool=__m0[\"createMaskPool\"];\nconst collectTransfers=__m0[\"collectTransfers\"];\nconst __m1=__req(\"packages/core/src/store/columnpack.js\");\nconst packChunk=__m1[\"packChunk\"];\nconst packedTransfers=__m1[\"packedTransfers\"];\nlet computeModule=null;\nlet computePromise=null;\nlet computeError=null;\nasync function loadCompute(loader){\nif(computeModule)return computeModule;\nif(!computePromise){\nconst load=loader||(()=>Promise.resolve(__req(\"packages/core/src/compute/index.js\")));\ncomputePromise=Promise.resolve()\n.then(load)\n.then((mod)=>{computeModule=mod;return mod;})\n.catch((err)=>{\ncomputeError=err;\ncomputeModule=null;\nreturn null;\n});\n}\nreturn computePromise;\n}\nfunction setCompute(mod){\ncomputeModule=mod;\ncomputePromise=mod?Promise.resolve(mod):null;\ncomputeError=mod?null:computeError;\n}\nfunction filterContext(handles,count,locale){\nconst byId=new Map();\nfor(const h of handles)if(h)byId.set(h.id,h);\nreturn{\nhandle(colId){return byId.get(colId);},\ncount,\npool:createMaskPool(),\nlocale,\n};\n}\nfunction dispatch(request,compute){\nconst{op,args}=request;\nif(op===OPS.COLUMNIZE){\nreturn packChunk(args.schema||[],args.rows||[],args.opts||{});\n}\nconst fn=compute[op];\nif(typeof fn!=='function'){\nconst err=new Error(`[lattice] compute kernel '${op}' is not exported`);\n(err).code=ERRORS.NO_KERNEL;\nthrow err;\n}\nswitch(op){\ncase OPS.COLLATE_STRING_RANKS:\nreturn fn(args.table||[],(args.table||[]).length,args.locale);\ncase OPS.SORT_COLUMN:\nreturn fn(unpackHandle(args.handle),args.order??null,args.opts||{});\ncase OPS.SORT_MULTI:{\nconst handles=unpackHandles(args.handles||[]);\nconst entries=(args.entries||[]).map((e)=>({\n...e,\nhandle:handles[e.index],\n}));\nreturn fn(handles,entries,args.order??null);\n}\ncase OPS.EVALUATE_FILTERS:\nreturn fn(args.filters,filterContext(unpackHandles(args.handles||[]),args.count,args.locale));\ncase OPS.COMPACT:\nreturn fn(args.mask,args.count,undefined);\ncase OPS.GROUP_BY_COLUMNS:\nreturn fn(unpackHandles(args.handles||[]),args.order??null,args.opts||{});\ncase OPS.TOTAL:\nreturn fn(unpackHandle(args.handle),args.indices??null,args.fn);\ncase OPS.PIVOT:\nreturn fn(unpackHandles(args.handles||[]),args.order??null,args.opts||{});\ncase OPS.FACET:\nreturn fn(unpackHandle(args.handle),args.indices??null,args.count,args.opts||{});\ndefault:{\nconst err=new Error(`[lattice] unknown worker op '${op}'`);\n(err).code=ERRORS.PROTOCOL;\nthrow err;\n}\n}\n}\nasync function handleMessage(message,opts={}){\nif(!message||message.lattice!==PROTOCOL)return null;\nconst{id,op}=message;\nif(op===CONTROL.CANCEL){\nopts.cancelled?.add(message.target);\nreturn null;\n}\nif(op===CONTROL.PING){\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result:'pong'},transfer:[]};\n}\nif(op===OPS.COLUMNIZE){\nif(opts.cancelled?.has(id)){opts.cancelled.delete(id);return null;}\ntry{\nconst result=packChunk(message.args.schema||[],message.args.rows||[],message.args.opts||{});\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result},transfer:packedTransfers(result)};\n}catch(err){\nconst e=(err);\nreturn{\nreply:{lattice:PROTOCOL,id,ok:false,error:{code:e.code||ERRORS.KERNEL,message:e.message||String(err),stack:e.stack}},\ntransfer:[],\n};\n}\n}\nconst compute=await loadCompute(opts.loader);\nif(!compute){\nreturn{\nreply:{\nlattice:PROTOCOL,\nid,\nok:false,\nerror:{\ncode:ERRORS.NO_COMPUTE,\nmessage:`[lattice] compute kernels unavailable in worker: ${computeError?computeError.message:'module not found'}`,\n},\n},\ntransfer:[],\n};\n}\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\ntry{\nconst result=dispatch(message,compute);\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result},transfer:collectTransfers(result)};\n}catch(err){\nconst e=(err);\nreturn{\nreply:{\nlattice:PROTOCOL,\nid,\nok:false,\nerror:{code:e.code||ERRORS.KERNEL,message:e.message||String(err),stack:e.stack},\n},\ntransfer:[],\n};\n}\n}\nfunction installKernel(scope,opts={}){\nconst cancelled=new Set();\nconst onMessage=async(event)=>{\nconst outcome=await handleMessage(event.data,{loader:opts.loader,cancelled});\nif(!outcome)return;\nscope.postMessage(outcome.reply,outcome.transfer);\n};\nscope.addEventListener('message',onMessage);\nloadCompute(opts.loader).then((mod)=>{\nscope.postMessage({lattice:PROTOCOL,id:0,op:CONTROL.READY,compute:!!mod});\n});\nreturn()=>scope.removeEventListener('message',onMessage);\n}\n});\nvar __entry=__req(\"packages/worker/src/kernel.js\");\nroot[\"__latticeKernel\"]=__entry;\n})(typeof globalThis!=='undefined'?globalThis:this);\n__latticeKernel.installKernel(self);\n",{type:'classic'});
|
|
72767
|
+
__req("packages/worker/src/inline.js").setWorkerSource("(function(root){\n'use strict';\nvar __mods=Object.create(null);\nvar __cache=Object.create(null);\nfunction __def(id,fn){__mods[id]=fn;}\nfunction __req(id){\nvar hit=__cache[id];\nif(hit)return hit;\nvar exports=Object.create(null);\n__cache[id]=exports;\nvar fn=__mods[id];\nif(!fn)throw new Error('[lattice] missing module: '+id);\nfn(exports,__req);\nreturn exports;\n}\n__def(\"packages/core/src/internal/util.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"VERSION\",{enumerable:true,get:function(){return VERSION;}});\nObject.defineProperty(__exports,\"reportedWarnings\",{enumerable:true,get:function(){return reportedWarnings;}});\nObject.defineProperty(__exports,\"warnOnce\",{enumerable:true,get:function(){return warnOnce;}});\nObject.defineProperty(__exports,\"infoOnce\",{enumerable:true,get:function(){return infoOnce;}});\nObject.defineProperty(__exports,\"resetWarnings\",{enumerable:true,get:function(){return resetWarnings;}});\nObject.defineProperty(__exports,\"fail\",{enumerable:true,get:function(){return fail;}});\nObject.defineProperty(__exports,\"invariant\",{enumerable:true,get:function(){return invariant;}});\nObject.defineProperty(__exports,\"DEV\",{enumerable:true,get:function(){return DEV;}});\nObject.defineProperty(__exports,\"isObject\",{enumerable:true,get:function(){return isObject;}});\nObject.defineProperty(__exports,\"isFunction\",{enumerable:true,get:function(){return isFunction;}});\nObject.defineProperty(__exports,\"isNil\",{enumerable:true,get:function(){return isNil;}});\nObject.defineProperty(__exports,\"isBlank\",{enumerable:true,get:function(){return isBlank;}});\nObject.defineProperty(__exports,\"isCtor\",{enumerable:true,get:function(){return isCtor;}});\nObject.defineProperty(__exports,\"pathGetter\",{enumerable:true,get:function(){return pathGetter;}});\nObject.defineProperty(__exports,\"pathSetter\",{enumerable:true,get:function(){return pathSetter;}});\nObject.defineProperty(__exports,\"getPath\",{enumerable:true,get:function(){return getPath;}});\nObject.defineProperty(__exports,\"setPath\",{enumerable:true,get:function(){return setPath;}});\nObject.defineProperty(__exports,\"humanise\",{enumerable:true,get:function(){return humanise;}});\nObject.defineProperty(__exports,\"escapeHtml\",{enumerable:true,get:function(){return escapeHtml;}});\nObject.defineProperty(__exports,\"titleCase\",{enumerable:true,get:function(){return titleCase;}});\nObject.defineProperty(__exports,\"expand\",{enumerable:true,get:function(){return expand;}});\nObject.defineProperty(__exports,\"toArray\",{enumerable:true,get:function(){return toArray;}});\nObject.defineProperty(__exports,\"merge\",{enumerable:true,get:function(){return merge;}});\nObject.defineProperty(__exports,\"mergeRow\",{enumerable:true,get:function(){return mergeRow;}});\nObject.defineProperty(__exports,\"Lru\",{enumerable:true,get:function(){return Lru;}});\nObject.defineProperty(__exports,\"collator\",{enumerable:true,get:function(){return collator;}});\nObject.defineProperty(__exports,\"defaultCompare\",{enumerable:true,get:function(){return defaultCompare;}});\nObject.defineProperty(__exports,\"now\",{enumerable:true,get:function(){return now;}});\nObject.defineProperty(__exports,\"nextFrame\",{enumerable:true,get:function(){return nextFrame;}});\nObject.defineProperty(__exports,\"cancelFrame\",{enumerable:true,get:function(){return cancelFrame;}});\nObject.defineProperty(__exports,\"frameBatched\",{enumerable:true,get:function(){return frameBatched;}});\nObject.defineProperty(__exports,\"settleDebounce\",{enumerable:true,get:function(){return settleDebounce;}});\nObject.defineProperty(__exports,\"whenIdle\",{enumerable:true,get:function(){return whenIdle;}});\nObject.defineProperty(__exports,\"uid\",{enumerable:true,get:function(){return uid;}});\nconst STAMPED_VERSION=\"1.24.0\";\nasync function resolveVersion(){\nif(STAMPED_VERSION!=='0.0.0-source')return STAMPED_VERSION;\ntry{\nif(typeof process==='undefined'||!process.versions||!process.versions.node){\nreturn STAMPED_VERSION;\n}\nconst mod=await import('node:'+'module');\nconst req=mod.createRequire((typeof document!=='undefined'&&document.currentScript?document.currentScript.src:''));\nconst fs=req('node:'+'fs');\nconst url=new URL('../../../../package.json',(typeof document!=='undefined'&&document.currentScript?document.currentScript.src:''));\nconst text=fs.readFileSync(url,'utf8');\nreturn JSON.parse(text).version||STAMPED_VERSION;\n}catch{\nreturn STAMPED_VERSION;\n}\n}\nconst VERSION=\"1.24.0\";\nconst warned=new Set();\nconst WARNED_LIMIT=2000;\nfunction rememberWarned(key){\nwarned.add(key);\nif(warned.size>WARNED_LIMIT){\nconst oldest=warned.values().next().value;\nif(oldest!==undefined)warned.delete(oldest);\n}\n}\nconst reported=[];\nconst REPORT_LIMIT=500;\nfunction record(key,level,message){\nreported.push({\nkey,\nlevel,\nmessage:message.map((m)=>(typeof m==='string'?m:safeString(m))).join(' '),\nat:Date.now(),\n});\nif(reported.length>REPORT_LIMIT)reported.shift();\n}\nfunction safeString(value){\nif(value instanceof Error)return value.message;\ntry{return JSON.stringify(value);}catch{return String(value);}\n}\nfunction reportedWarnings(){return reported.map((r)=>({...r}));}\nfunction warnOnce(key,...message){\nif(warned.has(key))return;\nrememberWarned(key);\nrecord(key,'warn',message);\nconsole.warn('[lattice]',...message);\n}\nfunction infoOnce(key,...message){\nif(warned.has(key))return;\nrememberWarned(key);\nrecord(key,'info',message);\nconsole.info('[lattice]',...message);\n}\nfunction resetWarnings(){\nwarned.clear();\nreported.length=0;\n}\nfunction fail(message,extra){\nconst err=new Error(`[lattice] ${message}`);\nif(extra!==undefined)err.cause=extra;\nthrow err;\n}\nfunction invariant(condition,message){\nif(!condition)fail(message);\n}\nconst DEV=(()=>{\ntry{\nreturn!(typeof process!=='undefined'&&process.env\n&&process.env.NODE_ENV==='production');\n}catch{\nreturn true;\n}\n})();\nfunction isObject(v){\nreturn v!==null&&typeof v==='object'&&!Array.isArray(v);\n}\nfunction isFunction(v){\nreturn typeof v==='function';\n}\nfunction isNil(v){\nreturn v===null||v===undefined;\n}\nfunction isBlank(v){\nreturn v===null||v===undefined||v==='';\n}\nfunction isCtor(v){\nif(typeof v!=='function')return false;\nif(/^class[\\s{]/.test(Function.prototype.toString.call(v)))return true;\nreturn!!(v.prototype&&Object.getOwnPropertyNames(v.prototype).length>1);\n}\nconst pathCache=new Map();\nfunction pathGetter(path){\nlet fn=pathCache.get(path);\nif(fn)return fn;\nif(!path.includes('.')){\nfn=(o)=>(o==null?undefined:o[path]);\n}else{\nconst parts=path.split('.');\nconst n=parts.length;\nfn=(o)=>{\nlet cur=o;\nfor(let i=0;i<n;i++){\nif(cur==null)return undefined;\ncur=cur[parts[i]];\n}\nreturn cur;\n};\n}\npathCache.set(path,fn);\nreturn fn;\n}\nconst setterCache=new Map();\nfunction pathSetter(path){\nlet fn=setterCache.get(path);\nif(fn)return fn;\nif(!path.includes('.')){\nfn=(o,v)=>{if(o!=null)o[path]=v;};\n}else{\nconst parts=path.split('.');\nconst last=parts.length-1;\nfn=(o,v)=>{\nlet cur=o;\nfor(let i=0;i<last;i++){\nif(cur==null)return;\nconst k=parts[i];\nif(cur[k]==null)cur[k]={};\ncur=cur[k];\n}\nif(cur!=null)cur[parts[last]]=v;\n};\n}\nsetterCache.set(path,fn);\nreturn fn;\n}\nfunction getPath(obj,path){\nreturn pathGetter(path)(obj);\n}\nfunction setPath(obj,path,value){\npathSetter(path)(obj,value);\n}\nfunction humanise(field){\nif(!field)return'';\nconst leaf=field.includes('.')?field.slice(field.lastIndexOf('.')+1):field;\nreturn leaf\n.replace(/[_-]+/g,' ')\n.replace(/([a-z0-9])([A-Z])/g,'$1 $2')\n.replace(/([A-Z]+)([A-Z][a-z])/g,'$1 $2')\n.replace(/\\s+/g,' ')\n.trim()\n.replace(/^./,(c)=>c.toUpperCase());\n}\nconst ESCAPES={'&':'&','<':'<','>':'>','\"':'"',\"'\":'''};\nfunction escapeHtml(s){\nconst str=s==null?'':String(s);\nreturn/[&<>\"']/.test(str)?str.replace(/[&<>\"']/g,(c)=>ESCAPES[c]):str;\n}\nfunction titleCase(s){\nreturn String(s).replace(/\\w\\S*/g,(t)=>t[0].toUpperCase()+t.slice(1).toLowerCase());\n}\nfunction expand(value,key,whenTrue){\nif(value===undefined)return undefined;\nif(value===true)return{enabled:true,...whenTrue};\nif(value===false)return{enabled:false};\nif(isObject(value))return value;\nreturn{[key]:value,enabled:true};\n}\nfunction toArray(v){\nif(v===undefined||v===null)return[];\nreturn Array.isArray(v)?v:[v];\n}\nconst MERGE_FORBIDDEN_KEYS=Object.freeze(new Set(['__proto__','constructor','prototype']));\nfunction merge(a,b){\nif(!isObject(a))return isObject(b)?{...b}:b;\nif(!isObject(b))return b===undefined?a:b;\nconst out={...a};\nfor(const k of Object.keys(b)){\nif(MERGE_FORBIDDEN_KEYS.has(k))continue;\nconst bv=b[k];\nif(bv===undefined)continue;\nout[k]=isObject(bv)&&isObject(out[k])?merge(out[k],bv):bv;\n}\nreturn out;\n}\nfunction mergeRow(previous,patch){\nif(!isObject(previous)||!isObject(patch)||previous===patch)return patch;\nconst out=Object.create(Object.getPrototypeOf(previous));\nObject.assign(out,previous,patch);\nreturn out;\n}\nclass Lru{\n#max;\n#map=new Map();\n#onEvict;\nconstructor(max=256,onEvict=null){\nthis.#max=max;\nthis.#onEvict=onEvict;\n}\nget size(){\nreturn this.#map.size;\n}\nget max(){\nreturn this.#max;\n}\nset max(v){\nthis.#max=v;\nthis.#trim();\n}\nhas(k){\nreturn this.#map.has(k);\n}\nget(k){\nconst m=this.#map;\nif(!m.has(k))return undefined;\nconst v=m.get(k);\nm.delete(k);\nm.set(k,v);\nreturn v;\n}\npeek(k){\nreturn this.#map.get(k);\n}\nset(k,v){\nconst m=this.#map;\nif(m.has(k))m.delete(k);\nm.set(k,v);\nthis.#trim();\nreturn v;\n}\ndelete(k){\nconst v=this.#map.get(k);\nif(this.#map.delete(k)&&this.#onEvict)this.#onEvict(v,k);\nreturn v;\n}\nclear(){\nif(this.#onEvict)for(const[k,v]of this.#map)this.#onEvict(v,k);\nthis.#map.clear();\n}\nkeys(){\nreturn this.#map.keys();\n}\nvalues(){\nreturn this.#map.values();\n}\n#trim(){\nconst m=this.#map;\nwhile(m.size>this.#max){\nconst oldest=m.keys().next().value;\nconst v=m.get(oldest);\nm.delete(oldest);\nif(this.#onEvict)this.#onEvict(v,oldest);\n}\n}\n}\nconst collators=new Map();\nfunction collator(locale,opts){\nconst key=`${locale||''}|${opts?JSON.stringify(opts):''}`;\nlet c=collators.get(key);\nif(!c){\nc=new Intl.Collator(locale||undefined,{\nnumeric:true,sensitivity:'variant',...opts,\n});\ncollators.set(key,c);\n}\nreturn c;\n}\nfunction defaultCompare(a,b){\nif(a===b)return 0;\nif(a===null||a===undefined)return 1;\nif(b===null||b===undefined)return-1;\nif(typeof a==='number'&&typeof b==='number'){\nif(Number.isNaN(a))return Number.isNaN(b)?0:1;\nif(Number.isNaN(b))return-1;\nreturn a<b?-1:a>b?1:0;\n}\nconst sa=String(a);\nconst sb=String(b);\nreturn sa<sb?-1:sa>sb?1:0;\n}\nfunction now(){\nreturn typeof performance!=='undefined'&&performance.now\n?performance.now()\n:Date.now();\n}\nconst hasRaf=typeof requestAnimationFrame==='function';\nfunction nextFrame(fn){\nif(hasRaf)return requestAnimationFrame(fn);\nreturn setTimeout(()=>fn(now()),16);\n}\nfunction cancelFrame(handle){\nif(handle==null)return;\nif(hasRaf)cancelAnimationFrame(handle);\nelse clearTimeout(handle);\n}\nfunction frameBatched(fn){\nlet handle=null;\nlet lastArgs=null;\nconst run=()=>{\nhandle=null;\nconst a=lastArgs;\nlastArgs=null;\nfn(...(a||[]));\n};\nconst wrapped=(...args)=>{\nlastArgs=args;\nif(handle===null)handle=nextFrame(run);\n};\nwrapped.cancel=()=>{\ncancelFrame(handle);\nhandle=null;\nlastArgs=null;\n};\nwrapped.flush=()=>{\nif(handle!==null){\ncancelFrame(handle);\nrun();\n}\n};\nreturn wrapped;\n}\nfunction settleDebounce(fn,waitMs){\nlet timer=null;\nlet held=null;\nconst trailing=()=>{\ntimer=null;\nif(held===null)return;\nconst args=held;\nheld=null;\nfn(...args);\narm();\n};\nconst arm=()=>{\ntimer=setTimeout(trailing,waitMs);\nif(typeof timer?.unref==='function')timer.unref();\n};\nconst wrapped=(...args)=>{\nif(timer===null){\nfn(...args);\narm();\n}else{\nheld=args;\nclearTimeout(timer);\narm();\n}\n};\nwrapped.flush=()=>{\nif(timer!==null)clearTimeout(timer);\ntimer=null;\nif(held===null)return;\nconst args=held;\nheld=null;\nfn(...args);\n};\nwrapped.cancel=()=>{\nif(timer!==null)clearTimeout(timer);\ntimer=null;\nheld=null;\n};\nwrapped.pending=()=>timer!==null||held!==null;\nreturn wrapped;\n}\nfunction whenIdle(fn,timeout=50){\nif(typeof requestIdleCallback==='function'){\nreturn requestIdleCallback(fn,{timeout});\n}\nreturn setTimeout(()=>fn({timeRemaining:()=>0,didTimeout:true}),1);\n}\nlet idSeq=0;\nfunction uid(prefix='l'){\nreturn`${prefix}${(++idSeq).toString(36)}`;\n}\n});\n__def(\"packages/worker/src/transport.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"PROTOCOL\",{enumerable:true,get:function(){return PROTOCOL;}});\nObject.defineProperty(__exports,\"OPS\",{enumerable:true,get:function(){return OPS;}});\nObject.defineProperty(__exports,\"CONTROL\",{enumerable:true,get:function(){return CONTROL;}});\nObject.defineProperty(__exports,\"ERRORS\",{enumerable:true,get:function(){return ERRORS;}});\nObject.defineProperty(__exports,\"packHandle\",{enumerable:true,get:function(){return packHandle;}});\nObject.defineProperty(__exports,\"packHandles\",{enumerable:true,get:function(){return packHandles;}});\nObject.defineProperty(__exports,\"TransportedDictionary\",{enumerable:true,get:function(){return TransportedDictionary;}});\nObject.defineProperty(__exports,\"unpackHandle\",{enumerable:true,get:function(){return unpackHandle;}});\nObject.defineProperty(__exports,\"unpackHandles\",{enumerable:true,get:function(){return unpackHandles;}});\nObject.defineProperty(__exports,\"createMaskPool\",{enumerable:true,get:function(){return createMaskPool;}});\nObject.defineProperty(__exports,\"isTransferable\",{enumerable:true,get:function(){return isTransferable;}});\nObject.defineProperty(__exports,\"collectTransfers\",{enumerable:true,get:function(){return collectTransfers;}});\nObject.defineProperty(__exports,\"isPortable\",{enumerable:true,get:function(){return isPortable;}});\nObject.defineProperty(__exports,\"filterColumnIds\",{enumerable:true,get:function(){return filterColumnIds;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst isFunction=__m0[\"isFunction\"];\nconst PROTOCOL=1;\nconst OPS=Object.freeze({\nSORT_COLUMN:'sortColumn',\nSORT_MULTI:'sortMulti',\nEVALUATE_FILTERS:'evaluateFilters',\nCOMPACT:'compact',\nGROUP_BY_COLUMNS:'groupByColumns',\nTOTAL:'total',\nPIVOT:'pivot',\nFACET:'facet',\nCOLUMNIZE:'columnize',\nCOLLATE_STRING_RANKS:'collateStringRanks',\n});\nconst CONTROL=Object.freeze({\nREADY:'ready',\nCANCEL:'cancel',\nPING:'ping',\n});\nconst ERRORS=Object.freeze({\nNO_COMPUTE:'E_NO_COMPUTE',\nNO_KERNEL:'E_NO_KERNEL',\nABORTED:'E_ABORTED',\nKERNEL:'E_KERNEL',\nPROTOCOL:'E_PROTOCOL',\n});\nfunction packHandle(handle){\nif(handle==null)return null;\nconst presence=handle.presence;\nreturn{\nid:handle.id,\nkind:handle.kind,\nnullable:!!handle.nullable,\nvalues:handle.values??null,\npresence:presence?(presence.words??presence):null,\npresenceBits:presence?(presence.size??(presence.words??presence).length*8):0,\ndict:handle.dict?sliceDictionary(handle.dict):null,\noffsets:handle.offsets??null,\nversion:handle.version??0,\n};\n}\nfunction sliceDictionary(dict){\nif(Array.isArray(dict))return dict;\nif(isFunction(dict.values))return dict.values();\nreturn[];\n}\nfunction packHandles(handles){\nconst out=new Array(handles.length);\nfor(let i=0;i<handles.length;i++)out[i]=packHandle(handles[i]);\nreturn out;\n}\nclass TransportedBitset{\n#words;\n#bits;\nconstructor(words,bits){\nthis.#words=words;\nthis.#bits=bits;\n}\nget words(){return this.#words;}\nget size(){return this.#bits;}\nget(i){return(this.#words[i>>>3]&(1<<(i&7)))!==0;}\ncount(){\nconst w=this.#words;\nlet n=0;\nfor(let i=0;i<w.length;i++){\nlet v=w[i];\nwhile(v){v&=v-1;n++;}\n}\nreturn n;\n}\n}\nclass TransportedDictionary{\n#values;\n#index=null;\n#version=0;\n#ranks=new Map();\nconstructor(values){\nthis.#values=values||[];\n}\nget size(){return this.#values.length;}\nget version(){return this.#version;}\ncodeOf(value){\nif(this.#index===null){\nthis.#index=new Map();\nfor(let i=0;i<this.#values.length;i++)this.#index.set(this.#values[i],i);\n}\nconst found=this.#index.get(value);\nif(found!==undefined)return found;\nconst code=this.#values.length;\nthis.#values.push(value);\nthis.#index.set(value,code);\nthis.#version++;\nreturn code;\n}\nvalueOf(code){return this.#values[code];}\nvalues(){return this.#values;}\nranks(locale){\nconst key=locale||'';\nconst cached=this.#ranks.get(key);\nif(cached&&cached.version===this.#version)return cached.ranks;\nconst n=this.#values.length;\nconst order=new Uint32Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\nconst cmp=collator(locale).compare;\nconst vals=this.#values;\nconst sorted=Array.from(order).sort((a,b)=>{\nconst av=vals[a];\nconst bv=vals[b];\nif(av===bv)return 0;\nif(av===null||av===undefined)return 1;\nif(bv===null||bv===undefined)return-1;\nreturn cmp(String(av),String(bv));\n});\nconst ranks=new Uint32Array(n);\nfor(let r=0;r<sorted.length;r++)ranks[sorted[r]]=r;\nthis.#ranks.set(key,{version:this.#version,ranks});\nreturn ranks;\n}\n}\nfunction unpackHandle(packed){\nif(packed==null)return null;\nconst presence=packed.presence\n?new TransportedBitset(packed.presence,packed.presenceBits||packed.presence.length*8)\n:null;\nconst dict=packed.dict?new TransportedDictionary(packed.dict):null;\nconst values=packed.values;\nconst offsets=packed.offsets??null;\nconst kind=packed.kind;\nconst get=(physical)=>{\nif(presence&&!presence.get(physical))return null;\nswitch(kind){\ncase'dictionary':\nreturn dict?dict.valueOf(values[physical]):values[physical];\ncase'bitset':\nreturn(values[physical>>>3]&(1<<(physical&7)))!==0;\ncase'multi':{\nif(!offsets)return null;\nconst from=offsets[physical];\nconst to=offsets[physical+1];\nconst out=new Array(to-from);\nfor(let i=from;i<to;i++)out[i-from]=dict?dict.valueOf(values[i]):values[i];\nreturn out;\n}\ndefault:\nreturn values[physical];\n}\n};\nreturn{\nid:packed.id,\nkind,\nnullable:packed.nullable,\nvalues,\npresence,\ndict,\noffsets,\nget,\nversion:packed.version,\n};\n}\nfunction unpackHandles(packed){\nconst out=new Array(packed.length);\nfor(let i=0;i<packed.length;i++)out[i]=unpackHandle(packed[i]);\nreturn out;\n}\nfunction createMaskPool(){\nconst masks=[];\nconst indices=[];\nreturn{\nmask(n){\nfor(let i=0;i<masks.length;i++){\nif(masks[i].length>=n){\nconst buf=masks.splice(i,1)[0].subarray(0,n);\nbuf.fill(0);\nreturn buf;\n}\n}\nreturn new Uint8Array(n);\n},\nindices(n){\nfor(let i=0;i<indices.length;i++){\nif(indices[i].length>=n)return indices.splice(i,1)[0].subarray(0,n);\n}\nreturn new Uint32Array(n);\n},\nrelease(buf){\nif(!buf)return;\nif(buf instanceof Uint8Array)masks.push(buf);\nelse if(buf instanceof Uint32Array)indices.push(buf);\n},\nclear(){masks.length=0;indices.length=0;},\n};\n}\nfunction isTransferable(v){\nif(!ArrayBuffer.isView(v))return false;\nconst buf=(v).buffer;\nif(!buf)return false;\nreturn typeof SharedArrayBuffer==='undefined'||!(buf instanceof SharedArrayBuffer);\n}\nfunction collectTransfers(value,out=[]){\nconst add=(v)=>{\nif(!isTransferable(v))return;\nconst buf=(v).buffer;\nif(!out.includes(buf))out.push(buf);\n};\nif(value==null)return out;\nif(ArrayBuffer.isView(value)){add(value);return out;}\nif(Array.isArray(value)){\nfor(const item of value)add(item);\nreturn out;\n}\nif(typeof value==='object'){\nfor(const key of Object.keys(value)){\nconst item=(value)[key];\nif(Array.isArray(item))for(const sub of item)add(sub);\nelse add(item);\n}\n}\nreturn out;\n}\nfunction isPortable(value,depth=0){\nif(value==null)return true;\nconst t=typeof value;\nif(t==='function'||t==='symbol')return false;\nif(t!=='object')return true;\nif(depth>4)return true;\nif(ArrayBuffer.isView(value)||value instanceof ArrayBuffer||value instanceof Date)return true;\nif(Array.isArray(value)){\nfor(const item of value)if(!isPortable(item,depth+1))return false;\nreturn true;\n}\nfor(const key of Object.keys(value)){\nif(!isPortable((value)[key],depth+1))return false;\n}\nreturn true;\n}\nfunction filterColumnIds(filters,out=new Set()){\nif(!filters||typeof filters!=='object')return out;\nconst node=(filters);\nif(typeof node.col==='string')out.add(node.col);\nconst conditions=node.conditions;\nif(Array.isArray(conditions))for(const child of conditions)filterColumnIds(child,out);\nreturn out;\n}\n});\n__def(\"packages/core/src/store/bitset.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Bitset\",{enumerable:true,get:function(){return Bitset;}});\nconst WORD_BITS=8;\nclass Bitset{\nstatic#POP=new Uint8Array(256);\nstatic{\nfor(let i=1;i<256;i++)Bitset.#POP[i]=Bitset.#POP[i>>1]+(i&1);\n}\n#words;\n#bits;\nconstructor(bits=0){\nconst n=Math.max(0,bits|0);\nthis.#bits=n;\nthis.#words=new Uint8Array(Math.ceil(n/WORD_BITS));\n}\nget size(){return this.#bits;}\nget words(){return this.#words;}\nget bytes(){return this.#words?this.#words.byteLength:0;}\nget(i){\nif(i<0||i>=this.#bits)return 0;\nreturn(this.#words[i>>3]>>(i&7))&1;\n}\nset(i){\nif(i>=0&&i<this.#bits)this.#words[i>>3]|=1<<(i&7);\nreturn this;\n}\nclear(i){\nif(i>=0&&i<this.#bits)this.#words[i>>3]&=~(1<<(i&7));\nreturn this;\n}\nassign(i,bit){return bit?this.set(i):this.clear(i);}\nfill(bit=false){\nthis.#words.fill(bit?0xff:0);\nif(bit)this.#maskTail();\nreturn this;\n}\ngrow(bits){\nconst n=Math.max(0,bits|0);\nif(n<=this.#bits)return this;\nconst need=Math.ceil(n/WORD_BITS);\nif(need>this.#words.length){\nconst next=new Uint8Array(need);\nnext.set(this.#words);\nthis.#words=next;\n}\nthis.#bits=n;\nreturn this;\n}\ncount(){\nconst w=this.#words;\nconst pop=Bitset.#POP;\nlet total=0;\nfor(let i=0;i<w.length;i++)total+=pop[w[i]];\nreturn total;\n}\nand(other){\nconst b=other instanceof Bitset?other.words:other;\nconst w=this.#words;\nconst shared=Math.min(w.length,b.length);\nfor(let i=0;i<shared;i++)w[i]&=b[i];\nfor(let i=shared;i<w.length;i++)w[i]=0;\nreturn this;\n}\nor(other){\nconst b=other instanceof Bitset?other.words:other;\nconst w=this.#words;\nconst shared=Math.min(w.length,b.length);\nfor(let i=0;i<shared;i++)w[i]|=b[i];\nreturn this;\n}\nnot(){\nconst w=this.#words;\nfor(let i=0;i<w.length;i++)w[i]=~w[i]&0xff;\nthis.#maskTail();\nreturn this;\n}\nclone(){\nconst out=new Bitset(this.#bits);\nout.words.set(this.#words.subarray(0,out.words.length));\nreturn out;\n}\nrelease(){\nthis.#words=new Uint8Array(0);\nthis.#bits=0;\n}\n#maskTail(){\nconst used=this.#bits&7;\nif(used===0)return;\nconst last=(this.#bits>>3);\nif(last<this.#words.length)this.#words[last]&=(1<<used)-1;\n}\nstatic from(bools){\nconst arr=Array.isArray(bools)?bools:Array.from(bools);\nconst out=new Bitset(arr.length);\nfor(let i=0;i<arr.length;i++)if(arr[i])out.set(i);\nreturn out;\n}\n}\n});\n__def(\"packages/core/src/store/dictionary.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Dictionary\",{enumerable:true,get:function(){return Dictionary;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst defaultCompare=__m0[\"defaultCompare\"];\nclass Dictionary{\n#values;\n#codes=new Map();\n#version=0;\n#ranks=null;\n#ranksVersion=-1;\n#ranksLocale='\\u0000';\nconstructor(values=[]){\nthis.#values=[];\nfor(let i=0;i<values.length;i++){\nconst v=values[i];\nif(this.#codes.has(v))continue;\nthis.#codes.set(v,this.#values.length);\nthis.#values.push(v);\n}\n}\nget size(){return this.#values.length;}\nget version(){return this.#version;}\nget bytes(){\nlet total=this.#values.length*8;\nfor(let i=0;i<this.#values.length;i++){\nconst v=this.#values[i];\nif(typeof v==='string')total+=v.length*2;\ntotal+=16;\n}\nreturn total;\n}\ncodeOf(value){\nconst existing=this.#codes.get(value);\nif(existing!==undefined)return existing;\nconst code=this.#values.length;\nthis.#values.push(value);\nthis.#codes.set(value,code);\nthis.#version++;\nreturn code;\n}\nlookup(value){\nconst code=this.#codes.get(value);\nreturn code===undefined?-1:code;\n}\nhas(value){return this.#codes.has(value);}\nvalueOf(code){return this.#values[code];}\nvalues(){return this.#values;}\nranks(locale){\nconst key=locale||'';\nif(this.#ranks&&this.#ranksVersion===this.#version&&this.#ranksLocale===key){\nreturn this.#ranks;\n}\nconst n=this.#values.length;\nconst order=new Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\nconst cmp=collator(locale).compare;\nconst values=this.#values;\norder.sort((a,b)=>this.#compare(values[a],values[b],cmp));\nconst ranks=new Uint32Array(n);\nfor(let rank=0;rank<n;rank++)ranks[order[rank]]=rank;\nthis.#ranks=ranks;\nthis.#ranksVersion=this.#version;\nthis.#ranksLocale=key;\nreturn ranks;\n}\n#compare(a,b,compare){\nif(typeof a==='string'&&typeof b==='string')return compare(a,b);\nreturn defaultCompare(a,b);\n}\n}\n});\n__def(\"packages/core/src/store/multivalue.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"MultiValue\",{enumerable:true,get:function(){return MultiValue;}});\nclass MultiValue{\n#values;\n#offsets;\n#rows=0;\n#fill=0;\nconstructor(capacity={}){\nconst rows=Math.max(1,capacity.rows??16);\nconst values=Math.max(1,capacity.values??rows);\nthis.#values=new Int32Array(values);\nthis.#offsets=new Uint32Array(rows+1);\n}\nget values(){return this.#values;}\nget offsets(){return this.#offsets;}\nget rows(){return this.#rows;}\nget length(){return this.#fill;}\nget bytes(){return this.#values.byteLength+this.#offsets.byteLength;}\ncount(r){\nif(r<0||r>=this.#rows)return 0;\nreturn this.#offsets[r+1]-this.#offsets[r];\n}\nat(r){\nif(r<0||r>=this.#rows)return this.#values.subarray(0,0);\nreturn this.#values.subarray(this.#offsets[r],this.#offsets[r+1]);\n}\nhas(r,code){\nif(r<0||r>=this.#rows)return false;\nconst v=this.#values;\nconst end=this.#offsets[r+1];\nfor(let i=this.#offsets[r];i<end;i++)if(v[i]===code)return true;\nreturn false;\n}\nhasAny(r,codes){\nfor(let i=0;i<codes.length;i++)if(this.has(r,codes[i]))return true;\nreturn false;\n}\nhasAll(r,codes){\nfor(let i=0;i<codes.length;i++)if(!this.has(r,codes[i]))return false;\nreturn true;\n}\nhasNone(r,codes){return!this.hasAny(r,codes);}\npush(codes){\nconst r=this.#rows;\nconst n=codes.length;\nthis.#ensureRows(r+1);\nthis.#ensureValues(this.#fill+n);\nconst start=this.#fill;\nfor(let i=0;i<n;i++)this.#values[start+i]=codes[i]|0;\nthis.#fill+=n;\nthis.#rows=r+1;\nthis.#offsets[r]=start;\nthis.#offsets[r+1]=this.#fill;\nreturn r;\n}\nwrite(r,codes){\nif(r===this.#rows){this.push(codes);return;}\nif(r<0||r>this.#rows)return;\nconst start=this.#offsets[r];\nconst end=this.#offsets[r+1];\nconst n=codes.length;\nif(end-start===n){\nfor(let i=0;i<n;i++)this.#values[start+i]=codes[i]|0;\nreturn;\n}\nthis.#rebuild(r,codes);\n}\ncompact(remap,liveCount,dead){\nconst oldValues=this.#values;\nconst oldOffsets=this.#offsets;\nconst oldRows=this.#rows;\nconst values=new Int32Array(Math.max(1,this.#fill));\nconst offsets=new Uint32Array(liveCount+1);\nlet w=0;\nfor(let p=0;p<oldRows;p++){\nif(remap[p]===dead)continue;\nconst start=oldOffsets[p];\nconst end=oldOffsets[p+1];\noffsets[remap[p]]=w;\nfor(let i=start;i<end;i++)values[w++]=oldValues[i];\noffsets[remap[p]+1]=w;\n}\nthis.#values=values;\nthis.#offsets=offsets;\nthis.#rows=liveCount;\nthis.#fill=w;\n}\nrelease(){\nthis.#values=new Int32Array(0);\nthis.#offsets=new Uint32Array(1);\nthis.#rows=0;\nthis.#fill=0;\n}\n#ensureRows(rows){\nif(rows+1<=this.#offsets.length)return;\nlet cap=this.#offsets.length-1;\nwhile(cap<rows)cap=cap*2||16;\nconst next=new Uint32Array(cap+1);\nnext.set(this.#offsets);\nthis.#offsets=next;\n}\n#ensureValues(n){\nif(n<=this.#values.length)return;\nlet cap=this.#values.length;\nwhile(cap<n)cap=cap*2||16;\nconst next=new Int32Array(cap);\nnext.set(this.#values);\nthis.#values=next;\n}\n#rebuild(r,codes){\nconst oldValues=this.#values;\nconst oldOffsets=this.#offsets;\nconst rows=this.#rows;\nconst delta=codes.length-(oldOffsets[r+1]-oldOffsets[r]);\nconst values=new Int32Array(Math.max(1,this.#fill+delta));\nconst offsets=new Uint32Array(oldOffsets.length);\nlet w=0;\nfor(let p=0;p<rows;p++){\noffsets[p]=w;\nif(p===r){\nfor(let i=0;i<codes.length;i++)values[w++]=codes[i]|0;\n}else{\nfor(let i=oldOffsets[p];i<oldOffsets[p+1];i++)values[w++]=oldValues[i];\n}\noffsets[p+1]=w;\n}\nthis.#values=values;\nthis.#offsets=offsets;\nthis.#fill=w;\n}\n}\n});\n__def(\"packages/core/src/compute/handle.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"identity\",{enumerable:true,get:function(){return identity;}});\nObject.defineProperty(__exports,\"rowCount\",{enumerable:true,get:function(){return rowCount;}});\nObject.defineProperty(__exports,\"bitReader\",{enumerable:true,get:function(){return bitReader;}});\nObject.defineProperty(__exports,\"presenceReader\",{enumerable:true,get:function(){return presenceReader;}});\nObject.defineProperty(__exports,\"dictSize\",{enumerable:true,get:function(){return dictSize;}});\nObject.defineProperty(__exports,\"dictValue\",{enumerable:true,get:function(){return dictValue;}});\nObject.defineProperty(__exports,\"multiValue\",{enumerable:true,get:function(){return multiValue;}});\nObject.defineProperty(__exports,\"valueReader\",{enumerable:true,get:function(){return valueReader;}});\nObject.defineProperty(__exports,\"numericTotalOrder\",{enumerable:true,get:function(){return numericTotalOrder;}});\nObject.defineProperty(__exports,\"valueComparator\",{enumerable:true,get:function(){return valueComparator;}});\nObject.defineProperty(__exports,\"dictRanks\",{enumerable:true,get:function(){return dictRanks;}});\nObject.defineProperty(__exports,\"isMissing\",{enumerable:true,get:function(){return isMissing;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst collator=__m0[\"collator\"];\nconst defaultCompare=__m0[\"defaultCompare\"];\nconst warnOnce=__m0[\"warnOnce\"];\nfunction identity(n){\nconst out=new Uint32Array(n);\nfor(let i=0;i<n;i++)out[i]=i;\nreturn out;\n}\nfunction rowCount(handle,opts){\nif(opts&&typeof opts.count==='number')return opts.count;\nif(!handle)return 0;\nif(typeof handle.count==='number')return handle.count;\nif(typeof handle.length==='number')return handle.length;\nconst values=handle.values;\nif(handle.kind==='multi'&&handle.offsets)return Math.max(0,handle.offsets.length-1);\nif(!values)return handle.presence&&typeof handle.presence.size==='number'?handle.presence.size:0;\nif(handle.kind==='bitset'){\nif(typeof values.size==='number')return values.size;\nif(handle.presence&&typeof handle.presence.size==='number')return handle.presence.size;\nwarnOnce(`count:${handle.id}`,`column \"${handle.id}\" is bitset-backed with no declared row count; assuming ${values.length*8}`);\nreturn values.length*8;\n}\nreturn values.length;\n}\nconst bitOrders=new WeakMap();\nfunction bitOrderOf(bitset){\nconst ctor=bitset.constructor;\nif(!ctor)return'unknown';\nconst cached=bitOrders.get(ctor);\nif(cached)return cached;\nlet order='unknown';\ntry{\nlet probe=null;\nif(typeof ctor.from==='function')probe=ctor.from([false,true]);\nelse{\nprobe=new ctor(8);\nprobe.set(1);\n}\nconst words=probe&&probe.words;\nif(words&&words.length){\nif(words[0]===0x02)order='lsb';\nelse if(words[0]===0x40)order='msb';\n}\n}catch{\norder='unknown';\n}\nbitOrders.set(ctor,order);\nreturn order;\n}\nfunction bitReader(bits){\nif(!bits)return()=>0;\nconst raw=bits instanceof Uint8Array?bits:bits.words;\nif(raw instanceof Uint8Array){\nconst order=bits instanceof Uint8Array?'lsb':bitOrderOf(bits);\nif(order==='lsb')return(i)=>(raw[i>>>3]>>>(i&7))&1;\nif(order==='msb')return(i)=>(raw[i>>>3]>>>(7-(i&7)))&1;\n}\nif(typeof bits.get==='function')return(i)=>(bits.get(i)?1:0);\nreturn()=>0;\n}\nfunction presenceReader(handle){\nif(!handle||!handle.presence)return null;\nreturn bitReader(handle.presence);\n}\nfunction dictSize(dict){\nif(!dict)return 0;\nif(typeof dict.size==='number')return dict.size;\nif(typeof dict.values==='function')return dict.values().length;\nreturn 0;\n}\nfunction dictValue(dict,code){\nif(!dict)return null;\nif(typeof dict.valueOf==='function')return dict.valueOf(code);\nif(typeof dict.values==='function')return dict.values()[code];\nreturn null;\n}\nfunction multiValue(handle,i){\nconst offsets=handle.offsets;\nconst values=handle.values;\nif(!offsets||!values)return[];\nconst from=offsets[i];\nconst to=offsets[i+1];\nif(!(to>from))return[];\nconst dict=handle.dict;\nconst out=new Array(to-from);\nfor(let k=from;k<to;k++)out[k-from]=dict?dictValue(dict,values[k]):values[k];\nreturn out;\n}\nfunction valueReader(handle){\nif(!handle)return()=>undefined;\nconst values=handle.values;\nconst present=presenceReader(handle);\nconst kind=handle.kind;\nif(kind==='dictionary'){\nconst dict=handle.dict;\nif(present)return(i)=>(present(i)?dictValue(dict,values[i]):null);\nreturn(i)=>dictValue(dict,values[i]);\n}\nif(kind==='bitset'){\nconst bit=bitReader(values);\nif(present)return(i)=>(present(i)?bit(i)===1:null);\nreturn(i)=>bit(i)===1;\n}\nif(kind==='multi'){\nif(present)return(i)=>(present(i)?multiValue(handle,i):null);\nreturn(i)=>multiValue(handle,i);\n}\nif(!values&&typeof handle.get==='function'){\nconst get=handle.get.bind(handle);\nreturn(i)=>{\nconst v=get(i);\nreturn v===undefined?null:v;\n};\n}\nif(present){\nreturn(i)=>{\nif(!present(i))return null;\nconst v=values[i];\nreturn v===undefined?null:v;\n};\n}\nreturn(i)=>{\nconst v=values[i];\nreturn v===undefined?null:v;\n};\n}\nfunction numericTotalOrder(a,b){\nif(a<b)return-1;\nif(a>b)return 1;\nif(a===b){\nconst na=Object.is(a,-0);\nconst nb=Object.is(b,-0);\nif(na===nb)return 0;\nreturn na?-1:1;\n}\nconst an=Number.isNaN(a);\nconst bn=Number.isNaN(b);\nif(an&&bn)return 0;\nreturn an?1:-1;\n}\nfunction valueComparator(locale){\nconst coll=collator(locale);\nreturn(a,b)=>{\nif(a===b)return 0;\nconst ta=typeof a;\nconst tb=typeof b;\nif(ta==='string'&&tb==='string')return coll.compare(a,b);\nif(ta==='number'&&tb==='number')return numericTotalOrder(a,b);\nif(ta==='boolean'&&tb==='boolean')return a===b?0:a?1:-1;\nif(a instanceof Date||b instanceof Date){\nconst na=a instanceof Date?a.getTime():Number(a);\nconst nb=b instanceof Date?b.getTime():Number(b);\nreturn numericTotalOrder(na,nb);\n}\nreturn defaultCompare(a,b);\n};\n}\nfunction dictRanks(dict,locale){\nif(dict&&typeof dict.ranks==='function')return dict.ranks(locale);\nconst table=dict&&typeof dict.values==='function'?dict.values():[];\nconst n=table.length;\nconst cmp=valueComparator(locale);\nconst order=new Array(n);\nfor(let i=0;i<n;i++)order[i]=i;\norder.sort((a,b)=>cmp(table[a],table[b])||a-b);\nconst ranks=new Uint32Array(n);\nfor(let r=0;r<n;r++)ranks[order[r]]=r;\nreturn ranks;\n}\nfunction isMissing(v){\nreturn v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v));\n}\n});\n__def(\"packages/core/src/compute/sort.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"radixSortFloat64\",{enumerable:true,get:function(){return radixSortFloat64;}});\nObject.defineProperty(__exports,\"radixSortInt32\",{enumerable:true,get:function(){return radixSortInt32;}});\nObject.defineProperty(__exports,\"rankSortDictionary\",{enumerable:true,get:function(){return rankSortDictionary;}});\nObject.defineProperty(__exports,\"mergeSortComparator\",{enumerable:true,get:function(){return mergeSortComparator;}});\nObject.defineProperty(__exports,\"rankSortStrings\",{enumerable:true,get:function(){return rankSortStrings;}});\nObject.defineProperty(__exports,\"collateStringRanks\",{enumerable:true,get:function(){return collateStringRanks;}});\nObject.defineProperty(__exports,\"sortColumn\",{enumerable:true,get:function(){return sortColumn;}});\nObject.defineProperty(__exports,\"sortMulti\",{enumerable:true,get:function(){return sortMulti;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst bitReader=__m0[\"bitReader\"];\nconst dictRanks=__m0[\"dictRanks\"];\nconst dictSize=__m0[\"dictSize\"];\nconst identity=__m0[\"identity\"];\nconst isMissing=__m0[\"isMissing\"];\nconst presenceReader=__m0[\"presenceReader\"];\nconst rowCount=__m0[\"rowCount\"];\nconst valueComparator=__m0[\"valueComparator\"];\nconst valueReader=__m0[\"valueReader\"];\nconst EMPTY_INDICES=new Uint32Array(0);\nconst SCRATCH=new ArrayBuffer(8);\nconst SCRATCH_F64=new Float64Array(SCRATCH);\nconst SCRATCH_U32=new Uint32Array(SCRATCH);\nconst HI=(()=>{\nSCRATCH_F64[0]=-1;\nreturn(SCRATCH_U32[1]&0x80000000)!==0?1:0;\n})();\nconst LO=HI===1?0:1;\nfunction transformDouble(value,out){\nSCRATCH_F64[0]=value;\nlet hi=SCRATCH_U32[HI];\nlet lo=SCRATCH_U32[LO];\nif((hi&0x80000000)!==0){\nhi=~hi>>>0;\nlo=~lo>>>0;\n}else{\nhi=(hi^0x80000000)>>>0;\n}\nout[0]=lo;\nout[1]=hi;\n}\nfunction radixLsd64(idx,lo,hi,n){\nif(n<2)return idx;\nconst hist=new Uint32Array(256*8);\nfor(let i=0;i<n;i++){\nconst l=lo[i];\nconst h=hi[i];\nhist[l&0xff]++;\nhist[256+((l>>>8)&0xff)]++;\nhist[512+((l>>>16)&0xff)]++;\nhist[768+((l>>>24)&0xff)]++;\nhist[1024+(h&0xff)]++;\nhist[1280+((h>>>8)&0xff)]++;\nhist[1536+((h>>>16)&0xff)]++;\nhist[1792+((h>>>24)&0xff)]++;\n}\nlet srcIdx=idx;\nlet srcLo=lo;\nlet srcHi=hi;\nlet dstIdx=new Uint32Array(n);\nlet dstLo=new Uint32Array(n);\nlet dstHi=new Uint32Array(n);\nconst offset=new Uint32Array(256);\nfor(let pass=0;pass<8;pass++){\nconst base=pass<<8;\nconst shift=(pass&3)<<3;\nconst useHi=pass>=4;\nlet skip=false;\nfor(let b=0;b<256;b++){\nif(hist[base+b]===n){skip=true;break;}\n}\nif(skip)continue;\nlet sum=0;\nfor(let b=0;b<256;b++){\noffset[b]=sum;\nsum+=hist[base+b];\n}\nfor(let i=0;i<n;i++){\nconst l=srcLo[i];\nconst h=srcHi[i];\nconst digit=((useHi?h:l)>>>shift)&0xff;\nconst p=offset[digit]++;\ndstIdx[p]=srcIdx[i];\ndstLo[p]=l;\ndstHi[p]=h;\n}\nlet t=srcIdx;srcIdx=dstIdx;dstIdx=t;\nt=srcLo;srcLo=dstLo;dstLo=t;\nt=srcHi;srcHi=dstHi;dstHi=t;\n}\nreturn srcIdx;\n}\nfunction radixLsd32(idx,keys,n){\nif(n<2)return idx;\nconst hist=new Uint32Array(256*4);\nfor(let i=0;i<n;i++){\nconst k=keys[i];\nhist[k&0xff]++;\nhist[256+((k>>>8)&0xff)]++;\nhist[512+((k>>>16)&0xff)]++;\nhist[768+((k>>>24)&0xff)]++;\n}\nlet srcIdx=idx;\nlet srcKeys=keys;\nlet dstIdx=new Uint32Array(n);\nlet dstKeys=new Uint32Array(n);\nconst offset=new Uint32Array(256);\nfor(let pass=0;pass<4;pass++){\nconst base=pass<<8;\nconst shift=pass<<3;\nlet skip=false;\nfor(let b=0;b<256;b++){\nif(hist[base+b]===n){skip=true;break;}\n}\nif(skip)continue;\nlet sum=0;\nfor(let b=0;b<256;b++){\noffset[b]=sum;\nsum+=hist[base+b];\n}\nfor(let i=0;i<n;i++){\nconst k=srcKeys[i];\nconst p=offset[(k>>>shift)&0xff]++;\ndstIdx[p]=srcIdx[i];\ndstKeys[p]=k;\n}\nlet t=srcIdx;srcIdx=dstIdx;dstIdx=t;\nt=srcKeys;srcKeys=dstKeys;dstKeys=t;\n}\nreturn srcIdx;\n}\nfunction countingSort(idx,keys,n,radix){\nconst counts=new Uint32Array(radix+1);\nfor(let i=0;i<n;i++)counts[keys[i]]++;\nlet sum=0;\nfor(let k=0;k<=radix;k++){\nconst c=counts[k];\ncounts[k]=sum;\nsum+=c;\n}\nconst out=new Uint32Array(n);\nfor(let i=0;i<n;i++)out[counts[keys[i]]++]=idx[i];\nreturn out;\n}\nfunction sortUint32Keys(idx,keys,n,radix){\nif(n<2)return idx;\nif(radix<=65536||radix<=n*2)return countingSort(idx,keys,n,radix);\nreturn radixLsd32(idx,keys,n);\n}\nfunction exact(buffer,n){\nif(buffer.length===n&&buffer.byteOffset===0)return buffer;\nreturn Uint32Array.prototype.slice.call(buffer,0,n);\n}\nfunction radixSortFloat64(values,order,descending=false){\nconst src=order||identity(values.length);\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst idx=new Uint32Array(n);\nconst lo=new Uint32Array(n);\nconst hi=new Uint32Array(n);\nconst nans=new Uint32Array(n);\nconst pair=new Uint32Array(2);\nlet m=0;\nlet nanCount=0;\nfor(let i=0;i<n;i++){\nconst row=src[i];\nconst v=values[row];\nif(Number.isNaN(v)){nans[nanCount++]=row;continue;}\ntransformDouble(v,pair);\nif(descending){\nlo[m]=~pair[0]>>>0;\nhi[m]=~pair[1]>>>0;\n}else{\nlo[m]=pair[0];\nhi[m]=pair[1];\n}\nidx[m++]=row;\n}\nconst sorted=radixLsd64(idx.subarray(0,m),lo.subarray(0,m),hi.subarray(0,m),m);\nif(nanCount===0)return exact(sorted,m);\nconst out=new Uint32Array(n);\nout.set(sorted.subarray(0,m),0);\nout.set(nans.subarray(0,nanCount),m);\nreturn out;\n}\nfunction radixSortInt32(values,order,descending=false){\nconst src=order||identity(values.length);\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst idx=Uint32Array.from(src);\nconst keys=new Uint32Array(n);\nfor(let i=0;i<n;i++){\nconst k=(values[idx[i]]^0x80000000)>>>0;\nkeys[i]=descending?(~k>>>0):k;\n}\nreturn exact(radixLsd32(idx,keys,n),n);\n}\nfunction rankSortDictionary(handle,order,opts={}){\nconst src=order||identity(rowCount(handle,opts));\nconst n=src.length;\nif(n<2)return Uint32Array.from(src);\nconst ranks=dictRanks(handle.dict,opts.locale);\nconst codes=handle.values;\nconst present=presenceReader(handle);\nconst size=Math.max(dictSize(handle.dict),ranks.length);\nconst absentRank=size;\nconst idx=Uint32Array.from(src);\nconst keys=new Uint32Array(n);\nconst descending=!!opts.descending;\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nlet rank=present&&present(row)===0?absentRank:ranks[codes[row]];\nif(rank===undefined)rank=absentRank;\nkeys[i]=descending?absentRank-rank:rank;\n}\nreturn exact(sortUint32Keys(idx,keys,n,size+1),n);\n}\nfunction mergeSortComparator(values,order,compare){\nconst n=order.length;\nlet src=Uint32Array.from(order);\nif(n<2)return src;\nlet dst=new Uint32Array(n);\nfor(let width=1;width<n;width<<=1){\nfor(let start=0;start<n;start+=width<<1){\nconst mid=Math.min(start+width,n);\nconst end=Math.min(start+(width<<1),n);\nlet i=start;\nlet j=mid;\nlet k=start;\nwhile(i<mid&&j<end){\ndst[k++]=compare(values[src[i]],values[src[j]])<=0?src[i++]:src[j++];\n}\nwhile(i<mid)dst[k++]=src[i++];\nwhile(j<end)dst[k++]=src[j++];\n}\nconst t=src;src=dst;dst=t;\n}\nreturn src;\n}\nfunction sortBitsetColumn(handle,idx,descending){\nconst bit=bitReader(handle.values);\nconst n=idx.length;\nconst out=new Uint32Array(n);\nconst first=descending?1:0;\nlet k=0;\nfor(let i=0;i<n;i++)if(bit(idx[i])===first)out[k++]=idx[i];\nfor(let i=0;i<n;i++)if(bit(idx[i])!==first)out[k++]=idx[i];\nreturn out;\n}\nfunction indexableValues(handle,idx){\nconst values=handle.values;\nconst kind=handle.kind;\nconst direct=(kind==='object'||kind===undefined)&&(Array.isArray(values)||ArrayBuffer.isView(values));\nif(direct&&!handle.presence)return values;\nconst reader=valueReader(handle);\nconst materialised=new Array(rowCount(handle)||0);\nfor(let i=0;i<idx.length;i++){\nconst row=idx[i];\nmaterialised[row]=reader(row);\n}\nreturn materialised;\n}\nfunction allStrings(values,idx){\nfor(let i=0;i<idx.length;i++){\nif(typeof values[idx[i]]!=='string')return false;\n}\nreturn true;\n}\nfunction rankSortStrings(idx,codes,ranks,d,descending){\nconst n=idx.length;\nconst idxOut=Uint32Array.from(idx);\nif(n<2||d<1)return idxOut;\nconst keys=new Uint32Array(n);\nconst top=d-1;\nfor(let i=0;i<n;i++){\nconst rank=ranks[codes[i]];\nkeys[i]=descending?top-rank:rank;\n}\nreturn exact(sortUint32Keys(idxOut,keys,n,d),n);\n}\nfunction collateStringRanks(table,d,locale){\nconst compare=valueComparator(locale);\nconst order=new Array(d);\nfor(let i=0;i<d;i++)order[i]=i;\norder.sort((a,b)=>compare(table[a],table[b])||a-b);\nconst ranks=new Uint32Array(d);\nfor(let r=0;r<d;r++)ranks[order[r]]=r;\nreturn ranks;\n}\nfunction keyedSortStrings(values,idx,opts){\nconst n=idx.length;\nconst codeOf=new Map();\nconst table=[];\nconst codes=new Uint32Array(n);\nfor(let i=0;i<n;i++){\nconst v=values[idx[i]];\nlet c=codeOf.get(v);\nif(c===undefined){c=table.length;codeOf.set(v,c);table.push(v);}\ncodes[i]=c;\n}\nconst d=table.length;\nconst ranks=collateStringRanks(table,d,opts.locale);\nreturn rankSortStrings(idx,codes,ranks,d,!!opts.descending);\n}\nfunction sortByComparator(handle,idx,opts){\nconst values=indexableValues(handle,idx);\nif(idx.length>=2&&allStrings(values,idx)){\nconst index=handle.stringRank;\nif(index&&index.version===handle.version&&index.usable(idx,values,opts.locale)){\nreturn index.sort(idx,opts);\n}\nreturn keyedSortStrings(values,idx,opts);\n}\nconst base=valueComparator(opts.locale);\nconst compare=opts.descending?(a,b)=>base(b,a):base;\nreturn mergeSortComparator(values,idx,compare);\n}\nfunction sortByCompare(handle,idx,opts){\nconst values=indexableValues(handle,idx);\nconst user=opts.compare;\nconst descending=!!opts.descending;\nconst compare=descending\n?(a,b)=>-user(a,b,undefined,undefined,true)\n:(a,b)=>user(a,b,undefined,undefined,false);\nreturn mergeSortComparator(values,idx,compare);\n}\nfunction partitionPresent(handle,idx){\nconst n=idx.length;\nconst present=presenceReader(handle);\nconst values=handle.values;\nconst checkNaN=handle.kind==='float64'&&!!values;\nconst looseKind=handle.kind==='object'||handle.kind==='multi'||handle.kind===undefined;\nif(!present&&!checkNaN&&!looseKind)return{present:idx,absent:EMPTY_INDICES};\nconst keep=new Uint32Array(n);\nconst drop=new Uint32Array(n);\nlet p=0;\nlet a=0;\nif(present&&checkNaN){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(present(row)===1&&!Number.isNaN(values[row]))keep[p++]=row;else drop[a++]=row;\n}\n}else if(checkNaN&&!present){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(!Number.isNaN(values[row]))keep[p++]=row;else drop[a++]=row;\n}\n}else if(present&&!looseKind){\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(present(row)===1)keep[p++]=row;else drop[a++]=row;\n}\n}else{\nconst reader=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst row=idx[i];\nif(!isMissing(reader(row)))keep[p++]=row;else drop[a++]=row;\n}\n}\nif(a===0)return{present:idx,absent:EMPTY_INDICES};\nreturn{present:keep.subarray(0,p),absent:drop.subarray(0,a)};\n}\nfunction joinRuns(sorted,absent,nullsFirst){\nif(absent.length===0)return sorted;\nconst out=new Uint32Array(sorted.length+absent.length);\nif(nullsFirst){\nout.set(absent,0);\nout.set(sorted,absent.length);\n}else{\nout.set(sorted,0);\nout.set(absent,sorted.length);\n}\nreturn out;\n}\nfunction sortColumn(handle,order,opts={}){\nconst src=order||identity(rowCount(handle,opts));\nif(!handle||src.length<2)return Uint32Array.from(src);\nconst{present,absent}=partitionPresent(handle,src);\nif(present.length===0)return Uint32Array.from(src);\nconst descending=!!opts.descending;\nlet sorted;\nif(typeof opts.compare==='function'){\nsorted=sortByCompare(handle,present,opts);\n}else{\nswitch(handle.kind){\ncase'float64':\nsorted=radixSortFloat64(handle.values,present,descending);\nbreak;\ncase'int32':\nsorted=radixSortInt32(handle.values,present,descending);\nbreak;\ncase'dictionary':\nsorted=rankSortDictionary(handle,present,opts);\nbreak;\ncase'bitset':\nsorted=sortBitsetColumn(handle,present,descending);\nbreak;\ndefault:\nsorted=sortByComparator(handle,present,opts);\nbreak;\n}\n}\nreturn joinRuns(sorted,absent,!!opts.nullsFirst);\n}\nfunction sortMulti(handles,entries,order,opts={}){\nconst list=entries||[];\nconst first=(list.length&&(list[0].handle||byId(handles,list[0].col)))||(handles&&handles[0]);\nlet current=order||identity(rowCount(first,opts));\nfor(let i=list.length-1;i>=0;i--){\nconst entry=list[i];\nconst handle=entry.handle||byId(handles,entry.col)||(handles&&handles[i]);\nif(!handle)continue;\ncurrent=sortColumn(handle,current,{\ndescending:entry.descending!==undefined?!!entry.descending:entry.dir==='desc',\nnullsFirst:!!entry.nullsFirst,\nlocale:entry.locale!==undefined?entry.locale:opts.locale,\ncompare:entry.compare,\n});\n}\nreturn current instanceof Uint32Array?current:Uint32Array.from(current);\n}\nfunction byId(handles,id){\nif(!handles||id===undefined)return undefined;\nfor(let i=0;i<handles.length;i++)if(handles[i]&&handles[i].id===id)return handles[i];\nreturn undefined;\n}\n});\n__def(\"packages/core/src/store/stringrank.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"DEFAULT_MAX_DISTINCT\",{enumerable:true,get:function(){return DEFAULT_MAX_DISTINCT;}});\nObject.defineProperty(__exports,\"StringRankIndex\",{enumerable:true,get:function(){return StringRankIndex;}});\nconst __m0=__req(\"packages/core/src/compute/sort.js\");\nconst collateStringRanks=__m0[\"collateStringRanks\"];\nconst rankSortStrings=__m0[\"rankSortStrings\"];\nconst DEFAULT_MAX_DISTINCT=100000;\nclass StringRankIndex{\n#table=[];\n#codeOf=new Map();\n#codeByRow;\n#length=0;\n#generation=0;\n#stamp=-1;\n#maxDistinct;\n#capped=false;\n#ranks=null;\n#ranksGeneration=-1;\n#ranksLocale='\\u0000';\nconstructor(maxDistinct=DEFAULT_MAX_DISTINCT){\nthis.#maxDistinct=maxDistinct>0?maxDistinct:DEFAULT_MAX_DISTINCT;\nthis.#codeByRow=new Uint32Array(0);\n}\nget version(){return this.#stamp;}\nset version(version){this.#stamp=version;}\nget generation(){return this.#generation;}\nget size(){return this.#table.length;}\nget capped(){return this.#capped;}\nget length(){return this.#length;}\nget bytes(){\nlet total=this.#codeByRow.byteLength;\nconst table=this.#table;\nfor(let i=0;i<table.length;i++)total+=table[i].length*2+24;\nreturn total;\n}\n#intern(value,capOnGrowth){\nconst existing=this.#codeOf.get(value);\nif(existing!==undefined)return existing;\nif(this.#capped)return-1;\nif(capOnGrowth&&this.#table.length>=this.#maxDistinct){\nthis.#capped=true;\nreturn-1;\n}\nconst code=this.#table.length;\nthis.#table.push(value);\nthis.#codeOf.set(value,code);\nthis.#generation++;\nreturn code;\n}\nbuild(values,count){\nconst n=count|0;\nthis.#table=[];\nthis.#codeOf=new Map();\nthis.#generation=0;\nthis.#capped=false;\nthis.#ranks=null;\nthis.#ranksGeneration=-1;\nthis.#codeByRow=new Uint32Array(n);\nfor(let row=0;row<n;row++){\nconst v=values[row];\nconst code=typeof v==='string'?this.#intern(v,false):-1;\nthis.#codeByRow[row]=code<0?0:code;\n}\nthis.#length=n;\n}\nappend(values,from,count){\nconst to=(from|0)+(count|0);\nif(to>this.#codeByRow.length){\nconst next=new Uint32Array(to);\nnext.set(this.#codeByRow.subarray(0,this.#length));\nthis.#codeByRow=next;\n}\nfor(let row=from|0;row<to;row++){\nconst v=values[row];\nconst code=typeof v==='string'?this.#intern(v,true):-1;\nthis.#codeByRow[row]=code<0?0:code;\n}\nthis.#length=Math.max(this.#length,to);\n}\nranks(locale){\nconst key=locale||'';\nif(this.#ranks&&this.#ranksGeneration===this.#generation&&this.#ranksLocale===key){\nreturn this.#ranks;\n}\nconst ranks=collateStringRanks(this.#table,this.#table.length,locale);\nthis.#ranks=ranks;\nthis.#ranksGeneration=this.#generation;\nthis.#ranksLocale=key;\nreturn ranks;\n}\nusable(idx,values,locale){\nif(this.#capped||this.#table.length===0)return false;\nconst codeByRow=this.#codeByRow;\nconst table=this.#table;\nconst covered=this.#length;\nfor(let i=0;i<idx.length;i++){\nconst row=idx[i];\nif(row>=covered)return false;\nif(table[codeByRow[row]]!==values[row])return false;\n}\nreturn true;\n}\nsort(idx,opts){\nconst ranks=this.ranks(opts.locale);\nconst d=this.#table.length;\nconst n=idx.length;\nconst codes=new Uint32Array(n);\nconst codeByRow=this.#codeByRow;\nfor(let i=0;i<n;i++)codes[i]=codeByRow[idx[i]];\nreturn rankSortStrings(idx,codes,ranks,d,!!opts.descending);\n}\n}\n});\n__def(\"packages/core/src/store/columnstore.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"REMOVED\",{enumerable:true,get:function(){return REMOVED;}});\nObject.defineProperty(__exports,\"toFloat\",{enumerable:true,get:function(){return toFloat;}});\nObject.defineProperty(__exports,\"ColumnHandle\",{enumerable:true,get:function(){return ColumnHandle;}});\nObject.defineProperty(__exports,\"ColumnStore\",{enumerable:true,get:function(){return ColumnStore;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst warnOnce=__m0[\"warnOnce\"];\nconst isFunction=__m0[\"isFunction\"];\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/bitset.js\");\nconst Bitset=__m1[\"Bitset\"];\nconst __m2=__req(\"packages/core/src/store/dictionary.js\");\nconst Dictionary=__m2[\"Dictionary\"];\nconst __m3=__req(\"packages/core/src/store/multivalue.js\");\nconst MultiValue=__m3[\"MultiValue\"];\nconst __m4=__req(\"packages/core/src/store/stringrank.js\");\nconst StringRankIndex=__m4[\"StringRankIndex\"];\nconst REMOVED=0xFFFFFFFF;\nconst DEFAULT_CAPACITY=1024;\nconst DEFAULT_COLUMNAR_BELOW=5000;\nconst DEFAULT_COMPACT_RATIO=0.2;\nconst KINDS=new Set(['float64','int32','bitset','dictionary','object','multi']);\nfunction absent(v){return v===null||v===undefined;}\nfunction toFloat(v){\nif(typeof v==='number')return v;\nif(v instanceof Date)return v.getTime();\nif(typeof v==='boolean')return v?1:0;\nconst n=Number(v);\nreturn Number.isNaN(n)&&typeof v==='string'?Date.parse(v):n;\n}\nfunction toInt(v){\nconst n=toFloat(v);\nreturn Number.isFinite(n)?n|0:0;\n}\nfunction toMembers(v){\nif(absent(v))return[];\nreturn Array.isArray(v)?v:[v];\n}\nfunction decodeFrom(old,p){\nswitch(old.kind){\ncase'float64':\ncase'int32':return old.buf[p];\ncase'bitset':return old.bits.get(p)===1;\ncase'dictionary':return old.dict.valueOf(old.buf[p]);\ncase'multi':{\nconst codes=old.mv.at(p);\nconst out=new Array(codes.length);\nfor(let i=0;i<codes.length;i++)out[i]=old.dict.valueOf(codes[i]);\nreturn out;\n}\ndefault:return old.buf[p];\n}\n}\nfunction decodePacked(frag,i){\nswitch(frag.kind){\ncase'float64':\ncase'int32':return frag.values[i];\ncase'bitset':return(frag.values[i>>3]&(1<<(i&7)))!==0;\ncase'dictionary':return(frag.table||[])[frag.values[i]];\ncase'multi':{\nconst start=frag.offsets[i];\nconst end=frag.offsets[i+1];\nconst table=frag.table||[];\nconst out=new Array(end-start);\nfor(let k=start;k<end;k++)out[k-start]=table[frag.values[k]];\nreturn out;\n}\ndefault:return frag.values[i];\n}\n}\nclass ColumnHandle{\n#id;\n#kind;\n#target;\n#nullable;\n#read;\n#host;\n#seed;\n#columnar=false;\n#buf=null;\n#bits=null;\n#mv=null;\n#dict=null;\n#stringRank=null;\n#stringRankOn;\n#stringRankMax;\n#stringRankVersion=-1;\n#presence=null;\n#capacity=0;\n#version=0;\n#overlay=null;\n#cache=null;\n#released=false;\nconstructor(schema,host){\nthis.#id=schema.id;\nconst kind=KINDS.has(schema.kind)?schema.kind:'object';\nif(schema.kind&&!KINDS.has(schema.kind)){\nwarnOnce(`store.kind.${schema.id}`,\n`column \"${schema.id}\" declares unknown storage kind \"${schema.kind}\"; falling back to object`);\n}\nthis.#target=kind;\nthis.#kind=kind;\nthis.#nullable=schema.nullable!==false;\nthis.#seed=schema.dictionary??null;\nthis.#host=host;\nthis.#read=isFunction(schema.read)\n?schema.read\n:pathGetter(schema.field||schema.id);\nthis.#stringRankOn=schema.stringRankIndex!=='off';\nthis.#stringRankMax=typeof schema.stringRankMaxDistinct==='number'\n?schema.stringRankMaxDistinct\n:0;\nthis.#overlay=new Map();\n}\nget id(){return this.#id;}\nget kind(){return this.#columnar?this.#kind:'object';}\nget target(){return this.#target;}\nget nullable(){return this.#nullable;}\nget values(){\nif(this.#released)return null;\nif(!this.#columnar)return this.#lazy().values;\nif(this.#kind==='bitset')return this.#bits.words;\nif(this.#kind==='multi')return this.#mv.values;\nreturn this.#buf;\n}\nget presence(){\nif(this.#released||!this.#nullable)return null;\nreturn this.#columnar?this.#presence:this.#lazy().presence;\n}\nget dict(){\nif(this.#released||!this.#columnar)return null;\nreturn this.#kind==='dictionary'||this.#kind==='multi'?this.#dict:null;\n}\nget stringRank(){\nif(this.#released||!this.#stringRankOn)return null;\nif(this.kind!=='object')return null;\nconst values=this.values;\nconst n=this.#host.physical();\nif(!values||n===0)return null;\nif(this.#stringRank===null){\nif(typeof values[0]!=='string')return null;\nconst index=new StringRankIndex(this.#resolveStringRankMax());\nindex.build(values,n);\nindex.version=this.#version;\nthis.#stringRank=index;\nthis.#stringRankVersion=this.#version;\nreturn index.capped?null:index;\n}\nif(this.#stringRank.length<n){\nthis.#stringRank.append(values,this.#stringRank.length,n-this.#stringRank.length);\n}\nthis.#stringRank.version=this.#version;\nthis.#stringRankVersion=this.#version;\nreturn this.#stringRank.capped?null:this.#stringRank;\n}\n#resolveStringRankMax(){return this.#stringRankMax;}\n#dropStringRank(){\nthis.#stringRank=null;\nthis.#stringRankVersion=-1;\n}\nget offsets(){\nif(this.#released||!this.#columnar||this.#kind!=='multi')return null;\nreturn this.#mv.offsets;\n}\nget version(){return this.#version;}\nget bytes(){\nlet total=0;\nif(this.#buf)total+=this.#buf.byteLength??this.#buf.length*8;\nif(this.#bits)total+=this.#bits.bytes;\nif(this.#mv)total+=this.#mv.bytes;\nif(this.#presence)total+=this.#presence.bytes;\nif(this.#dict)total+=this.#dict.bytes;\nif(this.#overlay)total+=this.#overlay.size*24;\nreturn total;\n}\nget(physical){\nif(this.#released)return undefined;\nif(physical<0||physical>=this.#host.physical())return undefined;\nif(!this.#columnar)return this.#rowValue(physical);\nif(this.#nullable&&this.#presence.get(physical)===0)return null;\nswitch(this.#kind){\ncase'float64':\ncase'int32':return this.#buf[physical];\ncase'bitset':return this.#bits.get(physical)===1;\ncase'dictionary':return this.#dict.valueOf(this.#buf[physical]);\ncase'multi':{\nconst codes=this.#mv.at(physical);\nconst out=new Array(codes.length);\nfor(let i=0;i<codes.length;i++)out[i]=this.#dict.valueOf(codes[i]);\nreturn out;\n}\ndefault:return this.#buf[physical];\n}\n}\nset(physical,value){\nif(this.#released)return;\nif(this.#columnar)this.#writeValue(physical,value);\nelse this.#overlay.set(physical,value===undefined?null:value);\nif(this.#stringRank)this.#dropStringRank();\nthis.#version++;\n}\nread(row){return this.#read(row);}\nappendColumn(objects,from,n){\nif(this.#released||n<=0)return;\nif(!this.#columnar){this.#version++;return;}\nconst read=this.#read;\nconst nullable=this.#nullable;\nconst presence=this.#presence;\nlet sawAbsent=false;\nswitch(this.#kind){\ncase'float64':{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nif(typeof v==='number'){\nif(nullable)presence.set(from+i);\nbuf[from+i]=v;\ncontinue;\n}\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?NaN:toFloat(v);\n}\nbreak;\n}\ncase'int32':{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?0:toInt(v);\n}\nbreak;\n}\ncase'bitset':{\nconst bits=this.#bits;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbits.assign(from+i,!gone&&!!v);\n}\nbreak;\n}\ncase'dictionary':{\nconst buf=this.#buf;\nconst dict=this.#dict;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?0:dict.codeOf(v);\n}\nbreak;\n}\ncase'multi':{\nconst mv=this.#mv;\nconst dict=this.#dict;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nconst members=toMembers(v);\nconst codes=new Array(members.length);\nfor(let k=0;k<members.length;k++)codes[k]=dict.codeOf(members[k]);\nmv.write(from+i,codes);\n}\nbreak;\n}\ndefault:{\nconst buf=this.#buf;\nfor(let i=0;i<n;i++){\nconst v=read(objects[i]);\nconst gone=v===null||v===undefined;\nif(nullable)presence.assign(from+i,!gone);\nelse if(gone)sawAbsent=true;\nbuf[from+i]=gone?null:v;\n}\nbreak;\n}\n}\nif(sawAbsent){\nwarnOnce(`store.null.${this.#id}`,\n`column \"${this.#id}\" is declared non-nullable but received null; storing a filler value`);\n}\nif(this.#stringRank&&this.#kind==='object'){\nthis.#stringRank.append(this.#buf,from,n);\nthis.#stringRank.version=this.#version+1;\nthis.#stringRankVersion=this.#version+1;\n}\nthis.#version++;\n}\nappendPacked(frag,from,n){\nif(this.#released||n<=0||!frag)return;\nif(!this.#columnar){this.#version++;return;}\nconst presence=this.#presence;\nconst fragPresence=frag.presence;\nif(presence){\nif(fragPresence){\nfor(let i=0;i<n;i++)presence.assign(from+i,(fragPresence[i>>3]&(1<<(i&7)))!==0);\n}else{\nfor(let i=0;i<n;i++)presence.set(from+i);\n}\n}\nconst kindsAgree=frag.kind===this.#kind;\nif(kindsAgree&&(this.#kind==='float64'||this.#kind==='int32')){\nthis.#buf.set(frag.values,from);\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='bitset'){\nconst words=frag.values;\nfor(let i=0;i<n;i++)this.#bits.assign(from+i,(words[i>>3]&(1<<(i&7)))!==0);\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='dictionary'){\nconst table=frag.table||[];\nconst remap=new Uint32Array(table.length);\nfor(let t=0;t<table.length;t++)remap[t]=this.#dict.codeOf(table[t]);\nconst codes=frag.values;\nconst buf=this.#buf;\nconst pres=presence;\nfor(let i=0;i<n;i++){\nif(pres&&(fragPresence?(fragPresence[i>>3]&(1<<(i&7)))===0:false)){buf[from+i]=0;continue;}\nbuf[from+i]=remap[codes[i]]??0;\n}\nthis.#version++;\nreturn;\n}\nif(kindsAgree&&this.#kind==='multi'){\nconst table=frag.table||[];\nconst remap=new Uint32Array(table.length);\nfor(let t=0;t<table.length;t++)remap[t]=this.#dict.codeOf(table[t]);\nconst flat=frag.values;\nconst offsets=frag.offsets;\nfor(let i=0;i<n;i++){\nconst start=offsets[i];\nconst end=offsets[i+1];\nconst codes=new Array(end-start);\nfor(let k=start;k<end;k++)codes[k-start]=remap[flat[k]]??0;\nthis.#mv.write(from+i,codes);\n}\nthis.#version++;\nreturn;\n}\nfor(let i=0;i<n;i++){\nconst gone=fragPresence\n?(fragPresence[i>>3]&(1<<(i&7)))===0\n:(frag.kind==='object'?frag.values[i]===null:false);\nthis.#writeValue(from+i,gone?null:decodePacked(frag,i));\n}\nthis.#version++;\n}\ntouch(){this.#version++;}\ncolumnarise(capacity,fill){\nif(this.#columnar||this.#released)return;\nconst values=new Array(fill);\nfor(let p=0;p<fill;p++)values[p]=this.#rowValue(p);\nthis.#kind=this.#target;\nthis.#columnar=true;\nthis.#alloc(capacity);\nfor(let p=0;p<fill;p++)this.#writeValue(p,values[p]);\nthis.#overlay.clear();\nthis.#cache=null;\nthis.#dropStringRank();\nthis.#version++;\n}\ngrow(capacity){\nif(!this.#columnar||this.#released||capacity<=this.#capacity)return;\nswitch(this.#kind){\ncase'float64':case'int32':case'dictionary':{\nconst next=new this.#buf.constructor(capacity);\nnext.set(this.#buf);\nthis.#buf=next;\nbreak;\n}\ncase'bitset':this.#bits.grow(capacity);break;\ncase'multi':break;\ndefault:this.#buf.length=capacity;break;\n}\nif(this.#presence)this.#presence.grow(capacity);\nthis.#capacity=capacity;\nthis.#version++;\n}\nconvert(kind){\nif(this.#released||!KINDS.has(kind))return false;\nthis.#target=kind;\nif(!this.#columnar||kind===this.#kind)return false;\nconst old={kind:this.#kind,buf:this.#buf,bits:this.#bits,mv:this.#mv,dict:this.#dict};\nconst n=this.#host.physical();\nconst presence=this.#presence;\nthis.#kind=kind;\nthis.#alloc(this.#capacity);\nfor(let p=0;p<n;p++){\nconst gone=presence!==null&&presence.get(p)===0;\nif(gone&&kind!=='multi')continue;\nthis.#writeValue(p,gone?null:decodeFrom(old,p));\n}\nthis.#dropStringRank();\nthis.#version++;\nreturn true;\n}\ncompact(remap,oldFill,liveCount){\nif(this.#released)return;\nthis.#dropStringRank();\nif(!this.#columnar){\nconst overlay=this.#overlay;\nif(overlay.size){\nconst next=new Map();\nfor(const[p,v]of overlay)if(remap[p]!==REMOVED)next.set(remap[p],v);\nthis.#overlay=next;\n}\nthis.#cache=null;\nthis.#version++;\nreturn;\n}\nswitch(this.#kind){\ncase'float64':case'int32':case'dictionary':case'object':{\nconst buf=this.#buf;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)buf[remap[p]]=buf[p];\nif(this.#kind==='object')for(let p=liveCount;p<oldFill;p++)buf[p]=undefined;\nbreak;\n}\ncase'bitset':{\nconst bits=this.#bits;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)bits.assign(remap[p],bits.get(p)===1);\nfor(let p=liveCount;p<oldFill;p++)bits.clear(p);\nbreak;\n}\ncase'multi':this.#mv.compact(remap,liveCount,REMOVED);break;\ndefault:break;\n}\nif(this.#presence){\nconst pres=this.#presence;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)pres.assign(remap[p],pres.get(p)===1);\nfor(let p=liveCount;p<oldFill;p++)pres.clear(p);\n}\nthis.#version++;\n}\nrelease(){\nif(this.#released)return;\nthis.#released=true;\nthis.#buf=null;\nif(this.#bits)this.#bits.release();\nthis.#bits=null;\nif(this.#mv)this.#mv.release();\nthis.#mv=null;\nif(this.#presence)this.#presence.release();\nthis.#presence=null;\nthis.#dict=null;\nthis.#stringRank=null;\nthis.#overlay=new Map();\nthis.#cache=null;\nthis.#capacity=0;\nthis.#version++;\n}\n#alloc(capacity){\nconst cap=Math.max(1,capacity);\nthis.#buf=null;\nthis.#bits=null;\nthis.#mv=null;\nswitch(this.#kind){\ncase'float64':this.#buf=new Float64Array(cap);break;\ncase'int32':this.#buf=new Int32Array(cap);break;\ncase'bitset':this.#bits=new Bitset(cap);break;\ncase'dictionary':\nthis.#buf=new Uint32Array(cap);\nthis.#dict=this.#dict??new Dictionary(this.#seed??[]);\nbreak;\ncase'multi':\nthis.#mv=new MultiValue({rows:cap,values:cap});\nthis.#dict=this.#dict??new Dictionary(this.#seed??[]);\nbreak;\ndefault:this.#buf=new Array(cap);break;\n}\nif(this.#kind!=='dictionary'&&this.#kind!=='multi')this.#dict=null;\nif(this.#nullable){\nif(this.#presence)this.#presence.grow(cap);\nelse this.#presence=new Bitset(cap);\n}\nthis.#capacity=cap;\n}\n#writeValue(p,value){\nconst gone=absent(value);\nif(this.#nullable)this.#presence.assign(p,!gone);\nelse if(gone){\nwarnOnce(`store.null.${this.#id}`,\n`column \"${this.#id}\" is declared non-nullable but received null; storing a filler value`);\n}\nswitch(this.#kind){\ncase'float64':this.#buf[p]=gone?NaN:toFloat(value);break;\ncase'int32':this.#buf[p]=gone?0:toInt(value);break;\ncase'bitset':this.#bits.assign(p,!gone&&!!value);break;\ncase'dictionary':this.#buf[p]=gone?0:this.#dict.codeOf(value);break;\ncase'multi':{\nconst members=toMembers(value);\nconst codes=new Array(members.length);\nfor(let i=0;i<members.length;i++)codes[i]=this.#dict.codeOf(members[i]);\nthis.#mv.write(p,codes);\nbreak;\n}\ndefault:this.#buf[p]=gone?null:value;break;\n}\n}\n#rowValue(p){\nif(this.#overlay.has(p))return this.#overlay.get(p);\nconst v=this.#read(this.#host.rowAt(p));\nreturn v===undefined?null:v;\n}\n#lazy(){\nif(this.#cache&&this.#cache.version===this.#version)return this.#cache;\nconst n=this.#host.physical();\nconst values=new Array(n);\nconst presence=this.#nullable?new Bitset(n):null;\nfor(let p=0;p<n;p++){\nconst v=this.#rowValue(p);\nvalues[p]=v;\nif(presence&&!absent(v))presence.set(p);\n}\nthis.#cache={version:this.#version,values,presence};\nreturn this.#cache;\n}\n}\nclass ColumnStore{\n#schema;\n#handles=new Map();\n#list=[];\n#rows=[];\n#fill=0;\n#capacity=0;\n#live=0;\n#dead=0;\n#tombs=new Bitset(0);\n#columnar=false;\n#retainSource=true;\n#columnarBelow;\n#initial;\n#ratio;\n#destroyed=false;\nconstructor(schema,opts={}){\nthis.#schema=Array.isArray(schema)?schema:[];\nthis.#initial=Math.max(1,opts.initialCapacity??DEFAULT_CAPACITY);\nthis.#retainSource=opts.retainSource!==false;\nthis.#columnarBelow=this.#retainSource?(opts.columnarBelow??DEFAULT_COLUMNAR_BELOW):0;\nthis.#ratio=opts.compactRatio??DEFAULT_COMPACT_RATIO;\nconst host={\nrowAt:(p)=>this.#rows[p],\nphysical:()=>this.#fill,\n};\nfor(const entry of this.#schema){\nif(!entry||!entry.id)continue;\nif(this.#handles.has(entry.id)){\nwarnOnce(`store.dup.${entry.id}`,`duplicate column id \"${entry.id}\" in the store schema; ignoring the second`);\ncontinue;\n}\nconst handle=new ColumnHandle(entry,host);\nthis.#handles.set(entry.id,handle);\nthis.#list.push(handle);\n}\nif(this.#columnarBelow<=0)this.#columnarise();\n}\nget count(){return this.#live;}\nget physical(){return this.#fill;}\nget capacity(){return this.#columnar?this.#capacity:this.#rows.length;}\nget tombstones(){return this.#dead;}\nget columnar(){return this.#columnar;}\nget destroyed(){return this.#destroyed;}\nget bytes(){\nlet total=this.#tombs.bytes+this.#rows.length*8;\nfor(const h of this.#list)total+=h.bytes;\nreturn total;\n}\nappend(objects){\nconst from=this.#fill;\nif(this.#destroyed||!objects)return{from,to:from};\nconst n=objects.length|0;\nif(n===0)return{from,to:from};\nif(this.#retainSource)for(let i=0;i<n;i++)this.#rows[from+i]=objects[i];\nthis.#fill=from+n;\nthis.#live+=n;\nthis.#tombs.grow(this.#fill);\nif(!this.#columnar){\nif(this.#fill>=this.#columnarBelow)this.#columnarise();\nelse for(const h of this.#list)h.touch();\nreturn{from,to:this.#fill};\n}\nthis.#ensure(this.#fill);\nconst cols=this.#list;\nfor(let c=0;c<cols.length;c++)cols[c].appendColumn(objects,from,n);\nreturn{from,to:this.#fill};\n}\nappendPacked(chunk,objects){\nconst from=this.#fill;\nif(this.#destroyed||!chunk)return{from,to:from};\nconst n=chunk.count|0;\nif(n===0)return{from,to:from};\nif(this.#retainSource&&objects){\nfor(let i=0;i<n;i++)this.#rows[from+i]=objects[i];\n}\nthis.#fill=from+n;\nthis.#live+=n;\nthis.#tombs.grow(this.#fill);\nif(!this.#columnar)this.#columnarise();\nthis.#ensure(this.#fill);\nconst byId=new Map();\nfor(const col of chunk.columns)byId.set(col.id,col);\nfor(const h of this.#list){\nconst frag=byId.get(h.id);\nif(frag)h.appendPacked(frag,from,n);\nelse{\nh.grow(this.#capacity);\n}\n}\nreturn{from,to:this.#fill};\n}\nsource(physical){\nif(this.#retainSource)return this.#rows[physical];\nif(physical<0||physical>=this.#fill)return undefined;\nreturn this.#reconstruct(physical);\n}\nsetSource(physical,object){\nif(this.#destroyed)return;\nif(physical<0||physical>=this.#fill)return;\nif(!this.#retainSource)return;\nthis.#rows[physical]=object;\n}\nget(colId,physical){\nconst h=this.#handles.get(colId);\nreturn h?h.get(physical):undefined;\n}\nset(colId,physical,value){\nif(this.#destroyed)return;\nif(physical<0||physical>=this.#fill)return;\nconst h=this.#handles.get(colId);\nif(!h){\nwarnOnce(`store.set.${colId}`,`set() on unknown column \"${colId}\"`);\nreturn;\n}\nh.set(physical,value);\n}\nremove(physical){\nif(this.#destroyed||physical<0||physical>=this.#fill)return false;\nif(this.#tombs.get(physical)===1)return false;\nthis.#tombs.set(physical);\nthis.#dead++;\nthis.#live--;\nreturn true;\n}\nlive(physical){\nif(physical<0||physical>=this.#fill)return false;\nreturn this.#tombs.get(physical)===0;\n}\ncompact(opts={}){\nif(this.#destroyed||this.#dead===0)return null;\nif(!opts.force&&this.#dead/this.#fill<this.#ratio)return null;\nconst oldFill=this.#fill;\nconst remap=new Uint32Array(oldFill);\nlet w=0;\nfor(let p=0;p<oldFill;p++)remap[p]=this.#tombs.get(p)===1?REMOVED:w++;\nfor(const h of this.#list)h.compact(remap,oldFill,w);\nif(this.#retainSource){\nconst rows=this.#rows;\nfor(let p=0;p<oldFill;p++)if(remap[p]!==REMOVED)rows[remap[p]]=rows[p];\nrows.length=w;\n}\nthis.#fill=w;\nthis.#live=w;\nthis.#dead=0;\nthis.#tombs=new Bitset(Math.max(this.#capacity,w));\nreturn remap;\n}\ncolumn(colId){return this.#handles.get(colId);}\ncolumns(){return this.#list.slice();}\nliveIndices(){\nconst out=new Uint32Array(this.#live);\nif(this.#dead===0){\nfor(let p=0;p<this.#fill;p++)out[p]=p;\nreturn out;\n}\nlet k=0;\nfor(let p=0;p<this.#fill;p++)if(this.#tombs.get(p)===0)out[k++]=p;\nreturn out;\n}\nconvert(colId,kind){\nconst h=this.#handles.get(colId);\nreturn h?h.convert(kind):false;\n}\ndestroy(){\nif(this.#destroyed)return;\nthis.#destroyed=true;\nfor(const h of this.#list)h.release();\nthis.#handles.clear();\nthis.#list.length=0;\nthis.#rows.length=0;\nthis.#tombs.release();\nthis.#fill=0;\nthis.#live=0;\nthis.#dead=0;\nthis.#capacity=0;\n}\n#ensure(n){\nif(n<=this.#capacity)return;\nlet cap=this.#capacity||this.#initial;\nwhile(cap<n)cap*=2;\nfor(const h of this.#list)h.grow(cap);\nthis.#tombs.grow(cap);\nthis.#capacity=cap;\n}\n#reconstruct(physical){\nconst out={};\nfor(const h of this.#list)out[h.id]=h.get(physical);\nreturn out;\n}\n#columnarise(){\nif(this.#columnar)return;\nlet cap=this.#initial;\nwhile(cap<this.#fill)cap*=2;\nthis.#columnar=true;\nthis.#capacity=cap;\nthis.#tombs.grow(cap);\nfor(const h of this.#list)h.columnarise(cap,this.#fill);\n}\n}\n});\n__def(\"packages/core/src/store/ingest.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"INGEST_DEFAULTS\",{enumerable:true,get:function(){return INGEST_DEFAULTS;}});\nObject.defineProperty(__exports,\"inferKind\",{enumerable:true,get:function(){return inferKind;}});\nObject.defineProperty(__exports,\"decideText\",{enumerable:true,get:function(){return decideText;}});\nObject.defineProperty(__exports,\"createReaders\",{enumerable:true,get:function(){return createReaders;}});\nObject.defineProperty(__exports,\"Ingest\",{enumerable:true,get:function(){return Ingest;}});\nObject.defineProperty(__exports,\"ingest\",{enumerable:true,get:function(){return ingest;}});\nObject.defineProperty(__exports,\"ingestSync\",{enumerable:true,get:function(){return ingestSync;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst now=__m0[\"now\"];\nconst nextFrame=__m0[\"nextFrame\"];\nconst infoOnce=__m0[\"infoOnce\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst isFunction=__m0[\"isFunction\"];\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/columnstore.js\");\nconst ColumnStore=__m1[\"ColumnStore\"];\nconst INGEST_DEFAULTS=Object.freeze({\nchunkMs:8,\nchunkRows:512,\nsampleSize:100,\ndictionaryRatio:0.1,\ncolumnarBelow:5000,\ninitialCapacity:1024,\n});\nfunction inferKind(samples,hints={}){\nif(hints.multi)return'multi';\nif(samples.length===0)return'object';\nlet numbers=0;let booleans=0;let strings=0;let dates=0;let arrays=0;\nfor(let i=0;i<samples.length;i++){\nconst v=samples[i];\nif(typeof v==='number')numbers++;\nelse if(typeof v==='boolean')booleans++;\nelse if(typeof v==='string')strings++;\nelse if(v instanceof Date)dates++;\nelse if(Array.isArray(v))arrays++;\n}\nconst n=samples.length;\nif(numbers===n)return'float64';\nif(booleans===n)return'bitset';\nif(dates===n)return'float64';\nif(strings===n)return'text';\nif(arrays===n)return'multi';\nreturn'object';\n}\nfunction decideText(distinct,rows,ratio){\nif(rows<=0)return'dictionary';\nreturn distinct<ratio*rows?'dictionary':'object';\n}\nfunction createReaders(columns,computed,context){\nconst readers=new Map();\nconst base=new Map();\nfor(const col of columns){\nif(col.computed)continue;\nconst read=isFunction(col.read)?col.read:pathGetter(col.field||col.id);\nbase.set(col.id,read);\nreaders.set(col.id,read);\n}\nconst order=computed?.order??[];\nconst fns=computed?.fns??{};\nconst deps=computed?.deps??{};\nconst wrapDeps=computed?.wrapDeps??null;\nconst active=order.filter((id)=>isFunction(fns[id]));\nconst wildcard=active.some((id)=>deps[id]==='*');\nlet memo=new WeakMap();\nconst resolve=(data)=>{\nconst values={};\nif(wildcard)for(const[id,read]of base)values[id]=read(data);\nfor(const id of active){\nconst declared=deps[id];\nlet bag;\nif(declared==='*'){\nbag=values;\n}else{\nbag={};\nconst list=declared||[];\nfor(let i=0;i<list.length;i++){\nconst d=list[i];\nbag[d]=d in values?values[d]:base.get(d)?.(data);\n}\n}\nvalues[id]=fns[id](wrapDeps?wrapDeps(bag,id):bag,{\ndata,row:null,column:null,grid:null,context,\n});\n}\nreturn values;\n};\nconst valuesFor=(data)=>{\nif(data===null||(typeof data!=='object'&&typeof data!=='function'))return resolve(data);\nlet v=memo.get(data);\nif(v===undefined){v=resolve(data);memo.set(data,v);}\nreturn v;\n};\nfor(const id of active){\nreaders.set(id,\n(data)=>valuesFor(data)[id]);\n}\nreturn{\nreaders,\nreset(){memo=new WeakMap();},\n};\n}\nclass ColumnPlan{\nspec;\nread;\nkind;\ninferred;\nnullable;\ncandidate=false;\ndistinct=null;\nchange=null;\nreason='';\nconstructor(spec,read){\nthis.spec=spec;\nthis.read=read;\nthis.kind='object';\nthis.inferred=false;\nthis.nullable=spec.nullable!==false;\n}\n}\nclass Ingest{\n#rows;\n#plans=[];\n#store=null;\n#readers;\n#cursor=0;\n#opts;\n#done=false;\n#cancelled=false;\n#elapsed=0;\n#columnar;\nconstructor(rows,plan={},opts={}){\nthis.#rows=Array.isArray(rows)?rows:Array.from(rows||[]);\nthis.#opts={...INGEST_DEFAULTS,...opts};\nconst columns=plan.columns??[];\nthis.#readers=createReaders(columns,plan.computed??null,plan.context);\nthis.#columnar=this.#rows.length>=this.#opts.columnarBelow;\nthis.#planColumns(columns,plan.computed??null);\nthis.#store=new ColumnStore(this.#plans.map((p)=>({\nid:p.spec.id,\nkind:p.kind,\nnullable:p.nullable,\nread:p.read,\ndictionary:p.spec.dictionary,\n})),{\ninitialCapacity:this.#opts.initialCapacity,\ncolumnarBelow:this.#opts.columnarBelow,\n});\n}\nget store(){return this.#store;}\nget done(){return this.#done||this.#cancelled;}\nget progress(){return this.#cursor;}\nslice(){\nif(this.done)return false;\nif(this.#opts.signal?.aborted){this.#cancelled=true;return false;}\nconst started=now();\nconst{chunkMs,chunkRows}=this.#opts;\nconst total=this.#rows.length;\ndo{\nconst end=Math.min(this.#cursor+chunkRows,total);\nthis.#store.append(this.#rows.slice(this.#cursor,end));\nthis.#measure(this.#cursor,end);\nthis.#cursor=end;\nthis.#readers.reset();\nthis.#reviewCardinality(false);\n}while(this.#cursor<total&&now()-started<chunkMs);\nthis.#elapsed+=now()-started;\nthis.#opts.onProgress?.({loaded:this.#cursor,total});\nif(this.#cursor>=total){\nthis.#reviewCardinality(true);\nthis.#done=true;\nreturn false;\n}\nreturn true;\n}\ncancel(){this.#cancelled=true;}\nresult(){\nreturn{\nstore:this.#store,\nschema:this.#plans.map((p)=>({\nid:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,\ndictionary:p.spec.dictionary,\n})),\ndecisions:this.#plans.map((p)=>({\nid:p.spec.id,\nkind:p.kind,\nnullable:p.nullable,\ninferred:p.inferred,\ndistinct:p.candidate||p.change?this.#distinctOf(p):null,\nchange:p.change,\nreason:p.reason,\n})),\ncount:this.#store.count,\nelapsed:this.#elapsed,\ncancelled:this.#cancelled,\n};\n}\n#planColumns(columns,computed){\nconst rows=this.#rows;\nconst sampleN=Math.min(this.#opts.sampleSize,rows.length);\nconst ratio=this.#opts.dictionaryRatio;\nconst pure=computed?.pure instanceof Set\n?computed.pure\n:new Set(computed?.pure??computed?.order??[]);\nfor(const spec of columns){\nif(!spec||!spec.id)continue;\nif(spec.computed&&(spec.pure===false||(computed&&!pure.has(spec.id)))){\nwarnOnce(`ingest.impure.${spec.id}`,\n`column \"${spec.id}\" is an impure computed column and is not materialised into the store`);\ncontinue;\n}\nconst read=this.#readers.readers.get(spec.id)\n??(isFunction(spec.read)?spec.read:pathGetter(spec.field||spec.id));\nconst plan=new ColumnPlan(spec,read);\nif(spec.kind){\nplan.kind=spec.kind;\nplan.reason='declared by the caller';\n}else if(spec.dictionary){\nplan.kind=spec.multi?'multi':'dictionary';\nplan.reason='value table supplied (lookup column)';\n}else{\nconst samples=[];\nfor(let i=0;i<sampleN&&samples.length<this.#opts.sampleSize;i++){\nconst v=read(rows[i]);\nif(v!==null&&v!==undefined)samples.push(v);\n}\nplan.inferred=true;\nconst kind=inferKind(samples,{multi:spec.multi});\nif(kind==='text'){\nconst distinct=new Set(samples).size;\nplan.kind=decideText(distinct,samples.length,ratio);\nplan.candidate=this.#columnar;\nplan.reason=`sampled ${distinct} distinct in ${samples.length}`;\n}else{\nplan.kind=kind;\nplan.reason=`inferred from ${samples.length} sampled values`;\nif(kind==='object'&&samples.length){\ninfoOnce(`ingest.mixed.${spec.id}`,\n`column \"${spec.id}\" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);\n}\n}\nif(plan.kind==='object'&&plan.candidate)plan.distinct=new Set(samples);\n}\nthis.#plans.push(plan);\n}\n}\n#measure(from,to){\nconst rows=this.#rows;\nfor(const plan of this.#plans){\nif(!plan.candidate||!plan.distinct)continue;\nconst set=plan.distinct;\nfor(let i=from;i<to;i++){\nconst v=plan.read(rows[i]);\nif(v!==null&&v!==undefined)set.add(v);\n}\n}\n}\n#distinctOf(plan){\nif(plan.distinct)return plan.distinct.size;\nconst handle=this.#store.column(plan.spec.id);\nreturn handle?.dict?handle.dict.size:0;\n}\n#reviewCardinality(final){\nconst ratio=this.#opts.dictionaryRatio;\nconst total=this.#rows.length;\nfor(const plan of this.#plans){\nif(!plan.candidate)continue;\nconst distinct=this.#distinctOf(plan);\nif(plan.kind==='dictionary'&&distinct>=ratio*total){\nconst handle=this.#store.column(plan.spec.id);\nplan.distinct=new Set(handle?.dict?handle.dict.values():[]);\nthis.#store.convert(plan.spec.id,'object');\nplan.kind='object';\nplan.change='demoted';\nplan.reason=`${distinct} distinct values is at or above ${ratio*100}% of ${total} rows`;\ncontinue;\n}\nif(plan.kind==='object'&&distinct>=ratio*total){\nplan.candidate=false;\nplan.distinct=null;\nplan.reason=`${distinct} distinct values is at or above ${ratio*100}% of ${total} rows`;\ncontinue;\n}\nif(final&&plan.kind==='object'&&distinct<ratio*total){\nthis.#store.convert(plan.spec.id,'dictionary');\nplan.kind='dictionary';\nplan.change=plan.change==='demoted'?null:'promoted';\nplan.reason=`${distinct} distinct values is below ${ratio*100}% of ${total} rows`;\nplan.distinct=null;\n}\nif(final)plan.candidate=false;\n}\n}\n}\nasync function ingest(rows,plan={},opts={}){\nconst run=new Ingest(rows,plan,opts);\nconst frame=opts.scheduler?.frame??nextFrame;\nwhile(run.slice()){\nawait new Promise((resolve)=>{frame(resolve);});\n}\nreturn run.result();\n}\nfunction ingestSync(rows,plan={},opts={}){\nconst run=new Ingest(rows,plan,{...opts,chunkMs:Infinity});\nwhile(run.slice());\nreturn run.result();\n}\n});\n__def(\"packages/core/src/store/columnpack.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"isPortableSchema\",{enumerable:true,get:function(){return isPortableSchema;}});\nObject.defineProperty(__exports,\"packChunk\",{enumerable:true,get:function(){return packChunk;}});\nObject.defineProperty(__exports,\"packedTransfers\",{enumerable:true,get:function(){return packedTransfers;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst pathGetter=__m0[\"pathGetter\"];\nconst __m1=__req(\"packages/core/src/store/ingest.js\");\nconst inferKind=__m1[\"inferKind\"];\nconst decideText=__m1[\"decideText\"];\nconst INGEST_DEFAULTS=__m1[\"INGEST_DEFAULTS\"];\nconst __m2=__req(\"packages/core/src/store/columnstore.js\");\nconst toFloat=__m2[\"toFloat\"];\nconst PORTABLE_KINDS=new Set(['float64','int32','bitset','dictionary','object','multi']);\nfunction isPortableSchema(schema){\nif(!Array.isArray(schema)||schema.length===0)return false;\nfor(const col of schema){\nif(!col||typeof col.id!=='string')return false;\nif(typeof col.field!=='string'||col.field==='')return false;\nif(col.kind&&!PORTABLE_KINDS.has(col.kind))return false;\n}\nreturn true;\n}\nfunction toInt(v){\nconst n=toFloat(v);\nreturn Number.isFinite(n)?n|0:0;\n}\nfunction toMembers(v){\nif(v===null||v===undefined)return[];\nreturn Array.isArray(v)?v:[v];\n}\nfunction resolveKind(col,values,rows,ratio){\nif(col.kind)return col.kind;\nconst samples=[];\nfor(let i=0;i<values.length&&samples.length<INGEST_DEFAULTS.sampleSize;i++){\nconst v=values[i];\nif(v!==null&&v!==undefined)samples.push(v);\n}\nconst kind=inferKind(samples,{multi:col.multi});\nif(kind!=='text')return kind;\nconst distinct=new Set(samples).size;\nreturn decideText(distinct,samples.length,ratio);\n}\nfunction packChunk(schema,rows,opts={}){\nconst n=rows.length|0;\nconst ratio=opts.dictionaryRatio??INGEST_DEFAULTS.dictionaryRatio;\nconst columns=[];\nfor(const col of schema){\nconst read=pathGetter(col.field||col.id);\nconst nullable=col.nullable!==false;\nconst raw=new Array(n);\nfor(let i=0;i<n;i++){\nconst v=read(rows[i]);\nraw[i]=v===undefined?null:v;\n}\nconst kind=resolveKind(col,raw,n,ratio);\nconst presence=nullable?new Uint8Array((n+7)>>3):null;\nconst present=(i)=>{if(presence)presence[i>>3]|=1<<(i&7);};\nlet packed;\nswitch(kind){\ncase'float64':{\nconst values=new Float64Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nvalues[i]=gone?NaN:toFloat(v);\n}\npacked={id:col.id,kind,nullable,values,presence,offsets:null,table:null};\nbreak;\n}\ncase'int32':{\nconst values=new Int32Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nvalues[i]=gone?0:toInt(v);\n}\npacked={id:col.id,kind,nullable,values,presence,offsets:null,table:null};\nbreak;\n}\ncase'bitset':{\nconst words=new Uint8Array((n+7)>>3);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nconst gone=v===null;\nif(!gone)present(i);\nif(!gone&&!!v)words[i>>3]|=1<<(i&7);\n}\npacked={id:col.id,kind,nullable,values:words,presence,offsets:null,table:null};\nbreak;\n}\ncase'dictionary':{\nconst codes=new Uint32Array(n);\nconst table=[];\nconst index=new Map();\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nif(v===null){codes[i]=0;continue;}\npresent(i);\nlet code=index.get(v);\nif(code===undefined){code=table.length;table.push(v);index.set(v,code);}\ncodes[i]=code;\n}\npacked={id:col.id,kind,nullable,values:codes,presence,offsets:null,table};\nbreak;\n}\ncase'multi':{\nconst table=[];\nconst index=new Map();\nconst offsets=new Uint32Array(n+1);\nconst flat=[];\nfor(let i=0;i<n;i++){\nconst v=raw[i];\noffsets[i]=flat.length;\nconst gone=v===null;\nif(!gone)present(i);\nconst members=toMembers(v);\nfor(let k=0;k<members.length;k++){\nconst m=members[k];\nlet code=index.get(m);\nif(code===undefined){code=table.length;table.push(m);index.set(m,code);}\nflat.push(code);\n}\n}\noffsets[n]=flat.length;\npacked={id:col.id,kind,nullable,values:Int32Array.from(flat),presence,offsets,table};\nbreak;\n}\ndefault:{\nconst values=new Array(n);\nfor(let i=0;i<n;i++){\nconst v=raw[i];\nif(v!==null)present(i);\nvalues[i]=v;\n}\npacked={id:col.id,kind:'object',nullable,values,presence,offsets:null,table:null};\nbreak;\n}\n}\ncolumns.push(packed);\n}\nreturn{count:n,columns};\n}\nfunction packedTransfers(chunk){\nconst out=[];\nif(!chunk||!Array.isArray(chunk.columns))return out;\nconst add=(v)=>{\nif(ArrayBuffer.isView(v)&&v.buffer&&!out.includes(v.buffer))out.push(v.buffer);\n};\nfor(const col of chunk.columns){\nadd(col.values);\nadd(col.presence);\nadd(col.offsets);\n}\nreturn out;\n}\n});\n__def(\"packages/core/src/compute/sortspec.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"collationDescriptor\",{enumerable:true,get:function(){return collationDescriptor;}});\nObject.defineProperty(__exports,\"isPortableSort\",{enumerable:true,get:function(){return isPortableSort;}});\nObject.defineProperty(__exports,\"isPortableSortSet\",{enumerable:true,get:function(){return isPortableSortSet;}});\nObject.defineProperty(__exports,\"describeSortEntry\",{enumerable:true,get:function(){return describeSortEntry;}});\nObject.defineProperty(__exports,\"describeSort\",{enumerable:true,get:function(){return describeSort;}});\nfunction collationDescriptor(locale){\nreturn{locale:locale===undefined?undefined:String(locale),numeric:true,sensitivity:'variant'};\n}\nfunction isPortableSort(entry){\nreturn!!entry&&typeof entry.compare!=='function';\n}\nfunction isPortableSortSet(entries){\nif(!entries)return true;\nfor(let i=0;i<entries.length;i++)if(!isPortableSort(entries[i]))return false;\nreturn true;\n}\nfunction describeSortEntry(entry,locale){\nconst col=entry.col!==undefined?entry.col:(entry.handle&&entry.handle.id);\nconst chosen=entry.locale!==undefined?entry.locale:locale;\nreturn{\ncol,\ndescending:entry.descending!==undefined?!!entry.descending:entry.dir==='desc',\nnullsFirst:!!entry.nullsFirst,\ncollation:collationDescriptor(chosen),\n};\n}\nfunction describeSort(entries,locale){\nconst list=entries||[];\nconst out=new Array(list.length);\nfor(let i=0;i<list.length;i++)out[i]=describeSortEntry(list[i],locale);\nreturn out;\n}\n});\n__def(\"packages/core/src/format/date.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"scanPattern\",{enumerable:true,get:function(){return scanPattern;}});\nObject.defineProperty(__exports,\"toDate\",{enumerable:true,get:function(){return toDate;}});\nObject.defineProperty(__exports,\"compilePattern\",{enumerable:true,get:function(){return compilePattern;}});\nObject.defineProperty(__exports,\"compileDate\",{enumerable:true,get:function(){return compileDate;}});\nObject.defineProperty(__exports,\"toIsoDate\",{enumerable:true,get:function(){return toIsoDate;}});\nObject.defineProperty(__exports,\"toIsoDateTime\",{enumerable:true,get:function(){return toIsoDateTime;}});\nObject.defineProperty(__exports,\"compareIso\",{enumerable:true,get:function(){return compareIso;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isNil=__m0[\"isNil\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst TOKENS=[\n'yyyy','yy','MMMM','MMM','MM','M','dd','d',\n'EEEE','EEE','HH','H','hh','h','mm','m','ss','s','SSS','a',\n];\nfunction scanPattern(pattern){\nconst out=[];\nlet i=0;\nlet literal='';\nconst flush=()=>{if(literal){out.push({token:null,text:literal});literal='';}};\nwhile(i<pattern.length){\nconst ch=pattern[i];\nif(ch===\"'\"){\nif(pattern[i+1]===\"'\"){literal+=\"'\";i+=2;continue;}\nconst end=pattern.indexOf(\"'\",i+1);\nif(end===-1){literal+=pattern.slice(i+1);i=pattern.length;continue;}\nliteral+=pattern.slice(i+1,end);\ni=end+1;\ncontinue;\n}\nconst token=TOKENS.find((t)=>pattern.startsWith(t,i));\nif(token){flush();out.push({token,text:token});i+=token.length;continue;}\nif(/[A-Za-z]/.test(ch)){\nwarnOnce(\n`date.pattern.token:${ch}`,\n`the date pattern \"${pattern}\" contains '${ch}', which is not a supported token, `\n+'so it is rendered as text. Quote it as a literal to silence this. '\n+`Supported: ${TOKENS.join(' ')}.`,\n);\n}\nliteral+=ch;\ni+=1;\n}\nflush();\nreturn out;\n}\nconst WALL_CLOCK=/^(\\d{4})-(\\d{2})-(\\d{2})(?:[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?(?:\\.\\d+)?)?$/;\nfunction toDate(value){\nif(isNil(value)||value==='')return null;\nif(value instanceof Date)return Number.isNaN(value.getTime())?null:value;\nif(typeof value==='number')return Number.isNaN(value)?null:new Date(value);\nif(typeof value==='string'){\nconst wall=WALL_CLOCK.exec(value.trim());\nif(wall){\nconst[,y,mo,d,h='0',mi='0',sec='0']=wall;\nreturn new Date(+y,+mo-1,+d,+h,+mi,+sec);\n}\nconst d=new Date(value);\nreturn Number.isNaN(d.getTime())?null:d;\n}\nreturn null;\n}\nfunction pad(n,w){return String(n).padStart(w,'0');}\nfunction fieldReader(timeZone){\nif(!timeZone){\nreturn(d)=>({\nyear:d.getFullYear(),month:d.getMonth()+1,day:d.getDate(),\nhour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),\nms:d.getMilliseconds(),weekday:d.getDay(),\n});\n}\nconst zoned=new Intl.DateTimeFormat('en-US',{\ntimeZone,year:'numeric',month:'2-digit',day:'2-digit',\nhour:'2-digit',minute:'2-digit',second:'2-digit',hour12:false,weekday:'short',\n});\nconst days={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};\nreturn(d)=>{\nconst f={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:d.getMilliseconds(),weekday:0};\nfor(const part of zoned.formatToParts(d)){\nswitch(part.type){\ncase'year':f.year=Number(part.value);break;\ncase'month':f.month=Number(part.value);break;\ncase'day':f.day=Number(part.value);break;\ncase'hour':f.hour=Number(part.value)%24;break;\ncase'minute':f.minute=Number(part.value);break;\ncase'second':f.second=Number(part.value);break;\ncase'weekday':f.weekday=days[part.value]??0;break;\ndefault:break;\n}\n}\nreturn f;\n};\n}\nfunction compilePattern(pattern,locale,timeZone){\nconst segments=scanPattern(pattern);\nconst read=fieldReader(timeZone);\nconst used=new Set(segments.filter((s)=>s.token).map((s)=>s.token));\nconst monthShort=used.has('MMM')?new Intl.DateTimeFormat(locale,{month:'short',timeZone}):null;\nconst monthLong=used.has('MMMM')?new Intl.DateTimeFormat(locale,{month:'long',timeZone}):null;\nconst dayShort=used.has('EEE')?new Intl.DateTimeFormat(locale,{weekday:'short',timeZone}):null;\nconst dayLong=used.has('EEEE')?new Intl.DateTimeFormat(locale,{weekday:'long',timeZone}):null;\nreturn(d)=>{\nconst f=read(d);\nlet out='';\nfor(const seg of segments){\nif(!seg.token){out+=seg.text;continue;}\nswitch(seg.token){\ncase'yyyy':out+=pad(f.year,4);break;\ncase'yy':out+=pad(f.year%100,2);break;\ncase'MMMM':out+=monthLong.format(d);break;\ncase'MMM':out+=monthShort.format(d);break;\ncase'MM':out+=pad(f.month,2);break;\ncase'M':out+=String(f.month);break;\ncase'dd':out+=pad(f.day,2);break;\ncase'd':out+=String(f.day);break;\ncase'EEEE':out+=dayLong.format(d);break;\ncase'EEE':out+=dayShort.format(d);break;\ncase'HH':out+=pad(f.hour,2);break;\ncase'H':out+=String(f.hour);break;\ncase'hh':out+=pad(f.hour%12===0?12:f.hour%12,2);break;\ncase'h':out+=String(f.hour%12===0?12:f.hour%12);break;\ncase'mm':out+=pad(f.minute,2);break;\ncase'm':out+=String(f.minute);break;\ncase'ss':out+=pad(f.second,2);break;\ncase's':out+=String(f.second);break;\ncase'SSS':out+=pad(f.ms,3);break;\ncase'a':out+=f.hour<12?'AM':'PM';break;\ndefault:out+=seg.text;break;\n}\n}\nreturn out;\n};\n}\nconst UNITS=[\n['year',365*24*3600e3],\n['month',30*24*3600e3],\n['week',7*24*3600e3],\n['day',24*3600e3],\n['hour',3600e3],\n['minute',60e3],\n['second',1e3],\n];\nfunction compileDate(spec,locale){\nconst s=spec||{};\nconst loc=s.locale||locale||undefined;\nconst nullDisplay=s.nullDisplay??'';\nconst timeZone=s.timeZone;\nlet absolute;\nif(s.pattern){\nabsolute=compilePattern(s.pattern,loc,timeZone);\n}else if(s.dateStyle||s.timeStyle){\nconst opts={timeZone};\nif(s.dateStyle)opts.dateStyle=s.dateStyle;\nif(s.timeStyle)opts.timeStyle=s.timeStyle;\nconst dtf=new Intl.DateTimeFormat(loc,opts);\nabsolute=(d)=>dtf.format(d);\n}else{\nconst dtf=new Intl.DateTimeFormat(loc,{dateStyle:'medium',timeZone});\nabsolute=(d)=>dtf.format(d);\n}\nconst relative=s.relative?new Intl.RelativeTimeFormat(loc,{numeric:'auto'}):null;\nconst thresholdDays=typeof s.relative==='object'&&s.relative\n?(s.relative.threshold??7)\n:7;\nconst thresholdMs=thresholdDays*24*3600e3;\nconst format=(value,params)=>{\nconst d=toDate(value);\nif(!d)return nullDisplay;\nif(relative){\nconst now=params&&typeof params.now==='number'?params.now:Date.now();\nconst delta=d.getTime()-now;\nif(Math.abs(delta)<thresholdMs){\nfor(const[unit,ms]of UNITS){\nif(Math.abs(delta)>=ms||unit==='second'){\nreturn relative.format(Math.round(delta/ms),unit);\n}\n}\n}\n}\nreturn absolute(d);\n};\nformat.spec=s;\nreturn format;\n}\nfunction toIsoDate(value){\nif(isNil(value)||value==='')return null;\nif(typeof value==='string'){\nconst match=/^(\\d{4}-\\d{2}-\\d{2})/.exec(value.trim());\nif(match)return match[1];\nconst parsed=toDate(value);\nreturn parsed?toIsoDate(parsed):null;\n}\nconst date=toDate(value);\nif(!date)return null;\nconst pad=(n)=>String(n).padStart(2,'0');\nreturn`${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())}`;\n}\nfunction toIsoDateTime(value,timeZone){\nif(isNil(value)||value==='')return null;\nif(typeof value==='string'){\nconst text=value.trim();\nif(ZONE_SUFFIX.test(text)){\nconst instant=toDate(text);\nreturn instant?wallClockIn(instant,timeZone):null;\n}\nconst match=/^(\\d{4}-\\d{2}-\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?/.exec(text);\nif(match){\nconst[,day,hour,minute,second]=match;\nreturn`${day}T${hour}:${minute}${second&&second!=='00'?`:${second}`:''}`;\n}\nif(/^\\d{4}-\\d{2}-\\d{2}$/.test(text))return`${text}T00:00`;\nconst parsed=toDate(text);\nreturn parsed?toIsoDateTime(parsed):null;\n}\nconst date=toDate(value);\nif(!date)return null;\nreturn wallClockIn(date,timeZone);\n}\nconst ZONE_SUFFIX=/(?:Z|[+-]\\d{2}:?\\d{2})$/i;\nfunction wallClockIn(date,timeZone){\nconst pad=(n)=>String(n).padStart(2,'0');\nif(timeZone){\ntry{\nconst parts=new Intl.DateTimeFormat('en-CA',{\ntimeZone,\nyear:'numeric',month:'2-digit',day:'2-digit',\nhour:'2-digit',minute:'2-digit',second:'2-digit',\nhour12:false,\n}).formatToParts(date).reduce((out,part)=>{\nif(part.type!=='literal')out[part.type]=part.value;\nreturn out;\n},{});\nconst hour=parts.hour==='24'?'00':parts.hour;\nconst seconds=Number(parts.second);\nreturn`${parts.year}-${parts.month}-${parts.day}T${hour}:${parts.minute}`\n+(seconds?`:${parts.second}`:'');\n}catch{\n}\n}\nconst day=`${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())}`;\nconst seconds=date.getSeconds();\nconst clock=`${pad(date.getHours())}:${pad(date.getMinutes())}${seconds?`:${pad(seconds)}`:''}`;\nreturn`${day}T${clock}`;\n}\nfunction compareIso(a,b){\nconst left=isNil(a)||a===''?null:String(a);\nconst right=isNil(b)||b===''?null:String(b);\nif(left===null)return right===null?0:1;\nif(right===null)return-1;\nreturn left<right?-1:left>right?1:0;\n}\n});\n__def(\"packages/core/src/compute/filter.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"releaseMask\",{enumerable:true,get:function(){return releaseMask;}});\nObject.defineProperty(__exports,\"compilePredicate\",{enumerable:true,get:function(){return compilePredicate;}});\nObject.defineProperty(__exports,\"testValue\",{enumerable:true,get:function(){return testValue;}});\nObject.defineProperty(__exports,\"evaluateCondition\",{enumerable:true,get:function(){return evaluateCondition;}});\nObject.defineProperty(__exports,\"evaluateFilters\",{enumerable:true,get:function(){return evaluateFilters;}});\nObject.defineProperty(__exports,\"pruneColumn\",{enumerable:true,get:function(){return pruneColumn;}});\nObject.defineProperty(__exports,\"mentionsColumn\",{enumerable:true,get:function(){return mentionsColumn;}});\nObject.defineProperty(__exports,\"compact\",{enumerable:true,get:function(){return compact;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isBlank=__m0[\"isBlank\"];\nconst toArray=__m0[\"toArray\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/format/date.js\");\nconst toIsoDate=__m1[\"toIsoDate\"];\nconst __m2=__req(\"packages/core/src/compute/handle.js\");\nconst bitReader=__m2[\"bitReader\"];\nconst dictSize=__m2[\"dictSize\"];\nconst dictValue=__m2[\"dictValue\"];\nconst presenceReader=__m2[\"presenceReader\"];\nconst valueComparator=__m2[\"valueComparator\"];\nconst valueReader=__m2[\"valueReader\"];\nconst ISO_DAY=/^\\d{4}-\\d{2}-\\d{2}$/;\nconst NULL_KEY='\\u0000null\\u0000';\nfunction acquireMask(ctx,n){\nconst pool=ctx&&ctx.pool;\nif(pool){\nconst take=pool.mask||pool.acquireMask||pool.acquire||pool.take;\nif(typeof take==='function'){\nconst mask=take.call(pool,n);\nif(mask&&mask.length>=n)return mask;\n}\n}\nreturn new Uint8Array(n);\n}\nfunction releaseMask(ctx,mask){\nconst pool=ctx&&ctx.pool;\nif(!pool||!mask)return;\nconst give=pool.release||pool.releaseMask||pool.free||pool.recycle;\nif(typeof give==='function')give.call(pool,mask);\n}\nfunction fillMask(mask,n,value){\nmask.fill(value,0,n);\nreturn mask;\n}\nfunction unorderable(v){\nreturn v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v));\n}\nfunction coerceTarget(value,type){\nif(value===null||value===undefined)return value;\nif(type==='number')return typeof value==='number'?value:Number(value);\nif(type==='date'||type==='dateString'){\nconst iso=toIsoDate(value);\nreturn iso===null?toMillis(value):iso;\n}\nif(type==='boolean'){\nif(typeof value==='boolean')return value;\nif(value==='true'||value===1)return true;\nif(value==='false'||value===0)return false;\nreturn!!value;\n}\nreturn value;\n}\nfunction toMillis(value){\nif(value instanceof Date)return value.getTime();\nif(typeof value==='number')return value;\nreturn Date.parse(String(value));\n}\nfunction toNumber(value){\nif(typeof value==='number')return value;\nif(value instanceof Date)return value.getTime();\nif(value===null||value===undefined||value==='')return NaN;\nreturn Number(value);\n}\nfunction textOf(v,caseSensitive){\nconst s=typeof v==='string'?v:String(v);\nreturn caseSensitive?s:s.toLowerCase();\n}\nfunction setKey(v,caseSensitive){\nif(v===null||v===undefined)return NULL_KEY;\nif(typeof v==='string')return caseSensitive?v:v.toLowerCase();\nif(v instanceof Date)return v.getTime();\nreturn v;\n}\nfunction buildSet(value,caseSensitive,type){\nconst set=new Set();\nfor(const raw of toArray(value)){\nconst entry=coerceTarget(raw,type);\nset.add(setKey(entry,caseSensitive));\nif(typeof entry==='string'&&entry!==''&&Number.isFinite(Number(entry)))set.add(Number(entry));\nelse if(typeof entry==='number'&&Number.isFinite(entry))set.add(setKey(String(entry),caseSensitive));\n}\nreturn set;\n}\nfunction valueEquals(a,b,caseSensitive){\nif(a===null||a===undefined||b===null||b===undefined){\nreturn(a===null||a===undefined)&&(b===null||b===undefined);\n}\nconst ta=typeof a;\nconst tb=typeof b;\nif(ta==='string'&&tb==='string')return caseSensitive?a===b:a.toLowerCase()===b.toLowerCase();\nif(a instanceof Date||b instanceof Date)return toMillis(a)===toMillis(b);\nif(ta==='number'&&tb==='number')return a===b||(Number.isNaN(a)&&Number.isNaN(b));\nif(ta==='number'&&tb==='string')return a===Number(b);\nif(ta==='string'&&tb==='number')return Number(a)===b;\nif(ta==='boolean'||tb==='boolean')return a===b;\nif(Array.isArray(a)&&Array.isArray(b)){\nreturn a.length===b.length&&a.every((x,i)=>valueEquals(x,b[i],caseSensitive));\n}\nreturn a===b;\n}\nfunction compileRegExp(value,caseSensitive){\ntry{\nif(value instanceof RegExp){\nconst flags=value.flags.replace(/[gy]/g,'');\nreturn new RegExp(value.source,caseSensitive?flags:flags.includes('i')?flags:`${flags}i`);\n}\nreturn new RegExp(String(value),caseSensitive?'':'i');\n}catch(err){\nwarnOnce(`regex:${String(value)}`,`filter operator \"matches\" received an invalid pattern: ${String(value)}`,err);\nreturn null;\n}\n}\nfunction compilePredicate(condition,locale){\nconst predicate=compileValuePredicate(condition,locale);\nconst type=condition&&condition.type;\nif(type!=='date'&&type!=='dateString')return predicate;\nreturn(v)=>predicate(typeof v==='string'&&ISO_DAY.test(v)?v:(toIsoDate(v)??v));\n}\nfunction compileValuePredicate(condition,locale){\nconst op=condition&&condition.op;\nconst caseSensitive=!!(condition&&condition.caseSensitive);\nconst type=condition&&condition.type;\nconst cmp=valueComparator(locale);\nconst not=(p)=>(v)=>!p(v);\nswitch(op){\ncase'eq':{\nconst target=coerceTarget(condition.value,type);\nreturn(v)=>valueEquals(v,target,caseSensitive);\n}\ncase'ne':{\nconst target=coerceTarget(condition.value,type);\nreturn(v)=>!valueEquals(v,target,caseSensitive);\n}\ncase'lt':case'lte':case'gt':case'gte':{\nconst target=coerceTarget(condition.value,type);\nif(unorderable(target))return()=>false;\nconst want=op==='lt'?-1:op==='lte'?0:op==='gt'?1:2;\nreturn(v)=>{\nif(unorderable(v))return false;\nconst c=cmp(v,target);\nreturn want===-1?c<0:want===0?c<=0:want===1?c>0:c>=0;\n};\n}\ncase'between':case'notBetween':{\nconst pair=toArray(condition.value);\nconst lo=coerceTarget(pair[0],type);\nconst hi=coerceTarget(pair[1],type);\nconst bounds=condition.bounds||'[]';\nconst loInclusive=bounds.charAt(0)!=='(';\nconst hiInclusive=bounds.charAt(1)!==')';\nif(unorderable(lo)||unorderable(hi))return op==='between'?()=>false:()=>true;\nconst inRange=(v)=>{\nif(unorderable(v))return false;\nconst a=cmp(v,lo);\nconst b=cmp(v,hi);\nreturn(loInclusive?a>=0:a>0)&&(hiInclusive?b<=0:b<0);\n};\nreturn op==='between'?inRange:not(inRange);\n}\ncase'in':case'notIn':{\nconst set=buildSet(condition.value,caseSensitive,type);\nconst member=(v)=>set.has(setKey(v,caseSensitive));\nreturn op==='in'?member:not(member);\n}\ncase'contains':case'notContains':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nconst has=(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).includes(needle));\nreturn op==='contains'?has:not(has);\n}\ncase'startsWith':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nreturn(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).startsWith(needle));\n}\ncase'endsWith':{\nconst needle=textOf(coerceTarget(condition.value,type),caseSensitive);\nreturn(v)=>(v===null||v===undefined?false:textOf(v,caseSensitive).endsWith(needle));\n}\ncase'matches':{\nconst re=compileRegExp(condition.value,caseSensitive);\nif(!re)return()=>false;\nreturn(v)=>(v===null||v===undefined?false:re.test(String(v)));\n}\ncase'blank':\nreturn(v)=>isBlank(v)||(Array.isArray(v)&&v.length===0);\ncase'notBlank':\nreturn(v)=>!(isBlank(v)||(Array.isArray(v)&&v.length===0));\ncase'containsAny':case'containsNone':{\nconst set=buildSet(condition.value,caseSensitive,type);\nconst any=(v)=>{\nconst list=v===null||v===undefined?[]:toArray(v);\nfor(let i=0;i<list.length;i++)if(set.has(setKey(list[i],caseSensitive)))return true;\nreturn false;\n};\nreturn op==='containsAny'?any:not(any);\n}\ncase'containsAll':{\nconst wanted=toArray(condition.value).map((x)=>setKey(coerceTarget(x,type),caseSensitive));\nreturn(v)=>{\nconst list=v===null||v===undefined?[]:toArray(v);\nif(wanted.length===0)return true;\nconst have=new Set(list.map((x)=>setKey(x,caseSensitive)));\nfor(let i=0;i<wanted.length;i++)if(!have.has(wanted[i]))return false;\nreturn true;\n};\n}\ndefault:\nwarnOnce(`op:${String(op)}`,`unknown filter operator \"${String(op)}\"; the condition passes every row`);\nreturn()=>true;\n}\n}\nfunction testValue(value,condition,locale){\nreturn compilePredicate(condition,locale)(value);\n}\nfunction presenceCondition(handle,wantPresent,mask,count){\nconst present=presenceReader(handle);\nif(present){\nconst target=wantPresent?1:0;\nfor(let i=0;i<count;i++)mask[i]=present(i)===target?1:0;\nreturn mask;\n}\nconst kind=handle.kind;\nif(kind==='float64'||kind==='int32'||kind==='bitset'){\nreturn fillMask(mask,count,wantPresent?1:0);\n}\nconst read=valueReader(handle);\nfor(let i=0;i<count;i++){\nconst v=read(i);\nconst blank=isBlank(v)||(Array.isArray(v)&&v.length===0);\nmask[i]=blank===wantPresent?0:1;\n}\nreturn mask;\n}\nfunction dictionaryCondition(handle,pred,mask,count){\nconst dict=handle.dict;\nconst size=dictSize(dict);\nconst allowed=new Uint8Array(size);\nfor(let code=0;code<size;code++)allowed[code]=pred(dictValue(dict,code))?1:0;\nconst codes=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<count;i++)mask[i]=allowed[codes[i]];\nreturn mask;\n}\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++)mask[i]=present(i)===1?allowed[codes[i]]:absentAnswer;\nreturn mask;\n}\nfunction booleanCondition(handle,pred,mask,count){\nconst bit=bitReader(handle.values);\nconst whenTrue=pred(true)?1:0;\nconst whenFalse=pred(false)?1:0;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<count;i++)mask[i]=bit(i)===1?whenTrue:whenFalse;\nreturn mask;\n}\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++){\nmask[i]=present(i)===0?absentAnswer:(bit(i)===1?whenTrue:whenFalse);\n}\nreturn mask;\n}\nfunction numericCondition(handle,condition,pred,mask,count){\nconst values=handle.values;\nconst type=condition.type;\nconst op=condition.op;\nlet handled=true;\nswitch(op){\ncase'eq':case'ne':{\nconst target=toNumber(coerceTarget(condition.value,type));\nconst wantNaN=typeof condition.value==='number'&&Number.isNaN(condition.value);\nconst invert=op==='ne'?1:0;\nif(wantNaN){\nfor(let i=0;i<count;i++)mask[i]=(Number.isNaN(values[i])?1:0)^invert;\n}else{\nfor(let i=0;i<count;i++)mask[i]=((values[i]===target)?1:0)^invert;\n}\nbreak;\n}\ncase'lt':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]<t?1:0;\nbreak;\n}\ncase'lte':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]<=t?1:0;\nbreak;\n}\ncase'gt':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]>t?1:0;\nbreak;\n}\ncase'gte':{\nconst t=toNumber(coerceTarget(condition.value,type));\nfor(let i=0;i<count;i++)mask[i]=values[i]>=t?1:0;\nbreak;\n}\ncase'between':case'notBetween':{\nconst pair=toArray(condition.value);\nconst lo=toNumber(coerceTarget(pair[0],type));\nconst hi=toNumber(coerceTarget(pair[1],type));\nconst bounds=condition.bounds||'[]';\nconst loInclusive=bounds.charAt(0)!=='(';\nconst hiInclusive=bounds.charAt(1)!==')';\nconst invert=op==='notBetween'?1:0;\nif(loInclusive&&hiInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>=lo)&(values[i]<=hi))?1:0)^invert;\n}else if(loInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>=lo)&(values[i]<hi))?1:0)^invert;\n}else if(hiInclusive){\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>lo)&(values[i]<=hi))?1:0)^invert;\n}else{\nfor(let i=0;i<count;i++)mask[i]=(((values[i]>lo)&(values[i]<hi))?1:0)^invert;\n}\nbreak;\n}\ncase'in':case'notIn':{\nconst set=new Set();\nfor(const raw of toArray(condition.value)){\nconst n=toNumber(coerceTarget(raw,type));\nif(!Number.isNaN(n))set.add(n);\n}\nconst invert=op==='notIn'?1:0;\nfor(let i=0;i<count;i++)mask[i]=(set.has(values[i])?1:0)^invert;\nbreak;\n}\ndefault:\nhandled=false;\nbreak;\n}\nif(!handled)return false;\nconst present=presenceReader(handle);\nif(present){\nconst absentAnswer=pred(null)?1:0;\nfor(let i=0;i<count;i++)if(present(i)===0)mask[i]=absentAnswer;\n}\nreturn true;\n}\nfunction genericCondition(handle,pred,mask,count){\nconst read=valueReader(handle);\nfor(let i=0;i<count;i++)mask[i]=pred(read(i))?1:0;\nreturn mask;\n}\nfunction evaluateCondition(condition,ctx,out){\nconst count=ctx.count|0;\nconst mask=out||acquireMask(ctx,count);\nif(!condition)return fillMask(mask,count,1);\nconst handle=typeof ctx.handle==='function'?ctx.handle(condition.col):undefined;\nconst custom=typeof ctx.custom==='function'?ctx.custom:null;\nif(!handle){\nif(custom){\nfor(let i=0;i<count;i++)mask[i]=custom(condition,i)?1:0;\nreturn mask;\n}\nwarnOnce(`filter:col:${String(condition.col)}`,\n`filter references unknown column \"${String(condition.col)}\"; the condition passes every row`);\nreturn fillMask(mask,count,1);\n}\nconst op=condition.op;\nif(op==='blank'||op==='notBlank')return presenceCondition(handle,op==='notBlank',mask,count);\nconst pred=compilePredicate(condition,ctx.locale);\nswitch(handle.kind){\ncase'dictionary':\nreturn dictionaryCondition(handle,pred,mask,count);\ncase'bitset':\nreturn booleanCondition(handle,pred,mask,count);\ncase'float64':case'int32':\nif(numericCondition(handle,condition,pred,mask,count))return mask;\nreturn genericCondition(handle,pred,mask,count);\ndefault:\nreturn genericCondition(handle,pred,mask,count);\n}\n}\nfunction evaluateNode(node,ctx,count){\nif(!node)return fillMask(acquireMask(ctx,count),count,1);\nif(Array.isArray(node.conditions)){\nconst children=node.conditions.filter((c)=>c!=null);\nconst op=node.op==='or'?'or':node.op==='not'?'not':'and';\nif(children.length===0)return fillMask(acquireMask(ctx,count),count,1);\nconst acc=evaluateNode(children[0],ctx,count);\nfor(let k=1;k<children.length;k++){\nconst rhs=evaluateNode(children[k],ctx,count);\nif(op==='or')for(let i=0;i<count;i++)acc[i]|=rhs[i];\nelse for(let i=0;i<count;i++)acc[i]&=rhs[i];\nreleaseMask(ctx,rhs);\n}\nif(op==='not')for(let i=0;i<count;i++)acc[i]^=1;\nreturn acc;\n}\nreturn evaluateCondition(node,ctx,acquireMask(ctx,count));\n}\nfunction evaluateFilters(filters,ctx){\nreturn evaluateNode(filters,ctx,ctx.count|0);\n}\nfunction pruneColumn(filters,colId){\nif(!filters||!colId)return filters||null;\nconst node=(filters);\nif(Array.isArray(node.conditions)){\nconst op=node.op==='or'?'or':node.op==='not'?'not':'and';\nif(op!=='and'){\nreturn mentionsColumn(node,colId)?null:filters;\n}\nconst kept=[];\nfor(const child of node.conditions){\nconst pruned=pruneColumn(child,colId);\nif(pruned)kept.push(pruned);\n}\nif(!kept.length)return null;\nreturn{...node,op:'and',conditions:kept};\n}\nreturn node.col===colId?null:filters;\n}\nfunction mentionsColumn(filters,colId){\nif(!filters||typeof filters!=='object')return false;\nconst node=(filters);\nif(node.col===colId)return true;\nif(Array.isArray(node.conditions)){\nfor(const child of node.conditions)if(mentionsColumn(child,colId))return true;\n}\nreturn false;\n}\nfunction compact(mask,count,out){\nif(out&&out.length>=count){\nlet k=0;\nfor(let i=0;i<count;i++)if(mask[i])out[k++]=i;\nreturn out.subarray(0,k);\n}\nlet survivors=0;\nfor(let i=0;i<count;i++)survivors+=mask[i]?1:0;\nconst result=new Uint32Array(survivors);\nlet k=0;\nfor(let i=0;i<count;i++)if(mask[i])result[k++]=i;\nreturn result;\n}\n});\n__def(\"packages/core/src/compute/group.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"packKeys\",{enumerable:true,get:function(){return packKeys;}});\nObject.defineProperty(__exports,\"groupByColumns\",{enumerable:true,get:function(){return groupByColumns;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst dictSize=__m0[\"dictSize\"];\nconst identity=__m0[\"identity\"];\nconst presenceReader=__m0[\"presenceReader\"];\nconst rowCount=__m0[\"rowCount\"];\nconst valueReader=__m0[\"valueReader\"];\nconst KEY_SEPARATOR='\\u001F';\nconst NULL_MARKER='\\u0000';\nconst MAX_DIRECT_COUNTS=1<<20;\nfunction packKeys(handles,idx,n){\nconst k=handles.length;\nconst readers=handles.map((h)=>valueReader(h));\nconst allDictionary=k>0&&handles.every((h)=>h&&h.kind==='dictionary'&&h.dict);\nif(allDictionary){\nconst cards=handles.map((h)=>dictSize(h.dict)+1);\nlet product=1;\nfor(let j=0;j<k;j++)product*=cards[j];\nif(product<=Number.MAX_SAFE_INTEGER){\nconst codes=handles.map((h)=>h.values);\nconst presence=handles.map((h)=>presenceReader(h));\nconst keyOf=(row)=>{\nlet key=0;\nfor(let j=0;j<k;j++){\nconst present=presence[j];\nconst code=present&&present(row)===0?cards[j]-1:codes[j][row];\nkey=key*cards[j]+code;\n}\nreturn key;\n};\nconst packed=new Float64Array(n);\nfor(let i=0;i<n;i++)packed[i]=keyOf(idx[i]);\nreturn{packed,strings:null,product,readers,keyOf};\n}\n}\nconst keyOf=(row)=>{\nlet key='';\nfor(let j=0;j<k;j++){\nconst v=readers[j](row);\nkey+=(j===0?'':KEY_SEPARATOR)+(v===null||v===undefined?NULL_MARKER:String(v));\n}\nreturn key;\n};\nconst strings=new Array(n);\nfor(let i=0;i<n;i++)strings[i]=keyOf(idx[i]);\nreturn{packed:null,strings,product:Infinity,readers,keyOf};\n}\nfunction scatterBuckets(idx,ids,n,groups){\nconst offsets=new Uint32Array(groups+1);\nfor(let i=0;i<n;i++)offsets[ids[i]+1]++;\nfor(let g=0;g<groups;g++)offsets[g+1]+=offsets[g];\nconst scattered=new Uint32Array(n);\nconst cursor=offsets.slice(0,groups);\nfor(let i=0;i<n;i++)scattered[cursor[ids[i]]++]=idx[i];\nconst buckets=new Array(groups);\nfor(let g=0;g<groups;g++)buckets[g]=scattered.subarray(offsets[g],offsets[g+1]);\nreturn buckets;\n}\nfunction groupByColumns(handles,order,opts={}){\nconst list=handles||[];\nconst idx=order||identity(rowCount(list[0],opts));\nconst n=idx.length;\nif(list.length===0||n===0)return{keys:[],buckets:[]};\nconst{packed,strings,product,readers}=packKeys(list,idx,n);\nconst ids=new Uint32Array(n);\nlet groups=0;\nlet packedKeys=null;\nif(packed&&product<=Math.max(1024,Math.min(MAX_DIRECT_COUNTS,n*4))){\nconst size=product;\nconst seen=new Int32Array(size).fill(-1);\nfor(let i=0;i<n;i++)seen[packed[i]]=0;\nfor(let key=0;key<size;key++)if(seen[key]===0)seen[key]=groups++;\nfor(let i=0;i<n;i++)ids[i]=seen[packed[i]];\npackedKeys=new Float64Array(groups);\nfor(let key=0;key<size;key++)if(seen[key]>=0)packedKeys[seen[key]]=key;\n}else if(packed){\nconst seen=new Map();\nfor(let i=0;i<n;i++){\nconst key=packed[i];\nlet id=seen.get(key);\nif(id===undefined){id=groups++;seen.set(key,id);}\nids[i]=id;\n}\npackedKeys=new Float64Array(groups);\nfor(const[key,id]of seen)packedKeys[id]=key;\n}else{\nconst seen=new Map();\nfor(let i=0;i<n;i++){\nconst key=strings[i];\nlet id=seen.get(key);\nif(id===undefined){id=groups++;seen.set(key,id);}\nids[i]=id;\n}\n}\nconst buckets=scatterBuckets(idx,ids,n,groups);\nconst keys=new Array(groups);\nfor(let g=0;g<groups;g++){\nconst row=buckets[g][0];\nconst tuple=new Array(readers.length);\nfor(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);\nkeys[g]=tuple;\n}\nconst result={keys,buckets};\nif(packedKeys)result.packed=packedKeys;\nreturn result;\n}\n});\n__def(\"packages/core/src/compute/facet.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"STRATEGIES\",{enumerable:true,get:function(){return STRATEGIES;}});\nObject.defineProperty(__exports,\"GRANULARITIES\",{enumerable:true,get:function(){return GRANULARITIES;}});\nObject.defineProperty(__exports,\"DEFAULT_BUCKETS\",{enumerable:true,get:function(){return DEFAULT_BUCKETS;}});\nObject.defineProperty(__exports,\"DEFAULT_CARDINALITY_LIMIT\",{enumerable:true,get:function(){return DEFAULT_CARDINALITY_LIMIT;}});\nObject.defineProperty(__exports,\"QUANTILE_SAMPLE\",{enumerable:true,get:function(){return QUANTILE_SAMPLE;}});\nObject.defineProperty(__exports,\"facetKind\",{enumerable:true,get:function(){return facetKind;}});\nObject.defineProperty(__exports,\"orderedReader\",{enumerable:true,get:function(){return orderedReader;}});\nObject.defineProperty(__exports,\"toNumeric\",{enumerable:true,get:function(){return toNumeric;}});\nObject.defineProperty(__exports,\"cardinalityOf\",{enumerable:true,get:function(){return cardinalityOf;}});\nObject.defineProperty(__exports,\"pickGranularity\",{enumerable:true,get:function(){return pickGranularity;}});\nObject.defineProperty(__exports,\"floorTo\",{enumerable:true,get:function(){return floorTo;}});\nObject.defineProperty(__exports,\"advance\",{enumerable:true,get:function(){return advance;}});\nObject.defineProperty(__exports,\"computeBounds\",{enumerable:true,get:function(){return computeBounds;}});\nObject.defineProperty(__exports,\"countInto\",{enumerable:true,get:function(){return countInto;}});\nObject.defineProperty(__exports,\"bucketOf\",{enumerable:true,get:function(){return bucketOf;}});\nObject.defineProperty(__exports,\"facet\",{enumerable:true,get:function(){return facet;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m0[\"presenceReader\"];\nconst valueReader=__m0[\"valueReader\"];\nconst dictSize=__m0[\"dictSize\"];\nconst dictValue=__m0[\"dictValue\"];\nconst STRATEGIES=Object.freeze(['equal','quantile','log']);\nconst GRANULARITIES=Object.freeze(['hour','day','week','month','quarter','year']);\nconst DEFAULT_BUCKETS=20;\nconst DEFAULT_CARDINALITY_LIMIT=50;\nconst QUANTILE_SAMPLE=10_000;\nfunction facetKind(handle,type){\nif(!handle)return'none';\nconst base=type&&type.base;\nif(base==='date'||base==='datetime'||base==='time'||base==='dateString')return'date';\nswitch(handle.kind){\ncase'bitset':return'boolean';\ncase'float64':case'int32':return'numeric';\ncase'dictionary':return'category';\ncase'multi':return'category';\ndefault:\nif(base==='number')return'numeric';\nif(base==='boolean')return'boolean';\nif(base==='text')return'category';\nreturn'none';\n}\n}\nfunction orderedReader(handle){\nconst values=handle.values;\nconst kind=handle.kind;\nif((kind==='float64'||kind==='int32')&&values)return(i)=>values[i];\nconst read=valueReader(handle);\nreturn(i)=>toNumeric(read(i));\n}\nfunction toNumeric(v){\nif(typeof v==='number')return v;\nif(v instanceof Date)return v.getTime();\nif(v===null||v===undefined||v==='')return NaN;\nif(typeof v==='boolean')return v?1:0;\nif(typeof v==='string'){\nconst n=Number(v);\nif(Number.isFinite(n))return n;\nconst t=Date.parse(v);\nreturn Number.isFinite(t)?t:NaN;\n}\nreturn NaN;\n}\nfunction cardinalityOf(handle,indices,count,limit=DEFAULT_CARDINALITY_LIMIT){\nif(!handle)return{cardinality:0,exact:true};\nif(handle.dict)return{cardinality:dictSize(handle.dict),exact:true};\nif(handle.kind==='bitset')return{cardinality:2,exact:true};\nconst read=valueReader(handle);\nconst n=indices?indices.length:count;\nconst seen=new Set();\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined)continue;\nseen.add(v);\nif(seen.size>limit)return{cardinality:seen.size,exact:false};\n}\nreturn{cardinality:seen.size,exact:true};\n}\nconst HOUR_MS=3600_000;\nconst DAY_MS=86_400_000;\nfunction pickGranularity(span,target=DEFAULT_BUCKETS){\nconst ms=Number.isFinite(span)&&span>0?span:0;\nconst wide=Math.max(1,target)*2;\nif(ms/HOUR_MS<=wide)return'hour';\nif(ms/DAY_MS<=wide)return'day';\nif(ms/(7*DAY_MS)<=wide)return'week';\nif(ms/(30*DAY_MS)<=wide)return'month';\nif(ms/(91*DAY_MS)<=wide)return'quarter';\nreturn'year';\n}\nfunction floorTo(ms,granularity){\nif(!Number.isFinite(ms))return NaN;\nconst d=new Date(ms);\nswitch(granularity){\ncase'hour':d.setMinutes(0,0,0);return d.getTime();\ncase'day':d.setHours(0,0,0,0);return d.getTime();\ncase'week':{\nd.setHours(0,0,0,0);\nconst back=(d.getDay()+6)%7;\nd.setDate(d.getDate()-back);\nreturn d.getTime();\n}\ncase'month':d.setDate(1);d.setHours(0,0,0,0);return d.getTime();\ncase'quarter':\nd.setMonth(Math.floor(d.getMonth()/3)*3,1);\nd.setHours(0,0,0,0);\nreturn d.getTime();\ndefault:d.setMonth(0,1);d.setHours(0,0,0,0);return d.getTime();\n}\n}\nfunction advance(ms,granularity){\nconst d=new Date(ms);\nswitch(granularity){\ncase'hour':d.setHours(d.getHours()+1);break;\ncase'day':d.setDate(d.getDate()+1);break;\ncase'week':d.setDate(d.getDate()+7);break;\ncase'month':d.setMonth(d.getMonth()+1);break;\ncase'quarter':d.setMonth(d.getMonth()+3);break;\ndefault:d.setFullYear(d.getFullYear()+1);break;\n}\nreturn d.getTime();\n}\nfunction numericExtent(handle,indices,count){\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nconst n=indices?indices.length:count;\nlet min=Infinity;\nlet max=-Infinity;\nlet nulls=0;\nlet finite=0;\nfor(let k=0;k<n;k++){\nconst i=indices?indices[k]:k;\nif(present&&!present(i)){nulls++;continue;}\nconst v=read(i);\nif(!Number.isFinite(v)){nulls++;continue;}\nif(v<min)min=v;\nif(v>max)max=v;\nfinite++;\n}\nreturn{min,max,nulls,finite};\n}\nfunction sortedSample(handle,indices,count,cap){\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nconst n=indices?indices.length:count;\nconst step=n>cap?n/cap:1;\nconst out=[];\nfor(let s=0;s<n;s+=step){\nconst i=indices?indices[Math.floor(s)]:Math.floor(s);\nif(present&&!present(i))continue;\nconst v=read(i);\nif(Number.isFinite(v))out.push(v);\n}\nconst arr=Float64Array.from(out);\narr.sort();\nreturn arr;\n}\nfunction computeBounds(handle,indices,count,opts={}){\nconst kind=opts.kind||facetKind(handle,opts.type);\nif(kind==='none'||!handle)return{kind:'none',buckets:[],suppressed:'type'};\nif(kind==='boolean')return boundsForBoolean(handle,indices,count);\nif(kind==='category')return boundsForCategory(handle,indices,count,opts);\nreturn boundsForOrdered(handle,indices,count,kind,opts);\n}\nfunction boundsForBoolean(handle,indices,count){\nconst present=presenceReader(handle);\nlet nulls=0;\nif(present){\nconst n=indices?indices.length:count;\nfor(let k=0;k<n;k++)if(!present(indices?indices[k]:k))nulls++;\n}\nconst buckets=[{value:false,label:'false'},{value:true,label:'true'}];\nif(nulls>0)buckets.push({null:true,label:'Empty'});\nreturn{kind:'boolean',buckets};\n}\nfunction boundsForCategory(handle,indices,count,opts){\nconst limit=opts.cardinalityLimit??DEFAULT_CARDINALITY_LIMIT;\nconst{cardinality}=cardinalityOf(handle,indices,count,limit);\nif(cardinality>limit&&(opts.aboveLimit||'suppress')==='suppress'){\nreturn{kind:'category',buckets:[],suppressed:'cardinality',cardinality};\n}\nconst read=valueReader(handle);\nconst n=indices?indices.length:count;\nconst tally=new Map();\nlet nulls=0;\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined||v===''){nulls++;continue;}\nif(Array.isArray(v)){\nif(!v.length){nulls++;continue;}\nfor(const m of v)tally.set(m,(tally.get(m)||0)+1);\ncontinue;\n}\ntally.set(v,(tally.get(v)||0)+1);\n}\nlet entries=[...tally.entries()];\nif(opts.order==='alpha'){\nentries.sort((a,b)=>String(a[0]).localeCompare(String(b[0])));\n}else{\nentries.sort((a,b)=>b[1]-a[1]);\n}\nlet remainder=0;\nlet dropped=0;\nif(entries.length>limit){\ndropped=entries.length-limit;\nfor(let i=limit;i<entries.length;i++)remainder+=entries[i][1];\nentries=entries.slice(0,limit);\n}\nconst buckets=entries.map(([value])=>({value,label:String(value)}));\nif(remainder>0)buckets.push({remainder:true,label:`Other (${dropped} values)`});\nif(nulls>0)buckets.push({null:true,label:'Empty'});\nreturn{kind:'category',buckets,cardinality};\n}\nfunction boundsForOrdered(handle,indices,count,kind,opts){\nconst{min,max,nulls,finite}=numericExtent(handle,indices,count);\nif(!finite){\nreturn{kind,buckets:nulls?[{null:true,label:'Empty'}]:[],empty:true};\n}\nconst wanted=Math.max(1,Math.floor(opts.buckets||DEFAULT_BUCKETS));\nlet buckets=[];\nif(kind==='date'){\nconst granularity=GRANULARITIES.includes(opts.granularity)\n?opts.granularity:pickGranularity(max-min,wanted);\nlet edge=floorTo(min,granularity);\nwhile(edge<=max&&buckets.length<4096){\nconst next=advance(edge,granularity);\nif(!(next>edge))break;\nbuckets.push({from:edge,to:next});\nedge=next;\n}\nreturn{kind,buckets:withNull(buckets,nulls),granularity};\n}\nconst strategy=STRATEGIES.includes(opts.strategy)?opts.strategy:'equal';\nif(strategy==='quantile'){\nconst sample=sortedSample(handle,indices,count,QUANTILE_SAMPLE);\nif(sample.length){\nconst edges=[sample[0]];\nfor(let b=1;b<wanted;b++){\nconst v=sample[Math.min(sample.length-1,Math.floor((b/wanted)*sample.length))];\nif(v>edges[edges.length-1])edges.push(v);\n}\nedges.push(max);\nfor(let b=0;b<edges.length-1;b++)buckets.push({from:edges[b],to:edges[b+1]});\n}\n}else if(strategy==='log'&&min>0){\nconst lo=Math.log10(min);\nconst hi=Math.log10(max);\nconst step=(hi-lo)/wanted||1;\nfor(let b=0;b<wanted;b++){\nbuckets.push({from:10**(lo+b*step),to:10**(lo+(b+1)*step)});\n}\n}\nif(!buckets.length){\nconst width=(max-min)/wanted||1;\nfor(let b=0;b<wanted;b++)buckets.push({from:min+b*width,to:min+(b+1)*width});\n}\nbuckets[buckets.length-1].to=max;\nreturn{kind,buckets:withNull(buckets,nulls),strategy,min,max};\n}\nfunction withNull(buckets,nulls){\nreturn nulls>0?[...buckets,{null:true,label:'Empty'}]:buckets;\n}\nfunction countInto(handle,indices,count,bounds,out){\nconst buckets=(bounds&&bounds.buckets)||[];\nconst counts=out&&out.length>=buckets.length?out.subarray(0,buckets.length)\n:new Uint32Array(buckets.length);\ncounts.fill(0);\nif(!handle||!buckets.length)return counts;\nconst nullBucket=buckets.length-1;\nconst hasNull=!!buckets[nullBucket]&&buckets[nullBucket].null===true;\nconst n=indices?indices.length:count;\nif(bounds.kind==='boolean'){\nconst read=valueReader(handle);\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined){if(hasNull)counts[nullBucket]++;continue;}\ncounts[v?1:0]++;\n}\nreturn counts;\n}\nif(bounds.kind==='category'){\nconst slot=new Map();\nfor(let b=0;b<buckets.length;b++){\nif(!buckets[b].null&&!buckets[b].remainder)slot.set(buckets[b].value,b);\n}\nconst remainderAt=buckets.findIndex((b)=>b.remainder);\nconst read=valueReader(handle);\nfor(let k=0;k<n;k++){\nconst v=read(indices?indices[k]:k);\nif(v===null||v===undefined||v===''){if(hasNull)counts[nullBucket]++;continue;}\nif(Array.isArray(v)){\nif(!v.length){if(hasNull)counts[nullBucket]++;continue;}\nfor(const m of v){\nconst at=slot.get(m);\nif(at!==undefined)counts[at]++;\nelse if(remainderAt>=0)counts[remainderAt]++;\n}\ncontinue;\n}\nconst at=slot.get(v);\nif(at!==undefined)counts[at]++;\nelse if(remainderAt>=0)counts[remainderAt]++;\n}\nreturn counts;\n}\nconst ordered=hasNull?buckets.length-1:buckets.length;\nconst edges=new Float64Array(ordered+1);\nfor(let b=0;b<ordered;b++)edges[b]=buckets[b].from;\nedges[ordered]=ordered?buckets[ordered-1].to:0;\nconst read=orderedReader(handle);\nconst present=presenceReader(handle);\nfor(let k=0;k<n;k++){\nconst i=indices?indices[k]:k;\nif(present&&!present(i)){if(hasNull)counts[nullBucket]++;continue;}\nconst v=read(i);\nif(!Number.isFinite(v)){if(hasNull)counts[nullBucket]++;continue;}\nconst at=bucketOf(edges,ordered,v);\nif(at>=0)counts[at]++;\n}\nreturn counts;\n}\nfunction bucketOf(edges,ordered,v){\nif(!ordered)return-1;\nif(v<edges[0])return-1;\nif(v>=edges[ordered])return v===edges[ordered]?ordered-1:-1;\nlet lo=0;\nlet hi=ordered-1;\nwhile(lo<hi){\nconst mid=(lo+hi+1)>>>1;\nif(v>=edges[mid])lo=mid;else hi=mid-1;\n}\nreturn lo;\n}\nfunction facet(handle,indices,count,opts={}){\nconst bounds=opts.bounds||computeBounds(handle,opts.boundsIndices??indices,count,opts);\nreturn{bounds,counts:countInto(handle,indices,count,bounds)};\n}\nconst __default=facet;\n});\n__def(\"packages/core/src/compute/special.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"logGamma\",{enumerable:true,get:function(){return logGamma;}});\nObject.defineProperty(__exports,\"incompleteBeta\",{enumerable:true,get:function(){return incompleteBeta;}});\nObject.defineProperty(__exports,\"normalQuantile\",{enumerable:true,get:function(){return normalQuantile;}});\nObject.defineProperty(__exports,\"normalCdf\",{enumerable:true,get:function(){return normalCdf;}});\nObject.defineProperty(__exports,\"studentT\",{enumerable:true,get:function(){return studentT;}});\nObject.defineProperty(__exports,\"studentTQuantile\",{enumerable:true,get:function(){return studentTQuantile;}});\nconst LANCZOS=Object.freeze([\n676.5203681218851,-1259.1392167224028,771.32342877765313,\n-176.61502916214059,12.507343278686905,-0.13857109526572012,\n9.9843695780195716e-6,1.5056327351493116e-7,\n]);\nconst EPS=3e-12;\nconst TINY=1e-300;\nfunction logGamma(x){\nif(x<0.5)return Math.log(Math.PI/Math.sin(Math.PI*x))-logGamma(1-x);\nconst z=x-1;\nlet a=0.99999999999980993;\nconst t=z+7.5;\nfor(let i=0;i<LANCZOS.length;i++)a+=LANCZOS[i]/(z+i+1);\nreturn 0.5*Math.log(2*Math.PI)+(z+0.5)*Math.log(t)-t+Math.log(a);\n}\nfunction betaContinuedFraction(a,b,x){\nconst qab=a+b;\nconst qap=a+1;\nconst qam=a-1;\nlet c=1;\nlet d=1-(qab*x)/qap;\nif(Math.abs(d)<TINY)d=TINY;\nd=1/d;\nlet h=d;\nfor(let m=1;m<=300;m++){\nconst m2=2*m;\nlet aa=(m*(b-m)*x)/((qam+m2)*(a+m2));\nd=1+aa*d;\nif(Math.abs(d)<TINY)d=TINY;\nc=1+aa/c;\nif(Math.abs(c)<TINY)c=TINY;\nd=1/d;\nh*=d*c;\naa=(-(a+m)*(qab+m)*x)/((a+m2)*(qap+m2));\nd=1+aa*d;\nif(Math.abs(d)<TINY)d=TINY;\nc=1+aa/c;\nif(Math.abs(c)<TINY)c=TINY;\nd=1/d;\nconst step=d*c;\nh*=step;\nif(Math.abs(step-1)<EPS)break;\n}\nreturn h;\n}\nfunction incompleteBeta(a,b,x){\nif(!(a>0)||!(b>0)||!Number.isFinite(x))return Number.NaN;\nif(x<=0)return 0;\nif(x>=1)return 1;\nconst front=Math.exp(\nlogGamma(a+b)-logGamma(a)-logGamma(b)+a*Math.log(x)+b*Math.log(1-x),\n);\nreturn x<(a+1)/(a+b+2)\n?(front*betaContinuedFraction(a,b,x))/a\n:1-(front*betaContinuedFraction(b,a,1-x))/b;\n}\nfunction normalQuantile(p){\nif(!(p>0)||!(p<1))return p===0?-Infinity:(p===1?Infinity:Number.NaN);\nconst a=[-3.969683028665376e+1,2.209460984245205e+2,-2.759285104469687e+2,\n1.383577518672690e+2,-3.066479806614716e+1,2.506628277459239];\nconst b=[-5.447609879822406e+1,1.615858368580409e+2,-1.556989798598866e+2,\n6.680131188771972e+1,-1.328068155288572e+1];\nconst c=[-7.784894002430293e-3,-3.223964580411365e-1,-2.400758277161838,\n-2.549732539343734,4.374664141464968,2.938163982698783];\nconst d=[7.784695709041462e-3,3.224671290700398e-1,2.445134137142996,\n3.754408661907416];\nconst low=0.02425;\nlet q;\nlet r;\nlet x;\nif(p<low){\nq=Math.sqrt(-2*Math.log(p));\nx=(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5])\n/ ((((d[0] * q + d[1]) * q + d[2]) * q + d[3]) * q + 1);\n}else if(p<=1-low){\nq=p-0.5;\nr=q*q;\nx=((((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q)\n/ (((((b[0] * r + b[1]) * r + b[2]) * r + b[3]) * r + b[4]) * r + 1);\n}else{\nq=Math.sqrt(-2*Math.log(1-p));\nx=-(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5])\n/ ((((d[0] * q + d[1]) * q + d[2]) * q + d[3]) * q + 1);\n}\nconst e=0.5*erfc(-x/Math.SQRT2)-p;\nconst u=e*Math.sqrt(2*Math.PI)*Math.exp((x*x)/2);\nreturn x-u/(1+(x*u)/2);\n}\nfunction erfc(x){\nconst z=Math.abs(x);\nconst t=2/(2+z);\nconst ty=4*t-2;\nconst cof=[-1.3026537197817094,6.4196979235649026e-1,1.9476473204185836e-2,\n-9.561514786808631e-3,-9.46595344482036e-4,3.66839497852761e-4,\n4.2523324806907e-5,-2.0278578112534e-5,-1.624290004647e-6,\n1.303655835580e-6,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,\n5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,\n2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,\n3.81e-16,7.106e-15];\nlet dd=0;\nlet dv=0;\nlet tmp;\nfor(let j=cof.length-1;j>0;j--){\ntmp=dv;\ndv=ty*dv-dd+cof[j];\ndd=tmp;\n}\nconst ans=t*Math.exp(-z*z+0.5*(cof[0]+ty*dv)-dd);\nreturn x>=0?ans:2-ans;\n}\nfunction normalCdf(x){\nreturn 0.5*erfc(-x/Math.SQRT2);\n}\nfunction studentT(t,df){\nif(!(df>0)||!Number.isFinite(t))return Number.NaN;\nconst tail=0.5*incompleteBeta(df/2,0.5,df/(df+t*t));\nreturn t>0?1-tail:tail;\n}\nfunction studentTQuantile(p,df){\nif(!(p>0)||!(p<1)||!(df>0))return Number.NaN;\nif(df>1e7)return normalQuantile(p);\nlet lo=-1e4;\nlet hi=1e4;\nlet x=normalQuantile(p);\nconst logBeta=logGamma(df/2)+logGamma(0.5)-logGamma((df+1)/2);\nfor(let i=0;i<60;i++){\nconst cdf=studentT(x,df);\nif(cdf<p)lo=x;else hi=x;\nconst pdf=Math.exp(-((df+1)/2)*Math.log(1+(x*x)/df)-logBeta)\n/ Math.sqrt(df);\nconst step=pdf>0?(cdf-p)/pdf:0;\nif(Math.abs(step)<1e-12)break;\nconst next=x-step;\nx=next>lo&&next<hi&&Number.isFinite(next)?next:(lo+hi)/2;\nif(hi-lo<1e-12)break;\n}\nreturn x;\n}\n});\n__def(\"packages/core/src/compute/sketch.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Welford\",{enumerable:true,get:function(){return Welford;}});\nObject.defineProperty(__exports,\"Reservoir\",{enumerable:true,get:function(){return Reservoir;}});\nObject.defineProperty(__exports,\"hash32\",{enumerable:true,get:function(){return hash32;}});\nObject.defineProperty(__exports,\"HyperLogLog\",{enumerable:true,get:function(){return HyperLogLog;}});\nObject.defineProperty(__exports,\"SpaceSaving\",{enumerable:true,get:function(){return SpaceSaving;}});\nObject.defineProperty(__exports,\"KLL\",{enumerable:true,get:function(){return KLL;}});\nObject.defineProperty(__exports,\"SKETCH_BOUNDS\",{enumerable:true,get:function(){return SKETCH_BOUNDS;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nclass Welford{\n#n=0;\n#mean=0;\n#m2=0;\nstatic get errorBound(){\nreturn Object.freeze({\nkind:'exact',metric:'none',value:0,\nstatement:'mean and variance match a full recompute to float rounding',\n});\n}\nget count(){return this.#n;}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#n++;\nconst delta=x-this.#mean;\nthis.#mean+=delta/this.#n;\nthis.#m2+=delta*(x-this.#mean);\n}\nmerge(other){\nif(other.#n===0)return;\nif(this.#n===0){this.#n=other.#n;this.#mean=other.#mean;this.#m2=other.#m2;return;}\nconst n=this.#n+other.#n;\nconst delta=other.#mean-this.#mean;\nthis.#mean+=delta*(other.#n/n);\nthis.#m2+=other.#m2+delta*delta*(this.#n*other.#n/n);\nthis.#n=n;\n}\nmean(){return this.#n?this.#mean:null;}\nvariance(){return this.#n>1?this.#m2/(this.#n-1):null;}\nvarianceP(){return this.#n?this.#m2/this.#n:null;}\nstddev(){const v=this.variance();return v===null?null:Math.sqrt(v);}\nstddevP(){const v=this.varianceP();return v===null?null:Math.sqrt(v);}\n}\nclass Reservoir{\n#items=[];\n#seen=0;\n#capacity;\n#rng;\nconstructor(capacity,rng=Math.random){\nif(!(capacity>0))throw new RangeError('reservoir capacity must be positive');\nthis.#capacity=Math.floor(capacity);\nthis.#rng=rng;\n}\nstatic get errorBound(){\nreturn Object.freeze({\nkind:'probabilistic',metric:'none',value:0,\nstatement:'uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators',\n});\n}\nget seen(){return this.#seen;}\nget size(){return this.#items.length;}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#seen++;\nif(this.#items.length<this.#capacity){\nthis.#items.push(x);\nreturn;\n}\nconst j=Math.floor(this.#rng()*this.#seen);\nif(j<this.#capacity)this.#items[j]=x;\n}\nsample(){return this.#items.slice();}\nmean(){\nif(!this.#items.length)return null;\nlet s=0;\nfor(const v of this.#items)s+=v;\nreturn s/this.#items.length;\n}\nquantile(p){\nconst n=this.#items.length;\nif(!n)return null;\nconst sorted=this.#items.slice().sort((a,b)=>a-b);\nif(n===1)return sorted[0];\nconst h=(n-1)*Math.min(1,Math.max(0,p));\nconst lo=Math.floor(h);\nconst hi=Math.ceil(h);\nreturn lo===hi?sorted[lo]:sorted[lo]+(h-lo)*(sorted[hi]-sorted[lo]);\n}\n}\nfunction fmix32(h){\nh^=h>>>16;\nh=Math.imul(h,0x85ebca6b);\nh^=h>>>13;\nh=Math.imul(h,0xc2b2ae35);\nh^=h>>>15;\nreturn h>>>0;\n}\nfunction hash32(v){\nif(typeof v==='number'){\nconst buf=new DataView(new ArrayBuffer(8));\nbuf.setFloat64(0,v===0?0:v);\nreturn fmix32(buf.getUint32(0)^buf.getUint32(4));\n}\nconst s=typeof v==='string'?v:String(v);\nlet h=0x811c9dc5;\nfor(let i=0;i<s.length;i++){\nh^=s.charCodeAt(i);\nh=Math.imul(h,0x01000193);\n}\nreturn fmix32(h);\n}\nclass HyperLogLog{\n#p;\n#m;\n#registers;\nconstructor(precision=14){\nconst p=Math.floor(precision);\nif(p<4||p>16)throw new RangeError('HLL precision must be 4..16');\nthis.#p=p;\nthis.#m=1<<p;\nthis.#registers=new Uint8Array(this.#m);\n}\nstatic errorBoundFor(precision=14){\nconst m=1<<Math.floor(precision);\nconst rse=1.04/Math.sqrt(m);\nreturn Object.freeze({\nkind:'probabilistic',metric:'relative',value:rse,\nstatement:`distinct count within ~${(rse*100).toFixed(2)}% relative standard error (m=${m} buckets)`,\n});\n}\nerrorBound(){return HyperLogLog.errorBoundFor(this.#p);}\nadd(v){\nconst h=hash32(v);\nconst idx=h&(this.#m-1);\nconst rest=(h>>>this.#p)|(1<<(32-this.#p));\nlet rank=1;\nlet x=rest;\nwhile((x&1)===0){rank++;x>>>=1;}\nif(rank>this.#registers[idx])this.#registers[idx]=rank;\n}\ncount(){\nconst m=this.#m;\nconst q=32-this.#p;\nconst hist=new Float64Array(q+2);\nfor(let i=0;i<m;i++)hist[this.#registers[i]]++;\nlet z=m*tau(1-hist[q+1]/m);\nfor(let k=q;k>=1;k--)z=0.5*(z+hist[k]);\nz+=m*sigma(hist[0]/m);\nconst estimate=(ERTL_ALPHA_INF*m*m)/z;\nreturn Math.round(estimate);\n}\n}\nconst ERTL_ALPHA_INF=0.5/Math.log(2);\nfunction sigma(x){\nif(x===1)return Infinity;\nlet y=1;\nlet z=x;\nlet prev;\ndo{\nx*=x;\nprev=z;\nz+=x*y;\ny+=y;\n}while(z!==prev);\nreturn z;\n}\nfunction tau(x){\nif(x===0||x===1)return 0;\nlet y=1;\nlet z=1-x;\nlet prev;\ndo{\nx=Math.sqrt(x);\nprev=z;\ny*=0.5;\nz-=(1-x)**2*y;\n}while(z!==prev);\nreturn z/3;\n}\nclass SpaceSaving{\n#counters=new Map();\n#capacity;\n#n=0;\nconstructor(capacity){\nif(!(capacity>0))throw new RangeError('Space-Saving capacity must be positive');\nthis.#capacity=Math.floor(capacity);\n}\nerrorBoundFor(n){\nconst value=n/this.#capacity;\nreturn Object.freeze({\nkind:'deterministic',metric:'absolute',value,\nstatement:`each count overestimates the truth by at most N/m = ${value.toFixed(2)} (N=${n}, m=${this.#capacity})`,\n});\n}\nget seen(){return this.#n;}\nadd(item){\nthis.#n++;\nconst existing=this.#counters.get(item);\nif(existing){existing.count++;return;}\nif(this.#counters.size<this.#capacity){\nthis.#counters.set(item,{count:1,error:0});\nreturn;\n}\nlet minItem;\nlet minCount=Infinity;\nfor(const[k,v]of this.#counters){\nif(v.count<minCount){minCount=v.count;minItem=k;}\n}\nthis.#counters.delete(minItem);\nthis.#counters.set(item,{count:minCount+1,error:minCount});\n}\ntop(k=this.#capacity){\nconst all=[...this.#counters.entries()]\n.map(([item,v])=>({item,count:v.count,error:v.error}))\n.sort((a,b)=>b.count-a.count);\nreturn all.slice(0,Math.max(0,Math.floor(k)));\n}\n}\nclass KLL{\n#k;\n#levels=[[]];\n#n=0;\n#rng;\n#capacityFactor;\nconstructor(k=200,rng=Math.random){\nthis.#k=Math.max(8,Math.floor(k));\nthis.#rng=rng;\nthis.#capacityFactor=2/3;\n}\nstatic errorBoundFor(k=200){\nconst eps=1/Math.max(8,Math.floor(k));\nreturn Object.freeze({\nkind:'probabilistic',metric:'rank',value:eps,\nstatement:`queried quantile's true rank within ~${(eps*100).toFixed(2)}% of N of the requested rank (k=${k})`,\n});\n}\nerrorBound(){return KLL.errorBoundFor(this.#k);}\nget count(){return this.#n;}\n#levelCapacity(height){\nconst top=this.#levels.length-1;\nconst depthFromTop=top-height;\nconst cap=Math.ceil(this.#k*this.#capacityFactor**depthFromTop);\nreturn Math.max(2,cap);\n}\nadd(x){\nif(!Number.isFinite(x))return;\nthis.#n++;\nthis.#levels[0].push(x);\nif(this.#levels[0].length>=this.#levelCapacity(0))this.#compact(0);\n}\n#compact(height){\nconst level=this.#levels[height];\nlevel.sort((a,b)=>a-b);\nif(height+1>=this.#levels.length)this.#levels.push([]);\nconst up=this.#levels[height+1];\nconst offset=this.#rng()<0.5?0:1;\nfor(let i=offset;i<level.length;i+=2)up.push(level[i]);\nthis.#levels[height]=[];\nfor(let h=0;h<this.#levels.length;h++){\nif(this.#levels[h].length>=this.#levelCapacity(h)){this.#compact(h);return;}\n}\n}\n#weighted(){\nconst out=[];\nfor(let h=0;h<this.#levels.length;h++){\nconst w=1<<h;\nfor(const v of this.#levels[h])out.push({v,w});\n}\nreturn out;\n}\nquantile(p){\nconst items=this.#weighted();\nif(!items.length)return null;\nitems.sort((a,b)=>a.v-b.v);\nlet totalW=0;\nfor(const it of items)totalW+=it.w;\nconst target=Math.min(1,Math.max(0,p))*totalW;\nlet cum=0;\nfor(const it of items){\ncum+=it.w;\nif(cum>=target)return it.v;\n}\nreturn items[items.length-1].v;\n}\nrank(x){\nlet cum=0;\nfor(let h=0;h<this.#levels.length;h++){\nconst w=1<<h;\nfor(const v of this.#levels[h])if(v<=x)cum+=w;\n}\nreturn cum;\n}\n}\nconst SKETCH_BOUNDS=Object.freeze({\ndistinct:HyperLogLog.errorBoundFor(14),\nmedian:KLL.errorBoundFor(200),\np25:KLL.errorBoundFor(200),\np75:KLL.errorBoundFor(200),\np90:KLL.errorBoundFor(200),\np95:KLL.errorBoundFor(200),\np99:KLL.errorBoundFor(200),\niqr:KLL.errorBoundFor(200),\ntopK:Object.freeze({\nkind:'deterministic',metric:'absolute',value:0,\nstatement:'each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m',\n}),\n});\nconst __default={\nWelford,Reservoir,HyperLogLog,SpaceSaving,KLL,hash32,SKETCH_BOUNDS,\n};\n});\n__def(\"packages/core/src/compute/statistics.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"KENDALL_LIMIT\",{enumerable:true,get:function(){return KENDALL_LIMIT;}});\nObject.defineProperty(__exports,\"MAINTENANCE\",{enumerable:true,get:function(){return MAINTENANCE;}});\nObject.defineProperty(__exports,\"APPROXIMATE\",{enumerable:true,get:function(){return APPROXIMATE;}});\nObject.defineProperty(__exports,\"maintenanceOf\",{enumerable:true,get:function(){return maintenanceOf;}});\nObject.defineProperty(__exports,\"numbers\",{enumerable:true,get:function(){return numbers;}});\nObject.defineProperty(__exports,\"frequencies\",{enumerable:true,get:function(){return frequencies;}});\nObject.defineProperty(__exports,\"herfindahl\",{enumerable:true,get:function(){return herfindahl;}});\nObject.defineProperty(__exports,\"entropy\",{enumerable:true,get:function(){return entropy;}});\nObject.defineProperty(__exports,\"evenness\",{enumerable:true,get:function(){return evenness;}});\nObject.defineProperty(__exports,\"topShare\",{enumerable:true,get:function(){return topShare;}});\nObject.defineProperty(__exports,\"gini\",{enumerable:true,get:function(){return gini;}});\nObject.defineProperty(__exports,\"moments\",{enumerable:true,get:function(){return moments;}});\nObject.defineProperty(__exports,\"quantileSorted\",{enumerable:true,get:function(){return quantileSorted;}});\nObject.defineProperty(__exports,\"quantile\",{enumerable:true,get:function(){return quantile;}});\nObject.defineProperty(__exports,\"STAT_FNS\",{enumerable:true,get:function(){return STAT_FNS;}});\nObject.defineProperty(__exports,\"STAT_LABELS\",{enumerable:true,get:function(){return STAT_LABELS;}});\nObject.defineProperty(__exports,\"weightedAverage\",{enumerable:true,get:function(){return weightedAverage;}});\nObject.defineProperty(__exports,\"extremeRow\",{enumerable:true,get:function(){return extremeRow;}});\nObject.defineProperty(__exports,\"correlation\",{enumerable:true,get:function(){return correlation;}});\nObject.defineProperty(__exports,\"trimmedMean\",{enumerable:true,get:function(){return trimmedMean;}});\nObject.defineProperty(__exports,\"winsorizedMean\",{enumerable:true,get:function(){return winsorizedMean;}});\nObject.defineProperty(__exports,\"modifiedZOutliers\",{enumerable:true,get:function(){return modifiedZOutliers;}});\nObject.defineProperty(__exports,\"jarqueBera\",{enumerable:true,get:function(){return jarqueBera;}});\nObject.defineProperty(__exports,\"weightedQuantile\",{enumerable:true,get:function(){return weightedQuantile;}});\nObject.defineProperty(__exports,\"pairs\",{enumerable:true,get:function(){return pairs;}});\nObject.defineProperty(__exports,\"covariance\",{enumerable:true,get:function(){return covariance;}});\nObject.defineProperty(__exports,\"regression\",{enumerable:true,get:function(){return regression;}});\nObject.defineProperty(__exports,\"spearman\",{enumerable:true,get:function(){return spearman;}});\nObject.defineProperty(__exports,\"kendall\",{enumerable:true,get:function(){return kendall;}});\nObject.defineProperty(__exports,\"seriesStats\",{enumerable:true,get:function(){return seriesStats;}});\nObject.defineProperty(__exports,\"D2_N2\",{enumerable:true,get:function(){return D2_N2;}});\nObject.defineProperty(__exports,\"D4_N2\",{enumerable:true,get:function(){return D4_N2;}});\nObject.defineProperty(__exports,\"movingRanges\",{enumerable:true,get:function(){return movingRanges;}});\nObject.defineProperty(__exports,\"withinSigma\",{enumerable:true,get:function(){return withinSigma;}});\nObject.defineProperty(__exports,\"capability\",{enumerable:true,get:function(){return capability;}});\nObject.defineProperty(__exports,\"controlLimits\",{enumerable:true,get:function(){return controlLimits;}});\nObject.defineProperty(__exports,\"westernElectricViolations\",{enumerable:true,get:function(){return westernElectricViolations;}});\nObject.defineProperty(__exports,\"nelsonViolations\",{enumerable:true,get:function(){return nelsonViolations;}});\nObject.defineProperty(__exports,\"CONTROL_RULE_SETS\",{enumerable:true,get:function(){return CONTROL_RULE_SETS;}});\nObject.defineProperty(__exports,\"controlViolations\",{enumerable:true,get:function(){return controlViolations;}});\nObject.defineProperty(__exports,\"countOutside\",{enumerable:true,get:function(){return countOutside;}});\nObject.defineProperty(__exports,\"histogram\",{enumerable:true,get:function(){return histogram;}});\nObject.defineProperty(__exports,\"DEFAULT_CONFIDENCE\",{enumerable:true,get:function(){return DEFAULT_CONFIDENCE;}});\nObject.defineProperty(__exports,\"meanInterval\",{enumerable:true,get:function(){return meanInterval;}});\nObject.defineProperty(__exports,\"proportionInterval\",{enumerable:true,get:function(){return proportionInterval;}});\nObject.defineProperty(__exports,\"slopeInterval\",{enumerable:true,get:function(){return slopeInterval;}});\nObject.defineProperty(__exports,\"capabilityInterval\",{enumerable:true,get:function(){return capabilityInterval;}});\nObject.defineProperty(__exports,\"standardizedMeanDifference\",{enumerable:true,get:function(){return standardizedMeanDifference;}});\nObject.defineProperty(__exports,\"normalTotalVariation\",{enumerable:true,get:function(){return normalTotalVariation;}});\nObject.defineProperty(__exports,\"frequencyMap\",{enumerable:true,get:function(){return frequencyMap;}});\nObject.defineProperty(__exports,\"categoricalDistance\",{enumerable:true,get:function(){return categoricalDistance;}});\nObject.defineProperty(__exports,\"SUBSET_RELIABILITY_FLOOR\",{enumerable:true,get:function(){return SUBSET_RELIABILITY_FLOOR;}});\nObject.defineProperty(__exports,\"compareColumn\",{enumerable:true,get:function(){return compareColumn;}});\nObject.defineProperty(__exports,\"isNumericColumn\",{enumerable:true,get:function(){return isNumericColumn;}});\nObject.defineProperty(__exports,\"populationRead\",{enumerable:true,get:function(){return populationRead;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m0[\"presenceReader\"];\nconst valueReader=__m0[\"valueReader\"];\nconst __m1=__req(\"packages/core/src/compute/special.js\");\nconst studentTQuantile=__m1[\"studentTQuantile\"];\nconst normalQuantile=__m1[\"normalQuantile\"];\nconst normalCdf=__m1[\"normalCdf\"];\nconst __m2=__req(\"packages/core/src/compute/sketch.js\");\nconst SKETCH_BOUNDS=__m2[\"SKETCH_BOUNDS\"];\nconst KENDALL_LIMIT=5000;\nconst MAINTENANCE=Object.freeze({\nvariance:'rescan',\nvarianceP:'rescan',\nstddev:'rescan',\nstddevP:'rescan',\nsumSquares:'rescan',\nweightedAvg:'rescan',\nmedian:'rescan',\np25:'rescan',\np75:'rescan',\np90:'rescan',\np95:'rescan',\np99:'rescan',\niqr:'rescan',\nmode:'rescan',\ndistinct:'rescan',\nrange:'rescan',\nskewness:'rescan',\nkurtosis:'rescan',\ngeomean:'rescan',\nharmean:'rescan',\nmad:'rescan',\nargmin:'rescan',\nargmax:'rescan',\nhhi:'rescan',\nentropy:'rescan',\nevenness:'rescan',\ntop3Share:'rescan',\ntop10Share:'rescan',\ngini:'rescan',\ntrimmedMean:'rescan',\nwinsorizedMean:'rescan',\nrobustOutliers:'rescan',\njarqueBera:'rescan',\npassRate:'rescan',\nfailureCount:'rescan',\n});\nconst APPROXIMATE=Object.freeze({\ndistinct:Object.freeze({sketch:'HyperLogLog',bound:SKETCH_BOUNDS.distinct}),\nmedian:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.median}),\np25:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p25}),\np75:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p75}),\np90:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p90}),\np95:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p95}),\np99:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.p99}),\niqr:Object.freeze({sketch:'KLL',bound:SKETCH_BOUNDS.iqr}),\ntop3Share:Object.freeze({sketch:'SpaceSaving',bound:SKETCH_BOUNDS.topK}),\ntop10Share:Object.freeze({sketch:'SpaceSaving',bound:SKETCH_BOUNDS.topK}),\n});\nfunction maintenanceOf(fn){\nconst exact=fn==='sum'||fn==='avg'||fn==='countValues'||fn==='min'||fn==='max'\n?'maintained'\n:(Object.prototype.hasOwnProperty.call(MAINTENANCE,fn)?MAINTENANCE[fn]:null);\nconst approximate=Object.prototype.hasOwnProperty.call(APPROXIMATE,fn)?APPROXIMATE[fn]:null;\nreturn{stat:fn,exact,approximate};\n}\nfunction numbers(handle,indices){\nconst n=indices.length;\nconst out=new Float64Array(n);\nlet count=0;\nconst numeric=handle&&(handle.kind==='float64'||handle.kind==='int32');\nif(numeric){\nconst values=handle.values;\nconst present=presenceReader(handle);\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present&&present(row)!==1)continue;\nconst v=values[row];\nif(Number.isNaN(v))continue;\nout[count++]=v;\n}\nreturn out.subarray(0,count);\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nconst v=typeof raw==='number'?raw:Number(raw);\nif(!Number.isFinite(v))continue;\nout[count++]=v;\n}\nreturn out.subarray(0,count);\n}\nfunction frequencies(handle,indices){\nconst seen=new Map();\nconst read=valueReader(handle);\nlet total=0;\nfor(let i=0;i<indices.length;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(typeof raw==='number'&&Number.isNaN(raw))continue;\nconst key=typeof raw==='object'?String(raw):raw;\nseen.set(key,(seen.get(key)||0)+1);\ntotal++;\n}\nconst counts=[...seen.values()].sort((a,b)=>b-a);\nreturn{counts,total,distinct:counts.length};\n}\nfunction sharesOf(freq){\nreturn freq.total>0?freq.counts.map((c)=>c/freq.total):[];\n}\nfunction herfindahl(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nlet sum=0;\nfor(const share of sharesOf(freq))sum+=share*share;\nreturn sum;\n}\nfunction entropy(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nlet sum=0;\nfor(const share of sharesOf(freq))if(share>0)sum-=share*Math.log2(share);\nreturn sum;\n}\nfunction evenness(handle,indices){\nconst freq=frequencies(handle,indices);\nif(!freq.total||freq.distinct<2)return freq.total?1:null;\nlet sum=0;\nfor(const share of sharesOf(freq))if(share>0)sum-=share*Math.log2(share);\nreturn sum/Math.log2(freq.distinct);\n}\nfunction topShare(handle,indices,n=3){\nconst freq=frequencies(handle,indices);\nif(!freq.total)return null;\nconst take=Math.max(1,Math.floor(n));\nlet held=0;\nfor(let i=0;i<Math.min(take,freq.counts.length);i++)held+=freq.counts[i];\nreturn held/freq.total;\n}\nfunction gini(handle,indices){\nconst values=numbers(handle,indices);\nconst n=values.length;\nif(!n)return null;\nconst sorted=values.slice().sort();\nif(sorted[0]<0)return null;\nlet total=0;\nlet weighted=0;\nfor(let i=0;i<n;i++){\ntotal+=sorted[i];\nweighted+=(i+1)*sorted[i];\n}\nif(total===0)return 0;\nreturn(2*weighted)/(n*total)-(n+1)/n;\n}\nfunction moments(values){\nlet n=0;\nlet mean=0;\nlet m2=0;\nfor(let i=0;i<values.length;i++){\nconst x=values[i];\nn++;\nconst delta=x-mean;\nmean+=delta/n;\nm2+=delta*(x-mean);\n}\nreturn{n,mean,m2};\n}\nfunction quantileSorted(sorted,p){\nconst n=sorted.length;\nif(!n)return NaN;\nif(n===1)return sorted[0];\nconst h=(n-1)*Math.min(1,Math.max(0,p));\nconst lo=Math.floor(h);\nconst hi=Math.ceil(h);\nif(lo===hi)return sorted[lo];\nreturn sorted[lo]+(h-lo)*(sorted[hi]-sorted[lo]);\n}\nfunction quantile(values,p){\nif(!values.length)return NaN;\nconst sorted=values.slice().sort();\nreturn quantileSorted(sorted,p);\n}\nfunction specTally(handle,indices){\nconst read=valueReader(handle);\nlet pass=0;\nlet fail=0;\nlet warn=0;\nfor(let k=0;k<indices.length;k++){\nconst raw=read(indices[k]);\nif(raw===null||raw===undefined||raw==='')continue;\nconst token=String(raw).toUpperCase();\nif(token==='PASS')pass++;\nelse if(token==='FAIL')fail++;\nelse if(token==='WARN')warn++;\n}\nreturn{pass:pass+warn,fail,warn,judged:pass+warn+fail};\n}\nconst STAT_FNS=Object.freeze({\nhhi:(h,i)=>herfindahl(h,i),\nentropy:(h,i)=>entropy(h,i),\nevenness:(h,i)=>evenness(h,i),\ntop3Share:(h,i)=>topShare(h,i,3),\ntop10Share:(h,i)=>topShare(h,i,10),\ngini:(h,i)=>gini(h,i),\ntrimmedMean:(h,i)=>trimmedMean(numbers(h,i),0.1),\nwinsorizedMean:(h,i)=>winsorizedMean(numbers(h,i),0.1),\nrobustOutliers:(h,i)=>modifiedZOutliers(numbers(h,i),3.5),\njarqueBera:(h,i)=>jarqueBera(numbers(h,i)),\nvariance:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>1?m2/(n-1):null;\n},\nvarianceP:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>0?m2/n:null;\n},\nstddev:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>1?Math.sqrt(m2/(n-1)):null;\n},\nstddevP:(h,i)=>{\nconst{n,m2}=moments(numbers(h,i));\nreturn n>0?Math.sqrt(m2/n):null;\n},\nmedian:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.5):null;\n},\np25:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.25):null;\n},\np75:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.75):null;\n},\np90:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.9):null;\n},\np95:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.95):null;\n},\np99:(h,i)=>{\nconst values=numbers(h,i);\nreturn values.length?quantile(values,0.99):null;\n},\niqr:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nconst sorted=values.slice().sort();\nreturn quantileSorted(sorted,0.75)-quantileSorted(sorted,0.25);\n},\nmad:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nconst middle=quantile(values,0.5);\nconst deviations=new Float64Array(values.length);\nfor(let k=0;k<values.length;k++)deviations[k]=Math.abs(values[k]-middle);\nreturn quantile(deviations,0.5);\n},\nrange:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet lo=Infinity;\nlet hi=-Infinity;\nfor(let k=0;k<values.length;k++){\nif(values[k]<lo)lo=values[k];\nif(values[k]>hi)hi=values[k];\n}\nreturn hi-lo;\n},\ndistinct:(h,i)=>{\nconst read=valueReader(h);\nconst seen=new Set();\nfor(let k=0;k<i.length;k++){\nconst v=read(i[k]);\nif(v===null||v===undefined||v==='')continue;\nseen.add(v instanceof Date?v.getTime():v);\n}\nreturn seen.size;\n},\nmode:(h,i)=>{\nconst read=valueReader(h);\nconst counts=new Map();\nfor(let k=0;k<i.length;k++){\nconst v=read(i[k]);\nif(v===null||v===undefined||v==='')continue;\nconst id=v instanceof Date?v.getTime():v;\ncounts.set(id,(counts.get(id)||0)+1);\n}\nlet best=null;\nlet most=1;\nfor(const[value,times]of counts){\nif(times>most){\nmost=times;\nbest=value;\n}\n}\nreturn best;\n},\nskewness:(h,i)=>{\nconst values=numbers(h,i);\nconst{n,mean,m2}=moments(values);\nif(n<3||m2<=0)return null;\nconst sd=Math.sqrt(m2/(n-1));\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=((values[k]-mean)/sd)**3;\nreturn(n/((n-1)*(n-2)))*sum;\n},\nkurtosis:(h,i)=>{\nconst values=numbers(h,i);\nconst{n,mean,m2}=moments(values);\nif(n<4||m2<=0)return null;\nconst sd=Math.sqrt(m2/(n-1));\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=((values[k]-mean)/sd)**4;\nconst a=(n*(n+1))/((n-1)*(n-2)*(n-3));\nconst b=(3*(n-1)**2)/((n-2)*(n-3));\nreturn a*sum-b;\n},\ngeomean:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet sum=0;\nfor(let k=0;k<values.length;k++){\nif(values[k]<=0)return null;\nsum+=Math.log(values[k]);\n}\nreturn Math.exp(sum/values.length);\n},\nharmean:(h,i)=>{\nconst values=numbers(h,i);\nif(!values.length)return null;\nlet sum=0;\nfor(let k=0;k<values.length;k++){\nif(values[k]===0)return null;\nsum+=1/values[k];\n}\nreturn values.length/sum;\n},\nsumSquares:(h,i)=>{\nconst values=numbers(h,i);\nlet sum=0;\nfor(let k=0;k<values.length;k++)sum+=values[k]*values[k];\nreturn sum;\n},\npassRate:(h,i)=>{\nconst{pass,judged}=specTally(h,i);\nreturn judged?pass/judged:null;\n},\nfailureCount:(h,i)=>specTally(h,i).fail,\n});\nconst STAT_LABELS=Object.freeze({\nhhi:'Concentration (HHI)',\nentropy:'Entropy',\nevenness:'Evenness',\ntop3Share:'Top 3 share',\ntop10Share:'Top 10 share',\ngini:'Gini coefficient',\ntrimmedMean:'Trimmed mean',\nwinsorizedMean:'Winsorized mean',\nrobustOutliers:'Outliers (robust)',\njarqueBera:'Jarque–Bera',\nmedian:'Median',\np25:'25th percentile',\np75:'75th percentile',\np90:'90th percentile',\np95:'95th percentile',\np99:'99th percentile',\niqr:'Interquartile range',\nmad:'Median absolute deviation',\nvariance:'Variance',\nvarianceP:'Variance (population)',\nstddev:'Standard deviation',\nstddevP:'Standard deviation (population)',\nrange:'Range',\ndistinct:'Distinct',\nmode:'Mode',\nskewness:'Skewness',\nkurtosis:'Kurtosis',\ngeomean:'Geometric mean',\nharmean:'Harmonic mean',\nsumSquares:'Sum of squares',\nweightedAvg:'Weighted average',\nargmin:'Lowest by',\nargmax:'Highest by',\npassRate:'Pass rate',\nfailureCount:'Failures',\n});\nfunction weightedAverage(handle,weights,indices){\nconst readValue=valueReader(handle);\nconst readWeight=valueReader(weights);\nlet top=0;\nlet bottom=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst value=Number(readValue(row));\nconst weight=Number(readWeight(row));\nif(!Number.isFinite(value)||!Number.isFinite(weight))continue;\ntop+=value*weight;\nbottom+=weight;\n}\nreturn bottom===0?null:top/bottom;\n}\nfunction extremeRow(handle,indices,largest){\nconst read=valueReader(handle);\nlet best=null;\nlet bestValue=largest?-Infinity:Infinity;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst value=Number(read(row));\nif(!Number.isFinite(value))continue;\nif(largest?value>bestValue:value<bestValue){\nbestValue=value;\nbest=row;\n}\n}\nreturn best;\n}\nfunction correlation(a,b,indices){\nconst readA=valueReader(a);\nconst readB=valueReader(b);\nlet n=0;\nlet sx=0;\nlet sy=0;\nlet sxx=0;\nlet syy=0;\nlet sxy=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst x=Number(readA(row));\nconst y=Number(readB(row));\nif(!Number.isFinite(x)||!Number.isFinite(y))continue;\nn++;\nsx+=x;\nsy+=y;\nsxx+=x*x;\nsyy+=y*y;\nsxy+=x*y;\n}\nif(n<2)return null;\nconst top=n*sxy-sx*sy;\nconst bottom=Math.sqrt((n*sxx-sx*sx)*(n*syy-sy*sy));\nif(bottom===0)return null;\nconst r=top/bottom;\nreturn Math.max(-1,Math.min(1,r));\n}\nfunction trimmedMean(values,share=0.1){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst cut=Math.floor(n*Math.min(0.49,Math.max(0,share)));\nconst kept=sorted.slice(cut,n-cut);\nif(!kept.length)return quantileSorted(sorted,0.5);\nlet sum=0;\nfor(const v of kept)sum+=v;\nreturn sum/kept.length;\n}\nfunction winsorizedMean(values,share=0.1){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst cut=Math.floor(n*Math.min(0.49,Math.max(0,share)));\nconst low=sorted[cut];\nconst high=sorted[n-1-cut];\nlet sum=0;\nfor(const v of sorted)sum+=Math.min(high,Math.max(low,v));\nreturn sum/n;\n}\nfunction modifiedZOutliers(values,threshold=3.5){\nconst n=values.length;\nif(!n)return null;\nconst sorted=Array.from(values).sort((a,b)=>a-b);\nconst middle=quantileSorted(sorted,0.5);\nconst deviations=sorted.map((v)=>Math.abs(v-middle)).sort((a,b)=>a-b);\nconst mad=quantileSorted(deviations,0.5);\nif(mad===0)return null;\nlet count=0;\nfor(const v of sorted)if(Math.abs((0.6745*(v-middle))/mad)>threshold)count++;\nreturn count;\n}\nfunction jarqueBera(values){\nconst n=values.length;\nif(n<8)return null;\nlet mean=0;\nfor(const v of values)mean+=v;\nmean/=n;\nlet m2=0;\nlet m3=0;\nlet m4=0;\nfor(const v of values){\nconst d=v-mean;\nm2+=d*d;\nm3+=d*d*d;\nm4+=d*d*d*d;\n}\nm2/=n;\nm3/=n;\nm4/=n;\nif(m2===0)return null;\nconst skew=m3/m2**1.5;\nconst excess=m4/(m2*m2)-3;\nreturn(n/6)*(skew*skew+(excess*excess)/4);\n}\nfunction weightedQuantile(values,weights,p){\nconst paired=[];\nlet total=0;\nfor(let i=0;i<values.length;i++){\nconst v=Number(values[i]);\nconst w=Number(weights[i]);\nif(!Number.isFinite(v)||!Number.isFinite(w)||w<=0)continue;\npaired.push([v,w]);\ntotal+=w;\n}\nif(!paired.length||total<=0)return null;\npaired.sort((a,b)=>a[0]-b[0]);\nif(paired.length===1)return paired[0][0];\nconst at=[];\nlet seen=0;\nfor(const[,w]of paired){\nat.push((seen+w/2)/total);\nseen+=w;\n}\nconst target=Math.max(0,Math.min(1,p));\nif(target<=at[0])return paired[0][0];\nif(target>=at[at.length-1])return paired[paired.length-1][0];\nfor(let i=1;i<at.length;i++){\nif(target>at[i])continue;\nconst span=at[i]-at[i-1];\nconst within=span>0?(target-at[i-1])/span:0;\nreturn paired[i-1][0]+(paired[i][0]-paired[i-1][0])*within;\n}\nreturn paired[paired.length-1][0];\n}\nfunction pairs(a,b,indices){\nconst readA=valueReader(a);\nconst readB=valueReader(b);\nconst xs=new Float64Array(indices.length);\nconst ys=new Float64Array(indices.length);\nlet n=0;\nfor(let i=0;i<indices.length;i++){\nconst row=indices[i];\nconst x=Number(readA(row));\nconst y=Number(readB(row));\nif(!Number.isFinite(x)||!Number.isFinite(y))continue;\nxs[n]=x;\nys[n]=y;\nn++;\n}\nreturn{xs:xs.subarray(0,n),ys:ys.subarray(0,n),n};\n}\nfunction covariance(a,b,indices,population=false){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=xs[i];my+=ys[i];}\nmx/=n;\nmy/=n;\nlet sum=0;\nfor(let i=0;i<n;i++)sum+=(xs[i]-mx)*(ys[i]-my);\nreturn sum/(population?n:n-1);\n}\nfunction regression(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=xs[i];my+=ys[i];}\nmx/=n;\nmy/=n;\nlet sxx=0;\nlet sxy=0;\nlet syy=0;\nfor(let i=0;i<n;i++){\nconst dx=xs[i]-mx;\nconst dy=ys[i]-my;\nsxx+=dx*dx;\nsxy+=dx*dy;\nsyy+=dy*dy;\n}\nif(sxx===0)return null;\nconst slope=sxy/sxx;\nconst intercept=my-slope*mx;\nconst r2=syy===0?1:Math.max(0,Math.min(1,(sxy*sxy)/(sxx*syy)));\nconst residual=Math.max(0,syy-slope*sxy);\nconst stdError=n>2?Math.sqrt(residual/(n-2)/sxx):0;\nreturn{slope,intercept,r2,stdError,n};\n}\nfunction ranksOf(values){\nconst n=values.length;\nconst order=Array.from({length:n},(unused,i)=>i)\n.sort((i,j)=>values[i]-values[j]);\nconst ranks=new Float64Array(n);\nlet i=0;\nwhile(i<n){\nlet j=i;\nwhile(j+1<n&&values[order[j+1]]===values[order[i]])j++;\nconst shared=(i+j)/2+1;\nfor(let k=i;k<=j;k++)ranks[order[k]]=shared;\ni=j+1;\n}\nreturn ranks;\n}\nfunction spearman(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2)return null;\nconst rx=ranksOf(xs);\nconst ry=ranksOf(ys);\nlet mx=0;\nlet my=0;\nfor(let i=0;i<n;i++){mx+=rx[i];my+=ry[i];}\nmx/=n;\nmy/=n;\nlet sxy=0;\nlet sxx=0;\nlet syy=0;\nfor(let i=0;i<n;i++){\nconst dx=rx[i]-mx;\nconst dy=ry[i]-my;\nsxy+=dx*dy;\nsxx+=dx*dx;\nsyy+=dy*dy;\n}\nif(sxx===0||syy===0)return null;\nreturn Math.max(-1,Math.min(1,sxy/Math.sqrt(sxx*syy)));\n}\nfunction kendall(a,b,indices){\nconst{xs,ys,n}=pairs(a,b,indices);\nif(n<2||n>KENDALL_LIMIT)return null;\nlet concordant=0;\nlet discordant=0;\nlet tiedXOnly=0;\nlet tiedYOnly=0;\nfor(let i=0;i<n;i++){\nfor(let j=i+1;j<n;j++){\nconst dx=Math.sign(xs[i]-xs[j]);\nconst dy=Math.sign(ys[i]-ys[j]);\nconst product=dx*dy;\nif(product>0)concordant++;\nelse if(product<0)discordant++;\nelse if(dx===0&&dy===0){}\nelse if(dx===0)tiedXOnly++;\nelse tiedYOnly++;\n}\n}\nconst orderedByX=concordant+discordant+tiedYOnly;\nconst orderedByY=concordant+discordant+tiedXOnly;\nif(orderedByX===0||orderedByY===0)return null;\nreturn(concordant-discordant)/Math.sqrt(orderedByX*orderedByY);\n}\nfunction seriesStats(ordered,opts={}){\nconst n=ordered.length;\nif(n<2)return null;\nconst first=ordered[0];\nconst last=ordered[n-1];\nconst returns=[];\nfor(let i=1;i<n;i++){\nconst previous=ordered[i-1];\nif(previous===0)continue;\nreturns.push((ordered[i]-previous)/Math.abs(previous));\n}\nlet volatility=null;\nif(returns.length>1){\nlet mean=0;\nfor(const r of returns)mean+=r;\nmean/=returns.length;\nlet m2=0;\nfor(const r of returns)m2+=(r-mean)**2;\nvolatility=Math.sqrt(m2/(returns.length-1));\n}\nconst periods=Number(opts.periodsPerYear)>0?Number(opts.periodsPerYear):null;\nlet peak=ordered[0];\nlet peakAt=0;\nlet worst=0;\nlet worstFrom=0;\nlet worstTo=0;\nfor(let i=1;i<n;i++){\nif(ordered[i]>peak){peak=ordered[i];peakAt=i;continue;}\nif(peak<=0)continue;\nconst fall=(peak-ordered[i])/peak;\nif(fall>worst){worst=fall;worstFrom=peakAt;worstTo=i;}\n}\nlet autocorrelation=null;\nif(n>2){\nlet mean=0;\nfor(let i=0;i<n;i++)mean+=ordered[i];\nmean/=n;\nlet top=0;\nlet bottom=0;\nfor(let i=0;i<n;i++){\nconst d=ordered[i]-mean;\nbottom+=d*d;\nif(i>0)top+=d*(ordered[i-1]-mean);\n}\nautocorrelation=bottom>0?top/bottom:null;\n}\nlet up=0;\nlet down=0;\nfor(const r of returns){if(r>0)up++;else if(r<0)down++;}\nlet growth=null;\nif(first>0&&last>0){\nconst perPeriod=(last/first)**(1/(n-1))-1;\ngrowth=periods?(1+perPeriod)**periods-1:perPeriod;\n}\nreturn{\nn,\nfirst,\nlast,\nchange:last-first,\nchangePercent:first===0?null:((last-first)/Math.abs(first))*100,\nvolatility,\nannualisedVolatility:volatility!==null&&periods?volatility*Math.sqrt(periods):null,\ngrowth,\nmaxDrawdown:worst,\nmaxDrawdownFrom:worstFrom,\nmaxDrawdownTo:worstTo,\nautocorrelation,\nupDays:up,\ndownDays:down,\n};\n}\nconst D2_N2=1.128;\nconst D4_N2=3.267;\nfunction movingRanges(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nconst ranges=[];\nfor(let i=1;i<n;i++)ranges.push(Math.abs(ordered[i]-ordered[i-1]));\nconst centre=ranges.reduce((t,r)=>t+r,0)/ranges.length;\nreturn{ranges,centre,upper:D4_N2*centre,lower:0};\n}\nfunction withinSigma(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nlet total=0;\nfor(let i=1;i<n;i++)total+=Math.abs(ordered[i]-ordered[i-1]);\nconst meanRange=total/(n-1);\nreturn{sigma:meanRange/D2_N2,meanRange};\n}\nfunction capability(ordered,spec){\nconst n=ordered.length;\nif(n<2||!spec)return null;\nconst lower=Number.isFinite(Number(spec.lower))?Number(spec.lower):null;\nconst upper=Number.isFinite(Number(spec.upper))?Number(spec.upper):null;\nif(lower===null&&upper===null)return null;\nlet mean=0;\nfor(let i=0;i<n;i++)mean+=ordered[i];\nmean/=n;\nlet m2=0;\nfor(let i=0;i<n;i++)m2+=(ordered[i]-mean)**2;\nconst overall=Math.sqrt(m2/(n-1));\nconst within=withinSigma(ordered);\nconst sigmaWithin=within?within.sigma:null;\nconst indices=(sigma)=>{\nif(!sigma||sigma<=0)return{index:null,k:null};\nconst both=lower!==null&&upper!==null;\nconst index=both?(upper-lower)/(6*sigma):null;\nconst upperSide=upper!==null?(upper-mean)/(3*sigma):Infinity;\nconst lowerSide=lower!==null?(mean-lower)/(3*sigma):Infinity;\nreturn{index,k:Math.min(upperSide,lowerSide)};\n};\nconst short=indices(sigmaWithin);\nconst long=indices(overall);\nlet outOfSpec=0;\nfor(let i=0;i<n;i++){\nif(lower!==null&&ordered[i]<lower){outOfSpec++;continue;}\nif(upper!==null&&ordered[i]>upper)outOfSpec++;\n}\nreturn{\nn,\nmean,\nlower,\nupper,\ntarget:Number.isFinite(Number(spec.target))?Number(spec.target):null,\nsigmaWithin,\nsigmaOverall:overall,\ncp:short.index,\ncpk:short.k,\npp:long.index,\nppk:long.k,\noutOfSpec,\ndefectRate:n?outOfSpec/n:null,\n};\n}\nfunction controlLimits(ordered){\nconst n=ordered.length;\nif(n<2)return null;\nconst within=withinSigma(ordered);\nif(!within||!(within.sigma>0))return null;\nlet centre=0;\nfor(let i=0;i<n;i++)centre+=ordered[i];\ncentre/=n;\nreturn{\ncentre,\nsigma:within.sigma,\nupper:centre+3*within.sigma,\nlower:centre-3*within.sigma,\n};\n}\nfunction westernElectricViolations(ordered,limits){\nif(!limits||!(limits.sigma>0))return[];\nconst n=ordered.length;\nconst{centre,sigma}=limits;\nconst z=(i)=>(ordered[i]-centre)/sigma;\nconst out=[];\nfor(let i=0;i<n;i++){\nif(Math.abs(z(i))>3){\nout.push({index:i,rule:1,description:'beyond three sigma'});\n}\nif(i>=2){\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=i-2;k<=i;k++)if(z(k)*side>2)hits++;\nif(hits>=2){\nout.push({index:i,rule:2,description:'two of three past two sigma'});\nbreak;\n}\n}\n}\nif(i>=4){\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=i-4;k<=i;k++)if(z(k)*side>1)hits++;\nif(hits>=4){\nout.push({index:i,rule:3,description:'four of five past one sigma'});\nbreak;\n}\n}\n}\nif(i>=7){\nfor(const side of[1,-1]){\nlet all=true;\nfor(let k=i-7;k<=i;k++)if(z(k)*side<=0){all=false;break;}\nif(all){\nout.push({index:i,rule:4,description:'eight in a row on one side'});\nbreak;\n}\n}\n}\n}\nreturn out;\n}\nfunction nelsonViolations(ordered,limits){\nif(!limits||!(limits.sigma>0))return[];\nconst n=ordered.length;\nconst{centre,sigma}=limits;\nconst z=(i)=>(ordered[i]-centre)/sigma;\nconst oneSide=(from,to,past,need)=>{\nfor(const side of[1,-1]){\nlet hits=0;\nfor(let k=from;k<=to;k++)if(z(k)*side>past)hits++;\nif(hits>=need)return true;\n}\nreturn false;\n};\nconst out=[];\nfor(let i=0;i<n;i++){\nif(Math.abs(z(i))>3)out.push({index:i,rule:1,description:'beyond three sigma'});\nif(i>=8){\nfor(const side of[1,-1]){\nlet all=true;\nfor(let k=i-8;k<=i;k++)if(z(k)*side<=0){all=false;break;}\nif(all){out.push({index:i,rule:2,description:'nine in a row on one side'});break;}\n}\n}\nif(i>=5){\nfor(const dir of[1,-1]){\nlet all=true;\nfor(let k=i-4;k<=i;k++){\nif((ordered[k]-ordered[k-1])*dir<=0){all=false;break;}\n}\nif(all){\nout.push({index:i,rule:3,description:dir>0?'six rising':'six falling'});\nbreak;\n}\n}\n}\nif(i>=13){\nlet alternating=true;\nfor(let k=i-12;k<=i;k++){\nconst a=ordered[k]-ordered[k-1];\nconst b=ordered[k+1<=i?k+1:k]-ordered[k];\nif(k+1>i)break;\nif(a===0||b===0||(a>0)===(b>0)){alternating=false;break;}\n}\nif(alternating)out.push({index:i,rule:4,description:'fourteen alternating'});\n}\nif(i>=2&&oneSide(i-2,i,2,2)){\nout.push({index:i,rule:5,description:'two of three past two sigma'});\n}\nif(i>=4&&oneSide(i-4,i,1,4)){\nout.push({index:i,rule:6,description:'four of five past one sigma'});\n}\nif(i>=14){\nlet inside=true;\nfor(let k=i-14;k<=i;k++)if(Math.abs(z(k))>=1){inside=false;break;}\nif(inside)out.push({index:i,rule:7,description:'fifteen within one sigma'});\n}\nif(i>=7){\nlet outside=true;\nfor(let k=i-7;k<=i;k++)if(Math.abs(z(k))<=1){outside=false;break;}\nif(outside)out.push({index:i,rule:8,description:'eight beyond one sigma'});\n}\n}\nreturn out;\n}\nconst CONTROL_RULE_SETS=Object.freeze(['westernElectric','nelson']);\nfunction controlViolations(ordered,limits,ruleSet='westernElectric'){\nreturn String(ruleSet)==='nelson'\n?nelsonViolations(ordered,limits)\n:westernElectricViolations(ordered,limits);\n}\nfunction countOutside(values,low,high){\nlet count=0;\nfor(let i=0;i<values.length;i++){\nif(values[i]<low||values[i]>high)count++;\n}\nreturn count;\n}\nfunction histogram(sorted,q1,q3,cap=20){\nconst n=sorted.length;\nif(!n)return[];\nconst min=sorted[0];\nconst max=sorted[n-1];\nif(max===min)return[{from:min,to:max,count:n}];\nconst iqr=q3-q1;\nconst fence=1.5*iqr;\nlet lo=iqr>0?Math.max(min,q1-fence):min;\nlet hi=iqr>0?Math.min(max,q3+fence):max;\nif(!(hi>lo)){lo=min;hi=max;}\nconst width=iqr>0?(2*iqr)/Math.cbrt(n):(hi-lo)/(Math.ceil(Math.log2(n))+1);\nconst count=width>0\n?Math.min(cap,Math.max(1,Math.ceil((hi-lo)/width)))\n:1;\nconst step=(hi-lo)/count;\nconst bins=[];\nfor(let i=0;i<count;i++){\nbins.push({from:lo+i*step,to:lo+(i+1)*step,count:0});\n}\nfor(let i=0;i<n;i++){\nconst at=Math.min(count-1,Math.max(0,Math.floor((sorted[i]-lo)/step)));\nbins[at].count++;\n}\nbins[0].from=min;\nbins[count-1].to=max;\nreturn bins;\n}\nconst DEFAULT_CONFIDENCE=0.95;\nfunction level(conf){\nconst c=Number(conf);\nreturn Number.isFinite(c)&&c>0&&c<1?c:DEFAULT_CONFIDENCE;\n}\nfunction meanInterval(values,conf=DEFAULT_CONFIDENCE){\nconst n=values.length;\nif(n<2)return null;\nlet sum=0;\nfor(let i=0;i<n;i++)sum+=values[i];\nconst mean=sum/n;\nlet ss=0;\nfor(let i=0;i<n;i++){const d=values[i]-mean;ss+=d*d;}\nconst sd=Math.sqrt(ss/(n-1));\nconst c=level(conf);\nconst t=studentTQuantile(1-(1-c)/2,n-1);\nconst margin=(t*sd)/Math.sqrt(n);\nreturn{mean,lower:mean-margin,upper:mean+margin,margin,n,confidence:c};\n}\nfunction proportionInterval(successes,n,conf=DEFAULT_CONFIDENCE){\nconst k=Number(successes);\nconst total=Number(n);\nif(!(total>0)||!(k>=0)||k>total)return null;\nconst c=level(conf);\nconst z=normalQuantile(1-(1-c)/2);\nconst p=k/total;\nconst z2=z*z;\nconst denominator=1+z2/total;\nconst centre=(p+z2/(2*total))/denominator;\nconst half=(z/denominator)\n*Math.sqrt((p*(1-p))/total+z2/(4*total*total));\nreturn{\nproportion:p,\nlower:Math.max(0,centre-half),\nupper:Math.min(1,centre+half),\nn:total,\nconfidence:c,\n};\n}\nfunction slopeInterval(fit,conf=DEFAULT_CONFIDENCE){\nif(!fit||!(fit.n>2)||!Number.isFinite(fit.stdError))return null;\nconst c=level(conf);\nconst t=studentTQuantile(1-(1-c)/2,fit.n-2);\nconst margin=t*fit.stdError;\nreturn{\nslope:fit.slope,\nlower:fit.slope-margin,\nupper:fit.slope+margin,\nmargin,\nconfidence:c,\n};\n}\nfunction capabilityInterval(index,n,conf=DEFAULT_CONFIDENCE){\nconst k=Number(index);\nconst count=Number(n);\nif(!Number.isFinite(k)||!(count>1))return null;\nconst c=level(conf);\nconst z=normalQuantile(1-(1-c)/2);\nconst margin=z*Math.sqrt(1/(9*count)+(k*k)/(2*(count-1)));\nreturn{index:k,lower:k-margin,upper:k+margin,margin,n:count,confidence:c};\n}\nfunction standardizedMeanDifference(population,subsetMean){\nif(!population||!(population.sd>0))return null;\nif(!Number.isFinite(subsetMean)||!Number.isFinite(population.mean))return null;\nreturn(subsetMean-population.mean)/population.sd;\n}\nfunction normalTotalVariation(d){\nif(!Number.isFinite(d))return 0;\nreturn Math.min(1,Math.max(0,2*normalCdf(Math.abs(d)/2)-1));\n}\nfunction frequencyMap(handle,indices){\nconst map=new Map();\nconst read=valueReader(handle);\nlet total=0;\nfor(let i=0;i<indices.length;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(typeof raw==='number'&&Number.isNaN(raw))continue;\nconst key=raw instanceof Date?raw.getTime()\n:(typeof raw==='object'?String(raw):raw);\nmap.set(key,(map.get(key)||0)+1);\ntotal++;\n}\nreturn{map,total};\n}\nfunction categoricalDistance(subset,subsetTotal,population,populationTotal){\nif(!(subsetTotal>0)||!(populationTotal>0))return null;\nlet sum=0;\nconst keys=new Set(subset.keys());\nfor(const k of population.keys())keys.add(k);\nfor(const k of keys){\nconst a=(subset.get(k)||0)/subsetTotal;\nconst b=(population.get(k)||0)/populationTotal;\nsum+=Math.abs(a-b);\n}\nreturn sum/2;\n}\nconst SUBSET_RELIABILITY_FLOOR=10;\nfunction compareColumn(handle,subsetIndices,populationStats){\nconst numeric=populationStats&&populationStats.numeric;\nif(numeric){\nconst values=numbers(handle,subsetIndices);\nconst{n,mean}=moments(values);\nconst d=n>0\n?standardizedMeanDifference(\n{mean:populationStats.mean,sd:populationStats.sd},mean,\n)\n:null;\nreturn{\nmeasure:'standardizedMeanDifference',\nmagnitude:d,\ndistance:d===null?0:normalTotalVariation(d),\ndirection:d===null?0:Math.sign(d),\nsubsetN:n,\npopulationN:populationStats.n||0,\nreliable:n>=SUBSET_RELIABILITY_FLOOR,\n};\n}\nconst{map,total}=frequencyMap(handle,subsetIndices);\nconst tvd=categoricalDistance(map,total,populationStats.map,populationStats.total);\nreturn{\nmeasure:'categoricalTotalVariation',\nmagnitude:tvd,\ndistance:tvd===null?0:tvd,\ndirection:0,\nsubsetN:total,\npopulationN:populationStats.total||0,\nreliable:total>=SUBSET_RELIABILITY_FLOOR,\n};\n}\nfunction isNumericColumn(handle,indices){\nif(handle&&(handle.kind==='float64'||handle.kind==='int32'))return true;\nconst read=valueReader(handle);\nlet seen=0;\nlet numeric=0;\nfor(let i=0;i<indices.length&&seen<200;i++){\nconst raw=read(indices[i]);\nif(raw===null||raw===undefined||raw==='')continue;\nif(raw instanceof Date)return false;\nseen++;\nconst v=typeof raw==='number'?raw:Number(raw);\nif(Number.isFinite(v))numeric++;\n}\nif(seen===0)return false;\nreturn numeric/seen>=0.9;\n}\nfunction populationRead(handle,populationIndices){\nif(isNumericColumn(handle,populationIndices)){\nconst values=numbers(handle,populationIndices);\nconst{n,mean,m2}=moments(values);\nreturn{numeric:true,mean,sd:n>0?Math.sqrt(m2/n):0,n};\n}\nconst{map,total}=frequencyMap(handle,populationIndices);\nreturn{numeric:false,map,total};\n}\n});\n__def(\"packages/core/src/compute/total.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"TOTAL_FNS\",{enumerable:true,get:function(){return TOTAL_FNS;}});\nObject.defineProperty(__exports,\"TOTAL_LABELS\",{enumerable:true,get:function(){return TOTAL_LABELS;}});\nObject.defineProperty(__exports,\"totalLabel\",{enumerable:true,get:function(){return totalLabel;}});\nObject.defineProperty(__exports,\"aggregatesFor\",{enumerable:true,get:function(){return aggregatesFor;}});\nObject.defineProperty(__exports,\"aggregateAllowed\",{enumerable:true,get:function(){return aggregateAllowed;}});\nObject.defineProperty(__exports,\"collectValues\",{enumerable:true,get:function(){return collectValues;}});\nObject.defineProperty(__exports,\"total\",{enumerable:true,get:function(){return total;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst isFunction=__m0[\"isFunction\"];\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst presenceReader=__m1[\"presenceReader\"];\nconst valueComparator=__m1[\"valueComparator\"];\nconst valueReader=__m1[\"valueReader\"];\nconst __m2=__req(\"packages/core/src/compute/statistics.js\");\nconst STAT_FNS=__m2[\"STAT_FNS\"];\nconst STAT_LABELS=__m2[\"STAT_LABELS\"];\nfunction isNumericBacking(handle){\nreturn!!handle&&(handle.kind==='float64'||handle.kind==='int32');\n}\nfunction sum(handle,indices){\nconst n=indices.length;\nlet acc=0;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<n;i++){\nconst v=values[indices[i]];\nif(!Number.isNaN(v))acc+=v;\n}\nreturn acc;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===1){\nconst v=values[row];\nif(!Number.isNaN(v))acc+=v;\n}\n}\nreturn acc;\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst v=numberOf(read(indices[i]));\nif(v!==null)acc+=v;\n}\nreturn acc;\n}\nsum.kernel=true;\nfunction countValues(handle,indices){\nconst n=indices.length;\nlet count=0;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nif(!present){\nfor(let i=0;i<n;i++)if(!Number.isNaN(values[indices[i]]))count++;\nreturn count;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===1&&!Number.isNaN(values[row]))count++;\n}\nreturn count;\n}\nconst read=valueReader(handle);\nfor(let i=0;i<n;i++){\nconst v=read(indices[i]);\nif(v!==null&&v!==undefined&&!(typeof v==='number'&&Number.isNaN(v)))count++;\n}\nreturn count;\n}\ncountValues.kernel=true;\nfunction count(handle,indices){\nreturn indices.length;\n}\ncount.kernel=true;\nfunction avg(handle,indices){\nconst values=countValues(handle,indices);\nif(values===0)return null;\nreturn sum(handle,indices)/values;\n}\navg.kernel=true;\nfunction extreme(handle,indices,direction,locale){\nconst n=indices.length;\nif(isNumericBacking(handle)){\nconst values=handle.values;\nconst present=presenceReader(handle);\nlet best=null;\nif(!present){\nfor(let i=0;i<n;i++){\nconst v=values[indices[i]];\nif(Number.isNaN(v))continue;\nif(best===null||(direction<0?v<best:v>best))best=v;\n}\nreturn best;\n}\nfor(let i=0;i<n;i++){\nconst row=indices[i];\nif(present(row)===0)continue;\nconst v=values[row];\nif(Number.isNaN(v))continue;\nif(best===null||(direction<0?v<best:v>best))best=v;\n}\nreturn best;\n}\nconst read=valueReader(handle);\nconst cmp=valueComparator(locale);\nlet best=null;\nfor(let i=0;i<n;i++){\nconst v=read(indices[i]);\nif(v===null||v===undefined||(typeof v==='number'&&Number.isNaN(v)))continue;\nif(best===null||(direction<0?cmp(v,best)<0:cmp(v,best)>0))best=v;\n}\nreturn best;\n}\nfunction min(handle,indices,ctx){\nreturn extreme(handle,indices,-1,ctx&&ctx.locale);\n}\nmin.kernel=true;\nfunction max(handle,indices,ctx){\nreturn extreme(handle,indices,1,ctx&&ctx.locale);\n}\nmax.kernel=true;\nfunction first(handle,indices){\nif(indices.length===0)return null;\nreturn valueReader(handle)(indices[0]);\n}\nfirst.kernel=true;\nfunction last(handle,indices){\nif(indices.length===0)return null;\nreturn valueReader(handle)(indices[indices.length-1]);\n}\nlast.kernel=true;\nfunction numberOf(v){\nif(typeof v==='number')return Number.isNaN(v)?null:v;\nif(v===null||v===undefined||v===''||typeof v==='boolean')return null;\nif(v instanceof Date)return v.getTime();\nconst n=Number(v);\nreturn Number.isNaN(n)?null:n;\n}\nconst TOTAL_FNS={\nsum,min,max,avg,count,first,last,countValues,\n...STAT_FNS,\n};\nconst TOTAL_LABELS=Object.freeze({\n...STAT_LABELS,\nsum:'Sum',\navg:'Average',\nmin:'Min',\nmax:'Max',\ncount:'Count',\ncountValues:'Count of values',\nfirst:'First',\nlast:'Last',\n});\nfunction totalLabel(fn){\nif(!fn)return'';\nif(typeof fn==='string')return TOTAL_LABELS[fn]||fn;\nreturn'Total';\n}\nconst CHOOSER_ORDER=Object.freeze([\n'sum','avg','min','max','count','countValues','first','last',\n]);\nfunction aggregatesFor(column){\nconst supported=column&&column.dataType\n&&column.dataType.totals&&column.dataType.totals.supported;\nif(Array.isArray(supported))return supported.slice();\nconst named=CHOOSER_ORDER.filter((name)=>name in TOTAL_FNS);\nfor(const name of Object.keys(TOTAL_FNS))if(!named.includes(name))named.push(name);\nreturn named;\n}\nfunction aggregateAllowed(column,name){\nif(typeof name!=='string')return true;\nreturn aggregatesFor(column).includes(name);\n}\nfunction collectValues(handle,indices){\nconst read=valueReader(handle);\nconst out=[];\nfor(let i=0;i<indices.length;i++){\nconst v=read(indices[i]);\nif(v===null||v===undefined)continue;\nout.push(v);\n}\nreturn out;\n}\nfunction total(handle,indices,fn,ctx){\nconst list=indices||[];\nif(typeof fn==='string'){\nconst kernel=TOTAL_FNS[fn];\nif(!kernel){\nwarnOnce(`total:${fn}`,`unknown total function \"${fn}\"; register it in config.totalFns`);\nreturn null;\n}\nreturn kernel(handle,list,ctx);\n}\nif(isFunction(fn)){\nif(fn.kernel===true)return fn(handle,list,ctx);\nreturn fn(collectValues(handle,list),ctx||{});\n}\nreturn null;\n}\n});\n__def(\"packages/core/src/compute/pivot.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"KEY_DELIMITER\",{enumerable:true,get:function(){return KEY_DELIMITER;}});\nObject.defineProperty(__exports,\"DEFAULT_PATH_SEPARATOR\",{enumerable:true,get:function(){return DEFAULT_PATH_SEPARATOR;}});\nObject.defineProperty(__exports,\"DEFAULT_MAX_COLUMNS\",{enumerable:true,get:function(){return DEFAULT_MAX_COLUMNS;}});\nObject.defineProperty(__exports,\"pivotKey\",{enumerable:true,get:function(){return pivotKey;}});\nObject.defineProperty(__exports,\"joinPath\",{enumerable:true,get:function(){return joinPath;}});\nObject.defineProperty(__exports,\"resolvePivotKeys\",{enumerable:true,get:function(){return resolvePivotKeys;}});\nObject.defineProperty(__exports,\"pivot\",{enumerable:true,get:function(){return pivot;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst warnOnce=__m0[\"warnOnce\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst valueComparator=__m1[\"valueComparator\"];\nconst __m2=__req(\"packages/core/src/compute/group.js\");\nconst packKeys=__m2[\"packKeys\"];\nconst __m3=__req(\"packages/core/src/compute/total.js\");\nconst total=__m3[\"total\"];\nconst KEY_DELIMITER='|';\nconst DEFAULT_PATH_SEPARATOR='/';\nconst DEFAULT_MAX_COLUMNS=2000;\nfunction pivotKey(groupPath,pivotPath,colId){\nreturn`${groupPath}${KEY_DELIMITER}${pivotPath}${KEY_DELIMITER}${colId}`;\n}\nfunction joinPath(parts,separator){\nlet out='';\nfor(let i=0;i<parts.length;i++){\nconst v=parts[i];\nout+=(i===0?'':separator)+(v===null||v===undefined?'':String(v));\n}\nreturn out;\n}\nfunction resolvePivotKeys(handles,order,opts={}){\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst n=order.length;\nconst{keyOf,readers}=packKeys(handles,order,0);\nconst seen=new Map();\nconst tuples=[];\nconst rawKeys=[];\nfor(let i=0;i<n;i++){\nconst row=order[i];\nconst key=keyOf(row);\nif(seen.has(key))continue;\nseen.set(key,tuples.length);\nrawKeys.push(key);\nconst tuple=new Array(readers.length);\nfor(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);\ntuples.push(tuple);\n}\nconst cmp=valueComparator(opts.locale);\nconst rank=tuples.map((_,i)=>i);\nrank.sort((a,b)=>{\nconst ta=tuples[a];\nconst tb=tuples[b];\nfor(let j=0;j<ta.length;j++){\nconst c=compareNullable(ta[j],tb[j],cmp);\nif(c!==0)return c;\n}\nreturn a-b;\n});\nconst keys=new Array(rank.length);\nconst paths=new Array(rank.length);\nconst idByKey=new Map();\nfor(let position=0;position<rank.length;position++){\nconst from=rank[position];\nkeys[position]=tuples[from];\npaths[position]=joinPath(tuples[from],separator);\nidByKey.set(rawKeys[from],position);\n}\nconst idOf=(row)=>{\nconst id=idByKey.get(keyOf(row));\nreturn id===undefined?-1:id;\n};\nreturn{keys,paths,idOf};\n}\nfunction compareNullable(a,b,cmp){\nconst na=a===null||a===undefined;\nconst nb=b===null||b===undefined;\nif(na||nb)return na&&nb?0:na?1:-1;\nreturn cmp(a,b);\n}\nfunction resolveValueColumns(opts){\nconst declared=opts.values||opts.totals||[];\nif(declared.length&&typeof declared[0]==='object'&&declared[0]!==null){\nreturn declared.filter((entry)=>entry&&entry.handle);\n}\nconst resolve=typeof opts.handle==='function'?opts.handle:null;\nif(!resolve){\nif(declared.length){\nwarnOnce('pivot:handles',\n'pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle.');\n}\nreturn[];\n}\nconst totalOf=typeof opts.totalOf==='function'?opts.totalOf:null;\nconst out=[];\nfor(const colId of declared){\nconst handle=resolve(colId);\nif(!handle)continue;\nout.push({colId,handle,fn:totalOf?totalOf(colId):'sum'});\n}\nreturn out;\n}\nfunction normaliseArgs(a,b,c){\nif(Array.isArray(a)){\nconst opts=c||{};\nreturn{...opts,pivotHandles:a,order:b||null,groups:opts.groups||null};\n}\nreturn a||{};\n}\nfunction pivot(input,orderArg,optsArg){\nconst opts=normaliseArgs(input,orderArg,optsArg);\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst valueColumns=resolveValueColumns(opts);\nconst maxColumns=opts.maxColumns===undefined?DEFAULT_MAX_COLUMNS:opts.maxColumns;\nconst groups=opts.groups&&opts.groups.buckets?opts.groups:null;\nconst buckets=groups?groups.buckets:[opts.order||new Uint32Array(0)];\nconst groupPaths=opts.groupPaths\n||(groups?groups.keys.map((tuple)=>joinPath(tuple,separator)):['']);\nconst scope=concatIndices(buckets);\nconst{keys,paths,idOf}=resolvePivotKeys(opts.pivotHandles||[],scope,opts);\nconst columns=paths.length*Math.max(1,valueColumns.length);\nconst fields=derivedFields(paths,valueColumns,separator);\nif(maxColumns&&columns>maxColumns){\nconst empty=new Map();\nreturn{\nkeys,\npaths,\nfields,\ngroupPaths,\ncolumns,\nvalues:empty,\ncells:empty,\nerror:{\ncode:'pivot-max-columns',\nmessage:`[lattice] pivot would generate ${columns} columns, above pivot.maxColumns of ${maxColumns}. Narrow the pivot columns or raise the limit.`,\ncolumns,\nmaxColumns,\n},\n};\n}\nconst cells=new Map();\nconst keyCount=paths.length;\nfor(let g=0;g<buckets.length;g++){\nconst bucket=buckets[g];\nconst groupPath=groupPaths[g]===undefined?'':groupPaths[g];\nconst n=bucket.length;\nif(n===0)continue;\nconst ids=new Int32Array(n);\nconst counts=new Uint32Array(keyCount+1);\nfor(let i=0;i<n;i++){\nconst id=idOf(bucket[i]);\nids[i]=id;\nif(id>=0)counts[id+1]++;\n}\nfor(let k=0;k<keyCount;k++)counts[k+1]+=counts[k];\nconst scattered=new Uint32Array(n);\nconst cursor=counts.slice(0,keyCount);\nfor(let i=0;i<n;i++){\nconst id=ids[i];\nif(id>=0)scattered[cursor[id]++]=bucket[i];\n}\nfor(let k=0;k<keyCount;k++){\nconst from=counts[k];\nconst to=counts[k+1];\nif(to===from)continue;\nconst slice=scattered.subarray(from,to);\nfor(let c=0;c<valueColumns.length;c++){\nconst column=valueColumns[c];\nconst result=total(column.handle,slice,column.fn,opts.totalContext||{locale:opts.locale});\ncells.set(pivotKey(groupPath,paths[k],column.colId),result);\n}\n}\n}\nreturn{keys,paths,fields,groupPaths,columns,values:cells,cells,error:null};\n}\nfunction derivedFields(paths,valueColumns,separator){\nif(valueColumns.length===0)return paths.slice();\nconst out=[];\nfor(const path of paths){\nfor(const column of valueColumns)out.push(`${path}${separator}${column.colId}`);\n}\nreturn out;\n}\nfunction concatIndices(buckets){\nif(buckets.length===1)return buckets[0]||new Uint32Array(0);\nlet n=0;\nfor(const b of buckets)n+=b?b.length:0;\nconst out=new Uint32Array(n);\nlet at=0;\nfor(const b of buckets){\nif(!b||b.length===0)continue;\nout.set(b,at);\nat+=b.length;\n}\nreturn out;\n}\n});\n__def(\"packages/core/src/compute/pivotmatrix.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"GRAND_PATH\",{enumerable:true,get:function(){return GRAND_PATH;}});\nObject.defineProperty(__exports,\"resolveAxis\",{enumerable:true,get:function(){return resolveAxis;}});\nObject.defineProperty(__exports,\"pivotMatrix\",{enumerable:true,get:function(){return pivotMatrix;}});\nObject.defineProperty(__exports,\"cellKey\",{enumerable:true,get:function(){return cellKey;}});\nObject.defineProperty(__exports,\"marginKey\",{enumerable:true,get:function(){return marginKey;}});\nconst __m0=__req(\"packages/core/src/compute/handle.js\");\nconst valueComparator=__m0[\"valueComparator\"];\nconst __m1=__req(\"packages/core/src/compute/total.js\");\nconst total=__m1[\"total\"];\nconst __m2=__req(\"packages/core/src/compute/group.js\");\nconst packKeys=__m2[\"packKeys\"];\nconst __m3=__req(\"packages/core/src/compute/pivot.js\");\nconst joinPath=__m3[\"joinPath\"];\nconst DEFAULT_PATH_SEPARATOR=__m3[\"DEFAULT_PATH_SEPARATOR\"];\nconst DEFAULT_MAX_COLUMNS=__m3[\"DEFAULT_MAX_COLUMNS\"];\nconst GRAND_PATH='';\nfunction resolveAxis(handles,leaves,opts={}){\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst list=handles||[];\nconst order=leaves instanceof Uint32Array?leaves:Uint32Array.from(leaves||[]);\nconst n=order.length;\nif(list.length===0){\nreturn{tuples:[[]],paths:[GRAND_PATH],buckets:[order]};\n}\nconst{keyOf,readers}=packKeys(list,order,0);\nconst seen=new Map();\nconst tuples=[];\nconst rawKeys=[];\nconst rowsByKey=[];\nfor(let i=0;i<n;i++){\nconst row=order[i];\nconst key=keyOf(row);\nlet at=seen.get(key);\nif(at===undefined){\nat=tuples.length;\nseen.set(key,at);\nrawKeys.push(key);\nconst tuple=new Array(readers.length);\nfor(let j=0;j<readers.length;j++)tuple[j]=readers[j](row);\ntuples.push(tuple);\nrowsByKey.push([]);\n}\nrowsByKey[at].push(row);\n}\nconst cmp=valueComparator(opts.locale);\nconst rank=tuples.map((_,i)=>i);\nrank.sort((a,b)=>{\nconst ta=tuples[a];\nconst tb=tuples[b];\nfor(let j=0;j<ta.length;j++){\nconst c=compareNullable(ta[j],tb[j],cmp);\nif(c!==0)return c;\n}\nreturn a-b;\n});\nconst outTuples=new Array(rank.length);\nconst paths=new Array(rank.length);\nconst buckets=new Array(rank.length);\nfor(let position=0;position<rank.length;position++){\nconst from=rank[position];\noutTuples[position]=tuples[from];\npaths[position]=joinPath(tuples[from],separator);\nbuckets[position]=Uint32Array.from(rowsByKey[from]);\n}\nreturn{tuples:outTuples,paths,buckets};\n}\nfunction compareNullable(a,b,cmp){\nconst na=a===null||a===undefined;\nconst nb=b===null||b===undefined;\nif(na||nb)return na&&nb?0:na?1:-1;\nreturn cmp(a,b);\n}\nfunction intersect(a,b,bSet){\nconst out=[];\nfor(let i=0;i<a.length;i++){\nif(bSet.has(a[i]))out.push(a[i]);\n}\nreturn Uint32Array.from(out);\n}\nfunction reduceCell(handle,leaves,fn,ctx){\nconst value=leaves.length?total(handle,leaves,fn,ctx):null;\nreturn{value,leaves,count:leaves.length};\n}\nfunction pivotMatrix(input){\nconst opts=(input&&input.opts)||{};\nconst separator=opts.separator||DEFAULT_PATH_SEPARATOR;\nconst ctx=opts.totalContext||{locale:opts.locale};\nconst measures=(input.measures||[]).filter((m)=>m&&m.handle);\nconst leaves=input.leaves instanceof Uint32Array\n?input.leaves\n:Uint32Array.from(input.leaves||[]);\nconst rowAxis=resolveAxis(input.rowHandles||[],leaves,{...opts,separator});\nconst columnAxis=resolveAxis(input.columnHandles||[],leaves,{...opts,separator});\nconst maxColumns=opts.maxColumns===undefined?DEFAULT_MAX_COLUMNS:opts.maxColumns;\nconst columns=columnAxis.paths.length*Math.max(1,measures.length);\nconst empty=new Map();\nif(maxColumns&&columns>maxColumns){\nreturn{\nrowAxis,\ncolumnAxis,\nmeasures:measures.map((m)=>({colId:m.colId,fn:m.fn})),\nbody:empty,\nrowMargin:empty,\ncolumnMargin:empty,\ngrand:empty,\ncolumns,\nerror:{\ncode:'pivot-max-columns',\nmessage:`[lattice] pivot would generate ${columns} columns, above pivot.maxColumns of `\n+`${maxColumns}. Narrow the pivot columns or raise the limit.`,\ncolumns,\nmaxColumns,\n},\n};\n}\nconst body=new Map();\nconst rowMargin=new Map();\nconst columnMargin=new Map();\nconst grand=new Map();\nconst columnSets=columnAxis.buckets.map((b)=>new Set(b));\nfor(let c=0;c<columnAxis.paths.length;c++){\nconst columnLeaves=columnAxis.buckets[c];\nconst columnPath=columnAxis.paths[c];\nfor(const m of measures){\ncolumnMargin.set(marginKey(columnPath,m.colId),reduceCell(m.handle,columnLeaves,m.fn,ctx));\n}\n}\nfor(let r=0;r<rowAxis.paths.length;r++){\nconst rowLeaves=rowAxis.buckets[r];\nconst rowPath=rowAxis.paths[r];\nfor(const m of measures){\nrowMargin.set(marginKey(rowPath,m.colId),reduceCell(m.handle,rowLeaves,m.fn,ctx));\n}\nfor(let c=0;c<columnAxis.paths.length;c++){\nconst cellLeaves=intersect(rowLeaves,columnAxis.buckets[c],columnSets[c]);\nif(cellLeaves.length===0)continue;\nconst columnPath=columnAxis.paths[c];\nfor(const m of measures){\nbody.set(cellKey(rowPath,columnPath,m.colId),reduceCell(m.handle,cellLeaves,m.fn,ctx));\n}\n}\n}\nfor(const m of measures){\ngrand.set(m.colId,reduceCell(m.handle,leaves,m.fn,ctx));\n}\nreturn{\nrowAxis,\ncolumnAxis,\nmeasures:measures.map((m)=>({colId:m.colId,fn:m.fn})),\nbody,\nrowMargin,\ncolumnMargin,\ngrand,\ncolumns,\nerror:null,\n};\n}\nfunction cellKey(rowPath,columnPath,colId){\nreturn`${rowPath}\\u0000${columnPath}\\u0000${colId}`;\n}\nfunction marginKey(path,colId){\nreturn`${path}\\u0000${colId}`;\n}\n});\n__def(\"packages/core/src/compute/reference.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"referenceValue\",{enumerable:true,get:function(){return referenceValue;}});\nObject.defineProperty(__exports,\"referenceSort\",{enumerable:true,get:function(){return referenceSort;}});\nObject.defineProperty(__exports,\"referenceFilter\",{enumerable:true,get:function(){return referenceFilter;}});\nObject.defineProperty(__exports,\"referencePasses\",{enumerable:true,get:function(){return referencePasses;}});\nObject.defineProperty(__exports,\"referenceGroup\",{enumerable:true,get:function(){return referenceGroup;}});\nObject.defineProperty(__exports,\"referenceTotal\",{enumerable:true,get:function(){return referenceTotal;}});\nconst __m0=__req(\"packages/core/src/internal/util.js\");\nconst getPath=__m0[\"getPath\"];\nconst __m1=__req(\"packages/core/src/compute/handle.js\");\nconst isMissing=__m1[\"isMissing\"];\nconst valueComparator=__m1[\"valueComparator\"];\nconst __m2=__req(\"packages/core/src/compute/filter.js\");\nconst testValue=__m2[\"testValue\"];\nconst KEY_SEPARATOR=String.fromCharCode(0x1f);\nconst NULL_MARKER=String.fromCharCode(0x00);\nfunction referenceValue(row,col){\nconst v=col.includes('.')?getPath(row,col):(row==null?undefined:row[col]);\nreturn v===undefined?null:v;\n}\nfunction referenceSort(rows,entries,opts={}){\nconst list=entries||[];\nlet order=rows.map((_,i)=>i);\nif(list.length===0)return order;\nfor(let e=list.length-1;e>=0;e--){\norder=referenceSortOne(rows,order,list[e],opts);\n}\nreturn order;\n}\nfunction referenceSortOne(rows,order,entry,opts){\nconst locale=entry.locale!==undefined?entry.locale:opts.locale;\nconst base=valueComparator(locale);\nconst descending=entry.descending!==undefined?!!entry.descending:entry.dir==='desc';\nconst present=[];\nconst absent=[];\nfor(const i of order){\nconst v=referenceValue(rows[i],entry.col);\nif(isMissing(v))absent.push(i);else present.push(i);\n}\nconst position=new Map();\nfor(let p=0;p<present.length;p++)position.set(present[p],p);\nconst compare=(a,b)=>{\nconst va=referenceValue(rows[a],entry.col);\nconst vb=referenceValue(rows[b],entry.col);\nlet c;\nif(typeof entry.compare==='function'){\nc=entry.compare(va,vb,rows[a],rows[b],descending);\nif(descending)c=-c;\n}else{\nc=descending?base(vb,va):base(va,vb);\n}\nreturn c!==0?c:position.get(a)-position.get(b);\n};\npresent.sort(compare);\nreturn entry.nullsFirst?absent.concat(present):present.concat(absent);\n}\nfunction referenceFilter(rows,filters,opts={}){\nconst out=[];\nfor(let i=0;i<rows.length;i++){\nif(referencePasses(rows[i],filters,opts,i))out.push(i);\n}\nreturn out;\n}\nfunction referencePasses(row,node,opts,index){\nif(!node)return true;\nif(Array.isArray(node.conditions)){\nconst children=node.conditions.filter((c)=>c!=null);\nif(children.length===0)return true;\nif(node.op==='or')return children.some((c)=>referencePasses(row,c,opts,index));\nconst all=children.every((c)=>referencePasses(row,c,opts,index));\nreturn node.op==='not'?!all:all;\n}\nif(node.col===undefined&&typeof opts.custom==='function')return!!opts.custom(node,row,index);\nreturn testValue(referenceValue(row,node.col),node,opts.locale);\n}\nfunction referenceGroup(rows,cols,order){\nconst source=order||rows.map((_,i)=>i);\nconst seen=new Map();\nconst keys=[];\nconst buckets=[];\nfor(const i of source){\nconst tuple=cols.map((col)=>referenceValue(rows[i],col));\nconst key=tuple\n.map((v)=>(v===null||v===undefined?NULL_MARKER:String(v)))\n.join(KEY_SEPARATOR);\nlet at=seen.get(key);\nif(at===undefined){\nat=keys.length;\nseen.set(key,at);\nkeys.push(tuple);\nbuckets.push([]);\n}\nbuckets[at].push(i);\n}\nreturn{keys,buckets};\n}\nfunction referenceTotal(values,fn,opts={}){\nconst cmp=valueComparator(opts.locale);\nconst live=values.filter((v)=>!isMissing(v));\nconst numbers=live.map(toNumberOrNull).filter((v)=>v!==null);\nswitch(fn){\ncase'count':return values.length;\ncase'countValues':return live.length;\ncase'sum':return numbers.reduce((a,b)=>a+b,0);\ncase'avg':return live.length===0?null:numbers.reduce((a,b)=>a+b,0)/live.length;\ncase'min':return live.length===0?null:live.reduce((a,b)=>(cmp(b,a)<0?b:a));\ncase'max':return live.length===0?null:live.reduce((a,b)=>(cmp(b,a)>0?b:a));\ncase'first':return values.length===0?null:normaliseNull(values[0]);\ncase'last':return values.length===0?null:normaliseNull(values[values.length-1]);\ndefault:return null;\n}\n}\nfunction toNumberOrNull(v){\nif(typeof v==='number')return Number.isNaN(v)?null:v;\nif(v===null||v===undefined||v===''||typeof v==='boolean')return null;\nif(v instanceof Date)return v.getTime();\nconst n=Number(v);\nreturn Number.isNaN(n)?null:n;\n}\nfunction normaliseNull(v){\nreturn v===undefined?null:v;\n}\n});\n__def(\"packages/core/src/compute/windowed.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"Window\",{enumerable:true,get:function(){return Window;}});\nObject.defineProperty(__exports,\"WINDOW_KINDS\",{enumerable:true,get:function(){return WINDOW_KINDS;}});\nObject.defineProperty(__exports,\"openWindow\",{enumerable:true,get:function(){return openWindow;}});\nObject.defineProperty(__exports,\"default\",{enumerable:true,get:function(){return __default;}});\nconst __m0=__req(\"packages/core/src/compute/sketch.js\");\nconst Welford=__m0[\"Welford\"];\nclass Window{\n#kind;\n#span;\n#ticks=[];\n#now;\n#opened;\nconstructor(kind,span=0,now=Date.now){\nif(kind!=='count'&&kind!=='time'&&kind!=='session'){\nthrow new RangeError(`unknown window kind: ${kind}`);\n}\nif((kind==='count'||kind==='time')&&!(span>0)){\nthrow new RangeError(`a ${kind} window needs a positive span`);\n}\nthis.#kind=kind;\nthis.#span=Math.floor(span);\nthis.#now=now;\nthis.#opened=now();\n}\nget size(){return this.#ticks.length;}\npush(v,t=this.#now()){\nif(!Number.isFinite(v))return;\nthis.#ticks.push({t,v});\nthis.#evict(t);\n}\n#evict(nowT){\nif(this.#kind==='count'){\nwhile(this.#ticks.length>this.#span)this.#ticks.shift();\n}else if(this.#kind==='time'){\nconst cutoff=nowT-this.#span;\nwhile(this.#ticks.length&&this.#ticks[0].t<cutoff)this.#ticks.shift();\n}\n}\nspec(){\nconst span=this.#kind==='session'?this.#now()-this.#opened:this.#span;\nreturn{kind:this.#kind,span,size:this.#ticks.length};\n}\nvalues(){return this.#ticks.map((tk)=>tk.v);}\naggregate(){\nconst spec=this.spec();\nif(!this.#ticks.length){\nreturn{over:spec,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};\n}\nconst w=new Welford();\nlet sum=0;\nlet min=Infinity;\nlet max=-Infinity;\nfor(const{v}of this.#ticks){\nsum+=v;\nif(v<min)min=v;\nif(v>max)max=v;\nw.add(v);\n}\nreturn{\nover:spec,\ncount:this.#ticks.length,\nsum,\nmean:w.mean(),\nmin,\nmax,\nvariance:w.variance(),\nstddev:w.stddev(),\n};\n}\nreduce(fn){\nconst agg=this.aggregate();\nconst map={\nsum:agg.sum,avg:agg.mean,mean:agg.mean,min:agg.min,max:agg.max,\ncount:agg.count,variance:agg.variance,stddev:agg.stddev,\n};\nif(!(fn in map))throw new RangeError(`unknown windowed aggregate: ${fn}`);\nreturn{value:map[fn],over:agg.over};\n}\n}\nconst WINDOW_KINDS=Object.freeze(['count','time','session']);\nfunction openWindow(opts,now=Date.now){\nconst span=opts.kind==='time'&&opts.minutes!=null\n?opts.minutes*60_000\n:opts.span??0;\nreturn new Window(opts.kind,span,now);\n}\nconst __default={Window,WINDOW_KINDS,openWindow};\n});\n__def(\"packages/core/src/compute/index.js\",function(__exports,__req){\n'use strict';\nconst __m0=__req(\"packages/core/src/compute/sort.js\");\nObject.defineProperty(__exports,\"sortColumn\",{enumerable:true,get:function(){return __m0[\"sortColumn\"];}});\nObject.defineProperty(__exports,\"sortMulti\",{enumerable:true,get:function(){return __m0[\"sortMulti\"];}});\nObject.defineProperty(__exports,\"radixSortFloat64\",{enumerable:true,get:function(){return __m0[\"radixSortFloat64\"];}});\nObject.defineProperty(__exports,\"radixSortInt32\",{enumerable:true,get:function(){return __m0[\"radixSortInt32\"];}});\nObject.defineProperty(__exports,\"rankSortDictionary\",{enumerable:true,get:function(){return __m0[\"rankSortDictionary\"];}});\nObject.defineProperty(__exports,\"mergeSortComparator\",{enumerable:true,get:function(){return __m0[\"mergeSortComparator\"];}});\nObject.defineProperty(__exports,\"collateStringRanks\",{enumerable:true,get:function(){return __m0[\"collateStringRanks\"];}});\nObject.defineProperty(__exports,\"rankSortStrings\",{enumerable:true,get:function(){return __m0[\"rankSortStrings\"];}});\nconst __m1=__req(\"packages/core/src/compute/sortspec.js\");\nObject.defineProperty(__exports,\"collationDescriptor\",{enumerable:true,get:function(){return __m1[\"collationDescriptor\"];}});\nObject.defineProperty(__exports,\"isPortableSort\",{enumerable:true,get:function(){return __m1[\"isPortableSort\"];}});\nObject.defineProperty(__exports,\"isPortableSortSet\",{enumerable:true,get:function(){return __m1[\"isPortableSortSet\"];}});\nObject.defineProperty(__exports,\"describeSortEntry\",{enumerable:true,get:function(){return __m1[\"describeSortEntry\"];}});\nObject.defineProperty(__exports,\"describeSort\",{enumerable:true,get:function(){return __m1[\"describeSort\"];}});\nconst __m2=__req(\"packages/core/src/compute/filter.js\");\nObject.defineProperty(__exports,\"evaluateFilters\",{enumerable:true,get:function(){return __m2[\"evaluateFilters\"];}});\nObject.defineProperty(__exports,\"evaluateCondition\",{enumerable:true,get:function(){return __m2[\"evaluateCondition\"];}});\nObject.defineProperty(__exports,\"compact\",{enumerable:true,get:function(){return __m2[\"compact\"];}});\nObject.defineProperty(__exports,\"testValue\",{enumerable:true,get:function(){return __m2[\"testValue\"];}});\nObject.defineProperty(__exports,\"compilePredicate\",{enumerable:true,get:function(){return __m2[\"compilePredicate\"];}});\nObject.defineProperty(__exports,\"releaseMask\",{enumerable:true,get:function(){return __m2[\"releaseMask\"];}});\nObject.defineProperty(__exports,\"pruneColumn\",{enumerable:true,get:function(){return __m2[\"pruneColumn\"];}});\nObject.defineProperty(__exports,\"mentionsColumn\",{enumerable:true,get:function(){return __m2[\"mentionsColumn\"];}});\nconst __m3=__req(\"packages/core/src/compute/group.js\");\nObject.defineProperty(__exports,\"groupByColumns\",{enumerable:true,get:function(){return __m3[\"groupByColumns\"];}});\nObject.defineProperty(__exports,\"packKeys\",{enumerable:true,get:function(){return __m3[\"packKeys\"];}});\nconst __m4=__req(\"packages/core/src/compute/facet.js\");\nObject.defineProperty(__exports,\"facet\",{enumerable:true,get:function(){return __m4[\"facet\"];}});\nObject.defineProperty(__exports,\"computeBounds\",{enumerable:true,get:function(){return __m4[\"computeBounds\"];}});\nObject.defineProperty(__exports,\"countInto\",{enumerable:true,get:function(){return __m4[\"countInto\"];}});\nObject.defineProperty(__exports,\"bucketOf\",{enumerable:true,get:function(){return __m4[\"bucketOf\"];}});\nObject.defineProperty(__exports,\"facetKind\",{enumerable:true,get:function(){return __m4[\"facetKind\"];}});\nObject.defineProperty(__exports,\"cardinalityOf\",{enumerable:true,get:function(){return __m4[\"cardinalityOf\"];}});\nObject.defineProperty(__exports,\"pickGranularity\",{enumerable:true,get:function(){return __m4[\"pickGranularity\"];}});\nObject.defineProperty(__exports,\"floorTo\",{enumerable:true,get:function(){return __m4[\"floorTo\"];}});\nObject.defineProperty(__exports,\"advance\",{enumerable:true,get:function(){return __m4[\"advance\"];}});\nObject.defineProperty(__exports,\"STRATEGIES\",{enumerable:true,get:function(){return __m4[\"STRATEGIES\"];}});\nObject.defineProperty(__exports,\"GRANULARITIES\",{enumerable:true,get:function(){return __m4[\"GRANULARITIES\"];}});\nObject.defineProperty(__exports,\"DEFAULT_BUCKETS\",{enumerable:true,get:function(){return __m4[\"DEFAULT_BUCKETS\"];}});\nObject.defineProperty(__exports,\"DEFAULT_CARDINALITY_LIMIT\",{enumerable:true,get:function(){return __m4[\"DEFAULT_CARDINALITY_LIMIT\"];}});\nObject.defineProperty(__exports,\"QUANTILE_SAMPLE\",{enumerable:true,get:function(){return __m4[\"QUANTILE_SAMPLE\"];}});\nconst __m5=__req(\"packages/core/src/compute/total.js\");\nObject.defineProperty(__exports,\"TOTAL_FNS\",{enumerable:true,get:function(){return __m5[\"TOTAL_FNS\"];}});\nObject.defineProperty(__exports,\"TOTAL_LABELS\",{enumerable:true,get:function(){return __m5[\"TOTAL_LABELS\"];}});\nObject.defineProperty(__exports,\"totalLabel\",{enumerable:true,get:function(){return __m5[\"totalLabel\"];}});\nObject.defineProperty(__exports,\"total\",{enumerable:true,get:function(){return __m5[\"total\"];}});\nObject.defineProperty(__exports,\"collectValues\",{enumerable:true,get:function(){return __m5[\"collectValues\"];}});\nconst __m6=__req(\"packages/core/src/compute/pivot.js\");\nObject.defineProperty(__exports,\"pivot\",{enumerable:true,get:function(){return __m6[\"pivot\"];}});\nObject.defineProperty(__exports,\"resolvePivotKeys\",{enumerable:true,get:function(){return __m6[\"resolvePivotKeys\"];}});\nObject.defineProperty(__exports,\"pivotKey\",{enumerable:true,get:function(){return __m6[\"pivotKey\"];}});\nObject.defineProperty(__exports,\"joinPath\",{enumerable:true,get:function(){return __m6[\"joinPath\"];}});\nObject.defineProperty(__exports,\"KEY_DELIMITER\",{enumerable:true,get:function(){return __m6[\"KEY_DELIMITER\"];}});\nObject.defineProperty(__exports,\"DEFAULT_PATH_SEPARATOR\",{enumerable:true,get:function(){return __m6[\"DEFAULT_PATH_SEPARATOR\"];}});\nObject.defineProperty(__exports,\"DEFAULT_MAX_COLUMNS\",{enumerable:true,get:function(){return __m6[\"DEFAULT_MAX_COLUMNS\"];}});\nconst __m7=__req(\"packages/core/src/compute/pivotmatrix.js\");\nObject.defineProperty(__exports,\"pivotMatrix\",{enumerable:true,get:function(){return __m7[\"pivotMatrix\"];}});\nObject.defineProperty(__exports,\"resolveAxis\",{enumerable:true,get:function(){return __m7[\"resolveAxis\"];}});\nObject.defineProperty(__exports,\"cellKey\",{enumerable:true,get:function(){return __m7[\"cellKey\"];}});\nObject.defineProperty(__exports,\"marginKey\",{enumerable:true,get:function(){return __m7[\"marginKey\"];}});\nObject.defineProperty(__exports,\"GRAND_PATH\",{enumerable:true,get:function(){return __m7[\"GRAND_PATH\"];}});\nconst __m8=__req(\"packages/core/src/compute/reference.js\");\nObject.defineProperty(__exports,\"referenceSort\",{enumerable:true,get:function(){return __m8[\"referenceSort\"];}});\nObject.defineProperty(__exports,\"referenceFilter\",{enumerable:true,get:function(){return __m8[\"referenceFilter\"];}});\nObject.defineProperty(__exports,\"referenceGroup\",{enumerable:true,get:function(){return __m8[\"referenceGroup\"];}});\nObject.defineProperty(__exports,\"referenceTotal\",{enumerable:true,get:function(){return __m8[\"referenceTotal\"];}});\nObject.defineProperty(__exports,\"referencePasses\",{enumerable:true,get:function(){return __m8[\"referencePasses\"];}});\nObject.defineProperty(__exports,\"referenceValue\",{enumerable:true,get:function(){return __m8[\"referenceValue\"];}});\nconst __m9=__req(\"packages/core/src/compute/handle.js\");\nObject.defineProperty(__exports,\"identity\",{enumerable:true,get:function(){return __m9[\"identity\"];}});\nObject.defineProperty(__exports,\"rowCount\",{enumerable:true,get:function(){return __m9[\"rowCount\"];}});\nObject.defineProperty(__exports,\"presenceReader\",{enumerable:true,get:function(){return __m9[\"presenceReader\"];}});\nObject.defineProperty(__exports,\"bitReader\",{enumerable:true,get:function(){return __m9[\"bitReader\"];}});\nObject.defineProperty(__exports,\"valueReader\",{enumerable:true,get:function(){return __m9[\"valueReader\"];}});\nObject.defineProperty(__exports,\"valueComparator\",{enumerable:true,get:function(){return __m9[\"valueComparator\"];}});\nObject.defineProperty(__exports,\"numericTotalOrder\",{enumerable:true,get:function(){return __m9[\"numericTotalOrder\"];}});\nObject.defineProperty(__exports,\"dictRanks\",{enumerable:true,get:function(){return __m9[\"dictRanks\"];}});\nObject.defineProperty(__exports,\"dictSize\",{enumerable:true,get:function(){return __m9[\"dictSize\"];}});\nObject.defineProperty(__exports,\"dictValue\",{enumerable:true,get:function(){return __m9[\"dictValue\"];}});\nObject.defineProperty(__exports,\"multiValue\",{enumerable:true,get:function(){return __m9[\"multiValue\"];}});\nObject.defineProperty(__exports,\"isMissing\",{enumerable:true,get:function(){return __m9[\"isMissing\"];}});\nconst __m10=__req(\"packages/core/src/compute/sketch.js\");\nObject.defineProperty(__exports,\"Welford\",{enumerable:true,get:function(){return __m10[\"Welford\"];}});\nObject.defineProperty(__exports,\"Reservoir\",{enumerable:true,get:function(){return __m10[\"Reservoir\"];}});\nObject.defineProperty(__exports,\"HyperLogLog\",{enumerable:true,get:function(){return __m10[\"HyperLogLog\"];}});\nObject.defineProperty(__exports,\"SpaceSaving\",{enumerable:true,get:function(){return __m10[\"SpaceSaving\"];}});\nObject.defineProperty(__exports,\"KLL\",{enumerable:true,get:function(){return __m10[\"KLL\"];}});\nObject.defineProperty(__exports,\"hash32\",{enumerable:true,get:function(){return __m10[\"hash32\"];}});\nObject.defineProperty(__exports,\"SKETCH_BOUNDS\",{enumerable:true,get:function(){return __m10[\"SKETCH_BOUNDS\"];}});\nconst __m11=__req(\"packages/core/src/compute/windowed.js\");\nObject.defineProperty(__exports,\"Window\",{enumerable:true,get:function(){return __m11[\"Window\"];}});\nObject.defineProperty(__exports,\"WINDOW_KINDS\",{enumerable:true,get:function(){return __m11[\"WINDOW_KINDS\"];}});\nObject.defineProperty(__exports,\"openWindow\",{enumerable:true,get:function(){return __m11[\"openWindow\"];}});\nconst __m12=__req(\"packages/core/src/compute/statistics.js\");\nObject.defineProperty(__exports,\"MAINTENANCE\",{enumerable:true,get:function(){return __m12[\"MAINTENANCE\"];}});\nObject.defineProperty(__exports,\"APPROXIMATE\",{enumerable:true,get:function(){return __m12[\"APPROXIMATE\"];}});\nObject.defineProperty(__exports,\"maintenanceOf\",{enumerable:true,get:function(){return __m12[\"maintenanceOf\"];}});\n});\n__def(\"packages/worker/src/kernel.js\",function(__exports,__req){\n'use strict';\nObject.defineProperty(__exports,\"loadCompute\",{enumerable:true,get:function(){return loadCompute;}});\nObject.defineProperty(__exports,\"setCompute\",{enumerable:true,get:function(){return setCompute;}});\nObject.defineProperty(__exports,\"dispatch\",{enumerable:true,get:function(){return dispatch;}});\nObject.defineProperty(__exports,\"handleMessage\",{enumerable:true,get:function(){return handleMessage;}});\nObject.defineProperty(__exports,\"installKernel\",{enumerable:true,get:function(){return installKernel;}});\nconst __m0=__req(\"packages/worker/src/transport.js\");\nconst PROTOCOL=__m0[\"PROTOCOL\"];\nconst OPS=__m0[\"OPS\"];\nconst CONTROL=__m0[\"CONTROL\"];\nconst ERRORS=__m0[\"ERRORS\"];\nconst unpackHandle=__m0[\"unpackHandle\"];\nconst unpackHandles=__m0[\"unpackHandles\"];\nconst createMaskPool=__m0[\"createMaskPool\"];\nconst collectTransfers=__m0[\"collectTransfers\"];\nconst __m1=__req(\"packages/core/src/store/columnpack.js\");\nconst packChunk=__m1[\"packChunk\"];\nconst packedTransfers=__m1[\"packedTransfers\"];\nlet computeModule=null;\nlet computePromise=null;\nlet computeError=null;\nasync function loadCompute(loader){\nif(computeModule)return computeModule;\nif(!computePromise){\nconst load=loader||(()=>Promise.resolve(__req(\"packages/core/src/compute/index.js\")));\ncomputePromise=Promise.resolve()\n.then(load)\n.then((mod)=>{computeModule=mod;return mod;})\n.catch((err)=>{\ncomputeError=err;\ncomputeModule=null;\nreturn null;\n});\n}\nreturn computePromise;\n}\nfunction setCompute(mod){\ncomputeModule=mod;\ncomputePromise=mod?Promise.resolve(mod):null;\ncomputeError=mod?null:computeError;\n}\nfunction filterContext(handles,count,locale){\nconst byId=new Map();\nfor(const h of handles)if(h)byId.set(h.id,h);\nreturn{\nhandle(colId){return byId.get(colId);},\ncount,\npool:createMaskPool(),\nlocale,\n};\n}\nfunction dispatch(request,compute){\nconst{op,args}=request;\nif(op===OPS.COLUMNIZE){\nreturn packChunk(args.schema||[],args.rows||[],args.opts||{});\n}\nconst fn=compute[op];\nif(typeof fn!=='function'){\nconst err=new Error(`[lattice] compute kernel '${op}' is not exported`);\n(err).code=ERRORS.NO_KERNEL;\nthrow err;\n}\nswitch(op){\ncase OPS.COLLATE_STRING_RANKS:\nreturn fn(args.table||[],(args.table||[]).length,args.locale);\ncase OPS.SORT_COLUMN:\nreturn fn(unpackHandle(args.handle),args.order??null,args.opts||{});\ncase OPS.SORT_MULTI:{\nconst handles=unpackHandles(args.handles||[]);\nconst entries=(args.entries||[]).map((e)=>({\n...e,\nhandle:handles[e.index],\n}));\nreturn fn(handles,entries,args.order??null);\n}\ncase OPS.EVALUATE_FILTERS:\nreturn fn(args.filters,filterContext(unpackHandles(args.handles||[]),args.count,args.locale));\ncase OPS.COMPACT:\nreturn fn(args.mask,args.count,undefined);\ncase OPS.GROUP_BY_COLUMNS:\nreturn fn(unpackHandles(args.handles||[]),args.order??null,args.opts||{});\ncase OPS.TOTAL:\nreturn fn(unpackHandle(args.handle),args.indices??null,args.fn);\ncase OPS.PIVOT:\nreturn fn(unpackHandles(args.handles||[]),args.order??null,args.opts||{});\ncase OPS.FACET:\nreturn fn(unpackHandle(args.handle),args.indices??null,args.count,args.opts||{});\ndefault:{\nconst err=new Error(`[lattice] unknown worker op '${op}'`);\n(err).code=ERRORS.PROTOCOL;\nthrow err;\n}\n}\n}\nasync function handleMessage(message,opts={}){\nif(!message||message.lattice!==PROTOCOL)return null;\nconst{id,op}=message;\nif(op===CONTROL.CANCEL){\nopts.cancelled?.add(message.target);\nreturn null;\n}\nif(op===CONTROL.PING){\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result:'pong'},transfer:[]};\n}\nif(op===OPS.COLUMNIZE){\nif(opts.cancelled?.has(id)){opts.cancelled.delete(id);return null;}\ntry{\nconst result=packChunk(message.args.schema||[],message.args.rows||[],message.args.opts||{});\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result},transfer:packedTransfers(result)};\n}catch(err){\nconst e=(err);\nreturn{\nreply:{lattice:PROTOCOL,id,ok:false,error:{code:e.code||ERRORS.KERNEL,message:e.message||String(err),stack:e.stack}},\ntransfer:[],\n};\n}\n}\nconst compute=await loadCompute(opts.loader);\nif(!compute){\nreturn{\nreply:{\nlattice:PROTOCOL,\nid,\nok:false,\nerror:{\ncode:ERRORS.NO_COMPUTE,\nmessage:`[lattice] compute kernels unavailable in worker: ${computeError?computeError.message:'module not found'}`,\n},\n},\ntransfer:[],\n};\n}\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\ntry{\nconst result=dispatch(message,compute);\nif(opts.cancelled?.has(id)){\nopts.cancelled.delete(id);\nreturn{reply:{lattice:PROTOCOL,id,ok:false,error:{code:ERRORS.ABORTED,message:'[lattice] request superseded'}},transfer:[]};\n}\nreturn{reply:{lattice:PROTOCOL,id,ok:true,result},transfer:collectTransfers(result)};\n}catch(err){\nconst e=(err);\nreturn{\nreply:{\nlattice:PROTOCOL,\nid,\nok:false,\nerror:{code:e.code||ERRORS.KERNEL,message:e.message||String(err),stack:e.stack},\n},\ntransfer:[],\n};\n}\n}\nfunction installKernel(scope,opts={}){\nconst cancelled=new Set();\nconst onMessage=async(event)=>{\nconst outcome=await handleMessage(event.data,{loader:opts.loader,cancelled});\nif(!outcome)return;\nscope.postMessage(outcome.reply,outcome.transfer);\n};\nscope.addEventListener('message',onMessage);\nloadCompute(opts.loader).then((mod)=>{\nscope.postMessage({lattice:PROTOCOL,id:0,op:CONTROL.READY,compute:!!mod});\n});\nreturn()=>scope.removeEventListener('message',onMessage);\n}\n});\nvar __entry=__req(\"packages/worker/src/kernel.js\");\nroot[\"__latticeKernel\"]=__entry;\n})(typeof globalThis!=='undefined'?globalThis:this);\n__latticeKernel.installKernel(self);\n",{type:'classic'});
|
|
71291
72768
|
}catch(err){}
|
|
71292
72769
|
var __entry=__req("packages/dom/src/index.js");
|
|
71293
72770
|
if(typeof module==='object'&&module.exports){module.exports=__entry;}
|