@uwdata/vgplot 0.11.0 → 0.12.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/dist/vgplot.js +10616 -9066
- package/dist/vgplot.min.js +17 -17
- package/package.json +6 -6
- package/src/api.js +14 -11
- package/src/plot/attributes.js +4 -1
- package/src/plot/interactors.js +27 -22
package/dist/vgplot.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var QV=Object.create;var tS=Object.defineProperty;var ZV=Object.getOwnPropertyDescriptor;var KV=Object.getOwnPropertyNames;var JV=Object.getPrototypeOf,tq=Object.prototype.hasOwnProperty;var QR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kr=(e,t)=>{for(var n in t)tS(e,n,{get:t[n],enumerable:!0})},eq=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KV(t))!tq.call(e,i)&&i!==n&&tS(e,i,{get:()=>t[i],enumerable:!(r=ZV(t,i))||r.enumerable});return e};var nq=(e,t,n)=>(n=e!=null?QV(JV(e)):{},eq(t||!e||!e.__esModule?tS(n,"default",{value:e,enumerable:!0}):n,e));var wj=QR((dHt,bj)=>{"use strict";function Cot(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function Bot(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function Pot(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function $ot(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function Uot(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function M0(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}bj.exports={ge:function(e,t,n,r,i){return M0(e,t,n,r,i,Cot)},gt:function(e,t,n,r,i){return M0(e,t,n,r,i,Bot)},lt:function(e,t,n,r,i){return M0(e,t,n,r,i,Pot)},le:function(e,t,n,r,i){return M0(e,t,n,r,i,$ot)},eq:function(e,t,n,r,i){return M0(e,t,n,r,i,Uot)}}});var Mj=QR((hHt,Aj)=>{"use strict";var O2=wj(),lh=0,Pu=1,M2=2;Aj.exports=jot;function H6(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var O0=H6.prototype;function W6(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function Sj(e,t){var n=uh(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function _j(e,t){var n=e.intervals([]);n.push(t),Sj(e,n)}function vj(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?lh:(n.splice(r,1),Sj(e,n),Pu)}O0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};O0.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?_j(this,e):this.left.insert(e):this.left=uh([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?_j(this,e):this.right.insert(e):this.right=uh([e]);else{var n=O2.ge(this.leftPoints,e,Q6),r=O2.ge(this.rightPoints,e,Z6);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};O0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return lh;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return vj(this,e);var r=this.left.remove(e);return r===M2?(this.left=null,this.count-=1,Pu):(r===Pu&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return lh;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return vj(this,e);var r=this.right.remove(e);return r===M2?(this.right=null,this.count-=1,Pu):(r===Pu&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?M2:lh;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}W6(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?W6(this,this.left):W6(this,this.right);return Pu}for(var a=O2.ge(this.leftPoints,e,Q6);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=O2.ge(this.rightPoints,e,Z6);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Pu}return lh}};function Ij(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function Tj(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function Ej(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}O0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return Ij(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return Tj(this.rightPoints,e,t)}else return Ej(this.leftPoints,t)};O0.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?Ij(this.leftPoints,t,n):e>this.mid?Tj(this.rightPoints,e,n):Ej(this.leftPoints,n)};function zot(e,t){return e-t}function Q6(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function Z6(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function uh(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(zot);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(Q6),l.sort(Z6),new H6(r,uh(i),uh(o),c,l)}function X6(e){this.root=e}var fh=X6.prototype;fh.insert=function(e){this.root?this.root.insert(e):this.root=new H6(e[0],null,null,[e],[e])};fh.remove=function(e){if(this.root){var t=this.root.remove(e);return t===M2&&(this.root=null),t!==lh}return!1};fh.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};fh.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(fh,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(fh,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function jot(e){return!e||e.length===0?new X6(null):new X6(uh(e))}});var ZR={};function bh(e,t=!1){let n,r,i=ZR;function o(l){n=e(l).finally(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=ZR,a(u)}),i=l}return t?c:a}var xr=class{constructor(t){this._filterBy=t,this._requestUpdate=bh(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var wh=Uint8Array.of(65,82,82,79,87,49),ai={V1:0,V2:1,V3:2,V4:3,V5:4};var ci={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},j={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Yu={HALF:0,SINGLE:1,DOUBLE:2},xs={DAY:0,MILLISECOND:1},dn={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},li={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},bs={Sparse:0,Dense:1};var Gu=Uint8Array,cg=Uint16Array,lg=Uint32Array,ug=BigUint64Array,_h=Int8Array,KR=Int16Array,br=Int32Array,Cr=BigInt64Array,eS=Float32Array,Pa=Float64Array;function JR(e,t){let n=Math.log2(e)-3;return(t?[_h,KR,br,Cr]:[Gu,cg,lg,ug])[n]}var Oat=Object.getPrototypeOf(Int8Array);function Wu(e,t){let n=0,r=e.length;if(r<=2147483648)do{let i=n+r>>>1;e[i]<=t?n=i+1:r=i}while(n<r);else do{let i=Math.trunc((n+r)/2);e[i]<=t?n=i+1:r=i}while(n<r);return n}function fg(e,t,n){if(t(e))return e;throw new Error(n(e))}function wr(e,t,n){return t=Array.isArray(t)?t:Object.values(t),fg(e,r=>t.includes(r),n??(()=>`${e} must be one of ${t}`))}function dg(e,t){for(let[n,r]of Object.entries(e))if(r===t)return n;return"<Unknown>"}var ws=e=>`Unsupported data type: "${dg(j,e)}" (id ${e})`,vh=(e,t,n=!0,r=null)=>({name:e,type:t,nullable:n,metadata:r});function tL(e){return Object.hasOwn(e,"name")&&eL(e.type)}function eL(e){return typeof e?.typeId=="number"}function $a(e,t="",n=!0){return tL(e)?e:vh(t,fg(e,eL,()=>"Data type expected."),n)}var hg=(e,t,n=!1,r=-1)=>({typeId:j.Dictionary,id:r,dictionary:e,indices:t||Xu(),ordered:n});var pg=(e=32,t=!0)=>({typeId:j.Int,bitWidth:wr(e,[8,16,32,64]),signed:t,values:JR(e,t)});var Xu=()=>pg(32);var nS=(e=2)=>({typeId:j.Float,precision:wr(e,Yu),values:[cg,eS,Pa][e]});var rS=()=>({typeId:j.Binary,offsets:br}),mg=()=>({typeId:j.Utf8,offsets:br});var iS=(e,t,n=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:wr(n,[128,256]),values:ug}),oS=e=>({typeId:j.Date,unit:wr(e,xs),values:e===xs.DAY?br:Cr});var sS=(e=dn.MILLISECOND,t=32)=>({typeId:j.Time,unit:wr(e,dn),bitWidth:wr(t,[32,64]),values:t===32?br:Cr});var yg=(e=dn.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:wr(e,dn),timezone:t,values:Cr}),aS=(e=li.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:wr(e,li),values:e===li.MONTH_DAY_NANO?void 0:br}),gg=e=>({typeId:j.List,children:[$a(e)],offsets:br}),xg=e=>({typeId:j.Struct,children:Array.isArray(e)&&tL(e[0])?e:Object.entries(e).map(([t,n])=>vh(t,n))}),cS=(e,t,n,r)=>(n??=t.map((i,o)=>o),{typeId:j.Union,mode:wr(e,bs),typeIds:n,typeMap:n.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>$a(i,`_${o}`)),typeIdForValue:r,offsets:br}),lS=e=>({typeId:j.FixedSizeBinary,stride:e}),bg=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[$a(e)]}),nL=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:br});var uS=(e=dn.MILLISECOND)=>({typeId:j.Duration,unit:wr(e,dn),values:Cr}),fS=()=>({typeId:j.LargeBinary,offsets:Cr}),dS=()=>({typeId:j.LargeUtf8,offsets:Cr}),hS=e=>({typeId:j.LargeList,children:[$a(e)],offsets:Cr}),pS=(e,t)=>({typeId:j.RunEndEncoded,children:[fg($a(e,"run_ends"),n=>n.type.typeId===j.Int,()=>"Run-ends must have an integer type."),$a(t,"values")]});var mS=e=>({typeId:j.ListView,children:[$a(e,"value")],offsets:br}),yS=e=>({typeId:j.LargeListView,children:[$a(e,"value")],offsets:Cr});var rq=new Pa(2),wg=rq.buffer,Pat=new Cr(wg),$at=new lg(wg),Uat=new br(wg),zat=new Gu(wg);function mo(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function _g(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Hu=e=>BigInt.asUintN(64,e);function iL(e,t){let n=t<<1,r;return BigInt.asIntN(64,e[n+1])<0?(r=Hu(~e[n])|Hu(~e[n+1])<<64n,r=-(r+1n)):r=e[n]|e[n+1]<<64n,r}function oL(e,t){let n=t<<2,r;return BigInt.asIntN(64,e[n+3])<0?(r=Hu(~e[n])|Hu(~e[n+1])<<64n|Hu(~e[n+2])<<128n|Hu(~e[n+3])<<192n,r=-(r+1n)):r=e[n]|e[n+1]<<64n|e[n+2]<<128n|e[n+3]<<192n,r}var oq=new TextDecoder("utf-8"),Gat=new TextEncoder;function Qu(e){return oq.decode(e)}var al=4;function gS(e,t){return(e[t>>3]&1<<t%8)!==0}function $n(e,t){let n=t+fe(e,t),r=n-fe(e,n),i=Sn(e,r);return(o,s,a=null)=>{if(o<i){let c=Sn(e,r+o);if(c)return s(e,n+c)}return a}}function Fi(e,t){return t}function Ua(e,t){return!!sq(e,t)}function sq(e,t){return Sh(e,t)<<24>>24}function Sh(e,t){return e[t]}function Sn(e,t){return aq(e,t)<<16>>16}function aq(e,t){return e[t]|e[t+1]<<8}function fe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function sL(e,t){return fe(e,t)>>>0}function hn(e,t){return mo(BigInt.asIntN(64,BigInt(sL(e,t))+(BigInt(sL(e,t+al))<<32n)))}function cl(e,t){let n=t+fe(e,t),r=fe(e,n);return n+=al,Qu(e.subarray(n,n+r))}function Br(e,t,n,r){if(!t)return[];let i=t+fe(e,t);return Array.from({length:fe(e,i)},(o,s)=>r(e,i+al+s*n))}var xS=Symbol("rowIndex");function Ih(e,t){class n{constructor(o){this[xS]=o}toJSON(){return aL(e,t,this[xS])}}let r=n.prototype;for(let i=0;i<e.length;++i){if(Object.hasOwn(r,e[i]))continue;let o=t[i];Object.defineProperty(r,e[i],{get(){return o.at(this[xS])},enumerable:!0})}return i=>new n(i)}function vg(e,t){return n=>aL(e,t,n)}function aL(e,t,n){let r={};for(let i=0;i<e.length;++i)r[e[i]]=t[i].at(n);return r}function cL(e){return e instanceof za}var ll=class{static ArrayType=null;constructor({length:t,nullCount:n,type:r,validity:i,values:o,offsets:s,sizes:a,children:c}){this.length=t,this.nullCount=n,this.type=r,this.validity=i,this.values=o,this.offsets=s,this.sizes=a,this.children=c,(!n||!this.validity)&&(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return gS(this.validity,t)}value(t){return this.values[t]}slice(t,n){let r=n-t,i=Array(r);for(let o=0;o<r;++o)i[o]=this.at(t+o);return i}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},za=class extends ll{constructor(t){super(t);let{length:n,values:r}=this;this.values=r.subarray(0,n)}slice(t,n){return this.nullCount?super.slice(t,n):this.values.subarray(t,n)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},Th=class extends ll{static ArrayType=Pa},Re=class extends ll{static ArrayType=Array},Eh=class extends Re{value(t){return null}},yo=class extends Th{value(t){return mo(this.values[t])}},Sg=class extends Th{value(t){let n=this.values[t],r=(n&31744)>>10,i=(n&1023)/1024,o=(-1)**((n&32768)>>15);switch(r){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(r-15)*(1+i)}},Ig=class extends Re{value(t){return gS(this.values,t)}},Tg=class extends ll{constructor(t){super(t);let{bitWidth:n,scale:r}=this.type;this.decimal=n===128?iL:oL,this.scale=10n**BigInt(r)}},Eg=class extends Tg{static ArrayType=Pa;value(t){return _g(this.decimal(this.values,t),this.scale)}},Ag=class extends Tg{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},Ah=class extends Re{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},Mg=class extends Th{value(t){return 864e5*this.values[t]}},lL=yo,Og=class extends yo{value(t){return super.value(t)*1e3}},uL=yo,Ng=class extends yo{value(t){return _g(this.values[t],1000n)}},Dg=class extends yo{value(t){return _g(this.values[t],1000000n)}},Rg=class extends Re{value(t){return this.values.subarray(t<<1,t+1<<1)}},Lg=class extends Re{value(t){let n=this.values,r=t<<4;return Float64Array.of(fe(n,r),fe(n,r+4),hn(n,r+8))}},fL=({values:e,offsets:t},n)=>e.subarray(t[n],t[n+1]),dL=({values:e,offsets:t},n)=>e.subarray(mo(t[n]),mo(t[n+1])),Fg=class extends Re{value(t){return fL(this,t)}},kg=class extends Re{value(t){return dL(this,t)}},Cg=class extends Re{value(t){return Qu(fL(this,t))}},Bg=class extends Re{value(t){return Qu(dL(this,t))}},Pg=class extends Re{value(t){let n=this.offsets;return this.children[0].slice(n[t],n[t+1])}},$g=class extends Re{value(t){let n=this.offsets;return this.children[0].slice(mo(n[t]),mo(n[t+1]))}},Ug=class extends Re{value(t){let n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(n,r)}},zg=class extends Re{value(t){let n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(mo(n),mo(r))}},jg=class extends Re{constructor(t){super(t),this.stride=this.type.stride}},Vg=class extends jg{value(t){let{stride:n,values:r}=this;return r.subarray(t*n,(t+1)*n)}},qg=class extends jg{value(t){let{children:n,stride:r}=this;return n[0].slice(t*r,(t+1)*r)}};function hL({children:e,offsets:t},n){let[r,i]=e[0].children,o=t[n],s=t[n+1],a=[];for(let c=o;c<s;++c)a.push([r.at(c),i.at(c)]);return a}var Yg=class extends Re{value(t){return hL(this,t)}},Gg=class extends Re{value(t){return new Map(hL(this,t))}},Mh=class extends Re{constructor({typeIds:t,...n}){super(n),this.typeIds=t,this.typeMap=this.type.typeMap}value(t,n=t){let{typeIds:r,children:i,typeMap:o}=this;return i[o[r[t]]].at(n)}},Wg=class extends Mh{value(t){return super.value(t,this.offsets[t])}},Oh=class extends Re{constructor(t,n=vg){super(t),this.names=this.type.children.map(r=>r.name),this.factory=n(this.names,this.children)}value(t){return this.factory(t)}},Xg=class extends Oh{constructor(t){super(t,Ih)}},Hg=class extends Re{value(t){let[{values:n},r]=this.children;return r.at(Wu(n,t))}},Qg=class extends Re{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},Zg=class extends Re{constructor({data:t,...n}){super(n),this.data=t}view(t){let{values:n,data:r}=this,i=t<<4,o=i+4,s=n,a=fe(s,i);return a>12&&(o=fe(s,i+12),s=r[fe(s,i+8)]),s.subarray(o,o+a)}},Kg=class extends Zg{value(t){return this.view(t)}},Jg=class extends Zg{value(t){return Qu(this.view(t))}};function bS(e){let t=[];return{add(n){return t.push(n),this},clear:()=>t=[],done:()=>new ul(t,e)}}var ul=class{constructor(t,n=t[0]?.type){this.type=n,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;let r=t.length,i=new Int32Array(r+1);if(r===1){let[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o<r;++o)i[o+1]=s+=t[o].length;this.offsets=i}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():cq(t)}at(t){let{data:n,offsets:r}=this,i=Wu(r,t)-1;return n[i]?.at(t-r[i])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:n,data:r}=this,i=!n&&cL(r[0]),o=r.length;if(i&&o===1)return r[0].values;let s=!o||n>0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(t);return i?lq(a,r):uq(a,r)}cache(){return this._cache??(this._cache=this.toArray())}};function*cq(e){for(let t=0;t<e.length;++t){let n=e[t][Symbol.iterator]();for(let r=n.next();!r.done;r=n.next())yield r.value}}function lq(e,t){for(let n=0,r=0;n<t.length;++n){let{values:i}=t[n];e.set(i,r),r+=i.length}return e}function uq(e,t){let n=-1;for(let r=0;r<t.length;++r){let i=t[r];for(let o=0;o<i.length;++o)e[++n]=i.at(o)}return e}var Zu=class e{constructor(t,n,r=!1){let i=t.fields.map(s=>s.name);this.schema=t,this.names=i,this.children=n,this.factory=r?Ih:vg;let o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,n.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let n=this.names.findIndex(r=>r===t);return n>-1?this.children[n]:void 0}selectAt(t,n=[]){let{children:r,factory:i,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>fq(s[a],n[c]))},t.map(a=>r[a]),i===Ih)}select(t,n){let r=this.names,i=t.map(o=>r.indexOf(o));return this.selectAt(i,n)}toColumns(){let{children:t,names:n}=this,r={};return n.forEach((i,o)=>r[i]=t[o]?.toArray()??[]),r}toArray(){let{children:t,getFactory:n,numRows:r}=this,i=t[0]?.data??[],o=Array(r);for(let s=0,a=-1;s<i.length;++s){let c=n(s);for(let l=0;l<i[s].length;++l)o[++a]=c(l)}return o}*[Symbol.iterator](){let{children:t,getFactory:n}=this,r=t[0]?.data??[];for(let i=0;i<r.length;++i){let o=n(i);for(let s=0;s<r[i].length;++s)yield o(s)}}at(t){let{children:n,getFactory:r,numRows:i}=this;if(t<0||t>=i)return null;let[{offsets:o}]=n,s=Wu(o,t)-1;return r(s)(t-o[s])}get(t){return this.at(t)}};function fq(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Nh(e,t={}){let{typeId:n,bitWidth:r,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:l,useProxy:u}=t;switch(n){case j.Null:return Eh;case j.Bool:return Ig;case j.Int:case j.Time:case j.Duration:return s||r<64?za:yo;case j.Float:return i?za:Sg;case j.Date:return pL(o===xs.DAY?Mg:lL,a&&Ah);case j.Timestamp:return pL(o===dn.SECOND?Og:o===dn.MILLISECOND?uL:o===dn.MICROSECOND?Ng:Dg,a&&Ah);case j.Decimal:return c?Ag:Eg;case j.Interval:return o===li.DAY_TIME?Rg:o===li.YEAR_MONTH?za:Lg;case j.FixedSizeBinary:return Vg;case j.Utf8:return Cg;case j.LargeUtf8:return Bg;case j.Binary:return Fg;case j.LargeBinary:return kg;case j.BinaryView:return Kg;case j.Utf8View:return Jg;case j.List:return Pg;case j.LargeList:return $g;case j.Map:return l?Gg:Yg;case j.ListView:return Ug;case j.LargeListView:return zg;case j.FixedSizeList:return qg;case j.Struct:return u?Xg:Oh;case j.RunEndEncoded:return Hg;case j.Dictionary:return Qg;case j.Union:return e.mode?Wg:Mh}throw new Error(ws(n))}function pL(e,t){return t?class extends t{constructor(r){super(new e(r))}}:e}function dq(e,t){return{offset:hn(e,t),metadataLength:fe(e,t+8),bodyLength:hn(e,t+16)}}function wS(e,t){return Br(e,t,24,dq)}function tx(e,t,n){let r=$n(e,t);if(r(10,Fi,0))throw new Error("Record batch compression not implemented");let i=n<ai.V4?8:0;return{length:r(4,hn,0),nodes:Br(e,r(6,Fi),16,(o,s)=>({length:hn(o,s),nullCount:hn(o,s+8)})),regions:Br(e,r(8,Fi),16+i,(o,s)=>({offset:hn(o,s+i),length:hn(o,s+i+8)})),variadic:Br(e,r(12,Fi),8,hn)}}function mL(e,t,n){let r=$n(e,t);return{id:r(4,hn,0),data:r(6,(i,o)=>tx(i,o,n)),isDelta:r(8,Ua,!1)}}function _S(e,t,n,r){wr(n,j,ws);let i=$n(e,t);switch(n){case j.Binary:return rS();case j.Utf8:return mg();case j.LargeBinary:return fS();case j.LargeUtf8:return dS();case j.List:return gg(r[0]);case j.ListView:return mS(r[0]);case j.LargeList:return hS(r[0]);case j.LargeListView:return yS(r[0]);case j.Struct:return xg(r);case j.RunEndEncoded:return pS(r[0],r[1]);case j.Int:return pg(i(4,fe,0),i(6,Ua,!1));case j.Float:return nS(i(4,Sn,Yu.HALF));case j.Decimal:return iS(i(4,fe,0),i(6,fe,0),i(8,fe,128));case j.Date:return oS(i(4,Sn,xs.MILLISECOND));case j.Time:return sS(i(4,Sn,dn.MILLISECOND),i(6,fe,32));case j.Timestamp:return yg(i(4,Sn,dn.SECOND),i(6,cl));case j.Interval:return aS(i(4,Sn,li.YEAR_MONTH));case j.Duration:return uS(i(4,Sn,dn.MILLISECOND));case j.FixedSizeBinary:return lS(i(4,fe,0));case j.FixedSizeList:return bg(r[0],i(4,fe,0));case j.Map:return nL(i(4,Ua,!1),r[0]);case j.Union:return cS(i(4,Sn,bs.Sparse),r,Br(e,i(6,Fi),4,fe))}return{typeId:n}}function Dh(e,t){let n=Br(e,t,4,(r,i)=>{let o=$n(r,i);return[o(4,cl),o(6,cl)]});return n.length?new Map(n):null}function ex(e,t,n){let r=$n(e,t);return{version:n,endianness:r(4,Sn,0),fields:r(6,hq,[]),metadata:r(8,Dh)}}function hq(e,t){return Br(e,t,4,yL)}function yL(e,t){let n=$n(e,t),r=n(8,Sh,j.NONE),i=n(10,Fi,0),o=n(12,mq),s=n(14,(c,l)=>pq(c,l)),a=_S(e,i,r,s);return o&&(o.dictionary=a,a=o),{name:n(4,cl),type:a,nullable:n(6,Ua,!1),metadata:n(16,Dh)}}function pq(e,t){let n=Br(e,t,4,yL);return n.length?n:null}function mq(e,t){if(!t)return null;let n=$n(e,t);return hg(null,n(6,yq,Xu()),n(8,Ua,!1),n(4,hn,0))}function yq(e,t){return _S(e,t,j.Int)}var gq=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,xq=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,bq=e=>`Unsupported message type: ${e} (${dg(ci,e)})`;function nx(e,t){let n=fe(e,t)||0;if(t+=al,n===-1&&(n=fe(e,t)||0,t+=al),n===0)return null;let r=e.subarray(t,t+=n);if(r.byteLength<n)throw new Error(gq(n,r.byteLength));let i=$n(r,0),o=i(4,Sn,ai.V1),s=i(6,Sh,ci.NONE),a=i(8,Fi,0),c=i(10,hn,0),l;if(a){let u=s===ci.Schema?ex:s===ci.DictionaryBatch?mL:s===ci.RecordBatch?tx:null;if(!u)throw new Error(bq(s));if(l=u(r,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(xq(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function gL(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&wq(t)?vq(t):_q(t)}function wq(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(wh[t]!==e[t])return!1;return!0}function _q(e){let t=[e].flat(),n,r=[],i=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=nx(o,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case ci.Schema:n||(n=a.content);break;case ci.RecordBatch:r.push(a.content);break;case ci.DictionaryBatch:i.push(a.content);break}}}return{schema:n,dictionaries:i,records:r,metadata:null}}function vq(e){let t=e.byteLength-(wh.length+4),n=fe(e,t),r=$n(e,t-n),i=r(4,Sn,ai.V1),o=r(8,wS,[]),s=r(10,wS,[]);return{schema:r(6,(a,c)=>ex(a,c,i)),dictionaries:o.map(({offset:a})=>nx(e,a).content),records:s.map(({offset:a})=>nx(e,a).content),metadata:r(12,Dh)}}function SS(e,t){return Sq(gL(e),t)}function Sq(e,t={}){let{schema:n={fields:[]},dictionaries:r,records:i}=e,{version:o,fields:s}=n,a=new Map,c=Tq(t,o,a),l=new Map;Iq(n,d=>{let h=d.type;h.typeId===j.Dictionary&&l.set(h.id,h.dictionary)});let u=new Map;for(let d of r){let{id:h,data:p,isDelta:m,body:y}=d,g=l.get(h),x=vS(g,c({...p,body:y}));if(u.has(h)){let b=u.get(h);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(h,bS(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>bS(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(vS(p.type,h)))}return new Zu(n,f.map(d=>d.done()),t.useProxy)}function Iq(e,t){e.fields.forEach(function n(r){t(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Tq(e,t,n){let r={version:t,options:e,dictionary:i=>n.get(i)};return i=>{let{length:o,nodes:s,regions:a,variadic:c,body:l}=i,u=-1,f=-1,d=-1;return{...r,length:o,node:()=>s[++u],buffer:h=>{let{length:p,offset:m}=a[++f];return h?new h(l.buffer,l.byteOffset+m,p/h.BYTES_PER_ELEMENT):l.subarray(m,m+p)},variadic:()=>c[++d],visit(h){return h.map(p=>vS(p.type,this))}}}}function vS(e,t){let{typeId:n}=e,{length:r,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=Nh(e,i);if(n===j.Null)return new l({length:r,nullCount:r,type:e});let u={...o(),type:e};switch(n){case j.Bool:case j.Int:case j.Time:case j.Duration:case j.Float:case j.Decimal:case j.Date:case j.Timestamp:case j.Interval:case j.FixedSizeBinary:return new l({...u,validity:s(),values:s(e.values)});case j.Utf8:case j.LargeUtf8:case j.Binary:case j.LargeBinary:return new l({...u,validity:s(),offsets:s(e.offsets),values:s()});case j.BinaryView:case j.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case j.List:case j.LargeList:case j.Map:return new l({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case j.ListView:case j.LargeListView:return new l({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case j.FixedSizeList:case j.Struct:return new l({...u,validity:s(),children:t.visit(e.children)});case j.RunEndEncoded:return new l({...u,children:t.visit(e.children)});case j.Dictionary:{let{id:f,indices:d}=e;return new l({...u,validity:s(),values:s(d.values)}).setDictionary(t.dictionary(f))}case j.Union:return c<ai.V5&&s(),new l({...u,typeIds:s(_h),offsets:e.mode===bs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(ws(n))}}var _lt=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function ja(e){return SS(e,{useDate:!0})}function rx(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(ja(l));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e),i.binaryType="arraybuffer";for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var _r=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${IL(t)}.`:""}${r}`}else return t?IL(t):"NULL"}};function IL(e){return e.split(".").map(n=>`"${n}"`).join(".")}function TL(e,t){return e instanceof _r&&e.column===t}function $t(e){return typeof e=="string"?Va(e):e}function dl(e){return typeof e=="string"?EL(e):e}function EL(e){return new _r(e)}function Va(e,t=null){return arguments.length===1&&(t=e,e=null),new _r(e,t)}function go(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e.replace("'","''")}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var vs=e=>typeof e?.addEventListener=="function";function ix(e){return e instanceof Ss}var Ss=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>vs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>Xq(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>vs(t)&&!ix(t)?go(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function Xq(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function IS(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];vs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:go(a));let c=e[++o];vs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=IS(e,t);return new Ss(n,r)}function TS(e){let t=$t(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var hl=e=>({value:e,toString:()=>go(e)});function Rh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function AL(e,t){let n=t.filter(i=>i!=null).map($t),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),q(r,...n).annotate({op:e,children:n,visit:Rh})}var vr=(...e)=>AL("AND",e.flat()),pl=(...e)=>AL("OR",e.flat()),Hq=e=>t=>q`(${e} ${$t(t)})`.annotate({op:e,a:t,visit:Rh}),ES=Hq("NOT"),ML=e=>t=>q`(${$t(t)} ${e})`.annotate({op:e,a:t,visit:Rh}),ml=ML("IS NULL"),Is=ML("IS NOT NULL"),qa=e=>(t,n)=>q`(${$t(t)} ${e} ${$t(n)})`.annotate({op:e,a:t,b:n,visit:Rh}),AS=qa("="),yl=qa("<>"),Ts=qa("<"),Lh=qa(">"),Es=qa("<="),MS=qa(">="),OS=qa("IS DISTINCT FROM"),Ku=qa("IS NOT DISTINCT FROM");function OL(e,t,n,r){t=$t(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?q`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:q`(${t} ${e} ${n[0]} AND ${n[1]})`:q``).annotate({op:e,visit:Rh,field:t,range:n})}var We=(e,t,n)=>OL("BETWEEN",e,t,n),NS=(e,t,n)=>OL("NOT BETWEEN",e,t,n);function gl(e,t){return Array.from({length:e},()=>t)}function In(e,t){return(...n)=>{let r=n.map($t),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...gl(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var DS=In("REGEXP_MATCHES"),RS=In("CONTAINS"),LS=In("PREFIX"),FS=In("SUFFIX"),Qq=In("LOWER"),Zq=In("UPPER"),Kq=In("LENGTH"),Jq=In("ISNAN"),tY=In("ISFINITE"),eY=In("ISINF");var Fh=class e extends Ss{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?q`${n} OVER "${i}"`:q`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=n,this.type=r,this.name=i,this.group=o,this.order=s,this.frame=a}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map($t),r=q(["PARTITION BY ",gl(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map($t),r=q(["ORDER BY ",gl(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=NL("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=NL("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function NL(e,t){if(vs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${DL(t.value)}`,n}return`${e} ${DL(t)}`}function DL(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function ki(e,t){return(...n)=>{let r=In(e)(...n);return new Fh(e,r,t)}}var kS=ki("ROW_NUMBER","INTEGER"),CS=ki("RANK","INTEGER"),BS=ki("DENSE_RANK","INTEGER"),PS=ki("PERCENT_RANK"),$S=ki("CUME_DIST"),US=ki("NTILE"),zS=ki("LAG"),jS=ki("LEAD"),VS=ki("FIRST_VALUE"),qS=ki("LAST_VALUE"),YS=ki("NTH_VALUE");function Vt(e,...t){return q(e,...t).annotate({aggregate:!0})}var GS=class e extends Ss{constructor(t,n,r,i,o){n=(n||[]).map($t);let{strings:s,exprs:a}=nY(t,n,r,i,o),{spans:c,cols:l}=IS(s,a);super(c,l),this.aggregate=t,this.args=n,this.type=r,this.isDistinct=i,this.filter=o}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(rY).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new Fh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function nY(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...gl(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function rY(e){let t=go(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new GS(e,n,t)}var Zn=Ht("COUNT","INTEGER"),kh=Ht("AVG"),iY=Ht("AVG"),WS=Ht("MAD"),ui=Ht("MAX"),fi=Ht("MIN"),Pr=Ht("SUM","DOUBLE"),XS=Ht("PRODUCT"),HS=Ht("MEDIAN"),QS=Ht("QUANTILE"),ZS=Ht("MODE"),KS=Ht("VARIANCE"),Ch=Ht("STDDEV"),JS=Ht("SKEWNESS"),tI=Ht("KURTOSIS"),eI=Ht("ENTROPY"),nI=Ht("VAR_POP"),rI=Ht("STDDEV_POP"),iI=Ht("CORR"),oI=Ht("COVAR_SAMP"),sI=Ht("COVAR_POP"),aI=Ht("REGR_INTERCEPT"),cI=Ht("REGR_SLOPE"),lI=Ht("REGR_COUNT"),oY=Ht("REGR_R2"),uI=Ht("REGR_SYY"),fI=Ht("REGR_SXX"),sY=Ht("REGR_SXY"),dI=Ht("REGR_AVGX"),aY=Ht("REGR_AVGY"),hI=Ht("FIRST"),pI=Ht("LAST"),Ju=Ht("ARG_MIN"),tf=Ht("ARG_MAX"),mI=Ht("STRING_AGG"),yI=Ht("ARRAY_AGG");function Bh(e,t){let n=$t(e),r=q`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var ef=e=>Bh(e,"DOUBLE"),gI=e=>Bh(e,"INTEGER");var xI=e=>q`epoch_ms(${$t(e)})`;function bI(e,t,n=1){let r=`INTERVAL ${n} ${t}`,i=$t(e);return q`TIME_BUCKET(${r}, ${i})`.annotate({label:t})}var wI=e=>{let t=$t(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},_I=e=>{let t=$t(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},vI=e=>{let t=$t(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Ph=In("ST_AsGeoJSON"),RL=In("ST_X"),LL=In("ST_Y"),$h=In("ST_CENTROID"),SI=e=>RL($h(e)),II=e=>LL($h(e));var pt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new xl("UNION",t.flat())}static unionAll(...t){return new xl("UNION ALL",t.flat())}static intersect(...t){return new xl("INTERSECT",t.flat())}static except(...t){return new xl("EXCEPT",t.flat())}static describe(t){let n=t.clone(),{clone:r,toString:i}=n;return Object.assign(n,{describe:!0,clone:()=>e.describe(r.call(n)),toString:()=>`DESCRIBE ${i.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let o of t.flat())if(o!=null)if(typeof o=="string")r.push({as:o,expr:$t(o)});else if(o instanceof _r)r.push({as:o.column,expr:o});else if(Array.isArray(o))r.push({as:o[0],expr:o[1]});else for(let s in o)r.push({as:ox(s),expr:$t(o[s])});let i=new Set(r.map(o=>o.as));return n.select=n.select.filter(o=>!i.has(o.as)).concat(r.filter(o=>o.expr)),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:dl(i)});else if(i instanceof _r)r.push({as:i.table,from:i});else if(Uh(i)||ix(i))r.push({from:i});else if(Array.isArray(i))r.push({as:ox(i[0]),from:dl(i[1])});else for(let o in i)r.push({as:ox(o),from:dl(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map($t)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:ox(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map($t)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(Uh(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:n,distinct:r,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:d,offset:h}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:x})=>`"${g}" AS (${x})`);p.push(`WITH ${y.join(", ")}`)}let m=n.map(({as:y,expr:g})=>TL(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:x})=>{let b=Uh(x)?`(${x})`:`${x}`;return!g||g===x.table?b:`${b} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:x,seed:b}=o,w=y?`${y} ROWS`:`${g} PERCENT`,v=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${v}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:x})=>`"${g}" AS (${x})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},xl=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map($t)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function Uh(e){return e instanceof pt||e instanceof xl}function TI(e){return Uh(e)&&e.describe}function ox(e){return cY(e)?e.slice(1,-1):e}function cY(e){return e[0]==='"'&&e[e.length-1]==='"'}var sx=e=>e;function FL(){return{apply:sx,invert:sx,sqlApply:$t,sqlInvert:sx}}function lY({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${$t(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${$t(t)})`,sqlInvert:t=>q`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>q`LN(${$t(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function uY({constant:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=$t(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function fY(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=$t(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function dY({exponent:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=$t(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function kL(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:xI($t(e)),sqlInvert:sx}}var hY={identity:FL,linear:FL,log:lY,symlog:uY,sqrt:fY,pow:dY,time:kL,utc:kL};function zh(e){let t=hY[e.type];return t?{...e,...t(e)}:null}function Ya(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function EI(e){return`INSTALL ${e}; LOAD ${e}`}function CL(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${go(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function ax(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=pY({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ya(t,p,{view:a,temp:c,replace:l})}function MI(e,t,n){return ax("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function OI(e,t,n){return ax("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function NI(e,t,n){return ax("read_parquet",e,t,n)}function DI(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return ax("st_read",e,t,i)}function RI(e,t,n={}){let{select:r=["*"],...i}=n,o=CL(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ya(e,s,i)}function pY(e){return Object.entries(e).map(([t,n])=>`${t}=${AI(n)}`).join(", ")}function AI(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>AI(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${AI(n)}`).join(", ")+"}";default:return e}}function PL(e){if(!e.filterIndexable)return null;let t=e.query(),n=ux(t,a=>a.from()?.[0].from.table);if(typeof n!="string"||!t.select)return null;let r=[],i=[],o={},s=a=>{let c=a.column;return`(SELECT AVG(${ux(t,u=>u.select().find(f=>f.as===c)?.expr)??a}) FROM "${n}")`};for(let a of t.select()){let{as:c,expr:{aggregate:l,args:u}}=a,f=l?.toUpperCase?.();switch(f){case"COUNT":case"SUM":r.push({[c]:Vt`SUM("${c}")::DOUBLE`});break;case"AVG":r.push({[c]:yY(o,c,u[0])});break;case"ARG_MAX":r.push({[c]:gY(o,c,u)});break;case"ARG_MIN":r.push({[c]:xY(o,c,u)});break;case"VARIANCE":case"VAR_SAMP":o[c]=null,r.push({[c]:cx(o,u[0],s)});break;case"VAR_POP":o[c]=null,r.push({[c]:cx(o,u[0],s,!1)});break;case"STDDEV":case"STDDEV_SAMP":o[c]=null,r.push({[c]:Vt`SQRT(${cx(o,u[0],s)})`});break;case"STDDEV_POP":o[c]=null,r.push({[c]:Vt`SQRT(${cx(o,u[0],s,!1)})`});break;case"COVAR_SAMP":o[c]=null,r.push({[c]:lx(o,u,s)});break;case"COVAR_POP":o[c]=null,r.push({[c]:lx(o,u,s,!1)});break;case"CORR":o[c]=null,r.push({[c]:BL(o,u,s)});break;case"REGR_COUNT":o[c]=null,r.push({[c]:Vt`${nf(o,u)}::DOUBLE`});break;case"REGR_AVGX":o[c]=null,r.push({[c]:zL(o,u)});break;case"REGR_AVGY":o[c]=null,r.push({[c]:jL(o,u)});break;case"REGR_SYY":o[c]=null,r.push({[c]:FI(o,0,u,s)});break;case"REGR_SXX":o[c]=null,r.push({[c]:FI(o,1,u,s)});break;case"REGR_SXY":o[c]=null,r.push({[c]:lx(o,u,s,null)});break;case"REGR_SLOPE":o[c]=null,r.push({[c]:VL(o,u,s)});break;case"REGR_INTERCEPT":o[c]=null,r.push({[c]:bY(o,u,s)});break;case"REGR_R2":o[c]=null,r.push({[c]:Vt`(${BL(o,u,s)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":r.push({[c]:Vt`${f}("${c}")`});break;default:if(!l)i.push(c);else return null}}return r.length?{from:n,dims:i,aggr:r,aux:o}:null}function Ci(e,...t){let n=t.length?"_"+t.map(mY).join("_"):"";return`__${e}${n}__`}function mY(e){return`${e}`.replaceAll('"',"").replaceAll(" ","_")}function ux(e,t){let n=e.subqueries;if(e.select&&n.length===0)return t(e);let r=ux(n[0],t);for(let i=1;i<n.length;++i){let o=ux(n[i],t);if(o!==void 0&&o!==r)return NaN}return r}function $L(e,t){let n=Ci("count",t);return e[n]=Vt`COUNT(${t})`,Vt`SUM(${n})`.annotate({name:n})}function yY(e,t,n){let r=$L(e,n);return Vt`(SUM("${t}" * ${r.name}) / ${r})`}function gY(e,t,[,n]){let r=Ci("max",n);return e[r]=Vt`MAX(${n})`,Vt`ARG_MAX("${t}", ${r})`}function xY(e,t,[,n]){let r=Ci("min",n);return e[r]=Vt`MIN(${n})`,Vt`ARG_MIN("${t}", ${r})`}function cx(e,t,n,r=!0){let i=$L(e,t),o=Ci("rssq",t),s=Ci("rsum",t),a=q`${t} - ${n(t)}`;return e[o]=Vt`SUM((${a}) ** 2)`,e[s]=Vt`SUM(${a})`,Vt`(SUM(${o}) - (SUM(${s}) ** 2 / ${i})) / (${i}${r?" - 1":""})`}function lx(e,t,n,r=!0){let i=nf(e,t),o=UL(e,t,n),s=jh(e,1,t,n),a=jh(e,0,t,n),c=r===null?"":r?` / (${i} - 1)`:` / ${i}`;return Vt`(${o} - ${s} * ${a} / ${i})${c}`}function BL(e,t,n){let r=nf(e,t),i=UL(e,t,n),o=LI(e,1,t,n),s=LI(e,0,t,n),a=jh(e,1,t,n),c=jh(e,0,t,n),l=Vt`(${o} - (${a} ** 2) / ${r})`,u=Vt`(${s} - (${c} ** 2) / ${r})`;return Vt`(${i} - ${a} * ${c} / ${r}) / SQRT(${l} * ${u})`}function nf(e,[t,n]){let r=Ci("count",t,n);return e[r]=Vt`REGR_COUNT(${t}, ${n})`,Vt`SUM(${r})`.annotate({name:r})}function jh(e,t,n,r){let i=n[t],o=n[1-t],s=Ci("rs",i);return e[s]=Vt`SUM(${i} - ${r(i)}) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function LI(e,t,n,r){let i=n[t],o=n[1-t],s=Ci("rss",i);return e[s]=Vt`SUM((${i} - ${r(i)}) ** 2) FILTER (${o} IS NOT NULL)`,Vt`SUM(${s})`}function UL(e,t,n){let[r,i]=t,o=Ci("sxy",r,i);return e[o]=Vt`SUM((${i} - ${n(i)}) * (${r} - ${n(r)}))`,Vt`SUM(${o})`}function zL(e,t){let[n,r]=t,i=nf(e,t),o=Ci("avg",r,n);return e[o]=Vt`REGR_AVGX(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function jL(e,t){let[n,r]=t,i=nf(e,t),o=Ci("avg",n,r);return e[o]=Vt`REGR_AVGY(${n}, ${r})`,Vt`(SUM(${o} * ${i.name}) / ${i})`}function FI(e,t,n,r){let i=nf(e,n),o=jh(e,t,n,r),s=LI(e,t,n,r);return Vt`(${s} - (${o} ** 2 / ${i}))`}function VL(e,t,n){let r=lx(e,t,n,null),i=FI(e,1,t,n);return Vt`(${r}) / ${i}`}function bY(e,t,n){let r=zL(e,t),i=jL(e,t),o=VL(e,t,n);return Vt`${i} - (${o}) * ${r}`}function YL(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=qL(t^o>>8)),t=qL(t^i&255)}return wY(t)}function qL(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function wY(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var _Y={skip:!0,result:null},fx=class{constructor(t,{schema:n="mosaic",enabled:r=!0}={}){this.indexes=new Map,this.active=null,this.mc=t,this._schema=n,this._enabled=r}set enabled(t){this._enabled!==t&&(t||this.clear(),this._enabled=t)}get enabled(){return this._enabled}set schema(t){this._schema!==t&&(this.clear(),this._schema=t)}get schema(){return this._schema}dropIndexTables(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.indexes.clear(),this.active=null}index(t,n,r){if(!this.enabled)return null;let{indexes:i,mc:o,schema:s}=this,{source:a}=r;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=vY(r),c.source===null))return null;if(i.has(t))return i.get(t);let l=PL(t),u;if(!l)u=null;else if(n.skip(t,r))u=_Y;else{let f=n.remove(a).predicate(t);u=TY(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,Ya(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function vY(e){let{source:t,meta:n}=e,r=e.predicate,i=r?.columns,o,s;if(!n||!i)return{source:null,columns:s,predicate:o};let{type:a,scales:c,bin:l,pixelSize:u=1}=n;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,$t(f)]));else if(a==="interval"&&c){let f=c.map(d=>IY(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?We("active0",d.range.map(f[0])):[],s={active0:f[0](r.field)}):(o=d=>d?vr(d.children.map(({range:h},p)=>We(`active${p}`,h.map(f[p])))):[],s=Object.fromEntries(r.children.map((d,h)=>[`active${h}`,f[h](d.field)]))))}return{source:s?t:null,columns:s,predicate:o}}var SY={ceil:"CEIL",round:"ROUND"};function IY(e,t,n){let{type:r,domain:i,range:o,apply:s,sqlApply:a}=zh(e);if(!s)return;let c=SY[`${n}`.toLowerCase()]||"FLOOR",l=s(Math.min(...i)),u=s(Math.max(...i)),f=r==="identity"?1:Math.abs(o[1]-o[0])/(u-l),d=f/t===1?"":`${f/t}::DOUBLE * `,h=l===0?"":` - ${l}::DOUBLE`;return p=>q`${c}(${d}(${a(p)}${h}))::INTEGER`}function TY(e,t,n,r){let{dims:i,aggr:o,aux:s}=n,{columns:a}=t,c=e.select({...a,...s}).groupby(Object.keys(a)),[l]=c.subqueries;if(l){let m=Object.values(a).flatMap(y=>y.columns);EY(l,m)}let u=c.orderby();c.query.orderby=[];let f=c.toString(),d=(YL(f)>>>0).toString(16),h=`${r}.cube_${d}`,p=pt.select(i,o).from(h).groupby(i).orderby(u);return new kI({id:d,table:h,create:f,active:t,select:p})}function EY(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var kI=class{constructor({table:t,create:n,active:r,select:i}={}){this.table=t,this.create=n,this.result=null,this.active=r,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}};var bl=class extends Promise{constructor(){let t,n;super((r,i)=>{t=r,n=i}),this._resolve=t,this._reject=n}fulfill(t){return this._resolve(t),this}reject(t){return this._reject(t),this}};bl.prototype.constructor=Promise;function AY(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function GL(e,t,n){let r=[],i=0;function o(){let s=MY(r,t);r=[],i=0;for(let a of s)NY(a,e,n),LY(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||AY(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function MY(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=OY(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function OY(e,t){let n=`${e}`;if(e instanceof pt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof _r&&o[s.column]||s))}else e.select().some(({expr:o})=>o.aggregate)&&r.$groupby("ALL");return`${r}`}else return n}function NY(e,t,n){if(DY(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=RY(e,n)},result:e.result=new bl});else for(let{entry:r,priority:i}of e)t(r,i)}function DY(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function RY(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof _r&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function LY(e,t){let{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=TI(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],d=s&&f?kY(o,f):f?FY(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function FY(e,t){return e.select(t.map(n=>n[0]),t.map(n=>n[1]))}function kY(e,t){let n=new Map(t),r=[];for(let i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}var CY=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,WL=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function XL({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&CY(r),o},clear(){n=new Map}}}var dx=class{constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,n){let r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);let i={item:t,next:null};r.head===null?r.head=r.tail=i:r.tail=r.tail.next=i}remove(t){for(let n of this.queue){let{head:r,tail:i}=n;for(let o=null,s=r;s;o=s,s=s.next)t(s.item)&&(s===r?r=s.next:o.next=s.next,s===i&&(i=o||r));n.head=r,n.tail=i}}next(){for(let t of this.queue){let{head:n}=t;if(n!==null)return t.head=n.next,t.tail===n&&(t.tail=null),n.item}}};var xo={High:0,Normal:1,Low:2},hx=class{constructor(){this.queue=new dx(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:t,result:n}=this.queue.next();this.pending=this.submit(t,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(t,n=xo.Normal){this.queue.insert(t,n),this.next()}recordQuery(t){this.recorders.length&&t&&this.recorders.forEach(n=>n.add(t))}async submit(t,n){try{let{query:r,type:i,cache:o=!1,record:s=!0,options:a}=t,c=r?`${r}`:null;if(s&&this.recordQuery(c),o){let f=this.clientCache.get(c);if(f){this._logger.debug("Cache"),n.fulfill(f);return}}let l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:c,...a});let u=await this.db.query({type:i,sql:c,...a});o&&this.clientCache.set(c,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.fulfill(u)}catch(r){n.reject(r)}}cache(t){return t!==void 0?this.clientCache=t===!0?XL():t||WL():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=GL(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=xo.Normal){let r=new bl,i={request:t,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(t){let n=new Set(t);n.size&&this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1)}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0))}record(){let t=[],n={add(r){t.push(r)},reset(){t=[]},snapshot(){return t.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),t}};return this.recorders.push(n),n}};function CI(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}var BY="count",PY="nulls",$Y="max",UY="min",zY="distinct";var jY={[BY]:Zn,[zY]:e=>Zn(e).distinct(),[$Y]:ui,[UY]:fi,[PY]:e=>Zn().where(ml(e))};function VY(e,t,n){return pt.from(e).select(Array.from(n,r=>[r,jY[r](t)]))}async function HL(e,t){return t.length===1&&`${t[0].column}`=="*"?YY(e,t[0].table):(await Promise.all(t.map(n=>qY(e,n)))).filter(n=>n)}async function qY(e,{table:t,column:n,stats:r}){let i=pt.from({source:t}).select({column:n}).groupby(n.aggregate?q`ALL`:[]),[o]=Array.from(await e.query(pt.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:CI(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let[a]=await e.query(VY(t,n,r),{persist:!0});return Object.assign(s,a)}async function YY(e,t){let n=await e.query(`DESCRIBE ${dl(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:CI(r.column_type),nullable:r.null==="YES"}))}function QL(){return{debug(){},info(){},log(){},warn(){},error(){}}}var px;function di(e){return e?px=e:px==null&&(px=new Vh),px}var Vh=class{constructor(t=rx(),{logger:n=console,manager:r=new hx,cache:i=!0,consolidate:o=!0,indexes:s={}}={}){this.manager=r,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(n),this.clear(),this.dataCubeIndexer=new fx(this,s)}clear({clients:t=!0,cache:n=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||QL(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=xo.Normal}={}){return t=Array.isArray(t)?t.filter(r=>r).join(`;
|
|
2
|
-
`):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=xo.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:xo.Low})}createBundle(t,n,r=xo.Low){let i={name:t,queries:n.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=xo.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=xo.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{this._logger.error(i),t.queryError(i)}).catch(i=>this._logger.error(i))}requestQuery(t,n){return this.dataCubeIndexer.clear(),n?this.updateClient(t,n):Promise.resolve(t.update())}async connect(t){let{clients:n}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this,this.initializeClient(t),GY(this,t.filterBy,t)}async initializeClient(t){let n=t.fields();return n?.length&&t.fieldInfo(await HL(this,n)),t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;if(!n.has(t))return;n.delete(t),t.coordinator=null;let i=r.get(t.filterBy);i&&i.clients.delete(t)}};function GY(e,t,n){if(!t)return;let r=e.filterGroups.get(t);if(!r){let i=s=>WY(e,t,s),o=()=>XY(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),r={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,r)}r.clients.add(n)}function WY(e,t,n){let{dataCubeIndexer:r,filterGroups:i}=e,{clients:o}=i.get(t);for(let s of o)r.index(s,t,n)}function XY(e,t){let{dataCubeIndexer:n,filterGroups:r}=e,{clients:i}=r.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{let a=n.index(s,t,o),c=a?null:t.predicate(s);if(a?.skip||!a&&!c)return;let l=a?.query(o.predicate)??s.query(c);return e.updateClient(s,l)}))}var mx=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new BI}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(t,n){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Array.from(o,c=>c(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},BI=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function qh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?HY(e,t):!0}function HY(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function Sr(e){return e instanceof Ga}var Ga=class e extends mx{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>Sr(n))){let n=new e,r=()=>{n.update(t.map(i=>Sr(i)?i.value:i))};return r(),t.forEach(i=>Sr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return qh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function $r(e){return e instanceof bo}function yx(e,t){return new bo(new gx(e),t&&[t].flat())}var bo=class e extends Ga{static intersect({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n},r)}static union({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n,union:!0},r)}static single({cross:t=!1,empty:n=!1,include:r=[]}={}){return yx({cross:t,empty:n,single:!0},r)}static crossfilter({empty:t=!1,include:n=[]}={}){return yx({cross:!0,empty:t},n)}constructor(t=new gx,n=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(n))for(let r of n)r._relay.add(this)}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(n=>n.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(n=>n.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(n=>n.update(t)),super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},gx=class{constructor({union:t,cross:n,single:r,empty:i}={}){this.union=!!t,this.cross=!!n,this.single=!!r,this.empty=!!i}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{empty:i,union:o}=this;if(i&&!t.length)return["FALSE"];if(this.skip(r,n))return;let s=t.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return o&&s.length>1?pl(s):s}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}return null}};function ZL(e="http://localhost:3000/"){return{async query(t){let n=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?n:t.type==="arrow"?ja(await(await n).arrayBuffer()):(await n).json()}}}function JL(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Z(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function KL(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bt(e){return this instanceof Bt?(this.v=e,this):new Bt(e)}function Ur(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){r[h]&&(i[h]=function(m){return new Promise(function(y,g){o.push([h,m,y,g])>1||c(h,m)})},p&&(i[h]=p(i[h])))}function c(h,p){try{l(r[h](p))}catch(m){d(o[0][3],m)}}function l(h){h.value instanceof Bt?Promise.resolve(h.value.v).then(u,f):d(o[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function rf(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Bt(e[i](s)),done:!1}:o?o(s):s}:o}}function Bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof KL=="function"?KL(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var VI={};kr(VI,{compareArrayLike:()=>jI,joinUint8Arrays:()=>zr,memcpy:()=>of,rebaseValueOffsets:()=>Ix,toArrayBufferView:()=>Ut,toArrayBufferViewAsyncIterator:()=>Ui,toArrayBufferViewIterator:()=>wo,toBigInt64Array:()=>nG,toBigUint64Array:()=>oG,toFloat32Array:()=>sG,toFloat32ArrayAsyncIterator:()=>vG,toFloat32ArrayIterator:()=>pG,toFloat64Array:()=>aG,toFloat64ArrayAsyncIterator:()=>SG,toFloat64ArrayIterator:()=>mG,toInt16Array:()=>eG,toInt16ArrayAsyncIterator:()=>xG,toInt16ArrayIterator:()=>uG,toInt32Array:()=>wl,toInt32ArrayAsyncIterator:()=>bG,toInt32ArrayIterator:()=>fG,toInt8Array:()=>tG,toInt8ArrayAsyncIterator:()=>gG,toInt8ArrayIterator:()=>lG,toUint16Array:()=>rG,toUint16ArrayAsyncIterator:()=>wG,toUint16ArrayIterator:()=>dG,toUint32Array:()=>iG,toUint32ArrayAsyncIterator:()=>_G,toUint32ArrayIterator:()=>hG,toUint8Array:()=>Lt,toUint8ArrayAsyncIterator:()=>zI,toUint8ArrayIterator:()=>UI,toUint8ClampedArray:()=>cG,toUint8ClampedArrayAsyncIterator:()=>IG,toUint8ClampedArrayIterator:()=>yG});var QY=new TextDecoder("utf-8"),Yh=e=>QY.decode(e),ZY=new TextEncoder,Wa=e=>ZY.encode(e);var KY=e=>typeof e=="number",tF=e=>typeof e=="boolean",sn=e=>typeof e=="function",Kn=e=>e!=null&&Object(e)===e,Pi=e=>Kn(e)&&sn(e.then);var $i=e=>Kn(e)&&sn(e[Symbol.iterator]),hi=e=>Kn(e)&&sn(e[Symbol.asyncIterator]),xx=e=>Kn(e)&&Kn(e.schema);var bx=e=>Kn(e)&&"done"in e&&"value"in e;var wx=e=>Kn(e)&&sn(e.stat)&&KY(e.fd);var _x=e=>Kn(e)&&Gh(e.body),vx=e=>"_getDOMStream"in e&&"_getNodeStream"in e,eF=e=>Kn(e)&&sn(e.abort)&&sn(e.getWriter)&&!vx(e),Gh=e=>Kn(e)&&sn(e.cancel)&&sn(e.getReader)&&!vx(e),nF=e=>Kn(e)&&sn(e.end)&&sn(e.write)&&tF(e.writable)&&!vx(e),Sx=e=>Kn(e)&&sn(e.read)&&sn(e.pipe)&&tF(e.readable)&&!vx(e),rF=e=>Kn(e)&&sn(e.clear)&&sn(e.bytes)&&sn(e.position)&&sn(e.setPosition)&&sn(e.capacity)&&sn(e.getBufferIdentifier)&&sn(e.createLong);var $I=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function JY(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function of(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function zr(e,t){let n=JY(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?of(s,o,a):s=o;break}of(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Ut(e,t){let n=bx(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Wa(n)),n instanceof ArrayBuffer?new e(n):n instanceof $I?new e(n):rF(n)?Ut(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var tG=e=>Ut(Int8Array,e),eG=e=>Ut(Int16Array,e),wl=e=>Ut(Int32Array,e),nG=e=>Ut(BigInt64Array,e),Lt=e=>Ut(Uint8Array,e),rG=e=>Ut(Uint16Array,e),iG=e=>Ut(Uint32Array,e),oG=e=>Ut(BigUint64Array,e),sG=e=>Ut(Float32Array,e),aG=e=>Ut(Float64Array,e),cG=e=>Ut(Uint8ClampedArray,e),PI=e=>(e.next(),e);function*wo(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $I?n(t):$i(t)?t:n(t);return yield*PI(function*(i){let o=null;do o=i.next(yield Ut(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var lG=e=>wo(Int8Array,e),uG=e=>wo(Int16Array,e),fG=e=>wo(Int32Array,e),UI=e=>wo(Uint8Array,e),dG=e=>wo(Uint16Array,e),hG=e=>wo(Uint32Array,e),pG=e=>wo(Float32Array,e),mG=e=>wo(Float64Array,e),yG=e=>wo(Uint8ClampedArray,e);function Ui(e,t){return Ur(this,arguments,function*(){if(Pi(t))return yield Bt(yield Bt(yield*rf(Bi(Ui(e,yield Bt(t))))));let r=function(s){return Ur(this,arguments,function*(){yield yield Bt(yield Bt(s))})},i=function(s){return Ur(this,arguments,function*(){yield Bt(yield*rf(Bi(PI(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $I?r(t):$i(t)?i(t):hi(t)?t:r(t);return yield Bt(yield*rf(Bi(PI(function(s){return Ur(this,arguments,function*(){let a=null;do a=yield Bt(s.next(yield yield Bt(Ut(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Bt(new e)})}var gG=e=>Ui(Int8Array,e),xG=e=>Ui(Int16Array,e),bG=e=>Ui(Int32Array,e),zI=e=>Ui(Uint8Array,e),wG=e=>Ui(Uint16Array,e),_G=e=>Ui(Uint32Array,e),vG=e=>Ui(Float32Array,e),SG=e=>Ui(Float64Array,e),IG=e=>Ui(Uint8ClampedArray,e);function Ix(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function jI(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var Tn={fromIterable(e){return Tx(TG(e))},fromAsyncIterable(e){return Tx(EG(e))},fromDOMStream(e){return Tx(AG(e))},fromNodeStream(e){return Tx(MG(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Tx=e=>(e.next(),e);function*TG(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?zr(r,s)[0]:([i,r,a]=zr(r,s),i)}({cmd:o,size:s}=yield null);let l=UI(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function EG(e){return Ur(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?zr(i,a)[0]:([o,i,c]=zr(i,a),o)}({cmd:s,size:a}=yield yield Bt(null));let u=zI(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Bt(u.next()):yield Bt(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Bt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Bt(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Bt(u.return(new Uint8Array(0))))}return yield Bt(null)})}function AG(e){return Ur(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?zr(i,a)[0]:([o,i,c]=zr(i,a),o)}({cmd:s,size:a}=yield yield Bt(null));let u=new YI(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Bt(u.read()):yield Bt(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Lt(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Bt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Bt(u.cancel(f)))}finally{r===!1?yield Bt(u.cancel()):e.locked&&u.releaseLock()}return yield Bt(null)})}var YI=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Lt(n)),n})}},qI=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function MG(e){return Ur(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?zr(l,a)[0]:([u,l,c]=zr(l,a),u)}if({cmd:s,size:a}=yield yield Bt(null),e.isTTY)return yield yield Bt(new Uint8Array(0)),yield Bt(null);try{n[0]=qI(e,"end"),n[1]=qI(e,"error");do{if(n[2]=qI(e,"readable"),[r,o]=yield Bt(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Lt(e.read(a-c)),u.byteLength<a-c&&(u=Lt(e.read()))):u=Lt(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Bt(f()));while(a<c)}while(!i)}finally{yield Bt(d(n,r==="error"?o:null))}return yield Bt(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of h)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var Me;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Me||(Me={}));var we;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(we||(we={}));var Ie;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Ie||(Ie={}));var En;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(En||(En={}));var yt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(yt||(yt={}));var Jn;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Jn||(Jn={}));var Kt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Kt||(Kt={}));var R;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(R||(R={}));var pi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(pi||(pi={}));var uT={};kr(uT,{clampIndex:()=>bW,clampRange:()=>Qh,createElementComparator:()=>Qa});var GI={};kr(GI,{valueToString:()=>zi});function zi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>zi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var XI={};kr(XI,{BN:()=>Xh,bigNumToBigInt:()=>sF,bigNumToString:()=>cf,isArrowBigNumSymbol:()=>iF});var iF=Symbol.for("isArrowBigNum");function ji(e,...t){return t.length===0?Object.setPrototypeOf(Ut(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}ji.prototype[iF]=!0;ji.prototype.toJSON=function(){return`"${cf(this)}"`};ji.prototype.valueOf=function(){return oF(this)};ji.prototype.toString=function(){return cf(this)};ji.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oF(this);case"string":return cf(this);case"default":return sF(this)}return cf(this)};function sf(...e){return ji.apply(this,e)}function af(...e){return ji.apply(this,e)}function Wh(...e){return ji.apply(this,e)}Object.setPrototypeOf(sf.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(af.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Wh.prototype,Object.create(Uint32Array.prototype));Object.assign(sf.prototype,ji.prototype,{constructor:sf,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(af.prototype,ji.prototype,{constructor:af,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Wh.prototype,ji.prototype,{constructor:Wh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function oF(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var cf=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return WI(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return WI(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${WI(t)}`},sF=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:cf(e);function WI(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Xh=class e{static new(t,n){switch(n){case!0:return new sf(t);case!1:return new af(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new sf(t)}return t.byteLength===16?new Wh(t):new af(t)}static signed(t){return new sf(t)}static unsigned(t){return new af(t)}static decimal(t){return new Wh(t)}constructor(t,n){return e.new(t,n)}};function Ir(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var aF,cF,lF,uF,fF,dF,hF,pF,mF,yF,gF,xF,bF,wF,_F,vF,SF,IF,TF,EF,lt=class e{static isNull(t){return t?.typeId===R.Null}static isInt(t){return t?.typeId===R.Int}static isFloat(t){return t?.typeId===R.Float}static isBinary(t){return t?.typeId===R.Binary}static isUtf8(t){return t?.typeId===R.Utf8}static isBool(t){return t?.typeId===R.Bool}static isDecimal(t){return t?.typeId===R.Decimal}static isDate(t){return t?.typeId===R.Date}static isTime(t){return t?.typeId===R.Time}static isTimestamp(t){return t?.typeId===R.Timestamp}static isInterval(t){return t?.typeId===R.Interval}static isDuration(t){return t?.typeId===R.Duration}static isList(t){return t?.typeId===R.List}static isStruct(t){return t?.typeId===R.Struct}static isUnion(t){return t?.typeId===R.Union}static isFixedSizeBinary(t){return t?.typeId===R.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===R.FixedSizeList}static isMap(t){return t?.typeId===R.Map}static isDictionary(t){return t?.typeId===R.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===we.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===we.Sparse}get typeId(){return R.NONE}};aF=Symbol.toStringTag;lt[aF]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(lt.prototype);var tr=class extends lt{toString(){return"Null"}get typeId(){return R.Null}};cF=Symbol.toStringTag;tr[cF]=(e=>e[Symbol.toStringTag]="Null")(tr.prototype);var Ve=class extends lt{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return R.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};lF=Symbol.toStringTag;Ve[lF]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Ve.prototype);var Ex=class extends Ve{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ax=class extends Ve{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},_o=class extends Ve{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Mx=class extends Ve{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ox=class extends Ve{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nx=class extends Ve{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Dx=class extends Ve{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Rx=class extends Ve{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ex.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ax.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(_o.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Mx.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ox.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nx.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Dx.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Rx.prototype,"ArrayType",{value:BigUint64Array});var Tr=class extends lt{constructor(t){super(),this.precision=t}get typeId(){return R.Float}get ArrayType(){switch(this.precision){case Ie.HALF:return Uint16Array;case Ie.SINGLE:return Float32Array;case Ie.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};uF=Symbol.toStringTag;Tr[uF]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Tr.prototype);var Lx=class extends Tr{constructor(){super(Ie.HALF)}},Fx=class extends Tr{constructor(){super(Ie.SINGLE)}},kx=class extends Tr{constructor(){super(Ie.DOUBLE)}};Object.defineProperty(Lx.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Fx.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(kx.prototype,"ArrayType",{value:Float64Array});var As=class extends lt{constructor(){super()}get typeId(){return R.Binary}toString(){return"Binary"}};fF=Symbol.toStringTag;As[fF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(As.prototype);var Ms=class extends lt{constructor(){super()}get typeId(){return R.Utf8}toString(){return"Utf8"}};dF=Symbol.toStringTag;Ms[dF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ms.prototype);var Os=class extends lt{constructor(){super()}get typeId(){return R.Bool}toString(){return"Bool"}};hF=Symbol.toStringTag;Os[hF]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Os.prototype);var Ns=class extends lt{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return R.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};pF=Symbol.toStringTag;Ns[pF]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Ns.prototype);var Ds=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Date}toString(){return`Date${(this.unit+1)*32}<${En[this.unit]}>`}};mF=Symbol.toStringTag;Ds[mF]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ds.prototype);var Vi=class extends lt{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return R.Time}toString(){return`Time${this.bitWidth}<${yt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};yF=Symbol.toStringTag;Vi[yF]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Vi.prototype);var Rs=class extends lt{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return R.Timestamp}toString(){return`Timestamp<${yt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gF=Symbol.toStringTag;Rs[gF]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Rs.prototype);var Ls=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Interval}toString(){return`Interval<${Jn[this.unit]}>`}};xF=Symbol.toStringTag;Ls[xF]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Ls.prototype);var Fs=class extends lt{constructor(t){super(),this.unit=t}get typeId(){return R.Duration}toString(){return`Duration<${yt[this.unit]}>`}};bF=Symbol.toStringTag;Fs[bF]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Fs.prototype);var qi=class extends lt{constructor(t){super(),this.children=[t]}get typeId(){return R.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};wF=Symbol.toStringTag;qi[wF]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(qi.prototype);var _e=class extends lt{constructor(t){super(),this.children=t}get typeId(){return R.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};_F=Symbol.toStringTag;_e[_F]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(_e.prototype);var Yi=class extends lt{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return R.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};vF=Symbol.toStringTag;Yi[vF]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Yi.prototype);var ks=class extends lt{constructor(t){super(),this.byteWidth=t}get typeId(){return R.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};SF=Symbol.toStringTag;ks[SF]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ks.prototype);var Gi=class extends lt{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return R.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};IF=Symbol.toStringTag;Gi[IF]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Gi.prototype);var Wi=class extends lt{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return R.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};TF=Symbol.toStringTag;Wi[TF]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Wi.prototype);var OG=(e=>()=>++e)(-1),jr=class extends lt{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?OG():Ir(r)}get typeId(){return R.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};EF=Symbol.toStringTag;jr[EF]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(jr.prototype);function Vr(e){let t=e;switch(e.typeId){case R.Decimal:return e.bitWidth/32;case R.Timestamp:return 2;case R.Date:return 1+t.unit;case R.Interval:return 1+t.unit;case R.FixedSizeList:return t.listSize;case R.FixedSizeBinary:return t.byteWidth;default:return 1}}var dt=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return NG(this,t,n)}getVisitFnByTypeId(t,n=!0){return lf(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function NG(e,t,n=!0){return typeof t=="number"?lf(e,t,n):typeof t=="string"&&t in R?lf(e,R[t],n):t&&t instanceof lt?lf(e,AF(t),n):t?.type&&t.type instanceof lt?lf(e,AF(t.type),n):lf(e,R.NONE,n)}function lf(e,t,n=!0){let r=null;switch(t){case R.Null:r=e.visitNull;break;case R.Bool:r=e.visitBool;break;case R.Int:r=e.visitInt;break;case R.Int8:r=e.visitInt8||e.visitInt;break;case R.Int16:r=e.visitInt16||e.visitInt;break;case R.Int32:r=e.visitInt32||e.visitInt;break;case R.Int64:r=e.visitInt64||e.visitInt;break;case R.Uint8:r=e.visitUint8||e.visitInt;break;case R.Uint16:r=e.visitUint16||e.visitInt;break;case R.Uint32:r=e.visitUint32||e.visitInt;break;case R.Uint64:r=e.visitUint64||e.visitInt;break;case R.Float:r=e.visitFloat;break;case R.Float16:r=e.visitFloat16||e.visitFloat;break;case R.Float32:r=e.visitFloat32||e.visitFloat;break;case R.Float64:r=e.visitFloat64||e.visitFloat;break;case R.Utf8:r=e.visitUtf8;break;case R.Binary:r=e.visitBinary;break;case R.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case R.Date:r=e.visitDate;break;case R.DateDay:r=e.visitDateDay||e.visitDate;break;case R.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case R.Timestamp:r=e.visitTimestamp;break;case R.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case R.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case R.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case R.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case R.Time:r=e.visitTime;break;case R.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case R.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case R.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case R.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case R.Decimal:r=e.visitDecimal;break;case R.List:r=e.visitList;break;case R.Struct:r=e.visitStruct;break;case R.Union:r=e.visitUnion;break;case R.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case R.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case R.Dictionary:r=e.visitDictionary;break;case R.Interval:r=e.visitInterval;break;case R.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case R.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case R.Duration:r=e.visitDuration;break;case R.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case R.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case R.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case R.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case R.FixedSizeList:r=e.visitFixedSizeList;break;case R.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${R[t]}'`)}function AF(e){switch(e.typeId){case R.Null:return R.Null;case R.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?R.Int8:R.Uint8;case 16:return n?R.Int16:R.Uint16;case 32:return n?R.Int32:R.Uint32;case 64:return n?R.Int64:R.Uint64}return R.Int}case R.Float:switch(e.precision){case Ie.HALF:return R.Float16;case Ie.SINGLE:return R.Float32;case Ie.DOUBLE:return R.Float64}return R.Float;case R.Binary:return R.Binary;case R.Utf8:return R.Utf8;case R.Bool:return R.Bool;case R.Decimal:return R.Decimal;case R.Time:switch(e.unit){case yt.SECOND:return R.TimeSecond;case yt.MILLISECOND:return R.TimeMillisecond;case yt.MICROSECOND:return R.TimeMicrosecond;case yt.NANOSECOND:return R.TimeNanosecond}return R.Time;case R.Timestamp:switch(e.unit){case yt.SECOND:return R.TimestampSecond;case yt.MILLISECOND:return R.TimestampMillisecond;case yt.MICROSECOND:return R.TimestampMicrosecond;case yt.NANOSECOND:return R.TimestampNanosecond}return R.Timestamp;case R.Date:switch(e.unit){case En.DAY:return R.DateDay;case En.MILLISECOND:return R.DateMillisecond}return R.Date;case R.Interval:switch(e.unit){case Jn.DAY_TIME:return R.IntervalDayTime;case Jn.YEAR_MONTH:return R.IntervalYearMonth}return R.Interval;case R.Duration:switch(e.unit){case yt.SECOND:return R.DurationSecond;case yt.MILLISECOND:return R.DurationMillisecond;case yt.MICROSECOND:return R.DurationMicrosecond;case yt.NANOSECOND:return R.DurationNanosecond}return R.Duration;case R.Map:return R.Map;case R.List:return R.List;case R.Struct:return R.Struct;case R.Union:switch(e.mode){case we.Dense:return R.DenseUnion;case we.Sparse:return R.SparseUnion}return R.Union;case R.FixedSizeBinary:return R.FixedSizeBinary;case R.FixedSizeList:return R.FixedSizeList;case R.Dictionary:return R.Dictionary}throw new Error(`Unrecognized type '${R[e.typeId]}'`)}dt.prototype.visitInt8=null;dt.prototype.visitInt16=null;dt.prototype.visitInt32=null;dt.prototype.visitInt64=null;dt.prototype.visitUint8=null;dt.prototype.visitUint16=null;dt.prototype.visitUint32=null;dt.prototype.visitUint64=null;dt.prototype.visitFloat16=null;dt.prototype.visitFloat32=null;dt.prototype.visitFloat64=null;dt.prototype.visitDateDay=null;dt.prototype.visitDateMillisecond=null;dt.prototype.visitTimestampSecond=null;dt.prototype.visitTimestampMillisecond=null;dt.prototype.visitTimestampMicrosecond=null;dt.prototype.visitTimestampNanosecond=null;dt.prototype.visitTimeSecond=null;dt.prototype.visitTimeMillisecond=null;dt.prototype.visitTimeMicrosecond=null;dt.prototype.visitTimeNanosecond=null;dt.prototype.visitDenseUnion=null;dt.prototype.visitSparseUnion=null;dt.prototype.visitIntervalDayTime=null;dt.prototype.visitIntervalYearMonth=null;dt.prototype.visitDuration=null;dt.prototype.visitDurationSecond=null;dt.prototype.visitDurationMillisecond=null;dt.prototype.visitDurationMicrosecond=null;dt.prototype.visitDurationNanosecond=null;var HI={};kr(HI,{float64ToUint16:()=>Hh,uint16ToFloat64:()=>Cx});var MF=new Float64Array(1),uf=new Uint32Array(MF.buffer);function Cx(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Hh(e){if(e!==e)return 32256;MF[0]=e;let t=(uf[1]&2147483648)>>16&65535,n=uf[1]&2146435072,r=0;return n>=1089470464?uf[0]>0?n=31744:(n=(n&2080374784)>>16,r=(uf[1]&1048575)>>10):n<=1056964608?(r=1048576+(uf[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(uf[1]&1048575)+512>>10),t|n|r&65535}var St=class extends dt{};function Ot(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var DG=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},QI=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},RG=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},LG=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},OF=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},FG=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Cs=({values:e},t,n)=>{e[t]=n},ZI=({values:e},t,n)=>{e[t]=n},NF=({values:e},t,n)=>{e[t]=Hh(n)},kG=(e,t,n)=>{switch(e.type.precision){case Ie.HALF:return NF(e,t,n);case Ie.SINGLE:case Ie.DOUBLE:return ZI(e,t,n)}},Bx=({values:e},t,n)=>{DG(e,t,n.valueOf())},Px=({values:e},t,n)=>{QI(e,t*2,n.valueOf())},KI=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},CG=({values:e,valueOffsets:t},n,r)=>OF(e,t,n,r),BG=({values:e,valueOffsets:t},n,r)=>{OF(e,t,n,Wa(r))},JI=(e,t,n)=>{e.type.unit===En.DAY?Bx(e,t,n):Px(e,t,n)},$x=({values:e},t,n)=>QI(e,t*2,n/1e3),Ux=({values:e},t,n)=>QI(e,t*2,n),zx=({values:e},t,n)=>RG(e,t*2,n),jx=({values:e},t,n)=>LG(e,t*2,n),tT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return $x(e,t,n);case yt.MILLISECOND:return Ux(e,t,n);case yt.MICROSECOND:return zx(e,t,n);case yt.NANOSECOND:return jx(e,t,n)}},Vx=({values:e},t,n)=>{e[t]=n},qx=({values:e},t,n)=>{e[t]=n},Yx=({values:e},t,n)=>{e[t]=n},Gx=({values:e},t,n)=>{e[t]=n},eT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return Vx(e,t,n);case yt.MILLISECOND:return qx(e,t,n);case yt.MICROSECOND:return Yx(e,t,n);case yt.NANOSECOND:return Gx(e,t,n)}},nT=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},PG=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=An.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},$G=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=An.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},UG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),zG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),jG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),VG=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),qG=(e,t,n)=>{let r=e.type.children.map(o=>An.getVisitFn(o.type)),i=n instanceof Map?jG(t,n):n instanceof Gt?zG(t,n):Array.isArray(n)?UG(t,n):VG(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},YG=(e,t,n)=>{e.type.mode===we.Dense?DF(e,t,n):RF(e,t,n)},DF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];An.visit(i,e.valueOffsets[t],n)},RF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];An.visit(i,t,n)},GG=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},rT=(e,t,n)=>{e.type.unit===Jn.DAY_TIME?Wx(e,t,n):Xx(e,t,n)},Wx=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Xx=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Hx=({values:e},t,n)=>{e[t]=n},Qx=({values:e},t,n)=>{e[t]=n},Zx=({values:e},t,n)=>{e[t]=n},Kx=({values:e},t,n)=>{e[t]=n},iT=(e,t,n)=>{switch(e.type.unit){case yt.SECOND:return Hx(e,t,n);case yt.MILLISECOND:return Qx(e,t,n);case yt.MICROSECOND:return Zx(e,t,n);case yt.NANOSECOND:return Kx(e,t,n)}},WG=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=An.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};St.prototype.visitBool=Ot(FG);St.prototype.visitInt=Ot(Cs);St.prototype.visitInt8=Ot(Cs);St.prototype.visitInt16=Ot(Cs);St.prototype.visitInt32=Ot(Cs);St.prototype.visitInt64=Ot(Cs);St.prototype.visitUint8=Ot(Cs);St.prototype.visitUint16=Ot(Cs);St.prototype.visitUint32=Ot(Cs);St.prototype.visitUint64=Ot(Cs);St.prototype.visitFloat=Ot(kG);St.prototype.visitFloat16=Ot(NF);St.prototype.visitFloat32=Ot(ZI);St.prototype.visitFloat64=Ot(ZI);St.prototype.visitUtf8=Ot(BG);St.prototype.visitBinary=Ot(CG);St.prototype.visitFixedSizeBinary=Ot(KI);St.prototype.visitDate=Ot(JI);St.prototype.visitDateDay=Ot(Bx);St.prototype.visitDateMillisecond=Ot(Px);St.prototype.visitTimestamp=Ot(tT);St.prototype.visitTimestampSecond=Ot($x);St.prototype.visitTimestampMillisecond=Ot(Ux);St.prototype.visitTimestampMicrosecond=Ot(zx);St.prototype.visitTimestampNanosecond=Ot(jx);St.prototype.visitTime=Ot(eT);St.prototype.visitTimeSecond=Ot(Vx);St.prototype.visitTimeMillisecond=Ot(qx);St.prototype.visitTimeMicrosecond=Ot(Yx);St.prototype.visitTimeNanosecond=Ot(Gx);St.prototype.visitDecimal=Ot(nT);St.prototype.visitList=Ot(PG);St.prototype.visitStruct=Ot(qG);St.prototype.visitUnion=Ot(YG);St.prototype.visitDenseUnion=Ot(DF);St.prototype.visitSparseUnion=Ot(RF);St.prototype.visitDictionary=Ot(GG);St.prototype.visitInterval=Ot(rT);St.prototype.visitIntervalDayTime=Ot(Wx);St.prototype.visitIntervalYearMonth=Ot(Xx);St.prototype.visitDuration=Ot(iT);St.prototype.visitDurationSecond=Ot(Hx);St.prototype.visitDurationMillisecond=Ot(Qx);St.prototype.visitDurationMicrosecond=Ot(Zx);St.prototype.visitDurationNanosecond=Ot(Kx);St.prototype.visitFixedSizeList=Ot(WG);St.prototype.visitMap=Ot($G);var An=new St;var Xi=Symbol.for("parent"),ff=Symbol.for("rowIndex"),Xa=class{constructor(t,n){return this[Xi]=t,this[ff]=n,new Proxy(this,new sT)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ff],n=this[Xi],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Xe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${zi(t)}: ${zi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new oT(this[Xi],this[ff])}},oT=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Xe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Xa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ff]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var sT=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xi].type.children.map(n=>n.name)}has(t,n){return t[Xi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Xi].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Xi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Xe.visit(t[Xi].children[r],t[ff]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Xi].type.children.findIndex(o=>o.name===n);return i!==-1?(An.visit(t[Xi].children[i],t[ff],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var bt=class extends dt{};function At(e){return(t,n)=>t.getValid(n)?e(t,n):null}var XG=(e,t)=>864e5*e[t],aT=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),HG=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,QG=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,LF=e=>new Date(e),ZG=(e,t)=>LF(XG(e,t)),KG=(e,t)=>LF(aT(e,t)),JG=(e,t)=>null,FF=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},tW=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},kF=({values:e},t)=>ZG(e,t),CF=({values:e},t)=>KG(e,t*2),Ha=({stride:e,values:t},n)=>t[e*n],eW=({stride:e,values:t},n)=>Cx(t[e*n]),BF=({values:e},t)=>e[t],nW=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),rW=({values:e,valueOffsets:t},n)=>FF(e,t,n),iW=({values:e,valueOffsets:t},n)=>{let r=FF(e,t,n);return r!==null?Yh(r):null},oW=({values:e},t)=>e[t],sW=({type:e,values:t},n)=>e.precision!==Ie.HALF?t[n]:Cx(t[n]),aW=(e,t)=>e.type.unit===En.DAY?kF(e,t):CF(e,t),PF=({values:e},t)=>1e3*aT(e,t*2),$F=({values:e},t)=>aT(e,t*2),UF=({values:e},t)=>HG(e,t*2),zF=({values:e},t)=>QG(e,t*2),cW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return PF(e,t);case yt.MILLISECOND:return $F(e,t);case yt.MICROSECOND:return UF(e,t);case yt.NANOSECOND:return zF(e,t)}},jF=({values:e},t)=>e[t],VF=({values:e},t)=>e[t],qF=({values:e},t)=>e[t],YF=({values:e},t)=>e[t],lW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return jF(e,t);case yt.MILLISECOND:return VF(e,t);case yt.MICROSECOND:return qF(e,t);case yt.NANOSECOND:return YF(e,t)}},uW=({values:e,stride:t},n)=>Xh.decimal(e.subarray(t*n,t*(n+1))),fW=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Gt([c])},dW=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new vo(s.slice(i,o-i))},hW=(e,t)=>new Xa(e,t),pW=(e,t)=>e.type.mode===we.Dense?GF(e,t):WF(e,t),GF=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,e.valueOffsets[t])},WF=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Xe.visit(r,t)},mW=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},yW=(e,t)=>e.type.unit===Jn.DAY_TIME?XF(e,t):HF(e,t),XF=({values:e},t)=>e.subarray(2*t,2*(t+1)),HF=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},QF=({values:e},t)=>e[t],ZF=({values:e},t)=>e[t],KF=({values:e},t)=>e[t],JF=({values:e},t)=>e[t],gW=(e,t)=>{switch(e.type.unit){case yt.SECOND:return QF(e,t);case yt.MILLISECOND:return ZF(e,t);case yt.MICROSECOND:return KF(e,t);case yt.NANOSECOND:return JF(e,t)}},xW=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Gt([o])};bt.prototype.visitNull=At(JG);bt.prototype.visitBool=At(tW);bt.prototype.visitInt=At(oW);bt.prototype.visitInt8=At(Ha);bt.prototype.visitInt16=At(Ha);bt.prototype.visitInt32=At(Ha);bt.prototype.visitInt64=At(BF);bt.prototype.visitUint8=At(Ha);bt.prototype.visitUint16=At(Ha);bt.prototype.visitUint32=At(Ha);bt.prototype.visitUint64=At(BF);bt.prototype.visitFloat=At(sW);bt.prototype.visitFloat16=At(eW);bt.prototype.visitFloat32=At(Ha);bt.prototype.visitFloat64=At(Ha);bt.prototype.visitUtf8=At(iW);bt.prototype.visitBinary=At(rW);bt.prototype.visitFixedSizeBinary=At(nW);bt.prototype.visitDate=At(aW);bt.prototype.visitDateDay=At(kF);bt.prototype.visitDateMillisecond=At(CF);bt.prototype.visitTimestamp=At(cW);bt.prototype.visitTimestampSecond=At(PF);bt.prototype.visitTimestampMillisecond=At($F);bt.prototype.visitTimestampMicrosecond=At(UF);bt.prototype.visitTimestampNanosecond=At(zF);bt.prototype.visitTime=At(lW);bt.prototype.visitTimeSecond=At(jF);bt.prototype.visitTimeMillisecond=At(VF);bt.prototype.visitTimeMicrosecond=At(qF);bt.prototype.visitTimeNanosecond=At(YF);bt.prototype.visitDecimal=At(uW);bt.prototype.visitList=At(fW);bt.prototype.visitStruct=At(hW);bt.prototype.visitUnion=At(pW);bt.prototype.visitDenseUnion=At(GF);bt.prototype.visitSparseUnion=At(WF);bt.prototype.visitDictionary=At(mW);bt.prototype.visitInterval=At(yW);bt.prototype.visitIntervalDayTime=At(XF);bt.prototype.visitIntervalYearMonth=At(HF);bt.prototype.visitDuration=At(gW);bt.prototype.visitDurationSecond=At(QF);bt.prototype.visitDurationMillisecond=At(ZF);bt.prototype.visitDurationMicrosecond=At(KF);bt.prototype.visitDurationNanosecond=At(JF);bt.prototype.visitFixedSizeList=At(xW);bt.prototype.visitMap=At(dW);var Xe=new bt;var mi=Symbol.for("keys"),df=Symbol.for("vals"),vo=class{constructor(t){return this[mi]=new Gt([t.children[0]]).memoize(),this[df]=t.children[1],new Proxy(this,new lT)}[Symbol.iterator](){return new cT(this[mi],this[df])}get size(){return this[mi].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[mi],n=this[df],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Xe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${zi(t)}: ${zi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},cT=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Xe.visit(this.vals,t)]})}},lT=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[mi].toArray().map(String)}has(t,n){return t[mi].includes(n)}getOwnPropertyDescriptor(t,n){if(t[mi].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[mi].indexOf(n);if(r!==-1){let i=Xe.visit(Reflect.get(t,df),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[mi].indexOf(n);return i!==-1?(An.visit(Reflect.get(t,df),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(vo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[mi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[df]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function bW(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var tk;function Qh(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(tk=o,o=s,s=tk),s>i&&(s=i),r?r(e,o,s):[o,s]}var ek=e=>e!==e;function Qa(e){if(typeof e!=="object"||e===null)return ek(e)?ek:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?jI(e,n):!1:e instanceof Map?_W(e):Array.isArray(e)?wW(e):e instanceof Gt?vW(e):SW(e,!0)}function wW(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Qa(e[n]);return Jx(t)}function _W(e){let t=-1,n=[];for(let r of e.values())n[++t]=Qa(r);return Jx(n)}function vW(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Qa(e.get(n));return Jx(t)}function SW(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=Qa(e[n[i]]);return Jx(r,n)}function Jx(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return IW(e,n);case Map:return nk(e,n,n.keys());case vo:case Xa:case Object:case void 0:return nk(e,n,t||Object.keys(n))}return n instanceof Gt?TW(e,n):!1}}function IW(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function TW(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function nk(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var fT={};kr(fT,{BitIterator:()=>_l,getBit:()=>rk,getBool:()=>eb,packBools:()=>Sl,popcnt_array:()=>ik,popcnt_bit_range:()=>Zh,popcnt_uint32:()=>tb,setBool:()=>EW,truncateBitmap:()=>vl});function eb(e,t,n,r){return(n&1<<r)!==0}function rk(e,t,n,r){return(n&1<<r)>>r}function EW(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function vl(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):Sl(new _l(n,e,t,null,eb)).subarray(0,r)),i}return n}function Sl(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var _l=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Zh(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _l(e,t,n-t,e,rk))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Zh(e,t,i)+Zh(e,r,n)+ik(e,i>>3,r-i>>3)}function ik(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=tb(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=tb(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=tb(o.getUint8(i)),i+=1;return r}function tb(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var AW=-1,le=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return lt.isSparseUnion(t)?this.children.some(n=>n.nullable):lt.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(lt.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=AW&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Zh(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Vr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(lt.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===we.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(lt.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===we.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(vl(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===R.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(vl(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[pi.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[pi.TYPE])&&(s[pi.TYPE]=o.subarray(t,t+n)),(o=s[pi.OFFSET])&&(s[pi.OFFSET]=o.subarray(t,t+n+1))||(o=s[pi.DATA])&&(s[pi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};le.prototype.children=Object.freeze([]);var dT=class e extends dt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new le(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.data),o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.data),o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Lt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ut(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(lt.isSparseUnion(n))return new le(n,r,s,a,[void 0,void 0,void 0,o],i);let c=wl(t.valueOffsets);return new le(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Lt(t.nullBitmap),o=Ut(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Lt(t.nullBitmap),{["length"]:s=i.length/Vr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new le(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Lt(t.nullBitmap),s=wl(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new le(n,r,a,c,[s,void 0,o],[i])}},MW=new dT;function Ft(e){return MW.visit(e)}var Kh=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function nb(e){return e.reduce((t,n)=>t+n.nullCount,0)}function rb(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function ib(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function hT(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function Jh(e,t){return e.getValid(t)}function Za(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return hT(r,this._offsets,n,t)}}function ob(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=hT(o,this._offsets,r,n);return t=void 0,s}}function sb(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):hT(o,this._offsets,i,n);return t=void 0,s}}var wt=class extends dt{};function OW(e,t){return t===null&&e.length>0?0:-1}function NW(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _l(n,e.offset+(t||0),e.length,n,eb)){if(!i)return r;++r}return-1}function kt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case R.Union:break;case R.Dictionary:break;default:return NW(e,n)}let r=Xe.getVisitFn(e),i=Qa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function ok(e,t,n){let r=Xe.getVisitFn(e),i=Qa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}wt.prototype.visitNull=OW;wt.prototype.visitBool=kt;wt.prototype.visitInt=kt;wt.prototype.visitInt8=kt;wt.prototype.visitInt16=kt;wt.prototype.visitInt32=kt;wt.prototype.visitInt64=kt;wt.prototype.visitUint8=kt;wt.prototype.visitUint16=kt;wt.prototype.visitUint32=kt;wt.prototype.visitUint64=kt;wt.prototype.visitFloat=kt;wt.prototype.visitFloat16=kt;wt.prototype.visitFloat32=kt;wt.prototype.visitFloat64=kt;wt.prototype.visitUtf8=kt;wt.prototype.visitBinary=kt;wt.prototype.visitFixedSizeBinary=kt;wt.prototype.visitDate=kt;wt.prototype.visitDateDay=kt;wt.prototype.visitDateMillisecond=kt;wt.prototype.visitTimestamp=kt;wt.prototype.visitTimestampSecond=kt;wt.prototype.visitTimestampMillisecond=kt;wt.prototype.visitTimestampMicrosecond=kt;wt.prototype.visitTimestampNanosecond=kt;wt.prototype.visitTime=kt;wt.prototype.visitTimeSecond=kt;wt.prototype.visitTimeMillisecond=kt;wt.prototype.visitTimeMicrosecond=kt;wt.prototype.visitTimeNanosecond=kt;wt.prototype.visitDecimal=kt;wt.prototype.visitList=kt;wt.prototype.visitStruct=kt;wt.prototype.visitUnion=kt;wt.prototype.visitDenseUnion=ok;wt.prototype.visitSparseUnion=ok;wt.prototype.visitDictionary=kt;wt.prototype.visitInterval=kt;wt.prototype.visitIntervalDayTime=kt;wt.prototype.visitIntervalYearMonth=kt;wt.prototype.visitDuration=kt;wt.prototype.visitDurationSecond=kt;wt.prototype.visitDurationMillisecond=kt;wt.prototype.visitDurationMicrosecond=kt;wt.prototype.visitDurationNanosecond=kt;wt.prototype.visitFixedSizeList=kt;wt.prototype.visitMap=kt;var Il=new wt;var _t=class extends dt{};function Mt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===R.Timestamp||t instanceof Ve&&t.bitWidth!==64||t instanceof Vi&&t.bitWidth!==64||t instanceof Tr&&t.precision!==Ie.HALF))return new Kh(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Kh(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new pT(s)})}var pT=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};_t.prototype.visitNull=Mt;_t.prototype.visitBool=Mt;_t.prototype.visitInt=Mt;_t.prototype.visitInt8=Mt;_t.prototype.visitInt16=Mt;_t.prototype.visitInt32=Mt;_t.prototype.visitInt64=Mt;_t.prototype.visitUint8=Mt;_t.prototype.visitUint16=Mt;_t.prototype.visitUint32=Mt;_t.prototype.visitUint64=Mt;_t.prototype.visitFloat=Mt;_t.prototype.visitFloat16=Mt;_t.prototype.visitFloat32=Mt;_t.prototype.visitFloat64=Mt;_t.prototype.visitUtf8=Mt;_t.prototype.visitBinary=Mt;_t.prototype.visitFixedSizeBinary=Mt;_t.prototype.visitDate=Mt;_t.prototype.visitDateDay=Mt;_t.prototype.visitDateMillisecond=Mt;_t.prototype.visitTimestamp=Mt;_t.prototype.visitTimestampSecond=Mt;_t.prototype.visitTimestampMillisecond=Mt;_t.prototype.visitTimestampMicrosecond=Mt;_t.prototype.visitTimestampNanosecond=Mt;_t.prototype.visitTime=Mt;_t.prototype.visitTimeSecond=Mt;_t.prototype.visitTimeMillisecond=Mt;_t.prototype.visitTimeMicrosecond=Mt;_t.prototype.visitTimeNanosecond=Mt;_t.prototype.visitDecimal=Mt;_t.prototype.visitList=Mt;_t.prototype.visitStruct=Mt;_t.prototype.visitUnion=Mt;_t.prototype.visitDenseUnion=Mt;_t.prototype.visitSparseUnion=Mt;_t.prototype.visitDictionary=Mt;_t.prototype.visitInterval=Mt;_t.prototype.visitIntervalDayTime=Mt;_t.prototype.visitIntervalYearMonth=Mt;_t.prototype.visitDuration=Mt;_t.prototype.visitDurationSecond=Mt;_t.prototype.visitDurationMillisecond=Mt;_t.prototype.visitDurationMicrosecond=Mt;_t.prototype.visitDurationNanosecond=Mt;_t.prototype.visitFixedSizeList=Mt;_t.prototype.visitMap=Mt;var hf=new _t;var DW=(e,t)=>e+t,So=class extends dt{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===yt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+qr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+qr.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},RW=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),LW=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),FW=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=qr.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},kW=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=qr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},CW=(e,t)=>e.type.mode===we.Dense?sk(e,t):ak(e,t),sk=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+qr.visit(t[o],r[i])},ak=({children:e},t)=>4+qr.visitMany(e,e.map(()=>t)).reduce(DW,0);So.prototype.visitUtf8=RW;So.prototype.visitBinary=LW;So.prototype.visitList=FW;So.prototype.visitFixedSizeList=kW;So.prototype.visitUnion=CW;So.prototype.visitDenseUnion=sk;So.prototype.visitSparseUnion=ak;var qr=new So;var ck,lk={},uk={},Gt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof le)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=lk[s.typeId],f=o[0];this.isValid=d=>Jh(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,uk[s.typeId]),this._offsets=rb(o);break}this.data=o,this.type=s,this.stride=Vr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return nb(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${R[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return hf.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(Qh(this,t,n,({data:r,_offsets:i},o,s)=>ib(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case R.Int:case R.Float:case R.Decimal:case R.Time:case R.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return lt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(lt.isDictionary(this.type)){let t=new ab(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new ab(this)}unmemoize(){if(lt.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};ck=Symbol.toStringTag;Gt[ck]=(e=>{e.type=lt.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(R).map(n=>R[n]).filter(n=>typeof n=="number"&&n!==R.NONE);for(let n of t){let r=Xe.getVisitFnByTypeId(n),i=An.getVisitFnByTypeId(n),o=Il.getVisitFnByTypeId(n),s=qr.getVisitFnByTypeId(n);lk[n]={get:r,set:i,indexOf:o,byteLength:s},uk[n]=Object.create(e,{isValid:{value:Za(Jh)},get:{value:Za(Xe.getVisitFnByTypeId(n))},set:{value:ob(An.getVisitFnByTypeId(n))},indexOf:{value:sb(Il.getVisitFnByTypeId(n))},getByteLength:{value:Za(qr.getVisitFnByTypeId(n))}})}return"Vector"})(Gt.prototype);var ab=class e extends Gt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function fk(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
|
|
3
|
-
switch (x) {${
|
|
4
|
-
case ${
|
|
1
|
+
var NW=Object.create;var ZI=Object.defineProperty;var OW=Object.getOwnPropertyDescriptor;var RW=Object.getOwnPropertyNames;var DW=Object.getPrototypeOf,LW=Object.prototype.hasOwnProperty;var fC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jn=(e,t)=>{for(var r in t)ZI(e,r,{get:t[r],enumerable:!0})},FW=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RW(t))!LW.call(e,i)&&i!==r&&ZI(e,i,{get:()=>t[i],enumerable:!(n=OW(t,i))||n.enumerable});return e};var CW=(e,t,r)=>(r=e!=null?NW(DW(e)):{},FW(t||!e||!e.__esModule?ZI(r,"default",{value:e,enumerable:!0}):r,e));var jV=fC((rne,zV)=>{"use strict";function Xat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>=0?(o=s,i=s-1):n=s+1}return o}function Hat(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>0?(o=s,i=s-1):n=s+1}return o}function Qat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<0?(o=s,n=s+1):i=s-1}return o}function Zat(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<=0?(o=s,n=s+1):i=s-1}return o}function Kat(e,t,r,n,i){for(;n<=i;){var o=n+i>>>1,s=e[o],a=r!==void 0?r(s,t):s-t;if(a===0)return o;a<=0?n=o+1:i=o-1}return-1}function j0(e,t,r,n,i,o){return typeof r=="function"?o(e,t,r,n===void 0?0:n|0,i===void 0?e.length-1:i|0):o(e,t,void 0,r===void 0?0:r|0,n===void 0?e.length-1:n|0)}zV.exports={ge:function(e,t,r,n,i){return j0(e,t,r,n,i,Xat)},gt:function(e,t,r,n,i){return j0(e,t,r,n,i,Hat)},lt:function(e,t,r,n,i){return j0(e,t,r,n,i,Qat)},le:function(e,t,r,n,i){return j0(e,t,r,n,i,Zat)},eq:function(e,t,r,n,i){return j0(e,t,r,n,i,Kat)}}});var QV=fC((nne,HV)=>{"use strict";var SI=jV(),ep=0,_f=1,vI=2;HV.exports=tct;function s8(e,t,r,n,i){this.mid=e,this.left=t,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(t?t.count:0)+(r?r.count:0)+n.length}var q0=s8.prototype;function i8(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function YV(e,t){var r=rp(t);e.mid=r.mid,e.left=r.left,e.right=r.right,e.leftPoints=r.leftPoints,e.rightPoints=r.rightPoints,e.count=r.count}function qV(e,t){var r=e.intervals([]);r.push(t),YV(e,r)}function VV(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?ep:(r.splice(n,1),YV(e,r),_f)}q0.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};q0.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?qV(this,e):this.left.insert(e):this.left=rp([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?qV(this,e):this.right.insert(e):this.right=rp([e]);else{var r=SI.ge(this.leftPoints,e,a8),n=SI.ge(this.rightPoints,e,c8);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};q0.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return ep;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return VV(this,e);var n=this.left.remove(e);return n===vI?(this.left=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return ep;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return VV(this,e);var n=this.right.remove(e);return n===vI?(this.right=null,this.count-=1,_f):(n===_f&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?vI:ep;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,n=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=n}i8(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i8(this,this.left):i8(this,this.right);return _f}for(var a=SI.ge(this.leftPoints,e,a8);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var n=SI.ge(this.rightPoints,e,c8);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),_f}return ep}};function WV(e,t,r){for(var n=0;n<e.length&&e[n][0]<=t;++n){var i=r(e[n]);if(i)return i}}function GV(e,t,r){for(var n=e.length-1;n>=0&&e[n][1]>=t;--n){var i=r(e[n]);if(i)return i}}function XV(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}q0.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return WV(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return GV(this.rightPoints,e,t)}else return XV(this.leftPoints,t)};q0.queryInterval=function(e,t,r){if(e<this.mid&&this.left){var n=this.left.queryInterval(e,t,r);if(n)return n}if(t>this.mid&&this.right){var n=this.right.queryInterval(e,t,r);if(n)return n}return t<this.mid?WV(this.leftPoints,t,r):e>this.mid?GV(this.rightPoints,e,r):XV(this.leftPoints,r)};function Jat(e,t){return e-t}function a8(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function c8(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function rp(e){if(e.length===0)return null;for(var t=[],r=0;r<e.length;++r)t.push(e[r][0],e[r][1]);t.sort(Jat);for(var n=t[t.length>>1],i=[],o=[],s=[],r=0;r<e.length;++r){var a=e[r];a[1]<n?i.push(a):n<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(a8),l.sort(c8),new s8(n,rp(i),rp(o),c,l)}function o8(e){this.root=e}var np=o8.prototype;np.insert=function(e){this.root?this.root.insert(e):this.root=new s8(e[0],null,null,[e],[e])};np.remove=function(e){if(this.root){var t=this.root.remove(e);return t===vI&&(this.root=null),t!==ep}return!1};np.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};np.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(np,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(np,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function tct(e){return!e||e.length===0?new o8(null):new o8(rp(e))}});var dC={};function fp(e,t=!1){let r,n,i=dC;function o(l){r=e(l).catch(()=>{}).finally(()=>{if(n){let{value:u}=n;n=null,o(u)}else r=null})}function s(l){n={event:l}}function a(l){r?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=dC,a(u)}),i=l}return t?c:a}var Bn=class{constructor(t){this._filterBy=t,this._requestUpdate=fp(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterStable(){return!0}fields(){return null}fieldInfo(t){return this}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){let r=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,r)}requestUpdate(){this._requestUpdate()}initialize(){return this._coordinator.initializeClient(this)}update(){return this}};var dp=Uint8Array.of(65,82,82,79,87,49),Ti={V1:0,V2:1,V3:2,V4:3,V5:4};var Ai={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},j={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},Mf={HALF:0,SINGLE:1,DOUBLE:2},js={DAY:0,MILLISECOND:1},Tr={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Ei={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},qs={Sparse:0,Dense:1};var Nf=Uint8Array,Sx=Uint16Array,Ix=Uint32Array,Tx=BigUint64Array,hp=Int8Array,hC=Int16Array,Pn=Int32Array,ti=BigInt64Array,KI=Float32Array,uc=Float64Array;function pC(e,t){let r=Math.log2(e)-3;return(t?[hp,hC,Pn,ti]:[Nf,Sx,Ix,Tx])[r]}var Ylt=Object.getPrototypeOf(Int8Array);function Of(e,t){let r=0,n=e.length;if(n<=2147483648)do{let i=r+n>>>1;e[i]<=t?r=i+1:n=i}while(r<n);else do{let i=Math.trunc((r+n)/2);e[i]<=t?r=i+1:n=i}while(r<n);return r}function Ax(e,t,r){if(t(e))return e;throw new Error(r(e))}function Un(e,t,r){return t=Array.isArray(t)?t:Object.values(t),Ax(e,n=>t.includes(n),r??(()=>`${e} must be one of ${t}`))}function Ex(e,t){for(let[r,n]of Object.entries(e))if(n===t)return r;return"<Unknown>"}var Vs=e=>`Unsupported data type: "${Ex(j,e)}" (id ${e})`,pp=(e,t,r=!0,n=null)=>({name:e,type:t,nullable:r,metadata:n});function mC(e){return Object.hasOwn(e,"name")&&yC(e.type)}function yC(e){return typeof e?.typeId=="number"}function fc(e,t="",r=!0){return mC(e)?e:pp(t,Ax(e,yC,()=>"Data type expected."),r)}var Mx=(e,t,r=!1,n=-1)=>({typeId:j.Dictionary,id:n,dictionary:e,indices:t||Rf(),ordered:r});var Nx=(e=32,t=!0)=>({typeId:j.Int,bitWidth:Un(e,[8,16,32,64]),signed:t,values:pC(e,t)});var Rf=()=>Nx(32);var JI=(e=2)=>({typeId:j.Float,precision:Un(e,Mf),values:[Sx,KI,uc][e]});var tT=()=>({typeId:j.Binary,offsets:Pn}),Ox=()=>({typeId:j.Utf8,offsets:Pn});var eT=(e,t,r=128)=>({typeId:j.Decimal,precision:e,scale:t,bitWidth:Un(r,[128,256]),values:Tx}),rT=e=>({typeId:j.Date,unit:Un(e,js),values:e===js.DAY?Pn:ti});var nT=(e=Tr.MILLISECOND,t=32)=>({typeId:j.Time,unit:Un(e,Tr),bitWidth:Un(t,[32,64]),values:t===32?Pn:ti});var Rx=(e=Tr.MILLISECOND,t=null)=>({typeId:j.Timestamp,unit:Un(e,Tr),timezone:t,values:ti}),iT=(e=Ei.MONTH_DAY_NANO)=>({typeId:j.Interval,unit:Un(e,Ei),values:e===Ei.MONTH_DAY_NANO?void 0:Pn}),Dx=e=>({typeId:j.List,children:[fc(e)],offsets:Pn}),Lx=e=>({typeId:j.Struct,children:Array.isArray(e)&&mC(e[0])?e:Object.entries(e).map(([t,r])=>pp(t,r))}),oT=(e,t,r,n)=>(r??=t.map((i,o)=>o),{typeId:j.Union,mode:Un(e,qs),typeIds:r,typeMap:r.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>fc(i,`_${o}`)),typeIdForValue:n,offsets:Pn}),sT=e=>({typeId:j.FixedSizeBinary,stride:e}),Fx=(e,t)=>({typeId:j.FixedSizeList,stride:t,children:[fc(e)]}),gC=(e,t)=>({typeId:j.Map,keysSorted:e,children:[t],offsets:Pn});var aT=(e=Tr.MILLISECOND)=>({typeId:j.Duration,unit:Un(e,Tr),values:ti}),cT=()=>({typeId:j.LargeBinary,offsets:ti}),lT=()=>({typeId:j.LargeUtf8,offsets:ti}),uT=e=>({typeId:j.LargeList,children:[fc(e)],offsets:ti}),fT=(e,t)=>({typeId:j.RunEndEncoded,children:[Ax(fc(e,"run_ends"),r=>r.type.typeId===j.Int,()=>"Run-ends must have an integer type."),fc(t,"values")]});var dT=e=>({typeId:j.ListView,children:[fc(e,"value")],offsets:Pn}),hT=e=>({typeId:j.LargeListView,children:[fc(e,"value")],offsets:ti});var kW=new uc(2),Cx=kW.buffer,tut=new ti(Cx),eut=new Ix(Cx),rut=new Pn(Cx),nut=new Nf(Cx);function Uo(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error(`BigInt exceeds integer number representation: ${e}`);return Number(e)}function kx(e,t){return Number(e/t)+Number(e%t)/Number(t)}var Df=e=>BigInt.asUintN(64,e);function bC(e,t){let r=t<<1,n;return BigInt.asIntN(64,e[r+1])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n,n=-(n+1n)):n=e[r]|e[r+1]<<64n,n}function _C(e,t){let r=t<<2,n;return BigInt.asIntN(64,e[r+3])<0?(n=Df(~e[r])|Df(~e[r+1])<<64n|Df(~e[r+2])<<128n|Df(~e[r+3])<<192n,n=-(n+1n)):n=e[r]|e[r+1]<<64n|e[r+2]<<128n|e[r+3]<<192n,n}var PW=new TextDecoder("utf-8"),cut=new TextEncoder;function Lf(e){return PW.decode(e)}var Cl=4;function pT(e,t){return(e[t>>3]&1<<t%8)!==0}function rn(e,t){let r=t+xe(e,t),n=r-xe(e,r),i=$r(e,n);return(o,s,a=null)=>{if(o<i){let c=$r(e,n+o);if(c)return s(e,r+c)}return a}}function eo(e,t){return t}function dc(e,t){return!!UW(e,t)}function UW(e,t){return mp(e,t)<<24>>24}function mp(e,t){return e[t]}function $r(e,t){return $W(e,t)<<16>>16}function $W(e,t){return e[t]|e[t+1]<<8}function xe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function wC(e,t){return xe(e,t)>>>0}function Ar(e,t){return Uo(BigInt.asIntN(64,BigInt(wC(e,t))+(BigInt(wC(e,t+Cl))<<32n)))}function kl(e,t){let r=t+xe(e,t),n=xe(e,r);return r+=Cl,Lf(e.subarray(r,r+n))}function ei(e,t,r,n){if(!t)return[];let i=t+xe(e,t);return Array.from({length:xe(e,i)},(o,s)=>n(e,i+Cl+s*r))}var mT=Symbol("rowIndex");function yp(e,t){class r{constructor(o){this[mT]=o}toJSON(){return vC(e,t,this[mT])}}let n=r.prototype;for(let i=0;i<e.length;++i){if(Object.hasOwn(n,e[i]))continue;let o=t[i];Object.defineProperty(n,e[i],{get(){return o.at(this[mT])},enumerable:!0})}return i=>new r(i)}function Bx(e,t){return r=>vC(e,t,r)}function vC(e,t,r){let n={};for(let i=0;i<e.length;++i)n[e[i]]=t[i].at(r);return n}function SC(e){return e instanceof hc}var Bl=class{static ArrayType=null;constructor({length:t,nullCount:r,type:n,validity:i,values:o,offsets:s,sizes:a,children:c}){this.length=t,this.nullCount=r,this.type=n,this.validity=i,this.values=o,this.offsets=s,this.sizes=a,this.children=c,(!r||!this.validity)&&(this.at=l=>this.value(l))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return pT(this.validity,t)}value(t){return this.values[t]}slice(t,r){let n=r-t,i=Array(n);for(let o=0;o<n;++o)i[o]=this.at(t+o);return i}*[Symbol.iterator](){for(let t=0;t<this.length;++t)yield this.at(t)}},hc=class extends Bl{constructor(t){super(t);let{length:r,values:n}=this;this.values=n.subarray(0,r)}slice(t,r){return this.nullCount?super.slice(t,r):this.values.subarray(t,r)}[Symbol.iterator](){return this.nullCount?super[Symbol.iterator]():this.values[Symbol.iterator]()}},gp=class extends Bl{static ArrayType=uc},$e=class extends Bl{static ArrayType=Array},xp=class extends $e{value(t){return null}},$o=class extends gp{value(t){return Uo(this.values[t])}},Px=class extends gp{value(t){let r=this.values[t],n=(r&31744)>>10,i=(r&1023)/1024,o=(-1)**((r&32768)>>15);switch(n){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(n-15)*(1+i)}},Ux=class extends $e{value(t){return pT(this.values,t)}},$x=class extends Bl{constructor(t){super(t);let{bitWidth:r,scale:n}=this.type;this.decimal=r===128?bC:_C,this.scale=10n**BigInt(n)}},zx=class extends $x{static ArrayType=uc;value(t){return kx(this.decimal(this.values,t),this.scale)}},jx=class extends $x{static ArrayType=Array;value(t){return this.decimal(this.values,t)}},bp=class extends $e{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}},qx=class extends gp{value(t){return 864e5*this.values[t]}},IC=$o,Vx=class extends $o{value(t){return super.value(t)*1e3}},TC=$o,Yx=class extends $o{value(t){return kx(this.values[t],1000n)}},Wx=class extends $o{value(t){return kx(this.values[t],1000000n)}},Gx=class extends $e{value(t){return this.values.subarray(t<<1,t+1<<1)}},Xx=class extends $e{value(t){let r=this.values,n=t<<4;return Float64Array.of(xe(r,n),xe(r,n+4),Ar(r,n+8))}},AC=({values:e,offsets:t},r)=>e.subarray(t[r],t[r+1]),EC=({values:e,offsets:t},r)=>e.subarray(Uo(t[r]),Uo(t[r+1])),Hx=class extends $e{value(t){return AC(this,t)}},Qx=class extends $e{value(t){return EC(this,t)}},Zx=class extends $e{value(t){return Lf(AC(this,t))}},Kx=class extends $e{value(t){return Lf(EC(this,t))}},Jx=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(r[t],r[t+1])}},tb=class extends $e{value(t){let r=this.offsets;return this.children[0].slice(Uo(r[t]),Uo(r[t+1]))}},eb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(r,n)}},rb=class extends $e{value(t){let r=this.offsets[t],n=r+this.sizes[t];return this.children[0].slice(Uo(r),Uo(n))}},nb=class extends $e{constructor(t){super(t),this.stride=this.type.stride}},ib=class extends nb{value(t){let{stride:r,values:n}=this;return n.subarray(t*r,(t+1)*r)}},ob=class extends nb{value(t){let{children:r,stride:n}=this;return r[0].slice(t*n,(t+1)*n)}};function MC({children:e,offsets:t},r){let[n,i]=e[0].children,o=t[r],s=t[r+1],a=[];for(let c=o;c<s;++c)a.push([n.at(c),i.at(c)]);return a}var sb=class extends $e{value(t){return MC(this,t)}},ab=class extends $e{value(t){return new Map(MC(this,t))}},_p=class extends $e{constructor({typeIds:t,...r}){super(r),this.typeIds=t,this.typeMap=this.type.typeMap}value(t,r=t){let{typeIds:n,children:i,typeMap:o}=this;return i[o[n[t]]].at(r)}},cb=class extends _p{value(t){return super.value(t,this.offsets[t])}},wp=class extends $e{constructor(t,r=Bx){super(t),this.names=this.type.children.map(n=>n.name),this.factory=r(this.names,this.children)}value(t){return this.factory(t)}},lb=class extends wp{constructor(t){super(t,yp)}},ub=class extends $e{value(t){let[{values:r},n]=this.children;return n.at(Of(r,t))}},fb=class extends $e{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}},db=class extends $e{constructor({data:t,...r}){super(r),this.data=t}view(t){let{values:r,data:n}=this,i=t<<4,o=i+4,s=r,a=xe(s,i);return a>12&&(o=xe(s,i+12),s=n[xe(s,i+8)]),s.subarray(o,o+a)}},hb=class extends db{value(t){return this.view(t)}},pb=class extends db{value(t){return Lf(this.view(t))}};function yT(e){let t=[];return{add(r){return t.push(r),this},clear:()=>t=[],done:()=>new Pl(t,e)}}var Pl=class{constructor(t,r=t[0]?.type){this.type=r,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;let n=t.length,i=new Int32Array(n+1);if(n===1){let[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o<n;++o)i[o+1]=s+=t[o].length;this.offsets=i}get[Symbol.toStringTag](){return"Column"}[Symbol.iterator](){let t=this.data;return t.length===1?t[0][Symbol.iterator]():zW(t)}at(t){let{data:r,offsets:n}=this,i=Of(n,t)-1;return r[i]?.at(t-n[i])}get(t){return this.at(t)}toArray(){let{length:t,nullCount:r,data:n}=this,i=!r&&SC(n[0]),o=n.length;if(i&&o===1)return n[0].values;let s=!o||r>0?Array:n[0].constructor.ArrayType??n[0].values.constructor,a=new s(t);return i?jW(a,n):qW(a,n)}cache(){return this._cache??(this._cache=this.toArray())}};function*zW(e){for(let t=0;t<e.length;++t){let r=e[t][Symbol.iterator]();for(let n=r.next();!n.done;n=r.next())yield n.value}}function jW(e,t){for(let r=0,n=0;r<t.length;++r){let{values:i}=t[r];e.set(i,n),n+=i.length}return e}function qW(e,t){let r=-1;for(let n=0;n<t.length;++n){let i=t[n];for(let o=0;o<i.length;++o)e[++r]=i.at(o)}return e}var Ff=class e{constructor(t,r,n=!1){let i=t.fields.map(s=>s.name);this.schema=t,this.names=i,this.children=r,this.factory=n?yp:Bx;let o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,r.map(a=>a.data[s])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){let r=this.names.findIndex(n=>n===t);return r>-1?this.children[r]:void 0}selectAt(t,r=[]){let{children:n,factory:i,schema:o}=this,{fields:s}=o;return new e({...o,fields:t.map((a,c)=>VW(s[a],r[c]))},t.map(a=>n[a]),i===yp)}select(t,r){let n=this.names,i=t.map(o=>n.indexOf(o));return this.selectAt(i,r)}toColumns(){let{children:t,names:r}=this,n={};return r.forEach((i,o)=>n[i]=t[o]?.toArray()??[]),n}toArray(){let{children:t,getFactory:r,numRows:n}=this,i=t[0]?.data??[],o=Array(n);for(let s=0,a=-1;s<i.length;++s){let c=r(s);for(let l=0;l<i[s].length;++l)o[++a]=c(l)}return o}*[Symbol.iterator](){let{children:t,getFactory:r}=this,n=t[0]?.data??[];for(let i=0;i<n.length;++i){let o=r(i);for(let s=0;s<n[i].length;++s)yield o(s)}}at(t){let{children:r,getFactory:n,numRows:i}=this;if(t<0||t>=i)return null;let[{offsets:o}]=r,s=Of(o,t)-1;return n(s)(t-o[s])}get(t){return this.at(t)}};function VW(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function vp(e,t={}){let{typeId:r,bitWidth:n,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalBigInt:c,useMap:l,useProxy:u}=t;switch(r){case j.Null:return xp;case j.Bool:return Ux;case j.Int:case j.Time:case j.Duration:return s||n<64?hc:$o;case j.Float:return i?hc:Px;case j.Date:return NC(o===js.DAY?qx:IC,a&&bp);case j.Timestamp:return NC(o===Tr.SECOND?Vx:o===Tr.MILLISECOND?TC:o===Tr.MICROSECOND?Yx:Wx,a&&bp);case j.Decimal:return c?jx:zx;case j.Interval:return o===Ei.DAY_TIME?Gx:o===Ei.YEAR_MONTH?hc:Xx;case j.FixedSizeBinary:return ib;case j.Utf8:return Zx;case j.LargeUtf8:return Kx;case j.Binary:return Hx;case j.LargeBinary:return Qx;case j.BinaryView:return hb;case j.Utf8View:return pb;case j.List:return Jx;case j.LargeList:return tb;case j.Map:return l?ab:sb;case j.ListView:return eb;case j.LargeListView:return rb;case j.FixedSizeList:return ob;case j.Struct:return u?lb:wp;case j.RunEndEncoded:return ub;case j.Dictionary:return fb;case j.Union:return e.mode?cb:_p}throw new Error(Vs(r))}function NC(e,t){return t?class extends t{constructor(n){super(new e(n))}}:e}function YW(e,t){return{offset:Ar(e,t),metadataLength:xe(e,t+8),bodyLength:Ar(e,t+16)}}function gT(e,t){return ei(e,t,24,YW)}function mb(e,t,r){let n=rn(e,t);if(n(10,eo,0))throw new Error("Record batch compression not implemented");let i=r<Ti.V4?8:0;return{length:n(4,Ar,0),nodes:ei(e,n(6,eo),16,(o,s)=>({length:Ar(o,s),nullCount:Ar(o,s+8)})),regions:ei(e,n(8,eo),16+i,(o,s)=>({offset:Ar(o,s+i),length:Ar(o,s+i+8)})),variadic:ei(e,n(12,eo),8,Ar)}}function OC(e,t,r){let n=rn(e,t);return{id:n(4,Ar,0),data:n(6,(i,o)=>mb(i,o,r)),isDelta:n(8,dc,!1)}}function xT(e,t,r,n){Un(r,j,Vs);let i=rn(e,t);switch(r){case j.Binary:return tT();case j.Utf8:return Ox();case j.LargeBinary:return cT();case j.LargeUtf8:return lT();case j.List:return Dx(n[0]);case j.ListView:return dT(n[0]);case j.LargeList:return uT(n[0]);case j.LargeListView:return hT(n[0]);case j.Struct:return Lx(n);case j.RunEndEncoded:return fT(n[0],n[1]);case j.Int:return Nx(i(4,xe,0),i(6,dc,!1));case j.Float:return JI(i(4,$r,Mf.HALF));case j.Decimal:return eT(i(4,xe,0),i(6,xe,0),i(8,xe,128));case j.Date:return rT(i(4,$r,js.MILLISECOND));case j.Time:return nT(i(4,$r,Tr.MILLISECOND),i(6,xe,32));case j.Timestamp:return Rx(i(4,$r,Tr.SECOND),i(6,kl));case j.Interval:return iT(i(4,$r,Ei.YEAR_MONTH));case j.Duration:return aT(i(4,$r,Tr.MILLISECOND));case j.FixedSizeBinary:return sT(i(4,xe,0));case j.FixedSizeList:return Fx(n[0],i(4,xe,0));case j.Map:return gC(i(4,dc,!1),n[0]);case j.Union:return oT(i(4,$r,qs.Sparse),n,ei(e,i(6,eo),4,xe))}return{typeId:r}}function Sp(e,t){let r=ei(e,t,4,(n,i)=>{let o=rn(n,i);return[o(4,kl),o(6,kl)]});return r.length?new Map(r):null}function yb(e,t,r){let n=rn(e,t);return{version:r,endianness:n(4,$r,0),fields:n(6,WW,[]),metadata:n(8,Sp)}}function WW(e,t){return ei(e,t,4,RC)}function RC(e,t){let r=rn(e,t),n=r(8,mp,j.NONE),i=r(10,eo,0),o=r(12,XW),s=r(14,(c,l)=>GW(c,l)),a=xT(e,i,n,s);return o&&(o.dictionary=a,a=o),{name:r(4,kl),type:a,nullable:r(6,dc,!1),metadata:r(16,Sp)}}function GW(e,t){let r=ei(e,t,4,RC);return r.length?r:null}function XW(e,t){if(!t)return null;let r=rn(e,t);return Mx(null,r(6,HW,Rf()),r(8,dc,!1),r(4,Ar,0))}function HW(e,t){return xT(e,t,j.Int)}var QW=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,ZW=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,KW=e=>`Unsupported message type: ${e} (${Ex(Ai,e)})`;function gb(e,t){let r=xe(e,t)||0;if(t+=Cl,r===-1&&(r=xe(e,t)||0,t+=Cl),r===0)return null;let n=e.subarray(t,t+=r);if(n.byteLength<r)throw new Error(QW(r,n.byteLength));let i=rn(n,0),o=i(4,$r,Ti.V1),s=i(6,mp,Ai.NONE),a=i(8,eo,0),c=i(10,Ar,0),l;if(a){let u=s===Ai.Schema?yb:s===Ai.DictionaryBatch?OC:s===Ai.RecordBatch?mb:null;if(!u)throw new Error(KW(s));if(l=u(n,a,o),c>0){let f=e.subarray(t,t+=c);if(f.byteLength<c)throw new Error(ZW(c,f.byteLength));l.body=f}}return{version:o,type:s,index:t,content:l}}function DC(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;return t instanceof Uint8Array&&JW(t)?eG(t):tG(t)}function JW(e){if(!e||e.length<4)return!1;for(let t=0;t<6;++t)if(dp[t]!==e[t])return!1;return!0}function tG(e){let t=[e].flat(),r,n=[],i=[];for(let o of t){if(!(o instanceof Uint8Array))throw new Error("IPC data batch was not a Uint8Array.");let s=0;for(;;){let a=gb(o,s);if(a===null)break;if(s=a.index,!!a.content)switch(a.type){case Ai.Schema:r||(r=a.content);break;case Ai.RecordBatch:n.push(a.content);break;case Ai.DictionaryBatch:i.push(a.content);break}}}return{schema:r,dictionaries:i,records:n,metadata:null}}function eG(e){let t=e.byteLength-(dp.length+4),r=xe(e,t),n=rn(e,t-r),i=n(4,$r,Ti.V1),o=n(8,gT,[]),s=n(10,gT,[]);return{schema:n(6,(a,c)=>yb(a,c,i)),dictionaries:o.map(({offset:a})=>gb(e,a).content),records:s.map(({offset:a})=>gb(e,a).content),metadata:n(12,Sp)}}function _T(e,t){return rG(DC(e),t)}function rG(e,t={}){let{schema:r={fields:[]},dictionaries:n,records:i}=e,{version:o,fields:s}=r,a=new Map,c=iG(t,o,a),l=new Map;nG(r,d=>{let h=d.type;h.typeId===j.Dictionary&&l.set(h.id,h.dictionary)});let u=new Map;for(let d of n){let{id:h,data:p,isDelta:m,body:y}=d,g=l.get(h),x=bT(g,c({...p,body:y}));if(u.has(h)){let b=u.get(h);m||b.clear(),b.add(x)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");u.set(h,yT(g).add(x))}}u.forEach((d,h)=>a.set(h,d.done()));let f=s.map(d=>yT(d.type));for(let d of i){let h=c(d);s.forEach((p,m)=>f[m].add(bT(p.type,h)))}return new Ff(r,f.map(d=>d.done()),t.useProxy)}function nG(e,t){e.fields.forEach(function r(n){t(n),n.type.dictionary?.children?.forEach(r),n.type.children?.forEach(r)})}function iG(e,t,r){let n={version:t,options:e,dictionary:i=>r.get(i)};return i=>{let{length:o,nodes:s,regions:a,variadic:c,body:l}=i,u=-1,f=-1,d=-1;return{...n,length:o,node:()=>s[++u],buffer:h=>{let{length:p,offset:m}=a[++f];return h?new h(l.buffer,l.byteOffset+m,p/h.BYTES_PER_ELEMENT):l.subarray(m,m+p)},variadic:()=>c[++d],visit(h){return h.map(p=>bT(p.type,this))}}}}function bT(e,t){let{typeId:r}=e,{length:n,options:i,node:o,buffer:s,variadic:a,version:c}=t,l=vp(e,i);if(r===j.Null)return new l({length:n,nullCount:n,type:e});let u={...o(),type:e};switch(r){case j.Bool:case j.Int:case j.Time:case j.Duration:case j.Float:case j.Decimal:case j.Date:case j.Timestamp:case j.Interval:case j.FixedSizeBinary:return new l({...u,validity:s(),values:s(e.values)});case j.Utf8:case j.LargeUtf8:case j.Binary:case j.LargeBinary:return new l({...u,validity:s(),offsets:s(e.offsets),values:s()});case j.BinaryView:case j.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case j.List:case j.LargeList:case j.Map:return new l({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case j.ListView:case j.LargeListView:return new l({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case j.FixedSizeList:case j.Struct:return new l({...u,validity:s(),children:t.visit(e.children)});case j.RunEndEncoded:return new l({...u,children:t.visit(e.children)});case j.Dictionary:{let{id:f,indices:d}=e;return new l({...u,validity:s(),values:s(d.values)}).setDictionary(t.dictionary(f))}case j.Union:return c<Ti.V5&&s(),new l({...u,typeIds:s(hp),offsets:e.mode===qs.Sparse?null:s(e.offsets),children:t.visit(e.children)});default:throw new Error(Vs(r))}}var Bft=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function pc(e){return _T(e,{useDate:!0})}function xb(e="ws://localhost:3000/"){let t=[],r=!1,n=null,i,o={open(){r=!0,c()},close(){for(r=!1,n=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(n){let{reject:u}=n;n=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(n){let{query:u,resolve:f,reject:d}=n;if(n=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(pc(l));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e),i.binaryType="arraybuffer";for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),r&&!n&&c()}function c(){t.length&&(n=t.shift(),i.send(JSON.stringify(n.query)))}return{get connected(){return r},query(l){return new Promise((u,f)=>a(l,u,f))}}}var Cf="COLUMN_REF",bb="COLUMN_PARAM",UC="TABLE_REF",$C="LITERAL",zC="INTERVAL",_b="ORDER_BY",wb="CAST",vb="CASE",Sb="WHEN",Ib="UNARY",jC="UNARY_POSTFIX",Tb="BINARY",Ab="BETWEEN",Eb="NOT_BETWEEN",Mb="LOGICAL_OPERATOR",Nb="IN",Ob="FUNCTION",$l="AGGREGATE",kf="WINDOW",Rb="WINDOW_DEF",Db="WINDOW_FRAME",qC="EXPRESSION",Bf="FRAGMENT",Lb="VERBATIM",Pf="PARAM",VC="WITH_CLAUSE",Fb="SELECT_CLAUSE",Cb="FROM_CLAUSE";var YC="SAMPLE_CLAUSE";var kb="WINDOW_CLAUSE";var Bb="SELECT_QUERY",Pb="DESCRIBE_QUERY",Ub="SET_OPERATION";function nn(e){return e instanceof Je}var Je=class{constructor(t){this.type=t}},Bt=class extends Je{};var zl=class extends Bt{constructor(t){super($C),this.value=t}toString(){return wT(this.value)}};function wT(e){switch(typeof e){case"number":return Number.isFinite(e)?`${e}`:"NULL";case"string":return`'${e.replace("'","''")}'`;case"boolean":return e?"TRUE":"FALSE";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(r,n,i)?`DATE '${r}-${n+1}-${i}'`:`epoch_ms(${t})`}else return e instanceof RegExp?`'${e.source}'`:`${e}`}}var ro=class extends Bt{constructor(t){super(Pf),this.param=t}get value(){return this.param.value}toString(){return wT(this.value)}};function vT(e){return e.split(".")}function no(e){return`"${e}"`}function $b(e){return e&&EG(e)?e.slice(1,-1):e}function EG(e){return e[0]==='"'&&e[e.length-1]==='"'}function mc(e){return e instanceof Uf}var Uf=class extends Bt{constructor(t){super(UC),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>no(t)).join(".")}};var jl=class extends Bt{constructor(t,r=[]){super(Ob),this.name=t,this.args=r}toString(){let{name:t,args:r}=this;return`${t}(${r.join(", ")})`}};function we(e,...t){return new jl(e,Ip(t).map(qt))}function ee(e,...t){return new Ap(e,Ip(t).map(qt))}function Mi(e,...t){return new ql(new Tp(e,Ip(t).map(qt)))}function $n(e,t=qt){return e.flat().filter(r=>r!=null).map(r=>t(r))}function Ip(e){let t=e.length,r=t;for(;r>0&&e[r-1]===void 0;--r);return r<t?e.slice(0,r):e}function Ni(e){return typeof e=="string"}function Ep(e){return Array.isArray(e)}function io(e){return e&&typeof e.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}var Np=class extends Je{constructor(t,r){super(kb),this.name=t,this.def=r}toString(){return`${no(this.name)} AS ${this.def}`}},ql=class e extends Bt{constructor(t,r=new Vl){super(kf),this.func=t,this.def=r}over(t){return new e(this.func,this.def.over(t))}partitionby(...t){return new e(this.func,this.def.partitionby(...t))}orderby(...t){return new e(this.func,this.def.orderby(...t))}rows(t){return new e(this.func,this.def.rows(t))}range(t){return new e(this.func,this.def.range(t))}toString(){return`${this.func} OVER ${this.def}`}},Tp=class extends jl{constructor(t,r){super(t,r)}},Vl=class extends Je{constructor(t,r,n,i){super(Rb),this.name=t,this.partition=r,this.order=n,this.frame=i}over(t){return Mp(this,{name:t})}partitionby(...t){return Mp(this,{partition:$n(t)})}orderby(...t){return Mp(this,{order:$n(t)})}rows(t){return Mp(this,{frame:new Op(t)})}range(t){return Mp(this,{frame:new Op(t,!0)})}toString(){let{name:t,partition:r,order:n,frame:i}=this,o=t&&no(t),s=[o,r?.length&&`PARTITION BY ${r.join(", ")}`,n?.length&&`ORDER BY ${n.join(", ")}`,i].filter(a=>a);return o&&s.length<2?o:`(${s.join(" ")})`}},Op=class extends Je{constructor(t,r=!1,n=void 0){super(Db),this.extent=io(t)?new ro(t):t,this.range=r,this.exclude=n}toString(){let{range:t,exclude:r,extent:n}=this,i=t?"RANGE":"ROWS",[o,s]=nn(n)?n.value:n,a=WC(o,"PRECEDING"),c=WC(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${c}${r?` ${r}`:""}`}};function Mp(e,t){return new Vl(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function WC(e,t){return e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} ${t}`:`UNBOUNDED ${t}`}function yc(e){return e instanceof Ws}var Ws=class extends Bt{constructor(t,r){super(t),this.table=r}get column(){return null}toString(){let{column:t,table:r}=this,n=`${r??""}`,i=t==="*"?"*":no(t);return(n?n+".":"")+i}},Rp=class extends Ws{constructor(t,r){super(Cf,r),this.name=t}get column(){return this.name}};var Dp=class extends Ws{constructor(t,r){super(bb,r),this.param=t}get column(){return`${this.param.value}`}};function Gs(e,t){let r=Yl(t);return io(e)?new Dp(new ro(e),r):new Rp(e,r)}var Wl=class extends Bt{constructor(t){super(Lb),this.value=t}toString(){return this.value}};function Er(e){return new zl(e)}function GC(e){return new Wl(e)}function zb(...e){let t=$n(e,String);return t?.length?new Uf(t):void 0}function qt(e){return Ni(e)?MG(e):Xl(e)}function Gl(e){return Ni(e)?GC(e):Xl(e)}function Xl(e){return e instanceof Bt?e:io(e)?new ro(e):Er(e)}function Yl(e){return Ni(e)?NG(e):Ep(e)?zb(e):e}function MG(e){let t=vT(e);return Gs(t.pop(),zb(t))}function NG(e){return zb(vT(e))}function ST(){return new Vl}var Ap=class e extends Bt{constructor(t,r,n,i){super($l),this.name=t,this.args=r,this.isDistinct=n,this.filter=i}distinct(t=!0){return new e(this.name,this.args,t,this.filter)}where(t){return Ni(t)&&(t=Gl(t)),new e(this.name,this.args,this.isDistinct,t)}window(){return new ql(this)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}toString(){let{name:t,args:r,isDistinct:n,filter:i}=this,o=n?"DISTINCT ":"",s=r?.length?r.join(", "):"*",a=i?` FILTER (WHERE ${i})`:"";return`${t}(${o}${s})${a}`}},XC=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];var jb=class extends Bt{constructor(t,r,n){super(t),this.expr=r,this.extent=n}toSQL(t){let{extent:r,expr:n}=this;return r?`(${n} ${t} ${r[0]} AND ${r[1]})`:""}},Hl=class extends jb{constructor(t,r){super(Ab,t,r)}toString(){return super.toSQL("BETWEEN")}},Lp=class extends jb{constructor(t,r){super(Eb,t,r)}toString(){return super.toSQL("NOT BETWEEN")}};var Fp=class extends Bt{constructor(t,r,n){super(Tb),this.op=t,this.left=r,this.right=n}toString(){return`(${this.left} ${this.op} ${this.right})`}};var $f=class e extends Bt{constructor(t=void 0,r=[],n=void 0){super(vb),this.expr=t,this._when=r,this._else=n}when(t,r){return new e(this.expr,this._when.concat(new zf(qt(t),qt(r))),this._else)}else(t){return new e(this.expr,this._when,qt(t))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}},zf=class extends Je{constructor(t,r){super(Sb),this.when=t,this.then=r}toString(){return`WHEN ${this.when} THEN ${this.then}`}};var Cp=class extends Bt{constructor(t,r){super(wb),this.expr=t,this.cast=r}toString(){return`(${this.expr})::${this.cast}`}};var kp=class extends Bt{constructor(t){super(Bf),this.spans=t}toString(){return this.spans.join("")}};var Bp=class extends Je{constructor(t,r=!1,n=void 0,i=void 0){super(YC),this.size=t,this.perc=r,this.method=n,this.seed=i}toString(){let{size:t,perc:r,method:n,seed:i}=this,o=r?"%":" ROWS",s=i!=null?`, ${i}`:"";return`${t}${o}${n?` (${n}${s})`:""}`}};var Pp=class extends Je{constructor(t,r){super(Fb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this;return!r||OG(t,r)?`${t}`:`${t} AS ${no(r)}`}};function OG(e,t){return e instanceof Ws&&e.table==null&&e.column===t}var Up=class extends Je{constructor(t,r){super(VC),this.name=t,this.query=r}toString(){return`"${this.name}" AS (${this.query})`}};function qb(e){return e instanceof ft}function gc(e){return e instanceof Zl}function IT(e){return e instanceof $p}var ft=class extends Bt{static select(...t){return new Zl().select(...t)}static from(...t){return new Zl().from(...t)}static with(...t){return new Zl().with(...t)}static union(...t){return new Ql("UNION",t.flat())}static unionAll(...t){return new Ql("UNION ALL",t.flat())}static intersect(...t){return new Ql("INTERSECT",t.flat())}static except(...t){return new Ql("EXCEPT",t.flat())}static describe(t){return new $p(t)}constructor(t){super(t),this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}orderby(...t){return this._orderby=this._orderby.concat($n(t)),this}limit(t){return this._limit=Number.isFinite(t)?t:void 0,this}offset(t){return this._offset=Number.isFinite(t)?t:void 0,this}},Zl=class e extends ft{constructor(){super(Bb),this._with=[],this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){let t=this.cteFor||this,n=(t instanceof e?t._with:[]).reduce((o,s)=>(o[s.name]=s.query,o),{}),i=[];return this._from.forEach(({expr:o})=>{if(qb(o))i.push(o);else if(mc(o)){let s=n[o.name];s&&i.push(s)}}),i}clone(){return Object.assign(new e,this)}with(...t){let r=[],n=(i,o)=>{let s=o.clone();s.cteFor=this,r.push(new Up(i,s))};return t.flat().forEach(i=>{if(i!=null)for(let o in i)n(o,i[o])}),this._with=this._with.concat(r),this}select(...t){let r=[],n=(o,s)=>r.push(new Pp(o==null?o:qt(o),$b(s)));t.flat().forEach(o=>{if(o!=null)if(Ni(o))n(o,o);else if(yc(o))n(o,o.column);else if(Ep(o))n(o[1],o[0]);else for(let s in o)n(o[s],s)});let i=new Set(r.map(o=>o.alias));return this._select=this._select.filter(o=>!i.has(o.alias)).concat(r.filter(o=>o.expr)),this}setSelect(...t){return this._select=[],this.select(...t)}distinct(t=!0){return this._distinct=!!t,this}from(...t){let r=[],n=(i,o)=>r.push(new zp(Yl(i),$b(o)));return t.flat().forEach(i=>{if(i!=null)if(Ni(i))n(i,i);else if(mc(i))n(i,i.name);else if(nn(i))n(i);else if(Ep(i))n(i[1],i[0]);else for(let o in i)n(i[o],o)}),this._from=this._from.concat(r),this}setFrom(...t){return this._from=[],this.from(...t)}sample(t,r,n){let i;if(typeof t=="number"){let o=t>0&&t<1,s=o?t*100:Math.floor(t);i=new Bp(s,o,r,n)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat($n(t,Gl)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat($n(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat($n(t,Gl)),this}window(...t){let r=[];return t.flat().forEach(n=>{if(n!=null)for(let i in n)r.push(new Np($b(i),n[i]))}),this._window=this._window.concat(r),this}qualify(...t){return this._qualify=this._qualify.concat($n(t,Gl)),this}toString(){let{_with:t,_select:r,_distinct:n,_from:i,_sample:o,_where:s,_groupby:a,_having:c,_window:l,_qualify:u,_orderby:f,_limit:d,_offset:h}=this,p=[];if(t.length&&p.push(`WITH ${t.join(", ")}`),p.push(`SELECT${n?" DISTINCT":""} ${r.join(", ")}`),i.length&&p.push(`FROM ${i.join(", ")}`),s.length){let m=s.map(String).filter(y=>y).join(" AND ");m&&p.push(`WHERE ${m}`)}if(o&&p.push(`USING SAMPLE ${o}`),a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let m=c.map(String).filter(y=>y).join(" AND ");m&&p.push(`HAVING ${m}`)}if(l.length&&p.push(`WINDOW ${l.join(", ")}`),u.length){let m=u.map(String).filter(y=>y).join(" AND ");m&&p.push(`QUALIFY ${m}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(d)&&p.push(`LIMIT ${d}`),Number.isFinite(h)&&p.push(`OFFSET ${h}`),p.join(" ")}},$p=class e extends Je{constructor(t){super(Pb),this.query=t}clone(){return new e(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}},Ql=class e extends ft{constructor(t,r){super(Ub),this.op=t,this.queries=r}get subqueries(){let{queries:t,cteFor:r}=this;return r&&t.forEach(n=>n.cteFor=r),t}clone(){let{op:t,queries:r,...n}=this;return Object.assign(new e(t,r),n)}toString(){let{op:t,queries:r,_orderby:n,_limit:i,_offset:o}=this,s=[r.join(` ${t} `)];return n.length&&s.push(`ORDER BY ${n.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};var zp=class extends Je{constructor(t,r){super(Cb),this.expr=t,this.alias=r}toString(){let{expr:t,alias:r}=this,n=qb(t)?`(${t})`:`${t}`;return r&&!(mc(t)&&t.table.join(".")===r)?`${n} AS ${no(r)}`:`${n}`}};var jp=class extends Bt{constructor(t,r){super(Nb),this.expr=t,this.values=r}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}};var qp=class extends Bt{constructor(t,r=1){super(zC),this.name=t,this.steps=r}toString(){return`INTERVAL ${this.steps} ${this.name}`}};var Vb=class extends Bt{constructor(t,r){super(Mb),this.op=t,this.clauses=r}toString(){let t=this.clauses;return t.length===0?"":t.length===1?`${t[0]}`:`(${t.join(` ${this.op} `)})`}},Vp=class extends Vb{constructor(t){super("AND",t)}},Yp=class extends Vb{constructor(t){super("OR",t)}};var jf=class extends Bt{constructor(t,r,n){super(_b),this.expr=t,this.desc=r,this.nullsFirst=n}toString(){let{expr:t,desc:r,nullsFirst:n}=this;return`${t}${r?" DESC":r===!1?" ASC":""}${n?" NULLS FIRST":n===!1?" NULLS LAST":""}`}};var Yb=class extends Bt{constructor(t,r,n){super(t),this.op=r,this.expr=n}},Wp=class extends Yb{constructor(t,r){super(Ib,t,r)}toString(){return`(${this.op} ${this.expr})`}},Gp=class extends Yb{constructor(t,r){super(jC,t,r)}toString(){return`(${this.expr} ${this.op})`}};function xc(e,t){return ee("arg_max",e,t)}function bc(e,t){return ee("arg_min",e,t)}function TT(e){return ee("array_agg",e)}function Xp(e){return ee("avg",e)}function AT(e,t){return ee("corr",e,t)}function Mr(e){return ee("count",e)}function ET(e,t){return ee("covar_samp",e,t)}function MT(e,t){return ee("covar_pop",e,t)}function NT(e){return ee("entropy",e)}function OT(e){return ee("first",e)}function RT(e){return ee("kurtosis",e)}function DT(e){return ee("mad",e)}function zr(e){return ee("max",e)}function LT(e){return ee("median",e)}function zn(e){return ee("min",e)}function FT(e){return ee("mode",e)}function CT(e){return ee("last",e)}function kT(e){return ee("product",e)}function BT(e,t){return ee("quantile",e,t)}function Hp(e,t){return ee("regr_avgx",e,t)}function PT(e,t){return ee("regr_avgy",e,t)}function Qp(e,t){return ee("regr_count",e,t)}function UT(e,t){return ee("regr_intercept",e,t)}function $T(e,t){return ee("regr_sxx",e,t)}function zT(e,t){return ee("regr_syy",e,t)}function jT(e,t){return ee("regr_slope",e,t)}function qT(e){return ee("skewness",e)}function Zp(e){return ee("stddev",e)}function VT(e){return ee("stddev_pop",e)}function YT(e){return ee("string_agg",e)}function de(e){return ee("sum",e)}function WT(e){return ee("var_samp",e)}function GT(e){return ee("var_pop",e)}function Xs(e,t,r){return e?new $f(void 0,[new zf(qt(e),qt(t))],qt(r)):new $f}function qf(e,t){return new Cp(qt(e),t)}function ve(e){return qf(e,"INTEGER")}function XT(e){return qf(e,"FLOAT")}function Ge(e){return qf(e,"DOUBLE")}function Wb(e,t){return new qp(e,t)}function HT(e){return we("epoch_ms",e)}function QT(e,t,r=1){return we("time_bucket",Wb(t,r),e)}function ZT(e){return we("make_date",2012,we("month",e),1)}function KT(e){let t=qt(e);return we("make_date",2012,we("month",t),we("day",t))}function JT(e){return we("make_date",2012,1,we("day",e))}function tA(...e){return we("greatest",...e)}function Gb(e){return we("exp",e)}function eA(e){return we("log",e)}function Vf(e){return we("ln",e)}function oo(e){return we("sign",e)}function Nr(e){return we("abs",e)}function Hs(e){return we("sqrt",e)}function rA(e){return we("ceil",e)}function Or(e){return we("floor",e)}function Qs(e,t){return we("round",e,t)}function RG(e,t){return new Wp(e,qt(t))}function HC(e,t){return new Gp(e,qt(t))}function jn(e,t,r){return new Fp(e,qt(t),qt(r))}function QC(e,t,r=!1){let n=r?Lp:Hl;return new n(qt(e),t?.map(qt))}function on(...e){return new Vp($n(e))}function Oi(...e){return new Yp($n(e))}function nA(e){return RG("NOT",e)}function Kl(e){return HC("IS NULL",e)}function Ri(e){return HC("IS NOT NULL",e)}function Kp(e,t){return jn("&",e,t)}function te(e,t){return jn("+",e,t)}function It(e,t){return jn("-",e,t)}function Nt(e,t){return jn("*",e,t)}function se(e,t){return jn("/",e,t)}function ir(e,t){return jn("**",e,t)}function iA(e,t){return jn("=",e,t)}function so(e,t){return jn("<>",e,t)}function ze(e,t){return jn("<",e,t)}function Di(e,t){return jn(">",e,t)}function ri(e,t){return jn("<=",e,t)}function oA(e,t){return jn(">=",e,t)}function sA(e,t){return jn("IS DISTINCT FROM",e,t)}function Yf(e,t){return jn("IS NOT DISTINCT FROM",e,t)}function jr(e,t){return QC(e,t,!1)}function aA(e,t){return QC(e,t,!0)}function cA(e,t){return new jp(qt(e),t.map(qt))}function lA(e,t){return new jf(qt(e),!1,t)}function uA(e,t){return new jf(qt(e),!0,t)}function Jp(e){return we("st_asgeojson",e)}function ZC(e){return we("st_x",e)}function KC(e){return we("st_y",e)}function tm(e){return we("st_centroid",e)}function fA(e){return ZC(tm(e))}function dA(e){return KC(tm(e))}function tr(e,...t){return new kp(DG(e,t))}function DG(e,t){let r=[e[0]],n=t.length;for(let i=0,o=0;i<n;){let s=t[i];nn(s)?r[++o]=s:io(s)?r[++o]=new ro(s):r[o]+=Ni(s)?s:Er(s);let a=e[++i];nn(r[o])?r[++o]=a:r[o]+=a}return r.filter(i=>i).map(i=>Ni(i)?new Wl(i):i)}function Xb(e,t,...r){return we(e,t,...Ip(r).map(Xl))}function hA(e,t,r){return Xb("regexp_matches",e,t,r)}function pA(e,t){return Xb("contains",e,t)}function mA(e,t){return Xb("starts_with",e,t)}function yA(e,t){return Xb("ends_with",e,t)}function gA(){return Mi("row_number")}function xA(){return Mi("rank")}function bA(){return Mi("dense_rank")}function _A(){return Mi("percent_rank")}function wA(){return Mi("cume_dist")}function vA(e){return Mi("ntile",e)}function SA(e,t,r){return Mi("lag",e,t,r)}function Wf(e,t,r){return Mi("lead",e,t,r)}function IA(e){return Mi("first_value",e)}function TA(e){return Mi("last_value",e)}function AA(e,t){return Mi("nth_value",e,t)}var Hb={[$l]:["args","filter"],[Ab]:["expr","extent"],[Tb]:["left","right"],[vb]:["expr","_when","_else"],[wb]:["expr"],[bb]:["param","table"],[Cf]:["table"],[Pb]:["query"],[qC]:["node"],[Bf]:["spans"],[Cb]:["expr"],[Ob]:["args"],[Nb]:["expr","values"],[Mb]:["clauses"],[Eb]:["expr","extent"],[_b]:["expr"],[Pf]:["value"],[Fb]:["expr"],[Bb]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[Ub]:["subqueries","_orderby"],[Ib]:["expr"],[Sb]:["when","then"],[kf]:["func","def"],[kb]:["def"],[Rb]:["partition","order","frame"],[Db]:["extent"]};function em(e,t){if(t.has(e))return t.get(e);if(nn(e)){let r=Hb[e.type],n=r?.length??0;for(let i=0;i<n;++i){let o=r[i],s=e[o];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)s[c]=em(s[c],t)}else s&&(e[o]=em(s,t))}}return e}function zo(e,t){if(!nn(e))return;let r=t(e);if(r)return r;let n=Hb[e.type],i=n?.length??0;for(let o=0;o<i;++o){let s=e[n[o]];if(Array.isArray(s)){let a=s.length;for(let c=0;c<a;++c)if(s[c]&&+zo(s[c],t)<0)return r}else if(s&&+zo(s,t)<0)return-1}}var LG=new RegExp(`^(${XC.join("|")})$`),FG=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\()/g;function CG(e){return e.split(FG).some(t=>t.endsWith("(")&&LG.test(t.slice(0,-1)))}function ni(e){let t=0;return zo(e,r=>{switch(r.type){case kf:return-1;case $l:return t|=1,-1;case Bf:case Lb:{let n=`${r}`.toLowerCase(),i=n.indexOf("(select ");return i>=0&&(n=n.slice(0,i)),n.includes(") over ")?-1:CG(n)?(t|=2,-1):1}}}),t}function EA(e){let t=new Set;return zo(e,r=>{r.type===$l&&t.add(r)}),Array.from(t)}function Gf(e){let t={};return zo(e,r=>{r.type===Cf&&(t[r]=r)}),Object.values(t)}function MA(e){let t=new Set;return zo(e,r=>{r.type===Pf&&t.add(r.param)}),Array.from(t)}function _c(e,t,{replace:r=!1,temp:n=!1,view:i=!1}={}){return"CREATE"+(r?" OR REPLACE ":" ")+(n?"TEMP ":"")+(i?"VIEW":"TABLE")+(r?" ":" IF NOT EXISTS ")+e+" AS "+t}function NA(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function OA(e){return`INSTALL ${e}; LOAD ${e}`}function JC(e,{columns:t=Object.keys(e?.[0]||{})}={}){let r=[];if(Array.isArray(t)?(r=t,t=r.reduce((i,o)=>(i[o]=o,i),{})):t&&(r=Object.keys(t)),!r.length)throw new Error("Can not create table from empty column set.");let n=[];for(let i of e){let o=r.map(s=>`${Xl(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function Qb(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=kG({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return _c(t,p,{view:a,temp:c,replace:l})}function DA(e,t,r){return Qb("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function LA(e,t,r){return Qb("read_json",e,t,r,{auto_detect:!0,format:"auto"})}function FA(e,t,r){return Qb("read_parquet",e,t,r)}function CA(e,t,r={}){let{options:n,...i}=r;if(n){let o=Array.isArray(n)?n.join(", "):typeof n=="string"?n:Object.entries(n).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return Qb("st_read",e,t,i)}function kA(e,t,r={}){let{select:n=["*"],...i}=r,o=JC(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return _c(e,s,i)}function kG(e){return Object.entries(e).map(([t,r])=>`${t}=${RA(r)}`).join(", ")}function RA(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>RA(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${RA(r)}`).join(", ")+"}";default:return e}}function BA(e,t,r,n,i){let o=i?It(r,Ge(e)):It(Ge(e),t),s=r===t?0:n/(r-t);return s?Nt(o,Ge(s)):o}function PA(e,t,r,n,i,o){return e.select({index:te(ve(Or(t)),Nt(ve(Or(r)),i)),...n}).groupby("index",o)}function UA(e,t,r){let n=r?s=>Nt(s,r):s=>s,i=Or(t),o=te(i,1);return ft.from(ft.unionAll(e.clone().select({i:ve(i),w:n(It(o,t))}),e.clone().select({i:ve(o),w:n(It(t,i))}))).select({index:"i",density:de("w")}).groupby("index").having(so("density",0))}function BG(e){return e}function $A(e,t,r,n,i,o){let s=n?g=>Nt(g,n):BG,a=(g,x)=>e.clone().select({xp:t,yp:r,i:g,w:x}),c=(g,x)=>te(g,Nt(x,i)),l=ve(Or(t)),u=ve(Or(r)),f=te(l,1),d=te(u,1),h=It(t,l),p=It(f,t),m=It(r,u),y=It(d,r);return ft.from(ft.unionAll(a(c(l,u),s(Nt(p,y))),a(c(l,d),s(Nt(p,m))),a(c(f,u),s(Nt(h,y))),a(c(f,d),s(Nt(h,m))))).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function zA(e,t,r,n,i,o,s=[],a=!0){e.select({x:ve(Or(t)),y:ve(Or(r))});let c=s.concat(n),l=ft.from(e).select(c,{x0:"x",y0:"y",dx:It(Wf("x").over("sw"),"x"),dy:It(Wf("y").over("sw"),"y")}).window({sw:ST().partitionby(c).orderby(lA("x"))}).qualify([Oi(ze("x0",i),ze(te("x0","dx"),i)),Oi(ze("y0",o),ze(te("y0","dy"),o)),Oi(Di("x0",0),Di(te("x0","dx"),0)),Oi(Di("y0",0),Di(te("y0","dy"),0))]),u=ft.select({x:tA(zr(Nr("dx")),zr(Nr("dy")))}).from("pairs"),f=ft.select({i:ve(tr`UNNEST(range((${u})))`)}),d=ft.unionAll(ft.select(c,{x:te("x0","i"),y:te("y0",ve(Qs(se(Nt("i","dy"),"dx"))))}).from("pairs","indices").where([ri(Nr("dy"),Nr("dx")),ze("i",Nr("dx"))]),ft.select(c,{x:te("x0",ve(Qs(se(Nt(Nt(oo("dy"),"i"),"dx"),"dy")))),y:te("y0",Nt(oo("dy"),"i"))}).from("pairs","indices").where([Di(Nr("dy"),Nr("dx")),ze("i",Nr("dy"))]),ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(Kl("dx"))),h=ft.from("raster").select(c,"x","y",a?{w:se(1,Mr().partitionby(["x"].concat(c)))}:null).where([ri(0,"x"),ze("x",i),ri(0,"y"),ze("y",o)]);return ft.with({pairs:l,indices:f,raster:d,points:h}).from("points").select(s,{index:te("x",Nt("y",ve(i))),density:a?de("w"):Mr()}).groupby("index",s)}function jA(e,t,r,n,i=[]){let o=ve(Or(t)),s=a=>ft.from(e).select(a).groupby(o,i);return ft.union(s([{[r]:zn(r),[n]:bc(n,r)},...i]),s([{[r]:zr(r),[n]:xc(n,r)},...i]),s([{[r]:bc(r,n),[n]:zn(n)},...i]),s([{[r]:xc(r,n),[n]:zr(n)},...i])).orderby(i,r)}var Zb=e=>e;function tk(){return{apply:Zb,invert:Zb,sqlApply:qt,sqlInvert:Zb}}function PG({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>Vf(t),sqlInvert:t=>Gb(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>eA(t),sqlInvert:t=>ir(10,t)};{let t=+e;return{apply:r=>Math.log(r)/Math.log(t),invert:r=>Math.pow(t,r),sqlApply:r=>se(Vf(r),Vf(t)),sqlInvert:r=>ir(t,r)}}}function UG({constant:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r)),invert:r=>Math.sign(r)*Math.exp(Math.abs(r)-t),sqlApply:r=>(r=qt(r),Nt(oo(r),Vf(te(t,Nr(r))))),sqlInvert:r=>Nt(oo(r),It(Gb(Nr(r)),t))}}function $G(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),Nt(oo(e),Hs(Nr(e)))),sqlInvert:e=>Nt(oo(e),ir(e,2))}}function zG({exponent:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.pow(Math.abs(r),t),invert:r=>Math.sign(r)*Math.pow(Math.abs(r),1/t),sqlApply:r=>(r=qt(r),Nt(oo(r),ir(Nr(r),t))),sqlInvert:r=>Nt(oo(r),ir(Nr(r),se(1,t)))}}function ek(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Er(+e):qG(e)?Er(+e.value):HT(e),sqlInvert:Zb}}var jG={identity:tk,linear:tk,log:PG,symlog:UG,sqrt:$G,pow:zG,time:ek,utc:ek};function rm(e){let t=jG[e.type];return t?{...e,...t(e)}:null}function qG(e){return e instanceof zl&&e.value instanceof Date}function Kb(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=rk(t^o>>8)),t=rk(t^i&255)}return VG(t)>>>0}function rk(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function VG(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function ik(e,t,r){switch(e.name){case"count":case"sum":return YG(t,e);case"avg":return WG(t,e);case"arg_max":return GG(t,e);case"arg_min":return XG(t,e);case"variance":case"var_samp":return Jb(t,e,r);case"var_pop":return Jb(t,e,r,!1);case"stddev":case"stddev_samp":return Hs(Jb(t,e,r));case"stddev_pop":return Hs(Jb(t,e,r,!1));case"covar_samp":return t1(t,e,r);case"covar_pop":return t1(t,e,r,!1);case"corr":return nk(t,e,r);case"regr_count":return Xf(t,e).expr;case"regr_avgx":return ck(t,e);case"regr_avgy":return lk(t,e);case"regr_syy":return VA(t,0,e,r);case"regr_sxx":return VA(t,1,e,r);case"regr_sxy":return t1(t,e,r,null);case"regr_slope":return uk(t,e,r);case"regr_intercept":return HG(t,e,r);case"regr_r2":return ir(nk(t,e,r),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{let n=ok(e);return t[n]=e,tr`${e.name}("${n}")`}default:return null}}function ok(e){return"pre_"+Kb(`${e}`).toString(16)}function gn(e,t,r){let n=r?.filter;n&&(t=t.filter?t.where(on(n,t.filter)):t.where(n));let i=ok(t);return e[i]=t,i}function sk(e,t){let r=gn(e,Mr(t.args[0]),t);return{expr:de(r),name:r}}function YG(e,t){return de(gn(e,t))}function WG(e,t){let r=gn(e,t),{expr:n,name:i}=sk(e,t);return se(de(Nt(r,i)),n)}function GG(e,t){let r=gn(e,t),n=gn(e,zr(t.args[1]),t);return xc(r,n)}function XG(e,t){let r=gn(e,t),n=gn(e,zn(t.args[1]),t);return bc(r,n)}function Jb(e,t,r,n=!0){let i=t.args[0],{expr:o}=sk(e,t),s=It(i,r(i)),a=gn(e,de(ir(s,2)),t),c=gn(e,de(s),t),l=n?It(o,1):o;return se(It(de(a),se(ir(de(c),2),o)),l)}function t1(e,t,r,n=!0){let{expr:i}=Xf(e,t),o=ak(e,t,r),s=nm(e,1,t,r),a=nm(e,0,t,r),c=It(o,se(Nt(s,a),i));return n===null?c:n?se(c,It(i,1)):se(c,i)}function nk(e,t,r){let{expr:n}=Xf(e,t),i=ak(e,t,r),o=qA(e,1,t,r),s=qA(e,0,t,r),a=nm(e,1,t,r),c=nm(e,0,t,r),l=It(o,se(ir(a,2),n)),u=It(s,se(ir(c,2),n));return se(It(i,se(Nt(a,c),n)),Hs(Nt(l,u)))}function Xf(e,t){let[r,n]=t.args,i=gn(e,Qp(r,n),t);return{expr:de(i),name:i}}function nm(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(It(o,n(o))).where(Ri(s));return de(gn(e,a,r))}function qA(e,t,r,n){let i=r.args,o=i[t],s=i[1-t],a=de(ir(It(o,n(o)),2)).where(Ri(s));return de(gn(e,a,r))}function ak(e,t,r){let[n,i]=t.args,o=de(Nt(It(i,r(i)),It(n,r(n))));return de(gn(e,o,t))}function ck(e,t){let[r,n]=t.args,{expr:i,name:o}=Xf(e,t),s=gn(e,Hp(r,n),t);return se(de(Nt(s,o)),i)}function lk(e,t){let[r,n]=t.args,{expr:i,name:o}=Xf(e,t),s=gn(e,PT(r,n),t);return se(de(Nt(s,o)),i)}function VA(e,t,r,n){let{expr:i}=Xf(e,r),o=nm(e,t,r,n),s=qA(e,t,r,n);return It(s,se(ir(o,2),i))}function uk(e,t,r){let n=t1(e,t,r,null),i=VA(e,1,t,r);return se(n,i)}function HG(e,t,r){let n=ck(e,t),i=lk(e,t),o=uk(e,t,r);return It(i,Nt(o,n))}function fk(e){if(!e.filterStable)return null;let t=e.query();if(!gc(t))return null;let r=e1(t,c=>{let l=c._from[0]?.expr;return mc(l)?l.name:l});if(typeof r!="string")return null;let n=new Map,i={},o={},s=[],a=c=>{let l=c.column,u=e1(t,f=>f._select.find(d=>d.alias===l)?.expr);return tr`(SELECT avg(${u??c}) FROM "${r}")`};for(let{alias:c,expr:l}of t._select){if(ni(l)>1)return null;let u=EA(l);if(u.length===0)s.push(c),i[c]=l;else{for(let f of u){if(f.isDistinct)return null;let d=ik(f,i,a);if(!d)return null;n.set(f,d)}o[c]=em(l,n)}}return n.size?{group:s,preagg:i,output:o}:null}function e1(e,t){let r=e.subqueries;if(gc(e)&&r.length===0)return t(e);let n=e1(r[0],t);for(let i=1;i<r.length;++i){let o=e1(r[i],t);if(o!==void 0&&o!==n)return NaN}return n}var QG={skip:!0,result:null},r1=class{constructor(t,{schema:r="mosaic",enabled:n=!0}={}){this.entries=new Map,this.active=null,this.mc=t,this._schema=r,this._enabled=n}set enabled(t){this._enabled!==t&&(t||this.clear(),this._enabled=t)}get enabled(){return this._enabled}set schema(t){this._schema!==t&&(this.clear(),this._schema=t)}get schema(){return this._schema}dropSchema(){return this.clear(),this.mc.exec(`DROP SCHEMA IF EXISTS "${this.schema}" CASCADE`)}clear(){this.entries.clear(),this.active=null}request(t,r,n){if(!this.enabled)return null;let{entries:i,mc:o,schema:s}=this,{source:a}=n;if(!a||this.active&&(this.active.source!==a&&this.clear(),this.active?.source===null))return null;let{active:c}=this;if(!c&&(this.active=c=ZG(n),c.source===null))return null;if(i.has(t))return i.get(t);let l=fk(t),u;if(!l)u=null;else if(r.skip(t,n))u=QG;else{let f=r.remove(a).predicate(t);u=tX(t.query(f),c,l,s),u.result=o.exec([`CREATE SCHEMA IF NOT EXISTS ${s}`,_c(u.table,u.create,{temp:!1})]),u.result.catch(d=>o.logger().error(d))}return i.set(t,u),u}};function ZG(e){let{source:t,meta:r}=e,n=e.predicate,i=Gf(n).map(f=>f.column),o,s;if(!r||!i)return{source:null,columns:s,predicate:o};let{type:a,scales:c,bin:l,pixelSize:u=1}=r;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,qt(f)]));else if(a==="interval"&&c){let f=c.map(d=>JG(d,u,l));f.some(d=>!d)||(f.length===1?(o=d=>d?jr("active0",d.extent.map(f[0])):[],s={active0:f[0](n.expr)}):(o=d=>d?on(d.clauses.map((h,p)=>jr(`active${p}`,h.extent.map(f[p])))):[],s=Object.fromEntries(n.clauses.map((d,h)=>[`active${h}`,f[h](d.expr)]))))}return{source:s?t:null,columns:s,predicate:o}}var KG={ceil:rA,round:Qs};function JG(e,t,r){let{type:n,domain:i,range:o,apply:s,sqlApply:a}=rm(e);if(!s)return;let c=KG[`${r}`.toLowerCase()]||Or,l=s(Math.min(...i)),u=s(Math.max(...i)),f=(n==="identity"?1:Math.abs(o[1]-o[0])/(u-l))/t,d=f===1?p=>p:p=>Nt(Ge(f),p),h=l===0?p=>p:p=>It(p,Ge(l));return p=>ve(c(d(h(a(p)))))}function tX(e,t,r,n){let{group:i,output:o,preagg:s}=r,{columns:a}=t,c=e.setSelect({...s,...a}).groupby(Object.keys(a)),[l]=c.subqueries;if(l){let y=Object.values(a).flatMap(g=>Gf(g).map(x=>x.column));eX(l,y)}let u=c._having,f=c._orderby;c._having=[],c._orderby=[];let d=c.toString(),h=(Kb(d)>>>0).toString(16),p=`${n}.preagg_${h}`,m=ft.select(i,o).from(p).groupby(i).having(u).orderby(f);return new YA({table:p,create:d,active:t,select:m})}function eX(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),gc(i)&&i._from.length&&i.select(t),i.subqueries.forEach(n))};n(e)}var YA=class{constructor({table:t,create:r,active:n,select:i}){this.table=t,this.create=r,this.result=null,this.active=n,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}};function WA(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}var rX="count",nX="nulls",iX="max",oX="min",sX="distinct";var aX={[rX]:Mr,[sX]:e=>Mr(e).distinct(),[iX]:zr,[oX]:zn,[nX]:e=>Mr().where(Kl(e))};function cX(e,t,r){return ft.from(e).select(Array.from(r,n=>({[n]:aX[n](t)})))}async function dk(e,t){return t.length===1&&t[0].column==="*"?uX(e,t[0].table):(await Promise.all(t.map(r=>lX(e,r)))).filter(r=>r)}async function lX(e,{table:t,column:r,stats:n}){let i=ft.from({source:t}).select({column:r}).groupby(r.aggregate?tr`ALL`:[]),[o]=Array.from(await e.query(ft.describe(i))),s={table:t,column:`${r}`,sqlType:o.column_type,type:WA(o.column_type),nullable:o.null==="YES"};if(!(n?.length||n?.size))return s;let[a]=await e.query(cX(t,r,n),{persist:!0});return Object.assign(s,a)}async function uX(e,t){let r=await e.query(`DESCRIBE ${Yl(t)}`);return Array.from(r).map(n=>({table:t,column:n.column_name,sqlType:n.column_type,type:WA(n.column_type),nullable:n.null==="YES"}))}var wc=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")}),Jl=class extends Promise{constructor(){let t,r;super((n,i)=>{t=n,r=i}),this._resolve=t,this._reject=r,this._state=wc.pending,this._value=void 0}fulfill(t){if(this._value!==void 0){if(t!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(t===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(t)}return this._state=wc.done,this}ready(t){return this._state=wc.ready,this._value=t,this}reject(t){return this._state=wc.error,this._reject(t),this}get state(){return this._state}};Jl.prototype.constructor=Promise;function n1(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){}}}function fX(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function hk(e,t){let r=[],n=0;function i(){let o=dX(r,t);r=[],n=0;for(let s of o)pX(s,e),gX(s,t)}return{add(o,s){o.request.type==="arrow"?(n=n||fX(()=>i()),r.push({entry:o,priority:s,index:r.length})):e(o,s)}}}function dX(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=hX(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function hX(e,t){let r=`${e}`;if(gc(e)&&!t.get(r)){if(e._orderby.length||e._where.length||e._qualify.length||e._having.length)return r;let n=e.clone().setSelect("*"),i=e._groupby;if(i.length){let o={};e._select.forEach(({alias:s,expr:a})=>o[s]=a),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}else e._select.some(o=>ni(o.expr))&&n.setGroupby("ALL");return`${n}`}else return r}function pX(e,t){if(mX(e))t({request:{type:"arrow",cache:!1,query:e.query=yX(e)},result:e.result=new Jl});else for(let{entry:r,priority:n}of e)t(r,n)}function mX(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let r=1;r<e.length;++r)if(t!==`${e[r].entry.request.query}`)return!0}return!1}function yX(e){let t=e.maps=[],r=new Map;for(let o of e){let{query:s}=o.entry.request,a=[];t.push(a);for(let{alias:c,expr:l}of s._select){let u=`${l}`;r.has(u)||r.set(u,[`col${r.size}`,l]);let[f]=r.get(u);a.push([f,c])}}let n=e[0].entry.request.query.clone(),i=n._groupby;if(i.length){let o={};e.maps[0].forEach(([s,a])=>o[a]=s),n.setGroupby(i.map(s=>yc(s)&&o[s.column]||s))}return n.setSelect(Array.from(r.values()))}async function gX(e,t){let{maps:r,query:n,result:i}=e;if(!r)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=IT(n);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=r[c],d=s&&f?bX(o,f):f?xX(o,f):o;l.cache&&t.set(String(l.query),d),u.fulfill(d)})}function xX(e,t){return e.select(t.map(r=>r[0]),t.map(r=>r[1]))}function bX(e,t){let r=new Map(t),n=[];for(let i of e)r.has(i.column_name)&&n.push({...i,column_name:r.get(i.column_name)});return n}var _X=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,pk=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function mk({max:e=1e3,ttl:t=3*60*60*1e3}={}){let r=new Map;function n(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of r){let{last:l}=c;l<s&&(o=a,s=l),i>l&&r.delete(a)}o&&r.delete(o)}return{get(i){let o=r.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return r.set(i,{last:performance.now(),value:o}),r.size>e&&_X(n),o},clear(){r=new Map}}}var i1=class{constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,r){let n=this.queue[r];if(!n)throw new Error(`Invalid queue priority rank: ${r}`);let i={item:t,next:null};n.head===null?n.head=n.tail=i:n.tail=n.tail.next=i}remove(t){for(let r of this.queue){let{head:n,tail:i}=r;for(let o=null,s=n;s;o=s,s=s.next)t(s.item)&&(s===n?n=s.next:o.next=s.next,s===i&&(i=o||n));r.head=n,r.tail=i}}next(){for(let t of this.queue){let{head:r}=t;if(r!==null)return t.head=r.next,t.tail===r&&(t.tail=null),r.item}}};var jo=Object.freeze({High:0,Normal:1,Low:2}),o1=class{constructor(t=32){this.queue=new i1(3),this.db=null,this.clientCache=null,this._logger=n1(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=t,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;let{request:t,result:r}=this.queue.next();this.pendingResults.push(r),t.type==="exec"&&(this.pendingExec=!0),this.submit(t,r).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==wc.pending;){let n=this.pendingResults.shift();n.state===wc.ready?n.fulfill():n.state===wc.done&&this._logger.warn("Found resolved query in pending results.")}t.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,r=jo.Normal){this.queue.insert(t,r),this.next()}async submit(t,r){try{let{query:n,type:i,cache:o=!1,options:s}=t,a=n?`${n}`:null;if(o){let f=this.clientCache.get(a);if(f){let d=await f;this._logger.debug("Cache"),r.ready(d);return}}let c=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:a,...s});let l=this.db.query({type:i,sql:a,...s});o&&this.clientCache.set(a,l);let u=await l;o&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-c).toFixed(1)}`),r.ready(i==="exec"?null:u)}catch(n){r.reject(n)}}cache(t){return t!==void 0?this.clientCache=t===!0?mk():t||pk():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=hk(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,r=jo.Normal){let n=new Jl,i={request:t,result:n};return this._consolidate?this._consolidate.add(i,r):this.enqueue(i,r),n}cancel(t){let r=new Set(t);if(r.size){this.queue.remove(({result:n})=>r.has(n)?(n.reject("Canceled"),!0):!1);for(let n of this.pendingResults)r.has(n)&&n.reject("Canceled")}}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0));for(let t of this.pendingResults)t.reject("Cleared");this.pendingResults=[]}};var s1;function Li(e){return e?s1=e:s1==null&&(s1=new im),s1}var im=class{constructor(t=xb(),{logger:r=console,manager:n=new o1,cache:i=!0,consolidate:o=!0,preagg:s={}}={}){this.manager=n,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(r),this.clear(),this.preaggregator=new r1(this,s)}clear({clients:t=!0,cache:r=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(n=>n.disconnect()),this.filterGroups=new Map,this.clients?.forEach(n=>this.disconnect(n)),this.clients=new Set),r&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||n1(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=jo.Normal}={}){return t=Array.isArray(t)?t.filter(n=>n).join(`;
|
|
2
|
+
`):t,this.manager.request({type:"exec",query:t},r)}query(t,{type:r="arrow",cache:n=!0,priority:i=jo.Normal,...o}={}){return this.manager.request({type:r,query:t,cache:n,options:o},i)}prefetch(t,r={}){return this.query(t,{...r,cache:!0,priority:jo.Low})}createBundle(t,r,n=jo.Low){let i={name:t,queries:r.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},n)}loadBundle(t,r=jo.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=jo.Normal){return t.queryPending(),this.query(r,{priority:n}).then(i=>t.queryResult(i).update(),i=>{this._logger.error(i),t.queryError(i)}).catch(i=>this._logger.error(i))}requestQuery(t,r){return this.preaggregator.clear(),r?this.updateClient(t,r):Promise.resolve(t.update())}async connect(t){let{clients:r}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this,this.initializeClient(t),wX(this,t.filterBy,t)}async initializeClient(t){let r=t.fields();return r?.length&&t.fieldInfo(await dk(this,r)),t.requestQuery()}disconnect(t){let{clients:r,filterGroups:n}=this;if(!r.has(t))return;r.delete(t),t.coordinator=null;let i=n.get(t.filterBy);i&&i.clients.delete(t)}};function wX(e,t,r){if(!t)return;let n=e.filterGroups.get(t);if(!n){let i=s=>vX(e,t,s),o=()=>SX(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),n={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,n)}n.clients.add(r)}function vX(e,t,r){let{preaggregator:n,filterGroups:i}=e,{clients:o}=i.get(t);for(let s of o)n.request(s,t,r)}function SX(e,t){let{preaggregator:r,filterGroups:n}=e,{clients:i}=n.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{let a=r.request(s,t,o),c=a?null:t.predicate(s);if(a?.skip||!a&&!c)return;let l=a?.query(o.predicate)??s.query(c);return e.updateClient(s,l)}))}var a1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new GA}),this._callbacks.get(t).callbacks.add(r)}removeEventListener(t,r){let n=this._callbacks.get(t);n&&n.callbacks.delete(r)}willEmit(t,r){return r}emitQueueFilter(t,r){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,r){let n=this._callbacks.get(t)||{};if(n.pending)n.queue.enqueue(r,this.emitQueueFilter(t,r));else{let i=this.willEmit(t,r),{callbacks:o,queue:s}=n;if(o?.size){let a=Array.from(o,c=>c(i));n.pending=Promise.allSettled(a).then(()=>{n.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},GA=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,r){let n={value:t};if(r&&this.next){let i=this;for(;i.next;)r(i.next.value)?i=i.next:i.next=i.next.next;i.next=n}else this.next=n}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function om(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?IX(e,t):!0}function IX(e,t){if(e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function or(e){return e instanceof vc}var vc=class e extends a1{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(r=>or(r))){let r=new e,n=()=>{r.update(t.map(i=>or(i)?i.value:i))};return n(),t.forEach(i=>or(i)?i.addEventListener("value",n):0),r}return new e(t)}get value(){return this._value}update(t,{force:r}={}){return om(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function ii(e){return e instanceof qo}function c1(e,t){return new qo(new l1(e),t&&[t].flat())}var qo=class e extends vc{static intersect({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r},n)}static union({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r,union:!0},n)}static single({cross:t=!1,empty:r=!1,include:n=[]}={}){return c1({cross:t,empty:r,single:!0},n)}static crossfilter({empty:t=!1,include:r=[]}={}){return c1({cross:!0,empty:t},r)}constructor(t=new l1,r=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(r))for(let n of r)n._relay.add(this)}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let r=this.clone();return r._value=r._resolved=r._resolver.resolve(this._resolved,{source:t}),r._value.active={source:t},r}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(r=>r.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(r=>r.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(r=>r.update(t)),super.update(this._resolved)}willEmit(t,r){return t==="value"?(this._value=r,this.value):r}emitQueueFilter(t,r){return t==="value"?this._resolver.queueFilter(r):null}skip(t,r){return this._resolver.skip(t,r)}predicate(t,r=!1){let{clauses:n}=this,i=r?null:n.active;return this._resolver.predicate(n,i,t)}},l1=class{constructor({union:t,cross:r,single:n,empty:i}={}){this.union=!!t,this.cross=!!r,this.single=!!n,this.empty=!!i}resolve(t,r,n=!1){let{source:i,predicate:o}=r,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&n&&s.forEach(c=>c.source?.reset?.()),o&&a.push(r),a}skip(t,r){return this.cross&&r?.clients?.has(t)}predicate(t,r,n){let{empty:i,union:o}=this;if(i&&!t.length)return[Er(!1)];if(this.skip(n,r))return;let s=t.filter(a=>!this.skip(n,a)).map(a=>a.predicate);return o&&s.length>1?Oi(s):s}queueFilter(t){if(this.cross){let r=t.active?.source;return n=>n.active?.source!==r}return null}};function yk(e="http://localhost:3000/"){return{async query(t){let r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?r:t.type==="arrow"?pc(await(await r).arrayBuffer()):(await r).json()}}}function xk(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Q(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function gk(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ut(e){return this instanceof Ut?(this.v=e,this):new Ut(e)}function oi(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){n[h]&&(i[h]=function(m){return new Promise(function(y,g){o.push([h,m,y,g])>1||c(h,m)})},p&&(i[h]=p(i[h])))}function c(h,p){try{l(n[h](p))}catch(m){d(o[0][3],m)}}function l(h){h.value instanceof Ut?Promise.resolve(h.value.v).then(u,f):d(o[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Hf(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:Ut(e[i](s)),done:!1}:o?o(s):s}:o}}function ao(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof gk=="function"?gk(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var JA={};Jn(JA,{compareArrayLike:()=>KA,joinUint8Arrays:()=>si,memcpy:()=>cm,rebaseValueOffsets:()=>g1,toArrayBufferView:()=>zt,toArrayBufferViewAsyncIterator:()=>uo,toArrayBufferViewIterator:()=>Yo,toBigInt64Array:()=>y1,toBigUint64Array:()=>LX,toFloat32Array:()=>FX,toFloat32ArrayAsyncIterator:()=>QX,toFloat32ArrayIterator:()=>jX,toFloat64Array:()=>CX,toFloat64ArrayAsyncIterator:()=>ZX,toFloat64ArrayIterator:()=>qX,toInt16Array:()=>OX,toInt16ArrayAsyncIterator:()=>WX,toInt16ArrayIterator:()=>PX,toInt32Array:()=>tu,toInt32ArrayAsyncIterator:()=>GX,toInt32ArrayIterator:()=>UX,toInt8Array:()=>NX,toInt8ArrayAsyncIterator:()=>YX,toInt8ArrayIterator:()=>BX,toUint16Array:()=>RX,toUint16ArrayAsyncIterator:()=>XX,toUint16ArrayIterator:()=>$X,toUint32Array:()=>DX,toUint32ArrayAsyncIterator:()=>HX,toUint32ArrayIterator:()=>zX,toUint8Array:()=>St,toUint8ArrayAsyncIterator:()=>ZA,toUint8ArrayIterator:()=>QA,toUint8ClampedArray:()=>kX,toUint8ClampedArrayAsyncIterator:()=>KX,toUint8ClampedArrayIterator:()=>VX});var TX=new TextDecoder("utf-8"),sm=e=>TX.decode(e),AX=new TextEncoder,Vo=e=>AX.encode(e);var EX=e=>typeof e=="number",bk=e=>typeof e=="boolean",gr=e=>typeof e=="function",xn=e=>e!=null&&Object(e)===e,co=e=>xn(e)&&gr(e.then);var lo=e=>xn(e)&&gr(e[Symbol.iterator]),Fi=e=>xn(e)&&gr(e[Symbol.asyncIterator]),u1=e=>xn(e)&&xn(e.schema);var f1=e=>xn(e)&&"done"in e&&"value"in e;var d1=e=>xn(e)&&gr(e.stat)&&EX(e.fd);var h1=e=>xn(e)&&am(e.body),p1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,_k=e=>xn(e)&&gr(e.abort)&&gr(e.getWriter)&&!p1(e),am=e=>xn(e)&&gr(e.cancel)&&gr(e.getReader)&&!p1(e),wk=e=>xn(e)&&gr(e.end)&&gr(e.write)&&bk(e.writable)&&!p1(e),m1=e=>xn(e)&&gr(e.read)&&gr(e.pipe)&&bk(e.readable)&&!p1(e),vk=e=>xn(e)&&gr(e.clear)&&gr(e.bytes)&&gr(e.position)&&gr(e.setPosition)&&gr(e.capacity)&&gr(e.getBufferIdentifier)&&gr(e.createLong);var HA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function MX(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function cm(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function si(e,t){let r=MX(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?cm(s,o,a):s=o;break}cm(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function zt(e,t){let r=f1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Vo(r)),r instanceof ArrayBuffer?new e(r):r instanceof HA?new e(r):vk(r)?zt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var NX=e=>zt(Int8Array,e),OX=e=>zt(Int16Array,e),tu=e=>zt(Int32Array,e),y1=e=>zt(BigInt64Array,e),St=e=>zt(Uint8Array,e),RX=e=>zt(Uint16Array,e),DX=e=>zt(Uint32Array,e),LX=e=>zt(BigUint64Array,e),FX=e=>zt(Float32Array,e),CX=e=>zt(Float64Array,e),kX=e=>zt(Uint8ClampedArray,e),XA=e=>(e.next(),e);function*Yo(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof HA?r(t):lo(t)?t:r(t);return yield*XA(function*(i){let o=null;do o=i.next(yield zt(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var BX=e=>Yo(Int8Array,e),PX=e=>Yo(Int16Array,e),UX=e=>Yo(Int32Array,e),QA=e=>Yo(Uint8Array,e),$X=e=>Yo(Uint16Array,e),zX=e=>Yo(Uint32Array,e),jX=e=>Yo(Float32Array,e),qX=e=>Yo(Float64Array,e),VX=e=>Yo(Uint8ClampedArray,e);function uo(e,t){return oi(this,arguments,function*(){if(co(t))return yield Ut(yield Ut(yield*Hf(ao(uo(e,yield Ut(t))))));let n=function(s){return oi(this,arguments,function*(){yield yield Ut(yield Ut(s))})},i=function(s){return oi(this,arguments,function*(){yield Ut(yield*Hf(ao(XA(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof HA?n(t):lo(t)?i(t):Fi(t)?t:n(t);return yield Ut(yield*Hf(ao(XA(function(s){return oi(this,arguments,function*(){let a=null;do a=yield Ut(s.next(yield yield Ut(zt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ut(new e)})}var YX=e=>uo(Int8Array,e),WX=e=>uo(Int16Array,e),GX=e=>uo(Int32Array,e),ZA=e=>uo(Uint8Array,e),XX=e=>uo(Uint16Array,e),HX=e=>uo(Uint32Array,e),QX=e=>uo(Float32Array,e),ZX=e=>uo(Float64Array,e),KX=e=>uo(Uint8ClampedArray,e);function g1(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function KA(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var qr={fromIterable(e){return x1(JX(e))},fromAsyncIterable(e){return x1(tH(e))},fromDOMStream(e){return x1(eH(e))},fromNodeStream(e){return x1(rH(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},x1=e=>(e.next(),e);function*JX(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?si(n,s)[0]:([i,n,a]=si(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=QA(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function tH(e){return oi(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=ZA(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.next()):yield Ut(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield Ut(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield Ut(u.return(new Uint8Array(0))))}return yield Ut(null)})}function eH(e){return oi(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?si(i,a)[0]:([o,i,c]=si(i,a),o)}({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0});let u=new eE(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield Ut(u.read()):yield Ut(u.read(a-c)),!r&&o.byteLength>0&&(i.push(St(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield Ut(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield Ut(u.cancel(f)))}finally{n===!1?yield Ut(u.cancel()):e.locked&&u.releaseLock()}return yield Ut(null)})}var eE=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Q(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Q(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=St(r)),r})}},tE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function rH(e){return oi(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?si(l,a)[0]:([u,l,c]=si(l,a),u)}if({cmd:s,size:a}=(yield yield Ut(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ut(new Uint8Array(0)),yield Ut(null);try{r[0]=tE(e,"end"),r[1]=tE(e,"error");do{if(r[2]=tE(e,"readable"),[n,o]=yield Ut(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=St(e.read(a-c)),u.byteLength<a-c&&(u=St(e.read()))):u=St(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ut(f()));while(a<c)}while(!i)}finally{yield Ut(d(r,n==="error"?o:null))}return yield Ut(null);function d(h,p){return u=l=null,new Promise((m,y)=>{for(let[g,x]of h)e.off(g,x);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var he;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(he||(he={}));var Se;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Se||(Se={}));var be;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(be||(be={}));var Xe;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Xe||(Xe={}));var ct;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ct||(ct={}));var xr;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(xr||(xr={}));var Wo=new Int32Array(2),b1=new Float32Array(Wo.buffer),_1=new Float64Array(Wo.buffer),Qf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var lm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(lm||(lm={}));var ai=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Wo[0]=this.readInt32(t),b1[0]}readFloat64(t){return Wo[Qf?0:1]=this.readInt32(t),Wo[Qf?1:0]=this.readInt32(t+4),_1[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){b1[0]=r,this.writeInt32(t,Wo[0])}writeFloat64(t,r){_1[0]=r,this.writeInt32(t,Wo[Qf?0:1]),this.writeInt32(t+4,Wo[Qf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===lm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var eu=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=ai.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=ai.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var um;(function(e){e[e.BUFFER=0]="BUFFER"})(um||(um={}));var fm;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(fm||(fm={}));var v1=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):fm.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):um.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,fm.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,um.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var Zf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Kf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Kf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Zf).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new v1).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Zs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ci).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Sc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Sc||(Sc={}));var dm;(function(e){e[e.DenseArray=0]="DenseArray"})(dm||(dm={}));var ho=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var Go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ho).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):dm.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,dm.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var hm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var pm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Ic=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xe.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Xe.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Xo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var Tc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var Ac=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var Ec=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var Mc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):be.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,be.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var Nc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xr.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,xr.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var mm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var ym=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var gm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var xm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var bm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var Ks=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var Js=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ct.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Se.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,Se.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var _m=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var Ie;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(Ie||(Ie={}));var sn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ie.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Go).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Ie.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Sc.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new sn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Sc.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Vt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Vt||(Vt={}));var D;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var ki;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(ki||(ki={}));var wE={};Jn(wE,{clampRange:()=>Im,createElementComparator:()=>Fc,wrapIndex:()=>ru});var rE={};Jn(rE,{valueToString:()=>mo});function mo(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>mo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var sE={};Jn(sE,{BN:()=>vm,bigNumToBigInt:()=>Ik,bigNumToNumber:()=>oE,bigNumToString:()=>ed,isArrowBigNumSymbol:()=>Sk});function re(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function nE(e,t){return re(e/t)+re(e%t)/re(t)}var Sk=Symbol.for("isArrowBigNum");function yo(e,...t){return t.length===0?Object.setPrototypeOf(zt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}yo.prototype[Sk]=!0;yo.prototype.toJSON=function(){return`"${ed(this)}"`};yo.prototype.valueOf=function(e){return oE(this,e)};yo.prototype.toString=function(){return ed(this)};yo.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oE(this);case"string":return ed(this);case"default":return Ik(this)}return ed(this)};function Jf(...e){return yo.apply(this,e)}function td(...e){return yo.apply(this,e)}function wm(...e){return yo.apply(this,e)}Object.setPrototypeOf(Jf.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(td.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(wm.prototype,Object.create(Uint32Array.prototype));Object.assign(Jf.prototype,yo.prototype,{constructor:Jf,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(td.prototype,yo.prototype,{constructor:td,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(wm.prototype,yo.prototype,{constructor:wm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var nH=BigInt(4294967296)*BigInt(4294967296),iH=nH-BigInt(1);function oE(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of s)c|=(u^iH)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of s)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),f=c/u,d=c%u;return re(f)+re(d)/re(u)}return re(c)}function ed(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return iE(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return iE(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${iE(t)}`}function Ik(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:ed(e)}function iE(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var vm=class e{static new(t,r){switch(r){case!0:return new Jf(t);case!1:return new td(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Jf(t)}return t.byteLength===16?new wm(t):new td(t)}static signed(t){return new Jf(t)}static unsigned(t){return new td(t)}static decimal(t){return new wm(t)}constructor(t,r){return e.new(t,r)}};var Tk,Ak,Ek,Mk,Nk,Ok,Rk,Dk,Lk,Fk,Ck,kk,Bk,Pk,Uk,$k,zk,jk,qk,Vk,Yk,Wk,K=class e{static isNull(t){return t?.typeId===D.Null}static isInt(t){return t?.typeId===D.Int}static isFloat(t){return t?.typeId===D.Float}static isBinary(t){return t?.typeId===D.Binary}static isLargeBinary(t){return t?.typeId===D.LargeBinary}static isUtf8(t){return t?.typeId===D.Utf8}static isLargeUtf8(t){return t?.typeId===D.LargeUtf8}static isBool(t){return t?.typeId===D.Bool}static isDecimal(t){return t?.typeId===D.Decimal}static isDate(t){return t?.typeId===D.Date}static isTime(t){return t?.typeId===D.Time}static isTimestamp(t){return t?.typeId===D.Timestamp}static isInterval(t){return t?.typeId===D.Interval}static isDuration(t){return t?.typeId===D.Duration}static isList(t){return t?.typeId===D.List}static isStruct(t){return t?.typeId===D.Struct}static isUnion(t){return t?.typeId===D.Union}static isFixedSizeBinary(t){return t?.typeId===D.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===D.FixedSizeList}static isMap(t){return t?.typeId===D.Map}static isDictionary(t){return t?.typeId===D.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===Se.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Se.Sparse}constructor(t){this.typeId=t}};Tk=Symbol.toStringTag;K[Tk]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(K.prototype);var bn=class extends K{constructor(){super(D.Null)}toString(){return"Null"}};Ak=Symbol.toStringTag;bn[Ak]=(e=>e[Symbol.toStringTag]="Null")(bn.prototype);var _r=class extends K{constructor(t,r){super(D.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Ek=Symbol.toStringTag;_r[Ek]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_r.prototype);var S1=class extends _r{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},I1=class extends _r{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ho=class extends _r{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},T1=class extends _r{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},A1=class extends _r{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},E1=class extends _r{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},M1=class extends _r{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},N1=class extends _r{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(S1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(I1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ho.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(T1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(A1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(E1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(M1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(N1.prototype,"ArrayType",{value:BigUint64Array});var Bi=class extends K{constructor(t){super(D.Float),this.precision=t}get ArrayType(){switch(this.precision){case be.HALF:return Uint16Array;case be.SINGLE:return Float32Array;case be.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Mk=Symbol.toStringTag;Bi[Mk]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Bi.prototype);var O1=class extends Bi{constructor(){super(be.HALF)}},R1=class extends Bi{constructor(){super(be.SINGLE)}},D1=class extends Bi{constructor(){super(be.DOUBLE)}};Object.defineProperty(O1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(R1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(D1.prototype,"ArrayType",{value:Float64Array});var ta=class extends K{constructor(){super(D.Binary)}toString(){return"Binary"}};Nk=Symbol.toStringTag;ta[Nk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ta.prototype);var ea=class extends K{constructor(){super(D.LargeBinary)}toString(){return"LargeBinary"}};Ok=Symbol.toStringTag;ea[Ok]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ea.prototype);var ra=class extends K{constructor(){super(D.Utf8)}toString(){return"Utf8"}};Rk=Symbol.toStringTag;ra[Rk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ra.prototype);var na=class extends K{constructor(){super(D.LargeUtf8)}toString(){return"LargeUtf8"}};Dk=Symbol.toStringTag;na[Dk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(na.prototype);var ia=class extends K{constructor(){super(D.Bool)}toString(){return"Bool"}};Lk=Symbol.toStringTag;ia[Lk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(ia.prototype);var oa=class extends K{constructor(t,r,n=128){super(D.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Fk=Symbol.toStringTag;oa[Fk]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(oa.prototype);var sa=class extends K{constructor(t){super(D.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Xe[this.unit]}>`}get ArrayType(){return this.unit===Xe.DAY?Int32Array:BigInt64Array}};Ck=Symbol.toStringTag;sa[Ck]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(sa.prototype);var aa=class extends K{constructor(t,r){super(D.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${ct[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};kk=Symbol.toStringTag;aa[kk]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(aa.prototype);var ca=class extends K{constructor(t,r){super(D.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${ct[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Bk=Symbol.toStringTag;ca[Bk]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ca.prototype);var la=class extends K{constructor(t){super(D.Interval),this.unit=t}toString(){return`Interval<${xr[this.unit]}>`}};Pk=Symbol.toStringTag;la[Pk]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(la.prototype);var ua=class extends K{constructor(t){super(D.Duration),this.unit=t}toString(){return`Duration<${ct[this.unit]}>`}};Uk=Symbol.toStringTag;ua[Uk]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ua.prototype);var go=class extends K{constructor(t){super(D.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};$k=Symbol.toStringTag;go[$k]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(go.prototype);var Re=class extends K{constructor(t){super(D.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};zk=Symbol.toStringTag;Re[zk]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Re.prototype);var xo=class extends K{constructor(t,r,n){super(D.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};jk=Symbol.toStringTag;xo[jk]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(xo.prototype);var fa=class extends K{constructor(t){super(D.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};qk=Symbol.toStringTag;fa[qk]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(fa.prototype);var bo=class extends K{constructor(t,r){super(D.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Vk=Symbol.toStringTag;bo[Vk]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(bo.prototype);var _o=class extends K{constructor(t,r=!1){var n,i,o;if(super(D.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Yk=Symbol.toStringTag;_o[Yk]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(_o.prototype);var oH=(e=>()=>++e)(-1),li=class extends K{constructor(t,r,n,i){super(D.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?oH():re(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Wk=Symbol.toStringTag;li[Wk]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(li.prototype);function ui(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return sH(this,t,r)}getVisitFnByTypeId(t,r=!0){return rd(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function sH(e,t,r=!0){return typeof t=="number"?rd(e,t,r):typeof t=="string"&&t in D?rd(e,D[t],r):t&&t instanceof K?rd(e,Gk(t),r):t?.type&&t.type instanceof K?rd(e,Gk(t.type),r):rd(e,D.NONE,r)}function rd(e,t,r=!0){let n=null;switch(t){case D.Null:n=e.visitNull;break;case D.Bool:n=e.visitBool;break;case D.Int:n=e.visitInt;break;case D.Int8:n=e.visitInt8||e.visitInt;break;case D.Int16:n=e.visitInt16||e.visitInt;break;case D.Int32:n=e.visitInt32||e.visitInt;break;case D.Int64:n=e.visitInt64||e.visitInt;break;case D.Uint8:n=e.visitUint8||e.visitInt;break;case D.Uint16:n=e.visitUint16||e.visitInt;break;case D.Uint32:n=e.visitUint32||e.visitInt;break;case D.Uint64:n=e.visitUint64||e.visitInt;break;case D.Float:n=e.visitFloat;break;case D.Float16:n=e.visitFloat16||e.visitFloat;break;case D.Float32:n=e.visitFloat32||e.visitFloat;break;case D.Float64:n=e.visitFloat64||e.visitFloat;break;case D.Utf8:n=e.visitUtf8;break;case D.LargeUtf8:n=e.visitLargeUtf8;break;case D.Binary:n=e.visitBinary;break;case D.LargeBinary:n=e.visitLargeBinary;break;case D.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case D.Date:n=e.visitDate;break;case D.DateDay:n=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:n=e.visitTimestamp;break;case D.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:n=e.visitTime;break;case D.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:n=e.visitDecimal;break;case D.List:n=e.visitList;break;case D.Struct:n=e.visitStruct;break;case D.Union:n=e.visitUnion;break;case D.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:n=e.visitDictionary;break;case D.Interval:n=e.visitInterval;break;case D.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:n=e.visitDuration;break;case D.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:n=e.visitFixedSizeList;break;case D.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function Gk(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?D.Int8:D.Uint8;case 16:return r?D.Int16:D.Uint16;case 32:return r?D.Int32:D.Uint32;case 64:return r?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case be.HALF:return D.Float16;case be.SINGLE:return D.Float32;case be.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.LargeBinary:return D.LargeBinary;case D.Utf8:return D.Utf8;case D.LargeUtf8:return D.LargeUtf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case ct.SECOND:return D.TimeSecond;case ct.MILLISECOND:return D.TimeMillisecond;case ct.MICROSECOND:return D.TimeMicrosecond;case ct.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case ct.SECOND:return D.TimestampSecond;case ct.MILLISECOND:return D.TimestampMillisecond;case ct.MICROSECOND:return D.TimestampMicrosecond;case ct.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case Xe.DAY:return D.DateDay;case Xe.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case xr.DAY_TIME:return D.IntervalDayTime;case xr.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case ct.SECOND:return D.DurationSecond;case ct.MILLISECOND:return D.DurationMillisecond;case ct.MICROSECOND:return D.DurationMicrosecond;case ct.NANOSECOND:return D.DurationNanosecond}return D.Duration;case D.Map:return D.Map;case D.List:return D.List;case D.Struct:return D.Struct;case D.Union:switch(e.mode){case Se.Dense:return D.DenseUnion;case Se.Sparse:return D.SparseUnion}return D.Union;case D.FixedSizeBinary:return D.FixedSizeBinary;case D.FixedSizeList:return D.FixedSizeList;case D.Dictionary:return D.Dictionary}throw new Error(`Unrecognized type '${D[e.typeId]}'`)}mt.prototype.visitInt8=null;mt.prototype.visitInt16=null;mt.prototype.visitInt32=null;mt.prototype.visitInt64=null;mt.prototype.visitUint8=null;mt.prototype.visitUint16=null;mt.prototype.visitUint32=null;mt.prototype.visitUint64=null;mt.prototype.visitFloat16=null;mt.prototype.visitFloat32=null;mt.prototype.visitFloat64=null;mt.prototype.visitDateDay=null;mt.prototype.visitDateMillisecond=null;mt.prototype.visitTimestampSecond=null;mt.prototype.visitTimestampMillisecond=null;mt.prototype.visitTimestampMicrosecond=null;mt.prototype.visitTimestampNanosecond=null;mt.prototype.visitTimeSecond=null;mt.prototype.visitTimeMillisecond=null;mt.prototype.visitTimeMicrosecond=null;mt.prototype.visitTimeNanosecond=null;mt.prototype.visitDenseUnion=null;mt.prototype.visitSparseUnion=null;mt.prototype.visitIntervalDayTime=null;mt.prototype.visitIntervalYearMonth=null;mt.prototype.visitDuration=null;mt.prototype.visitDurationSecond=null;mt.prototype.visitDurationMillisecond=null;mt.prototype.visitDurationMicrosecond=null;mt.prototype.visitDurationNanosecond=null;var aE={};Jn(aE,{float64ToUint16:()=>Sm,uint16ToFloat64:()=>L1});var Xk=new Float64Array(1),nd=new Uint32Array(Xk.buffer);function L1(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Sm(e){if(e!==e)return 32256;Xk[0]=e;let t=(nd[1]&2147483648)>>16&65535,r=nd[1]&2146435072,n=0;return r>=1089470464?nd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(nd[1]&1048575)>>10):r<=1056964608?(n=1048576+(nd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(nd[1]&1048575)+512>>10),t|r|n&65535}var wt=class extends mt{};function Ot(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var aH=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Hk=(e,t,r,n)=>{if(r+1<t.length){let i=re(t[r]),o=re(t[r+1]);e.set(n.subarray(0,o-i),i)}},cH=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},da=({values:e},t,r)=>{e[t]=r},cE=({values:e},t,r)=>{e[t]=r},Qk=({values:e},t,r)=>{e[t]=Sm(r)},lH=(e,t,r)=>{switch(e.type.precision){case be.HALF:return Qk(e,t,r);case be.SINGLE:case be.DOUBLE:return cE(e,t,r)}},F1=({values:e},t,r)=>{aH(e,t,r.valueOf())},C1=({values:e},t,r)=>{e[t]=BigInt(r)},lE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Zk=({values:e,valueOffsets:t},r,n)=>Hk(e,t,r,n),Kk=({values:e,valueOffsets:t},r,n)=>Hk(e,t,r,Vo(n)),uE=(e,t,r)=>{e.type.unit===Xe.DAY?F1(e,t,r):C1(e,t,r)},k1=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},B1=({values:e},t,r)=>{e[t]=BigInt(r)},P1=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},U1=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},fE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return k1(e,t,r);case ct.MILLISECOND:return B1(e,t,r);case ct.MICROSECOND:return P1(e,t,r);case ct.NANOSECOND:return U1(e,t,r)}},$1=({values:e},t,r)=>{e[t]=r},z1=({values:e},t,r)=>{e[t]=r},j1=({values:e},t,r)=>{e[t]=r},q1=({values:e},t,r)=>{e[t]=r},dE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return $1(e,t,r);case ct.MILLISECOND:return z1(e,t,r);case ct.MICROSECOND:return j1(e,t,r);case ct.NANOSECOND:return q1(e,t,r)}},hE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},uH=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=Vr.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},fH=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=Vr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},dH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),hH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),pH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),mH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),yH=(e,t,r)=>{let n=e.type.children.map(o=>Vr.getVisitFn(o.type)),i=r instanceof Map?pH(t,r):r instanceof Gt?hH(t,r):Array.isArray(r)?dH(t,r):mH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},gH=(e,t,r)=>{e.type.mode===Se.Dense?Jk(e,t,r):tB(e,t,r)},Jk=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,e.valueOffsets[t],r)},tB=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];Vr.visit(i,t,r)},xH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},pE=(e,t,r)=>{e.type.unit===xr.DAY_TIME?V1(e,t,r):Y1(e,t,r)},V1=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},Y1=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},W1=({values:e},t,r)=>{e[t]=r},G1=({values:e},t,r)=>{e[t]=r},X1=({values:e},t,r)=>{e[t]=r},H1=({values:e},t,r)=>{e[t]=r},mE=(e,t,r)=>{switch(e.type.unit){case ct.SECOND:return W1(e,t,r);case ct.MILLISECOND:return G1(e,t,r);case ct.MICROSECOND:return X1(e,t,r);case ct.NANOSECOND:return H1(e,t,r)}},bH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=Vr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};wt.prototype.visitBool=Ot(cH);wt.prototype.visitInt=Ot(da);wt.prototype.visitInt8=Ot(da);wt.prototype.visitInt16=Ot(da);wt.prototype.visitInt32=Ot(da);wt.prototype.visitInt64=Ot(da);wt.prototype.visitUint8=Ot(da);wt.prototype.visitUint16=Ot(da);wt.prototype.visitUint32=Ot(da);wt.prototype.visitUint64=Ot(da);wt.prototype.visitFloat=Ot(lH);wt.prototype.visitFloat16=Ot(Qk);wt.prototype.visitFloat32=Ot(cE);wt.prototype.visitFloat64=Ot(cE);wt.prototype.visitUtf8=Ot(Kk);wt.prototype.visitLargeUtf8=Ot(Kk);wt.prototype.visitBinary=Ot(Zk);wt.prototype.visitLargeBinary=Ot(Zk);wt.prototype.visitFixedSizeBinary=Ot(lE);wt.prototype.visitDate=Ot(uE);wt.prototype.visitDateDay=Ot(F1);wt.prototype.visitDateMillisecond=Ot(C1);wt.prototype.visitTimestamp=Ot(fE);wt.prototype.visitTimestampSecond=Ot(k1);wt.prototype.visitTimestampMillisecond=Ot(B1);wt.prototype.visitTimestampMicrosecond=Ot(P1);wt.prototype.visitTimestampNanosecond=Ot(U1);wt.prototype.visitTime=Ot(dE);wt.prototype.visitTimeSecond=Ot($1);wt.prototype.visitTimeMillisecond=Ot(z1);wt.prototype.visitTimeMicrosecond=Ot(j1);wt.prototype.visitTimeNanosecond=Ot(q1);wt.prototype.visitDecimal=Ot(hE);wt.prototype.visitList=Ot(uH);wt.prototype.visitStruct=Ot(yH);wt.prototype.visitUnion=Ot(gH);wt.prototype.visitDenseUnion=Ot(Jk);wt.prototype.visitSparseUnion=Ot(tB);wt.prototype.visitDictionary=Ot(xH);wt.prototype.visitInterval=Ot(pE);wt.prototype.visitIntervalDayTime=Ot(V1);wt.prototype.visitIntervalYearMonth=Ot(Y1);wt.prototype.visitDuration=Ot(mE);wt.prototype.visitDurationSecond=Ot(W1);wt.prototype.visitDurationMillisecond=Ot(G1);wt.prototype.visitDurationMicrosecond=Ot(X1);wt.prototype.visitDurationNanosecond=Ot(H1);wt.prototype.visitFixedSizeList=Ot(bH);wt.prototype.visitMap=Ot(fH);var Vr=new wt;var wo=Symbol.for("parent"),id=Symbol.for("rowIndex"),Rc=class{constructor(t,r){return this[wo]=t,this[id]=r,new Proxy(this,new gE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[id],r=this[wo],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=sr.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new yE(this[wo],this[id])}},yE=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,sr.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Rc.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[id]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var gE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wo].type.children.map(r=>r.name)}has(t,r){return t[wo].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[wo].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[wo].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=sr.visit(t[wo].children[n],t[id]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[wo].type.children.findIndex(o=>o.name===r);return i!==-1?(Vr.visit(t[wo].children[i],t[id],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var yt=class extends mt{};function Tt(e){return(t,r)=>t.getValid(r)?e(t,r):null}var _H=(e,t)=>864e5*e[t],wH=(e,t)=>null,eB=(e,t,r)=>{if(r+1>=t.length)return null;let n=re(t[r]),i=re(t[r+1]);return e.subarray(n,i)},vH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},rB=({values:e},t)=>_H(e,t),nB=({values:e},t)=>re(e[t]),Dc=({stride:e,values:t},r)=>t[e*r],SH=({stride:e,values:t},r)=>L1(t[e*r]),iB=({values:e},t)=>e[t],IH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),oB=({values:e,valueOffsets:t},r)=>eB(e,t,r),sB=({values:e,valueOffsets:t},r)=>{let n=eB(e,t,r);return n!==null?sm(n):null},TH=({values:e},t)=>e[t],AH=({type:e,values:t},r)=>e.precision!==be.HALF?t[r]:L1(t[r]),EH=(e,t)=>e.type.unit===Xe.DAY?rB(e,t):nB(e,t),aB=({values:e},t)=>1e3*re(e[t]),cB=({values:e},t)=>re(e[t]),lB=({values:e},t)=>nE(e[t],BigInt(1e3)),uB=({values:e},t)=>nE(e[t],BigInt(1e6)),MH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return aB(e,t);case ct.MILLISECOND:return cB(e,t);case ct.MICROSECOND:return lB(e,t);case ct.NANOSECOND:return uB(e,t)}},fB=({values:e},t)=>e[t],dB=({values:e},t)=>e[t],hB=({values:e},t)=>e[t],pB=({values:e},t)=>e[t],NH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return fB(e,t);case ct.MILLISECOND:return dB(e,t);case ct.MICROSECOND:return hB(e,t);case ct.NANOSECOND:return pB(e,t)}},OH=({values:e,stride:t},r)=>vm.decimal(e.subarray(t*r,t*(r+1))),RH=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new Gt([c])},DH=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Qo(s.slice(i,o-i))},LH=(e,t)=>new Rc(e,t),FH=(e,t)=>e.type.mode===Se.Dense?mB(e,t):yB(e,t),mB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,e.valueOffsets[t])},yB=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return sr.visit(n,t)},CH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},kH=(e,t)=>e.type.unit===xr.DAY_TIME?gB(e,t):xB(e,t),gB=({values:e},t)=>e.subarray(2*t,2*(t+1)),xB=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},bB=({values:e},t)=>e[t],_B=({values:e},t)=>e[t],wB=({values:e},t)=>e[t],vB=({values:e},t)=>e[t],BH=(e,t)=>{switch(e.type.unit){case ct.SECOND:return bB(e,t);case ct.MILLISECOND:return _B(e,t);case ct.MICROSECOND:return wB(e,t);case ct.NANOSECOND:return vB(e,t)}},PH=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new Gt([o])};yt.prototype.visitNull=Tt(wH);yt.prototype.visitBool=Tt(vH);yt.prototype.visitInt=Tt(TH);yt.prototype.visitInt8=Tt(Dc);yt.prototype.visitInt16=Tt(Dc);yt.prototype.visitInt32=Tt(Dc);yt.prototype.visitInt64=Tt(iB);yt.prototype.visitUint8=Tt(Dc);yt.prototype.visitUint16=Tt(Dc);yt.prototype.visitUint32=Tt(Dc);yt.prototype.visitUint64=Tt(iB);yt.prototype.visitFloat=Tt(AH);yt.prototype.visitFloat16=Tt(SH);yt.prototype.visitFloat32=Tt(Dc);yt.prototype.visitFloat64=Tt(Dc);yt.prototype.visitUtf8=Tt(sB);yt.prototype.visitLargeUtf8=Tt(sB);yt.prototype.visitBinary=Tt(oB);yt.prototype.visitLargeBinary=Tt(oB);yt.prototype.visitFixedSizeBinary=Tt(IH);yt.prototype.visitDate=Tt(EH);yt.prototype.visitDateDay=Tt(rB);yt.prototype.visitDateMillisecond=Tt(nB);yt.prototype.visitTimestamp=Tt(MH);yt.prototype.visitTimestampSecond=Tt(aB);yt.prototype.visitTimestampMillisecond=Tt(cB);yt.prototype.visitTimestampMicrosecond=Tt(lB);yt.prototype.visitTimestampNanosecond=Tt(uB);yt.prototype.visitTime=Tt(NH);yt.prototype.visitTimeSecond=Tt(fB);yt.prototype.visitTimeMillisecond=Tt(dB);yt.prototype.visitTimeMicrosecond=Tt(hB);yt.prototype.visitTimeNanosecond=Tt(pB);yt.prototype.visitDecimal=Tt(OH);yt.prototype.visitList=Tt(RH);yt.prototype.visitStruct=Tt(LH);yt.prototype.visitUnion=Tt(FH);yt.prototype.visitDenseUnion=Tt(mB);yt.prototype.visitSparseUnion=Tt(yB);yt.prototype.visitDictionary=Tt(CH);yt.prototype.visitInterval=Tt(kH);yt.prototype.visitIntervalDayTime=Tt(gB);yt.prototype.visitIntervalYearMonth=Tt(xB);yt.prototype.visitDuration=Tt(BH);yt.prototype.visitDurationSecond=Tt(bB);yt.prototype.visitDurationMillisecond=Tt(_B);yt.prototype.visitDurationMicrosecond=Tt(wB);yt.prototype.visitDurationNanosecond=Tt(vB);yt.prototype.visitFixedSizeList=Tt(PH);yt.prototype.visitMap=Tt(DH);var sr=new yt;var Lc=Symbol.for("keys"),sd=Symbol.for("vals"),od=Symbol.for("kKeysAsStrings"),xE=Symbol.for("_kKeysAsStrings"),Qo=class{constructor(t){return this[Lc]=new Gt([t.children[0]]).memoize(),this[sd]=t.children[1],new Proxy(this,new _E)}get[od](){return this[xE]||(this[xE]=Array.from(this[Lc].toArray(),String))}[Symbol.iterator](){return new bE(this[Lc],this[sd])}get size(){return this[Lc].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Lc],r=this[sd],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=sr.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${mo(t)}: ${mo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},bE=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),sr.visit(this.vals,t)]})}},_E=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[od]}has(t,r){return t[od].includes(r)}getOwnPropertyDescriptor(t,r){if(t[od].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[od].indexOf(r);if(n!==-1){let i=sr.visit(Reflect.get(t,sd),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[od].indexOf(r);return i!==-1?(Vr.visit(Reflect.get(t,sd),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Qo.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Lc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[sd]:{writable:!0,enumerable:!1,configurable:!1,value:null},[xE]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var SB;function Im(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(SB=o,o=s,s=SB),s>i&&(s=i),n?n(e,o,s):[o,s]}var ru=(e,t)=>e<0?t+e:e,IB=e=>e!==e;function Fc(e){if(typeof e!=="object"||e===null)return IB(e)?IB:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?KA(e,r):!1:e instanceof Map?$H(e):Array.isArray(e)?UH(e):e instanceof Gt?zH(e):jH(e,!0)}function UH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e[r]);return Q1(t)}function $H(e){let t=-1,r=[];for(let n of e.values())r[++t]=Fc(n);return Q1(r)}function zH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Fc(e.get(r));return Q1(t)}function jH(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Fc(e[r[i]]);return Q1(n,r)}function Q1(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return qH(e,r);case Map:return TB(e,r,r.keys());case Qo:case Rc:case Object:case void 0:return TB(e,r,t||Object.keys(r))}return r instanceof Gt?VH(e,r):!1}}function qH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function VH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function TB(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var vE={};Jn(vE,{BitIterator:()=>nu,getBit:()=>AB,getBool:()=>K1,packBools:()=>ou,popcnt_array:()=>EB,popcnt_bit_range:()=>Tm,popcnt_uint32:()=>Z1,setBool:()=>YH,truncateBitmap:()=>iu});function K1(e,t,r,n){return(r&1<<n)!==0}function AB(e,t,r,n){return(r&1<<n)>>n}function YH(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function iu(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):ou(new nu(r,e,t,null,K1)).subarray(0,n)),i}return r}function ou(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var nu=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Tm(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new nu(e,t,r-t,e,AB))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Tm(e,t,i)+Tm(e,n,r)+EB(e,i>>3,n-i>>3)}function EB(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=Z1(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=Z1(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=Z1(o.getUint8(i)),i+=1;return n}function Z1(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var WH=-1,ae=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return K.isSparseUnion(t)?this.children.some(r=>r.nullable):K.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(K.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=WH&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Tm(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ui(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:r}=this;if(K.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Se.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(K.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Se.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(iu(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let f=o[u];n=(f&l)!==0,o[u]=r?f|l:f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===D.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(iu(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[ki.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[ki.TYPE])&&(s[ki.TYPE]=o.subarray(t,t+r)),(o=s[ki.OFFSET])&&(s[ki.OFFSET]=o.subarray(t,t+r+1))||(o=s[ki.DATA])&&(s[ki.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ae.prototype.children=Object.freeze([]);var SE=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ae(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=y1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.data),o=St(t.nullBitmap),s=y1(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=St(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=zt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(K.isSparseUnion(r))return new ae(r,n,s,a,[void 0,void 0,void 0,o],i);let c=tu(t.valueOffsets);return new ae(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.indices.ArrayType,t.data),{["dictionary"]:s=new Gt([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=St(t.nullBitmap),o=zt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=St(t.nullBitmap),{["length"]:s=i.length/ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ae(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=St(t.nullBitmap),s=tu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ae(r,n,a,c,[s,void 0,o],[i])}},GH=new SE;function Dt(e){return GH.visit(e)}var Am=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function MB(e){return e.some(t=>t.nullable)}function J1(e){return e.reduce((t,r)=>t+r.nullCount,0)}function t_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function e_(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function IE(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Em(e,t){return e.getValid(t)}function ad(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return IE(n,this._offsets,r,t)}}function r_(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=IE(o,this._offsets,n,r);return t=void 0,s}}function n_(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):IE(o,this._offsets,i,r);return t=void 0,s}}var gt=class extends mt{};function XH(e,t){return t===null&&e.length>0?0:-1}function HH(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new nu(r,e.offset+(t||0),e.length,r,K1)){if(!i)return n;++n}return-1}function Lt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case D.Union:break;case D.Dictionary:break;default:return HH(e,r)}let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function NB(e,t,r){let n=sr.getVisitFn(e),i=Fc(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}gt.prototype.visitNull=XH;gt.prototype.visitBool=Lt;gt.prototype.visitInt=Lt;gt.prototype.visitInt8=Lt;gt.prototype.visitInt16=Lt;gt.prototype.visitInt32=Lt;gt.prototype.visitInt64=Lt;gt.prototype.visitUint8=Lt;gt.prototype.visitUint16=Lt;gt.prototype.visitUint32=Lt;gt.prototype.visitUint64=Lt;gt.prototype.visitFloat=Lt;gt.prototype.visitFloat16=Lt;gt.prototype.visitFloat32=Lt;gt.prototype.visitFloat64=Lt;gt.prototype.visitUtf8=Lt;gt.prototype.visitLargeUtf8=Lt;gt.prototype.visitBinary=Lt;gt.prototype.visitLargeBinary=Lt;gt.prototype.visitFixedSizeBinary=Lt;gt.prototype.visitDate=Lt;gt.prototype.visitDateDay=Lt;gt.prototype.visitDateMillisecond=Lt;gt.prototype.visitTimestamp=Lt;gt.prototype.visitTimestampSecond=Lt;gt.prototype.visitTimestampMillisecond=Lt;gt.prototype.visitTimestampMicrosecond=Lt;gt.prototype.visitTimestampNanosecond=Lt;gt.prototype.visitTime=Lt;gt.prototype.visitTimeSecond=Lt;gt.prototype.visitTimeMillisecond=Lt;gt.prototype.visitTimeMicrosecond=Lt;gt.prototype.visitTimeNanosecond=Lt;gt.prototype.visitDecimal=Lt;gt.prototype.visitList=Lt;gt.prototype.visitStruct=Lt;gt.prototype.visitUnion=Lt;gt.prototype.visitDenseUnion=NB;gt.prototype.visitSparseUnion=NB;gt.prototype.visitDictionary=Lt;gt.prototype.visitInterval=Lt;gt.prototype.visitIntervalDayTime=Lt;gt.prototype.visitIntervalYearMonth=Lt;gt.prototype.visitDuration=Lt;gt.prototype.visitDurationSecond=Lt;gt.prototype.visitDurationMillisecond=Lt;gt.prototype.visitDurationMicrosecond=Lt;gt.prototype.visitDurationNanosecond=Lt;gt.prototype.visitFixedSizeList=Lt;gt.prototype.visitMap=Lt;var su=new gt;var xt=class extends mt{};function At(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(K.isInt(t)&&t.bitWidth!==64||K.isTime(t)&&t.bitWidth!==64||K.isFloat(t)&&t.precision!==be.HALF))return new Am(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Am(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new TE(s)})}var TE=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};xt.prototype.visitNull=At;xt.prototype.visitBool=At;xt.prototype.visitInt=At;xt.prototype.visitInt8=At;xt.prototype.visitInt16=At;xt.prototype.visitInt32=At;xt.prototype.visitInt64=At;xt.prototype.visitUint8=At;xt.prototype.visitUint16=At;xt.prototype.visitUint32=At;xt.prototype.visitUint64=At;xt.prototype.visitFloat=At;xt.prototype.visitFloat16=At;xt.prototype.visitFloat32=At;xt.prototype.visitFloat64=At;xt.prototype.visitUtf8=At;xt.prototype.visitLargeUtf8=At;xt.prototype.visitBinary=At;xt.prototype.visitLargeBinary=At;xt.prototype.visitFixedSizeBinary=At;xt.prototype.visitDate=At;xt.prototype.visitDateDay=At;xt.prototype.visitDateMillisecond=At;xt.prototype.visitTimestamp=At;xt.prototype.visitTimestampSecond=At;xt.prototype.visitTimestampMillisecond=At;xt.prototype.visitTimestampMicrosecond=At;xt.prototype.visitTimestampNanosecond=At;xt.prototype.visitTime=At;xt.prototype.visitTimeSecond=At;xt.prototype.visitTimeMillisecond=At;xt.prototype.visitTimeMicrosecond=At;xt.prototype.visitTimeNanosecond=At;xt.prototype.visitDecimal=At;xt.prototype.visitList=At;xt.prototype.visitStruct=At;xt.prototype.visitUnion=At;xt.prototype.visitDenseUnion=At;xt.prototype.visitSparseUnion=At;xt.prototype.visitDictionary=At;xt.prototype.visitInterval=At;xt.prototype.visitIntervalDayTime=At;xt.prototype.visitIntervalYearMonth=At;xt.prototype.visitDuration=At;xt.prototype.visitDurationSecond=At;xt.prototype.visitDurationMillisecond=At;xt.prototype.visitDurationMicrosecond=At;xt.prototype.visitDurationNanosecond=At;xt.prototype.visitFixedSizeList=At;xt.prototype.visitMap=At;var cd=new xt;var OB,RB={},DB={},Gt=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ae)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=RB[s.typeId],u=o[0];this.isValid=f=>Em(u,f),this.get=f=>a(u,f),this.set=(f,d)=>c(u,f,d),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,DB[s.typeId]),this._offsets=t_(o);break}this.data=o,this.type=s,this.stride=ui(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return MB(this.data)}get nullCount(){return J1(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${D[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(ru(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return cd.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Im(this,t,r,({data:n,_offsets:i},o,s)=>e_(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return K.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(K.isDictionary(this.type)){let t=new i_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new i_(this)}unmemoize(){if(K.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};OB=Symbol.toStringTag;Gt[OB]=(e=>{e.type=K.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(D).map(r=>D[r]).filter(r=>typeof r=="number"&&r!==D.NONE);for(let r of t){let n=sr.getVisitFnByTypeId(r),i=Vr.getVisitFnByTypeId(r),o=su.getVisitFnByTypeId(r);RB[r]={get:n,set:i,indexOf:o},DB[r]=Object.create(e,{isValid:{value:ad(Em)},get:{value:ad(sr.getVisitFnByTypeId(r))},set:{value:r_(Vr.getVisitFnByTypeId(r))},indexOf:{value:n_(su.getVisitFnByTypeId(r))}})}return"Vector"})(Gt.prototype);var i_=class e extends Gt{constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Gt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function LB(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
|
|
3
|
+
switch (x) {${r.map(n=>`
|
|
4
|
+
case ${QH(n)}:`).join("")}
|
|
5
5
|
return false;
|
|
6
|
-
}`),e.length!==
|
|
6
|
+
}`),e.length!==r.length&&(t=`if (x !== x) return false;
|
|
7
7
|
${t}`),new Function("x",`${t}
|
|
8
|
-
return true;`)}function BW(e){return typeof e!="bigint"?zi(e):`${zi(e)}n`}var mT=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,PW=(e,t=0)=>e.length>=t?e.subarray(0,t):of(new e.constructor(t),e,0),Ka=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?mT(r*1,this.BYTES_PER_ELEMENT):mT(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=mT(t*this.stride,this.BYTES_PER_ELEMENT);let n=PW(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=of(new this.ArrayType(t),this.buffer)}};Ka.prototype.offset=0;var Bs=class extends Ka{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},pf=class extends Bs{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},mf=class extends Bs{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var Te=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Vr(t),this._nulls=new pf,n&&n.length>0&&(this._isValid=fk(n))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Ft({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Te.prototype.length=1;Te.prototype.stride=1;Te.prototype.children=null;Te.prototype.finished=!1;Te.prototype.nullValues=null;Te.prototype._isValid=()=>!0;var He=class extends Te{constructor(t){super(t),this._values=new Bs(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},Io=class extends Te{constructor(t){super(t),this._pendingLength=0,this._offsets=new mf}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof vo?n[mi].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Tl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var To=new Int32Array(2),cb=new Float32Array(To.buffer),lb=new Float64Array(To.buffer),yf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var tp;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(tp||(tp={}));var Yr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return To[0]=this.readInt32(t),cb[0]}readFloat64(t){return To[yf?0:1]=this.readInt32(t),To[yf?1:0]=this.readInt32(t+4),lb[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){cb[0]=n,this.writeInt32(t,To[0])}writeFloat64(t,n){lb[0]=n,this.writeInt32(t,To[yf?0:1]),this.writeInt32(t+4,To[yf?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===tp.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var El=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Yr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Yr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var an=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var Ja;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ja||(Ja={}));var tc;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(tc||(tc={}));var ep;(function(e){e[e.DenseArray=0]="DenseArray"})(ep||(ep={}));var Qi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var Eo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Qi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ep.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,ep.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var np=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var rp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var ip;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ip||(ip={}));var ec=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ip.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ip.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var Ao=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var Zi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Zi||(Zi={}));var nc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var rc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var ic=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var op;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(op||(op={}));var oc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):op.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,op.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var sp;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(sp||(sp={}));var sc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sp.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,sp.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var ap=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var ac=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var cp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var lp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var Ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var $s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zi.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Zi.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var up;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(up||(up={}));var Ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):up.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,up.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var fp=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ve;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ve||(ve={}));var Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ve.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new Eo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ve.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var Er=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):tc.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Un).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,tc.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Gr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ja.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Er).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Tl).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Tl).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Ja.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var se=class e{constructor(t=[],n,r,i=Me.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=yT(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=fb(fb(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:fb(fb(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=yT(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};se.prototype.fields=null;se.prototype.metadata=null;se.prototype.dictionaries=null;var zt=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};zt.prototype.type=null;zt.prototype.name=null;zt.prototype.nullable=null;zt.prototype.metadata=null;function fb(e,t){return new Map([...e||new Map,...t||new Map])}function yT(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(lt.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&yT(o.children,t)}return t}var $W=El,UW=Yr,Us=class{static decode(t){t=new UW(Lt(t));let n=Gr.getRootAsFooter(t),r=se.decode(n.schema(),new Map,n.version());return new gT(r,n)}static encode(t){let n=new $W,r=se.encode(n,t.schema);Gr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())zs.encode(n,s);let i=n.endVector();Gr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())zs.encode(n,s);let o=n.endVector();return Gr.startFooter(n),Gr.addSchema(n,r),Gr.addVersion(n,Me.V5),Gr.addRecordBatches(n,i),Gr.addDictionaries(n,o),Gr.finishFooterBuffer(n,Gr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Me.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var gT=class extends Us{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return zs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return zs.decode(n)}return null}},zs=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Tl.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=Ir(r),this.bodyLength=Ir(n)}};var Se=Object.freeze({done:!0,value:void 0}),dp=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Al=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},db=class extends Al{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Se);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Tn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Tn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),Se})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),Se})}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(Se)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Mo=class extends db{write(t){if((t=Lt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Yh(this.toUint8Array(!0)):this.toUint8Array(!1).then(Yh)}toUint8Array(t=!1){return t?zr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=Bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return zr(s,a)[0]})}},Oo=class{constructor(t){t&&(this.source=new xT(Tn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},gi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Mo?this.source=new js(Tn.fromAsyncIterable(t)):Sx(t)?this.source=new js(Tn.fromNodeStream(t)):Gh(t)?this.source=new js(Tn.fromDOMStream(t)):_x(t)?this.source=new js(Tn.fromDOMStream(t.body)):$i(t)?this.source=new js(Tn.fromIterable(t)):Pi(t)?this.source=new js(Tn.fromAsyncIterable(t)):hi(t)&&(this.source=new js(Tn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xT=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Se)}return(t){return Object.create(this.source.return&&this.source.return(t)||Se)}},js=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Z(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Z(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||Se;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Z(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||Se;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var hp=class extends Oo{constructor(t,n){super(),this.position=0,this.buffer=Lt(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},cc=class extends gi{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var wT={};kr(wT,{BaseInt64:()=>pp,Int128:()=>mp,Int64:()=>Vs,Uint64:()=>Le});function gf(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var xf=8,bT=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],pp=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${gf(this.buffer[1])} ${gf(this.buffer[0])}`}},Le=class e extends pp{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=xf<r-o?xf:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([bT[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Vs=class e extends pp{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=xf<i-s?xf:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([bT[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},mp=class e{constructor(t){this.buffer=t}high(){return new Vs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Vs(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Le(new Uint32Array([this.buffer[3],0])),r=new Le(new Uint32Array([this.buffer[2],0])),i=new Le(new Uint32Array([this.buffer[1],0])),o=new Le(new Uint32Array([this.buffer[0],0])),s=new Le(new Uint32Array([t.buffer[3],0])),a=new Le(new Uint32Array([t.buffer[2],0])),c=new Le(new Uint32Array([t.buffer[1],0])),l=new Le(new Uint32Array([t.buffer[0],0])),u=Le.multiply(o,l);this.buffer[0]=u.low();let f=new Le(new Uint32Array([u.high(),0]));return u=Le.multiply(i,l),f.plus(u),u=Le.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Le(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Le.multiply(r,l)).plus(Le.multiply(i,c)).plus(Le.multiply(o,a)),this.buffer[3]+=Le.multiply(n,l).plus(Le.multiply(r,c)).plus(Le.multiply(i,a)).plus(Le.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${gf(this.buffer[3])} ${gf(this.buffer[2])} ${gf(this.buffer[1])} ${gf(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=xf<i-s?xf:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([bT[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var yp=class extends dt{constructor(t,n,r,i,o=Me.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof zt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Ft({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Me.V5&&this.readNullBitmap(t,r),t.mode===we.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Ft({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},hb=class extends yp{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Sl(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Ut(Uint8Array,Ut(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return lt.isTimestamp(t)?Ut(Uint8Array,Vs.convertArray(r[n])):(lt.isInt(t)||lt.isTime(t))&&t.bitWidth===64||lt.isDuration(t)?Ut(Uint8Array,Vs.convertArray(r[n])):lt.isDate(t)&&t.unit===En.MILLISECOND?Ut(Uint8Array,Vs.convertArray(r[n])):lt.isDecimal(t)?Ut(Uint8Array,mp.convertArray(r[n])):lt.isBinary(t)||lt.isFixedSizeBinary(t)?zW(r[n]):lt.isBool(t)?Sl(r[n]):lt.isUtf8(t)?Wa(r[n].join("")):Ut(Uint8Array,Ut(t.ArrayType,r[n].map(i=>+i)))}};function zW(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var bf=class extends Io{constructor(t){super(t),this._values=new Ka(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Lt(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var pb=class extends Te{constructor(t){super(t),this._values=new pf}setValue(t,n){this._values.set(t,+n)}};var Ml=class extends He{};Ml.prototype._setValue=JI;var gp=class extends Ml{};gp.prototype._setValue=Bx;var xp=class extends Ml{};xp.prototype._setValue=Px;var bp=class extends He{};bp.prototype._setValue=nT;var mb=class extends Te{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new jr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ol({type:this.type.indices,nullValues:n}),this.dictionary=Ol({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var wp=class extends He{};wp.prototype._setValue=KI;var yb=class extends Te{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Gi(this.type.listSize,new zt(n,t.type,!0)),r}};var Nl=class extends He{setValue(t,n){this._values.set(t,n)}},gb=class extends Nl{setValue(t,n){super.setValue(t,Hh(n))}},xb=class extends Nl{},bb=class extends Nl{};var Dl=class extends He{};Dl.prototype._setValue=rT;var _p=class extends Dl{};_p.prototype._setValue=Wx;var vp=class extends Dl{};vp.prototype._setValue=Xx;var qs=class extends He{};qs.prototype._setValue=iT;var Sp=class extends qs{};Sp.prototype._setValue=Hx;var Ip=class extends qs{};Ip.prototype._setValue=Qx;var Tp=class extends qs{};Tp.prototype._setValue=Zx;var Ep=class extends qs{};Ep.prototype._setValue=Kx;var xi=class extends He{setValue(t,n){this._values.set(t,n)}},wb=class extends xi{},_b=class extends xi{},vb=class extends xi{},Sb=class extends xi{},Ib=class extends xi{},Tb=class extends xi{},Eb=class extends xi{},Ab=class extends xi{};var Mb=class extends Io{constructor(t){super(t),this._offsets=new mf}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new qi(new zt(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Ob=class extends Io{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Wi(new zt(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Nb=class extends Te{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Db=class extends Te{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new _e([...this.type.children,new zt(n,t.type,!0)]),r}};var Ys=class extends He{};Ys.prototype._setValue=tT;var Ap=class extends Ys{};Ap.prototype._setValue=$x;var Mp=class extends Ys{};Mp.prototype._setValue=Ux;var Op=class extends Ys{};Op.prototype._setValue=zx;var Np=class extends Ys{};Np.prototype._setValue=jx;var Gs=class extends He{};Gs.prototype._setValue=eT;var Dp=class extends Gs{};Dp.prototype._setValue=Vx;var Rp=class extends Gs{};Rp.prototype._setValue=qx;var Lp=class extends Gs{};Lp.prototype._setValue=Yx;var Fp=class extends Gs{};Fp.prototype._setValue=Gx;var wf=class extends Te{constructor(t){super(t),this._typeIds=new Bs(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new zt(n,t.type)];return this.type=new Yi(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Rb=class extends wf{},Lb=class extends wf{constructor(t){super(t),this._offsets=new Bs(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var kp=class extends Io{constructor(t){super(t),this._values=new Ka(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Wa(n))}_flushPending(t,n){}};kp.prototype._flushPending=bf.prototype._flushPending;var _T=class extends dt{visitNull(){return Nb}visitBool(){return pb}visitInt(){return xi}visitInt8(){return wb}visitInt16(){return _b}visitInt32(){return vb}visitInt64(){return Sb}visitUint8(){return Ib}visitUint16(){return Tb}visitUint32(){return Eb}visitUint64(){return Ab}visitFloat(){return Nl}visitFloat16(){return gb}visitFloat32(){return xb}visitFloat64(){return bb}visitUtf8(){return kp}visitBinary(){return bf}visitFixedSizeBinary(){return wp}visitDate(){return Ml}visitDateDay(){return gp}visitDateMillisecond(){return xp}visitTimestamp(){return Ys}visitTimestampSecond(){return Ap}visitTimestampMillisecond(){return Mp}visitTimestampMicrosecond(){return Op}visitTimestampNanosecond(){return Np}visitTime(){return Gs}visitTimeSecond(){return Dp}visitTimeMillisecond(){return Rp}visitTimeMicrosecond(){return Lp}visitTimeNanosecond(){return Fp}visitDecimal(){return bp}visitList(){return Mb}visitStruct(){return Db}visitUnion(){return wf}visitDenseUnion(){return Lb}visitSparseUnion(){return Rb}visitDictionary(){return mb}visitInterval(){return Dl}visitIntervalDayTime(){return _p}visitIntervalYearMonth(){return vp}visitDuration(){return qs}visitDurationSecond(){return Sp}visitDurationMillisecond(){return Ip}visitDurationMicrosecond(){return Tp}visistDurationNanosecond(){return Ep}visitFixedSizeList(){return yb}visitMap(){return Ob}},dk=new _T;var vt=class extends dt{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function er(e,t){return t instanceof e.constructor}function Cp(e,t){return e===t||er(e,t)}function Ws(e,t){return e===t||er(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Fb(e,t){return e===t||er(e,t)&&e.precision===t.precision}function jW(e,t){return e===t||er(e,t)&&e.byteWidth===t.byteWidth}function vT(e,t){return e===t||er(e,t)&&e.unit===t.unit}function Bp(e,t){return e===t||er(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Pp(e,t){return e===t||er(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function VW(e,t){return e===t||er(e,t)&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function qW(e,t){return e===t||er(e,t)&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function ST(e,t){return e===t||er(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&No.compareManyFields(e.children,t.children)}function YW(e,t){return e===t||er(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&No.visit(e.indices,t.indices)&&No.visit(e.dictionary,t.dictionary)}function IT(e,t){return e===t||er(e,t)&&e.unit===t.unit}function $p(e,t){return e===t||er(e,t)&&e.unit===t.unit}function GW(e,t){return e===t||er(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}function WW(e,t){return e===t||er(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&No.compareManyFields(e.children,t.children)}vt.prototype.visitNull=Cp;vt.prototype.visitBool=Cp;vt.prototype.visitInt=Ws;vt.prototype.visitInt8=Ws;vt.prototype.visitInt16=Ws;vt.prototype.visitInt32=Ws;vt.prototype.visitInt64=Ws;vt.prototype.visitUint8=Ws;vt.prototype.visitUint16=Ws;vt.prototype.visitUint32=Ws;vt.prototype.visitUint64=Ws;vt.prototype.visitFloat=Fb;vt.prototype.visitFloat16=Fb;vt.prototype.visitFloat32=Fb;vt.prototype.visitFloat64=Fb;vt.prototype.visitUtf8=Cp;vt.prototype.visitBinary=Cp;vt.prototype.visitFixedSizeBinary=jW;vt.prototype.visitDate=vT;vt.prototype.visitDateDay=vT;vt.prototype.visitDateMillisecond=vT;vt.prototype.visitTimestamp=Bp;vt.prototype.visitTimestampSecond=Bp;vt.prototype.visitTimestampMillisecond=Bp;vt.prototype.visitTimestampMicrosecond=Bp;vt.prototype.visitTimestampNanosecond=Bp;vt.prototype.visitTime=Pp;vt.prototype.visitTimeSecond=Pp;vt.prototype.visitTimeMillisecond=Pp;vt.prototype.visitTimeMicrosecond=Pp;vt.prototype.visitTimeNanosecond=Pp;vt.prototype.visitDecimal=Cp;vt.prototype.visitList=VW;vt.prototype.visitStruct=qW;vt.prototype.visitUnion=ST;vt.prototype.visitDenseUnion=ST;vt.prototype.visitSparseUnion=ST;vt.prototype.visitDictionary=YW;vt.prototype.visitInterval=IT;vt.prototype.visitIntervalDayTime=IT;vt.prototype.visitIntervalYearMonth=IT;vt.prototype.visitDuration=$p;vt.prototype.visitDurationSecond=$p;vt.prototype.visitDurationMillisecond=$p;vt.prototype.visitDurationMicrosecond=$p;vt.prototype.visitDurationNanosecond=$p;vt.prototype.visitFixedSizeList=GW;vt.prototype.visitMap=WW;var No=new vt;function Rl(e,t){return No.compareSchemas(e,t)}function hk(e,t){return No.compareFields(e,t)}function pk(e,t){return No.visit(e,t)}function Ol(e){let t=e.type,n=new(dk.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Ol(Object.assign(Object.assign({},l),{type:c})))}}return n}function kb(e,t){return XW(e,t.map(n=>n.data.concat()))}function XW(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=HW(n,s,u,t,i),s>0&&(r[o++]=Ft({type:new _e(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Pe(e,f))]}function HW(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Ft({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var mk,nr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new se([]),this._offsets=[0],this;let i,o;t[0]instanceof se&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Pe)return[c];if(c instanceof e)return c.batches;if(c instanceof le){if(c.type instanceof _e)return[new Pe(new se(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Gt([c[h]])),f=new se(l.map((h,p)=>new zt(String(h),u[p].type))),[,d]=kb(f,u);return d.length===0?[new Pe(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new se([]),!(i instanceof se))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Pe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Rl(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??rb(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=nb(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?hf.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
8
|
+
return true;`)}function QH(e){return typeof e!="bigint"?mo(e):`${mo(e)}n`}function AE(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function FB(e,t=0){return e.length>=t?e.subarray(0,t):cm(new e.constructor(t),e,0)}var vo=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?AE(n*1,this.BYTES_PER_ELEMENT):AE(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=AE(t*this.stride,this.BYTES_PER_ELEMENT);let r=FB(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=FB(this.buffer,t)}},ha=class extends vo{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ld=class extends ha{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ud=class extends ha{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Le=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=ui(t),this._nulls=new ld,r&&r.length>0&&(this._isValid=LB(r))}toVector(){return new Gt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Le.prototype.length=1;Le.prototype.stride=1;Le.prototype.children=null;Le.prototype.finished=!1;Le.prototype.nullValues=null;Le.prototype._isValid=()=>!0;var ar=class extends Le{constructor(t){super(t),this._values=new ha(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Vn=class extends Le{constructor(t){super(t),this._pendingLength=0,this._offsets=new ud(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Qo?r[Lc].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var au=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var fi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new qn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new au).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new au).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var me=class e{constructor(t=[],r,n,i=he.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=EE(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=o_(o_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:o_(o_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=EE(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};me.prototype.fields=null;me.prototype.metadata=null;me.prototype.dictionaries=null;var jt=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};jt.prototype.type=null;jt.prototype.name=null;jt.prototype.nullable=null;jt.prototype.metadata=null;function o_(e,t){return new Map([...e||new Map,...t||new Map])}function EE(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(K.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&EE(o.children,t)}return t}var ZH=eu,KH=ai,pa=class{static decode(t){t=new KH(St(t));let r=fi.getRootAsFooter(t),n=me.decode(r.schema(),new Map,r.version());return new ME(n,r)}static encode(t){let r=new ZH,n=me.encode(r,t.schema);fi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())ma.encode(r,s);let i=r.endVector();fi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())ma.encode(r,s);let o=r.endVector();return fi.startFooter(r),fi.addSchema(r,n),fi.addVersion(r,he.V5),fi.addRecordBatches(r,i),fi.addDictionaries(r,o),fi.finishFooterBuffer(r,fi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=he.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var ME=class extends pa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return ma.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return ma.decode(r)}return null}},ma=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return au.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=re(n),this.bodyLength=re(r)}};var De=Object.freeze({done:!0,value:void 0}),Mm=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},cu=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},s_=class extends cu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(De);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return qr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return qr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Q(this,void 0,void 0,function*(){return yield this.abort(t),De})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),De})}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(De)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Zo=class extends s_{write(t){if((t=St(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?sm(this.toUint8Array(!0)):this.toUint8Array(!1).then(sm)}toUint8Array(t=!1){return t?si(this._values)[0]:Q(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=ao(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return si(s,a)[0]})}},Ko=class{constructor(t){t&&(this.source=new NE(qr.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Pi=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Zo?this.source=new ya(qr.fromAsyncIterable(t)):m1(t)?this.source=new ya(qr.fromNodeStream(t)):am(t)?this.source=new ya(qr.fromDOMStream(t)):h1(t)?this.source=new ya(qr.fromDOMStream(t.body)):lo(t)?this.source=new ya(qr.fromIterable(t)):co(t)?this.source=new ya(qr.fromAsyncIterable(t)):Fi(t)&&(this.source=new ya(qr.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},NE=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||De)}return(t){return Object.create(this.source.return&&this.source.return(t)||De)}},ya=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Q(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Q(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Q(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Q(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Q(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||De;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Nm=class extends Ko{constructor(t,r){super(),this.position=0,this.buffer=St(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Cc=class extends Pi{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Q(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Q(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Q(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Q(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Q(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Q(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var RE={};Jn(RE,{BaseInt64:()=>Om,Int128:()=>Rm,Int64:()=>ga,Uint64:()=>je});function fd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var dd=8,OE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Om=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${fd(this.buffer[1])} ${fd(this.buffer[0])}`}},je=class e extends Om{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=dd<n-o?dd:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([OE[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},ga=class e extends Om{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=dd<i-s?dd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([OE[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Rm=class e{constructor(t){this.buffer=t}high(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ga(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new je(new Uint32Array([this.buffer[3],0])),n=new je(new Uint32Array([this.buffer[2],0])),i=new je(new Uint32Array([this.buffer[1],0])),o=new je(new Uint32Array([this.buffer[0],0])),s=new je(new Uint32Array([t.buffer[3],0])),a=new je(new Uint32Array([t.buffer[2],0])),c=new je(new Uint32Array([t.buffer[1],0])),l=new je(new Uint32Array([t.buffer[0],0])),u=je.multiply(o,l);this.buffer[0]=u.low();let f=new je(new Uint32Array([u.high(),0]));return u=je.multiply(i,l),f.plus(u),u=je.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new je(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(je.multiply(n,l)).plus(je.multiply(i,c)).plus(je.multiply(o,a)),this.buffer[3]+=je.multiply(r,l).plus(je.multiply(n,c)).plus(je.multiply(i,a)).plus(je.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${fd(this.buffer[3])} ${fd(this.buffer[2])} ${fd(this.buffer[1])} ${fd(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=dd<i-s?dd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([OE[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var Dm=class extends mt{constructor(t,r,n,i,o=he.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof jt?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Dt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<he.V5&&this.readNullBitmap(t,n),t.mode===Se.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Dt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},a_=class extends Dm{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):ou(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return zt(Uint8Array,zt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return K.isTimestamp(t)?zt(Uint8Array,ga.convertArray(n[r])):(K.isInt(t)||K.isTime(t))&&t.bitWidth===64||K.isDuration(t)?zt(Uint8Array,ga.convertArray(n[r])):K.isDate(t)&&t.unit===Xe.MILLISECOND?zt(Uint8Array,ga.convertArray(n[r])):K.isDecimal(t)?zt(Uint8Array,Rm.convertArray(n[r])):K.isBinary(t)||K.isLargeBinary(t)||K.isFixedSizeBinary(t)?JH(n[r]):K.isBool(t)?ou(n[r]):K.isUtf8(t)||K.isLargeUtf8(t)?Vo(n[r].join("")):zt(Uint8Array,zt(t.ArrayType,n[r].map(i=>+i)))}};function JH(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var hd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,St(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var pd=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,St(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var c_=class extends Le{constructor(t){super(t),this._values=new ld}setValue(t,r){this._values.set(t,+r)}};var lu=class extends ar{};lu.prototype._setValue=uE;var Lm=class extends lu{};Lm.prototype._setValue=F1;var Fm=class extends lu{};Fm.prototype._setValue=C1;var Cm=class extends ar{};Cm.prototype._setValue=hE;var l_=class extends Le{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new li(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=uu({type:this.type.indices,nullValues:r}),this.dictionary=uu({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var km=class extends ar{};km.prototype._setValue=lE;var u_=class extends Le{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new bo(this.type.listSize,new jt(r,t.type,!0)),n}};var fu=class extends ar{setValue(t,r){this._values.set(t,r)}},f_=class extends fu{setValue(t,r){super.setValue(t,Sm(r))}},d_=class extends fu{},h_=class extends fu{};var du=class extends ar{};du.prototype._setValue=pE;var Bm=class extends du{};Bm.prototype._setValue=V1;var Pm=class extends du{};Pm.prototype._setValue=Y1;var xa=class extends ar{};xa.prototype._setValue=mE;var Um=class extends xa{};Um.prototype._setValue=W1;var $m=class extends xa{};$m.prototype._setValue=G1;var zm=class extends xa{};zm.prototype._setValue=X1;var jm=class extends xa{};jm.prototype._setValue=H1;var Ui=class extends ar{setValue(t,r){this._values.set(t,r)}},p_=class extends Ui{},m_=class extends Ui{},y_=class extends Ui{},g_=class extends Ui{},x_=class extends Ui{},b_=class extends Ui{},__=class extends Ui{},w_=class extends Ui{};var v_=class extends Vn{constructor(t){super(t),this._offsets=new ud(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new go(new jt(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var S_=class extends Vn{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new _o(new jt(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var I_=class extends Le{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var T_=class extends Le{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Re([...this.type.children,new jt(r,t.type,!0)]),n}};var ba=class extends ar{};ba.prototype._setValue=fE;var qm=class extends ba{};qm.prototype._setValue=k1;var Vm=class extends ba{};Vm.prototype._setValue=B1;var Ym=class extends ba{};Ym.prototype._setValue=P1;var Wm=class extends ba{};Wm.prototype._setValue=U1;var _a=class extends ar{};_a.prototype._setValue=dE;var Gm=class extends _a{};Gm.prototype._setValue=$1;var Xm=class extends _a{};Xm.prototype._setValue=z1;var Hm=class extends _a{};Hm.prototype._setValue=j1;var Qm=class extends _a{};Qm.prototype._setValue=q1;var md=class extends Le{constructor(t){super(t),this._typeIds=new ha(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new jt(r,t.type)];return this.type=new xo(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},A_=class extends md{},E_=class extends md{constructor(t){super(t),this._offsets=new ha(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Zm=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Zm.prototype._flushPending=hd.prototype._flushPending;var Km=class extends Vn{constructor(t){super(t),this._values=new vo(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Vo(r))}_flushPending(t,r){}};Km.prototype._flushPending=pd.prototype._flushPending;var DE=class extends mt{visitNull(){return I_}visitBool(){return c_}visitInt(){return Ui}visitInt8(){return p_}visitInt16(){return m_}visitInt32(){return y_}visitInt64(){return g_}visitUint8(){return x_}visitUint16(){return b_}visitUint32(){return __}visitUint64(){return w_}visitFloat(){return fu}visitFloat16(){return f_}visitFloat32(){return d_}visitFloat64(){return h_}visitUtf8(){return Zm}visitLargeUtf8(){return Km}visitBinary(){return hd}visitLargeBinary(){return pd}visitFixedSizeBinary(){return km}visitDate(){return lu}visitDateDay(){return Lm}visitDateMillisecond(){return Fm}visitTimestamp(){return ba}visitTimestampSecond(){return qm}visitTimestampMillisecond(){return Vm}visitTimestampMicrosecond(){return Ym}visitTimestampNanosecond(){return Wm}visitTime(){return _a}visitTimeSecond(){return Gm}visitTimeMillisecond(){return Xm}visitTimeMicrosecond(){return Hm}visitTimeNanosecond(){return Qm}visitDecimal(){return Cm}visitList(){return v_}visitStruct(){return T_}visitUnion(){return md}visitDenseUnion(){return E_}visitSparseUnion(){return A_}visitDictionary(){return l_}visitInterval(){return du}visitIntervalDayTime(){return Bm}visitIntervalYearMonth(){return Pm}visitDuration(){return xa}visitDurationSecond(){return Um}visitDurationMillisecond(){return $m}visitDurationMicrosecond(){return zm}visitDurationNanosecond(){return jm}visitFixedSizeList(){return u_}visitMap(){return S_}},CB=new DE;var bt=class extends mt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function _n(e,t){return t instanceof e.constructor}function hu(e,t){return e===t||_n(e,t)}function wa(e,t){return e===t||_n(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function M_(e,t){return e===t||_n(e,t)&&e.precision===t.precision}function tQ(e,t){return e===t||_n(e,t)&&e.byteWidth===t.byteWidth}function LE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function Jm(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ty(e,t){return e===t||_n(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function eQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function rQ(e,t){return e===t||_n(e,t)&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function FE(e,t){return e===t||_n(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Jo.compareManyFields(e.children,t.children)}function nQ(e,t){return e===t||_n(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Jo.visit(e.indices,t.indices)&&Jo.visit(e.dictionary,t.dictionary)}function CE(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function ey(e,t){return e===t||_n(e,t)&&e.unit===t.unit}function iQ(e,t){return e===t||_n(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}function oQ(e,t){return e===t||_n(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Jo.compareManyFields(e.children,t.children)}bt.prototype.visitNull=hu;bt.prototype.visitBool=hu;bt.prototype.visitInt=wa;bt.prototype.visitInt8=wa;bt.prototype.visitInt16=wa;bt.prototype.visitInt32=wa;bt.prototype.visitInt64=wa;bt.prototype.visitUint8=wa;bt.prototype.visitUint16=wa;bt.prototype.visitUint32=wa;bt.prototype.visitUint64=wa;bt.prototype.visitFloat=M_;bt.prototype.visitFloat16=M_;bt.prototype.visitFloat32=M_;bt.prototype.visitFloat64=M_;bt.prototype.visitUtf8=hu;bt.prototype.visitLargeUtf8=hu;bt.prototype.visitBinary=hu;bt.prototype.visitLargeBinary=hu;bt.prototype.visitFixedSizeBinary=tQ;bt.prototype.visitDate=LE;bt.prototype.visitDateDay=LE;bt.prototype.visitDateMillisecond=LE;bt.prototype.visitTimestamp=Jm;bt.prototype.visitTimestampSecond=Jm;bt.prototype.visitTimestampMillisecond=Jm;bt.prototype.visitTimestampMicrosecond=Jm;bt.prototype.visitTimestampNanosecond=Jm;bt.prototype.visitTime=ty;bt.prototype.visitTimeSecond=ty;bt.prototype.visitTimeMillisecond=ty;bt.prototype.visitTimeMicrosecond=ty;bt.prototype.visitTimeNanosecond=ty;bt.prototype.visitDecimal=hu;bt.prototype.visitList=eQ;bt.prototype.visitStruct=rQ;bt.prototype.visitUnion=FE;bt.prototype.visitDenseUnion=FE;bt.prototype.visitSparseUnion=FE;bt.prototype.visitDictionary=nQ;bt.prototype.visitInterval=CE;bt.prototype.visitIntervalDayTime=CE;bt.prototype.visitIntervalYearMonth=CE;bt.prototype.visitDuration=ey;bt.prototype.visitDurationSecond=ey;bt.prototype.visitDurationMillisecond=ey;bt.prototype.visitDurationMicrosecond=ey;bt.prototype.visitDurationNanosecond=ey;bt.prototype.visitFixedSizeList=iQ;bt.prototype.visitMap=oQ;var Jo=new bt;function pu(e,t){return Jo.compareSchemas(e,t)}function kB(e,t){return Jo.compareFields(e,t)}function BB(e,t){return Jo.visit(e,t)}function uu(e){let t=e.type,r=new(CB.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(uu(Object.assign(Object.assign({},l),{type:c})))}}return r}function N_(e,t){return sQ(e,t.map(r=>r.data.concat()))}function sQ(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=aQ(r,s,u,t,i),s>0&&(n[o++]=Dt({type:new Re(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new He(e,f))]}function aQ(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var PB,wn=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new me([]),this._offsets=[0],this;let i,o;t[0]instanceof me&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof He)return[c];if(c instanceof e)return c.batches;if(c instanceof ae){if(c.type instanceof Re)return[new He(new me(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Gt([c[h]])),f=i??new me(l.map((h,p)=>new jt(String(h),u[p].type,u[p].nullable))),[,d]=N_(f,u);return d.length===0?[new He(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new me([]),!(i instanceof me))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof He))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!pu(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??t_(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=J1(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ru(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?cd.visit(new Gt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
9
9
|
${this.toArray().join(`,
|
|
10
10
|
`)}
|
|
11
|
-
]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new Pe(n,i)))}slice(t,n){let r=this.schema;[t,n]=Qh({length:this.numRows},t,n);let i=ib(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Pe(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Ft({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Gt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Gt([Ft({type:new tr,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=kb(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...kb(o,s))}};mk=Symbol.toStringTag;nr[mk]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Za(Jh),e.get=Za(Xe.getVisitFn(R.Struct)),e.set=ob(An.getVisitFn(R.Struct)),e.indexOf=sb(Il.getVisitFn(R.Struct)),e.getByteLength=Za(qr.getVisitFn(R.Struct)),"Table"))(nr.prototype);var gk,Pe=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ft({nullCount:0,type:new _e(this.schema.fields),children:this.schema.fields.map(n=>Ft({type:n.type,nullCount:0}))})]=t,!(this.data instanceof le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yk(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=zt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new se(r),a=Ft({type:new _e(r),length:o,children:i,nullCount:0});[this.schema,this.data]=yk(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=xk(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Xe.visit(this.data,t)}set(t,n){return An.visit(this.data,t,n)}indexOf(t,n){return Il.visit(this.data,t,n)}getByteLength(t){return qr.visit(this.data,t)}[Symbol.iterator](){return hf.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new nr(this.schema,[this,...t])}slice(t,n){let[r]=new Gt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Gt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Gt([Ft({type:new tr,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new se(o,new Map(this.schema.metadata)),i=Ft({type:new _e(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new _e(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Ft({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Ft({type:new _e(n.fields),length:this.numRows,children:r});return new e(n,i)}};gk=Symbol.toStringTag;Pe[gk]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Pe.prototype);function yk(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Ft({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Ft({type:new _e(i),length:n,children:o})]}function xk(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])xk(a.children,l?.children,n);if(lt.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var Ll=class extends Pe{constructor(t){let n=t.fields.map(i=>Ft({type:i.type})),r=Ft({type:new _e(t.fields),nullCount:0,children:n});super(t,r)}};var Up;(function(e){e[e.BUFFER=0]="BUFFER"})(Up||(Up={}));var zp;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(zp||(zp={}));var Cb=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):zp.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Up.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,zp.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Up.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var _f=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var vf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Wr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new vf).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new _f).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Cb).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var Xs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Wr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var Sf;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Sf||(Sf={}));var Ji=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ja.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Sf.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new an).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,Ja.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Sf.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var TT=class extends dt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return cp.startNull(n),cp.endNull(n)}visitInt(t,n){return Qi.startInt(n),Qi.addBitWidth(n,t.bitWidth),Qi.addIsSigned(n,t.isSigned),Qi.endInt(n)}visitFloat(t,n){return oc.startFloatingPoint(n),oc.addPrecision(n,t.precision),oc.endFloatingPoint(n)}visitBinary(t,n){return np.startBinary(n),np.endBinary(n)}visitBool(t,n){return rp.startBool(n),rp.endBool(n)}visitUtf8(t,n){return fp.startUtf8(n),fp.endUtf8(n)}visitDecimal(t,n){return Ao.startDecimal(n),Ao.addScale(n,t.scale),Ao.addPrecision(n,t.precision),Ao.addBitWidth(n,t.bitWidth),Ao.endDecimal(n)}visitDate(t,n){return ec.startDate(n),ec.addUnit(n,t.unit),ec.endDate(n)}visitTime(t,n){return Ps.startTime(n),Ps.addUnit(n,t.unit),Ps.addBitWidth(n,t.bitWidth),Ps.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return $s.startTimestamp(n),$s.addUnit(n,t.unit),r!==void 0&&$s.addTimezone(n,r),$s.endTimestamp(n)}visitInterval(t,n){return sc.startInterval(n),sc.addUnit(n,t.unit),sc.endInterval(n)}visitDuration(t,n){return nc.startDuration(n),nc.addUnit(n,t.unit),nc.endDuration(n)}visitList(t,n){return ap.startList(n),ap.endList(n)}visitStruct(t,n){return lp.startStruct_(n),lp.endStruct_(n)}visitUnion(t,n){Ki.startTypeIdsVector(n,t.typeIds.length);let r=Ki.createTypeIdsVector(n,t.typeIds);return Ki.startUnion(n),Ki.addMode(n,t.mode),Ki.addTypeIds(n,r),Ki.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return Eo.startDictionaryEncoding(n),Eo.addId(n,BigInt(t.id)),Eo.addIsOrdered(n,t.isOrdered),r!==void 0&&Eo.addIndexType(n,r),Eo.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return rc.startFixedSizeBinary(n),rc.addByteWidth(n,t.byteWidth),rc.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ic.startFixedSizeList(n),ic.addListSize(n,t.listSize),ic.endFixedSizeList(n)}visitMap(t,n){return ac.startMap(n),ac.addKeysSorted(n,t.keysSorted),ac.endMap(n)}},Bb=new TT;function vk(e,t=new Map){return new se(ZW(e,t),Pb(e.metadata),t)}function ET(e){return new Mn(e.count,Ik(e.columns),Tk(e.columns))}function Sk(e){return new Mr(ET(e.data),e.id,e.isDelta)}function ZW(e,t){return(e.fields||[]).filter(Boolean).map(n=>zt.fromJSON(n,t))}function bk(e,t){return(e.children||[]).filter(Boolean).map(n=>zt.fromJSON(n,t))}function Ik(e){return(e||[]).reduce((t,n)=>[...t,new bi(n.count,KW(n.VALIDITY)),...Ik(n.children)],[])}function Tk(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new Ar(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Ar(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Ar(t.length,i.OFFSET.length)),i.DATA&&t.push(new Ar(t.length,i.DATA.length)),t=Tk(i.children,t)}return t}function KW(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function Ek(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=_k(e,bk(e,t)),i=new zt(e.name,s,e.nullable,Pb(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?wk(r):new _o,a=new jr(t.get(n),r,n,o.isOrdered),i=new zt(e.name,a,e.nullable,Pb(e.metadata))):(r=(r=o.indexType)?wk(r):new _o,t.set(n,s=_k(e,bk(e,t))),a=new jr(s,r,n,o.isOrdered),i=new zt(e.name,a,e.nullable,Pb(e.metadata))),i||null}function Pb(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function wk(e){return new Ve(e.isSigned,e.bitWidth)}function _k(e,t){let n=e.type.name;switch(n){case"NONE":return new tr;case"null":return new tr;case"binary":return new As;case"utf8":return new Ms;case"bool":return new Os;case"list":return new qi((t||[])[0]);case"struct":return new _e(t||[]);case"struct_":return new _e(t||[])}switch(n){case"int":{let r=e.type;return new Ve(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new Tr(Ie[r.precision])}case"decimal":{let r=e.type;return new Ns(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ds(En[r.unit])}case"time":{let r=e.type;return new Vi(yt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Rs(yt[r.unit],r.timezone)}case"interval":{let r=e.type;return new Ls(Jn[r.unit])}case"duration":{let r=e.type;return new Fs(yt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Yi(we[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new ks(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Gi(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Wi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var JW=El,tX=Yr,Or=class e{static fromJSON(t,n){let r=new e(0,Me.V5,n);return r._createHeader=eX(t,n),r}static decode(t){t=new tX(Lt(t));let n=Ji.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=nX(n,o),s}static encode(t){let n=new JW,r=-1;return t.isSchema()?r=se.encode(n,t.header()):t.isRecordBatch()?r=Mn.encode(n,t.header()):t.isDictionaryBatch()&&(r=Mr.encode(n,t.header())),Ji.startMessage(n),Ji.addVersion(n,Me.V5),Ji.addHeader(n,r),Ji.addHeaderType(n,t.headerType),Ji.addBodyLength(n,BigInt(t.bodyLength)),Ji.finishMessageBuffer(n,Ji.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof se)return new e(0,Me.V5,Kt.Schema,t);if(t instanceof Mn)return new e(n,Me.V5,Kt.RecordBatch,t);if(t instanceof Mr)return new e(n,Me.V5,Kt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Kt.Schema}isRecordBatch(){return this.headerType===Kt.RecordBatch}isDictionaryBatch(){return this.headerType===Kt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Ir(t)}},Mn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=Ir(t)}},Mr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=Ir(n)}},Ar=class{constructor(t,n){this.offset=Ir(t),this.length=Ir(n)}},bi=class{constructor(t,n){this.length=Ir(t),this.nullCount=Ir(n)}};function eX(e,t){return()=>{switch(t){case Kt.Schema:return se.fromJSON(e);case Kt.RecordBatch:return Mn.fromJSON(e);case Kt.DictionaryBatch:return Mr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Kt[t]}, type: ${t} }`)}}function nX(e,t){return()=>{switch(t){case Kt.Schema:return se.decode(e.header(new Er),new Map,e.version());case Kt.RecordBatch:return Mn.decode(e.header(new Wr),e.version());case Kt.DictionaryBatch:return Mr.decode(e.header(new Xs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Kt[t]}, type: ${t} }`)}}zt.encode=hX;zt.decode=fX;zt.fromJSON=Ek;se.encode=dX;se.decode=rX;se.fromJSON=vk;Mn.encode=pX;Mn.decode=iX;Mn.fromJSON=ET;Mr.encode=mX;Mr.decode=oX;Mr.fromJSON=Sk;bi.encode=yX;bi.decode=aX;Ar.encode=gX;Ar.decode=sX;function rX(e,t=new Map,n=Me.V5){let r=uX(e,t);return new se(r,$b(e),t,n)}function iX(e,t=Me.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Mn(e.length(),cX(e),lX(e,t))}function oX(e,t=Me.V5){return new Mr(Mn.decode(e.data(),t),e.id(),e.isDelta())}function sX(e){return new Ar(e.offset(),e.length())}function aX(e){return new bi(e.length(),e.nullCount())}function cX(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=bi.decode(n));return t}function lX(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Me.V4&&(r.bb_pos+=8*(i+1)),n[++o]=Ar.decode(r));return n}function uX(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=zt.decode(r,t));return n}function Ak(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=zt.decode(r,t));return n}function fX(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=Ok(e,Ak(e,t)),r=new zt(e.name(),i,e.nullable(),$b(e))):t.has(n=Ir(a.id()))?(o=(o=a.indexType())?Mk(o):new _o,s=new jr(t.get(n),o,n,a.isOrdered()),r=new zt(e.name(),s,e.nullable(),$b(e))):(o=(o=a.indexType())?Mk(o):new _o,t.set(n,i=Ok(e,Ak(e,t))),s=new jr(i,o,n,a.isOrdered()),r=new zt(e.name(),s,e.nullable(),$b(e))),r||null}function $b(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Mk(e){return new Ve(e.isSigned(),e.bitWidth())}function Ok(e,t){let n=e.typeType();switch(n){case ve.NONE:return new tr;case ve.Null:return new tr;case ve.Binary:return new As;case ve.Utf8:return new Ms;case ve.Bool:return new Os;case ve.List:return new qi((t||[])[0]);case ve.Struct_:return new _e(t||[])}switch(n){case ve.Int:{let r=e.type(new Qi);return new Ve(r.isSigned(),r.bitWidth())}case ve.FloatingPoint:{let r=e.type(new oc);return new Tr(r.precision())}case ve.Decimal:{let r=e.type(new Ao);return new Ns(r.scale(),r.precision(),r.bitWidth())}case ve.Date:{let r=e.type(new ec);return new Ds(r.unit())}case ve.Time:{let r=e.type(new Ps);return new Vi(r.unit(),r.bitWidth())}case ve.Timestamp:{let r=e.type(new $s);return new Rs(r.unit(),r.timezone())}case ve.Interval:{let r=e.type(new sc);return new Ls(r.unit())}case ve.Duration:{let r=e.type(new nc);return new Fs(r.unit())}case ve.Union:{let r=e.type(new Ki);return new Yi(r.mode(),r.typeIdsArray()||[],t||[])}case ve.FixedSizeBinary:{let r=e.type(new rc);return new ks(r.byteWidth())}case ve.FixedSizeList:{let r=e.type(new ic);return new Gi(r.listSize(),(t||[])[0])}case ve.Map:{let r=e.type(new ac);return new Wi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ve[n]}" (${n})`)}function dX(e,t){let n=t.fields.map(o=>zt.encode(e,o));Er.startFieldsVector(e,n.length);let r=Er.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Er.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return an.startKeyValue(e),an.addKey(e,a),an.addValue(e,c),an.endKeyValue(e)})):-1;return Er.startSchema(e),Er.addFields(e,r),Er.addEndianness(e,xX?tc.Little:tc.Big),i!==-1&&Er.addCustomMetadata(e,i),Er.endSchema(e)}function hX(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;lt.isDictionary(o)?(s=o.dictionary.typeId,i=Bb.visit(o,e),r=Bb.visit(o.dictionary,e)):r=Bb.visit(o,e);let a=(o.children||[]).map(u=>zt.encode(e,u)),c=Un.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return an.startKeyValue(e),an.addKey(e,d),an.addValue(e,h),an.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Un.startField(e),Un.addType(e,r),Un.addTypeType(e,s),Un.addChildren(e,c),Un.addNullable(e,!!t.nullable),n!==-1&&Un.addName(e,n),i!==-1&&Un.addDictionary(e,i),l!==-1&&Un.addCustomMetadata(e,l),Un.endField(e)}function pX(e,t){let n=t.nodes||[],r=t.buffers||[];Wr.startNodesVector(e,n.length);for(let s of n.slice().reverse())bi.encode(e,s);let i=e.endVector();Wr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())Ar.encode(e,s);let o=e.endVector();return Wr.startRecordBatch(e),Wr.addLength(e,BigInt(t.length)),Wr.addNodes(e,i),Wr.addBuffers(e,o),Wr.endRecordBatch(e)}function mX(e,t){let n=Mn.encode(e,t.data);return Xs.startDictionaryBatch(e),Xs.addId(e,BigInt(t.id)),Xs.addIsDelta(e,t.isDelta),Xs.addData(e,n),Xs.endDictionaryBatch(e)}function yX(e,t){return vf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function gX(e,t){return _f.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var xX=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var MT=e=>`Expected ${Kt[e]} Message in stream, but was null or length 0.`,OT=e=>`Header pointer of flatbuffer-encoded ${Kt[e]} Message is null or length 0.`,Nk=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Dk=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,If=class{constructor(t){this.source=t instanceof Oo?t:new Oo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Se:t.value===-1&&(t=this.readMetadataLength()).done?Se:(t=this.readMetadata(t.value)).done?Se:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Lt(this.source.read(t));if(n.byteLength<t)throw new Error(Dk(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Kt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(OT(n));return i}readMetadataLength(){let t=this.source.read(Ub),n=t&&new Yr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return Se;if(n.byteLength<t)throw new Error(Nk(t,n.byteLength));return{done:!1,value:Or.decode(n)}}},jp=class{constructor(t,n){this.source=t instanceof gi?t:wx(t)?new cc(t,n):new gi(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Se:t.value===-1&&(t=yield this.readMetadataLength()).done?Se:(t=yield this.readMetadata(t.value)).done?Se:t})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Lt(yield this.source.read(t));if(n.byteLength<t)throw new Error(Dk(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Kt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(OT(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(Ub),n=t&&new Yr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return Se;if(n.byteLength<t)throw new Error(Nk(t,n.byteLength));return{done:!1,value:Or.decode(n)}})}},Vp=class extends If{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof dp?t:new dp(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Or.fromJSON(t.schema,Kt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:Or.fromJSON(n,Kt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:Or.fromJSON(n,Kt.RecordBatch)}}return this._body=[],Se}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(MT(t));return n.value}readSchema(){let t=Kt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(OT(t));return r}},Ub=4,AT="ARROW1",Tf=new Uint8Array(AT.length);for(let e=0;e<AT.length;e+=1)Tf[e]=AT.codePointAt(e);function zb(e,t=0){for(let n=-1,r=Tf.length;++n<r;)if(Tf[n]!==e[t+n])return!1;return!0}var Ef=Tf.length,NT=Ef+Ub,Rk=Ef*2+Ub;var On=class e extends Al{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return Pi(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Tn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Tn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:xx(t)?wX(t):wx(t)?SX(t):Pi(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):_x(t)||Gh(t)||Sx(t)||hi(t)?vX(new gi(t)):_X(new Oo(t))}static readAll(t){return t instanceof e?t.isSync()?Lk(t):Fk(t):xx(t)||ArrayBuffer.isView(t)||$i(t)||bx(t)?Lk(t):Fk(t)}},Do=class extends On{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ur(this,arguments,function*(){yield Bt(yield*rf(Bi(this[Symbol.iterator]())))})}},lc=class extends On{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=Bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},uc=class extends Do{constructor(t){super(t),this._impl=t}},qp=class extends lc{constructor(t){super(t),this._impl=t}},jb=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Ft({type:new _e(this.schema.fields),length:t.length,children:r});return new Pe(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new Gt(l)):new Gt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new yp(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},Af=class extends jb{constructor(t,n){super(n),this._reader=xx(t)?new Vp(this._handle=t):new If(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=kk(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Se}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Se}next(){if(this.closed)return Se;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ll(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Mf=class extends jb{constructor(t,n){super(n),this._reader=new jp(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Z(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=kk(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Se})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Se})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return Se;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ll(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Vb=class extends Af{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof hp?t:new hp(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Kt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Kt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-NT,r=t.readInt32(n),i=t.readAt(n-r,r);return Us.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},DT=class extends Mf{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof cc?t:new cc(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Kt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Kt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-NT,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Us.decode(i)})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},RT=class extends Af{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new hb(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function kk(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*Lk(e){let t=On.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Fk(e){return Ur(this,arguments,function*(){let n=yield Bt(On.from(e));try{if(!(yield Bt(n.open({autoDestroy:!1}))).closed)do yield yield Bt(n);while(!(yield Bt(n.reset().open())).closed)}finally{yield Bt(n.cancel())}})}function wX(e){return new Do(new RT(e))}function _X(e){let t=e.peek(Ef+7&-8);return t&&t.byteLength>=4?zb(t)?new uc(new Vb(e.read())):new Do(new Af(e)):new Do(new Af(function*(){}()))}function vX(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(Ef+7&-8);return t&&t.byteLength>=4?zb(t)?new uc(new Vb(yield e.read())):new lc(new Mf(e)):new lc(new Mf(function(){return Ur(this,arguments,function*(){})}()))})}function SX(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new cc(e,t);return t>=Rk&&zb(yield n.readAt(0,Ef+7&-8))?new qp(new DT(n)):new lc(new Mf(n))})}var $e=class e extends dt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Pe?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Gt)return this.visitMany(t.data),this;let{type:n}=t;if(!lt.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(lt.isUnion(n))this.nodes.push(new bi(r,0));else{let{nullCount:i}=t;lt.isNull(n)||to.call(this,i<=0?new Uint8Array(0):vl(t.offset,r,t.nullBitmap)),this.nodes.push(new bi(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function to(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Ar(this._byteLength,t)),this._byteLength+=t,this}function IX(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(to.call(this,i),n.mode===we.Sparse)return LT.call(this,e);if(n.mode===we.Dense){if(e.offset<=0)return to.call(this,o),LT.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);to.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function TX(e){let t;return e.nullCount>=e.length?to.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?to.call(this,vl(e.offset,e.length,t)):to.call(this,Sl(e.values))}function Hs(e){return to.call(this,e.values.subarray(0,e.length*e.stride))}function Ck(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return to.call(this,Ix(-i,t+1,r)),to.call(this,n.subarray(i,i+s)),this}function FT(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return to.call(this,Ix(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function LT(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}$e.prototype.visitBool=TX;$e.prototype.visitInt=Hs;$e.prototype.visitFloat=Hs;$e.prototype.visitUtf8=Ck;$e.prototype.visitBinary=Ck;$e.prototype.visitFixedSizeBinary=Hs;$e.prototype.visitDate=Hs;$e.prototype.visitTimestamp=Hs;$e.prototype.visitTime=Hs;$e.prototype.visitDecimal=Hs;$e.prototype.visitList=FT;$e.prototype.visitStruct=LT;$e.prototype.visitUnion=IX;$e.prototype.visitInterval=Hs;$e.prototype.visitDuration=Hs;$e.prototype.visitFixedSizeList=FT;$e.prototype.visitMap=FT;var Fl=class extends Al{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Mo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Kn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Pi(t)?t.then(n=>this.writeAll(n)):hi(t)?CT(this,t):kT(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof Mo?this._sink=t:(this._sink=new Mo,t&&eF(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&nF(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Rl(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof nr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Pe&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Rl(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Pe?t instanceof Ll||this._writeRecordBatch(t):t instanceof nr?this.writeAll(t.batches):$i(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=Or.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Kt.RecordBatch?this._recordBatchBlocks.push(new zs(a,t.bodyLength,this._position)):t.headerType===Kt.DictionaryBatch&&this._dictionaryBlocks.push(new zs(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Lt(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Or.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Tf)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=$e.assemble(t),s=new Mn(t.numRows,r,i),a=Or.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=$e.assemble(new Gt([t])),c=new Mn(t.length,o,s),l=new Mr(c,n,r),u=Or.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},kl=class e extends Fl{static writeAll(t,n){let r=new e(n);return Pi(t)?t.then(i=>r.writeAll(i)):hi(t)?CT(r,t):kT(r,t)}},Cl=class e extends Fl{static writeAll(t){let n=new e;return Pi(t)?t.then(r=>n.writeAll(r)):hi(t)?CT(n,t):kT(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=Us.encode(new Us(t,Me.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function kT(e,t){let n=t;t instanceof nr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function CT(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=Bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function Bk(e,t){if(hi(e))return AX(e,t);if($i(e))return EX(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function EX(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Lt(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function AX(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Lt(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function Uk(e){return new BT(e)}var BT=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=JL(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ol(o),this._getSize=i!=="bytes"?Pk:$k;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?Pk:$k}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},Pk=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},$k=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function qb(e,t){let n=new Mo,r=null,i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield n.close()})},start(a){return Z(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Z(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Z(this,void 0,void 0,function*(){return yield(yield On.from(n)).open(t)})}function s(a,c){return Z(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Yb(e,t){let n=new this(e),r=new gi(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Gb(e,t="stream"){return(t==="stream"?kl:Cl).writeAll(e).toUint8Array(!0)}var DX=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},XI),wT),fT),HI),VI),uT),GI),{compareSchemas:Rl,compareFields:hk,compareTypes:pk});Tn.toDOMStream=Bk;Te.throughDOM=Uk;On.throughDOM=qb;uc.throughDOM=qb;Do.throughDOM=qb;Fl.throughDOM=Yb;Cl.throughDOM=Yb;kl.throughDOM=Yb;var RX=Object.create,jk=Object.defineProperty,LX=Object.getOwnPropertyDescriptor,FX=Object.getOwnPropertyNames,kX=Object.getPrototypeOf,CX=Object.prototype.hasOwnProperty,BX=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),PX=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FX(t))!CX.call(e,i)&&i!==n&&jk(e,i,{get:()=>t[i],enumerable:!(r=LX(t,i))||r.enumerable});return e},$X=(e,t,n)=>(n=e!=null?RX(kX(e)):{},PX(t||!e||!e.__esModule?jk(n,"default",{value:e,enumerable:!0}):n,e)),UX=BX((e,t)=>{t.exports=Worker}),zX=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(zX||{}),jX=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(jX||{}),VX=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(VX||{}),qX=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(qX||{}),YX=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(YX||{}),GX=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(GX||{}),Vk=class{log(e){}},qk=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var WX=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(WX||{}),XX=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=On.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new nr(n)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let n=new Yk(this._bindings,this._conn,t),r=await On.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new HX(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=Gb(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},Yk=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},HX=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=On.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new nr(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new Yk(this.bindings,this.connectionId,t),r=await On.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},QX=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(QX||{}),ZX=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(ZX||{}),Jt=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function Wb(e){switch(e.typeId){case R.Binary:return{sqlType:"binary"};case R.Bool:return{sqlType:"bool"};case R.Date:return{sqlType:"date"};case R.DateDay:return{sqlType:"date32[d]"};case R.DateMillisecond:return{sqlType:"date64[ms]"};case R.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case R.Float:return{sqlType:"float"};case R.Float16:return{sqlType:"float16"};case R.Float32:return{sqlType:"float32"};case R.Float64:return{sqlType:"float64"};case R.Int:return{sqlType:"int32"};case R.Int16:return{sqlType:"int16"};case R.Int32:return{sqlType:"int32"};case R.Int64:return{sqlType:"int64"};case R.Uint16:return{sqlType:"uint16"};case R.Uint32:return{sqlType:"uint32"};case R.Uint64:return{sqlType:"uint64"};case R.Uint8:return{sqlType:"uint8"};case R.IntervalDayTime:return{sqlType:"interval[dt]"};case R.IntervalYearMonth:return{sqlType:"interval[m]"};case R.List:return{sqlType:"list",valueType:Wb(e.valueType)};case R.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case R.Null:return{sqlType:"null"};case R.Utf8:return{sqlType:"utf8"};case R.Struct:return{sqlType:"struct",fields:e.children.map(t=>VT(t.name,t.type))};case R.Map:{let t=e;return{sqlType:"map",keyType:Wb(t.keyType),valueType:Wb(t.valueType)}}case R.Time:return{sqlType:"time[s]"};case R.TimeMicrosecond:return{sqlType:"time[us]"};case R.TimeMillisecond:return{sqlType:"time[ms]"};case R.TimeNanosecond:return{sqlType:"time[ns]"};case R.TimeSecond:return{sqlType:"time[s]"};case R.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case R.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case R.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case R.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case R.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function VT(e,t){let n=Wb(t);return n.name=e,n}var KX=new TextEncoder,Gk=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Jt("RESET",null);return await this.postTask(e)}async ping(){let e=new Jt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Jt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Jt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Jt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Jt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Jt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Jt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Jt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Jt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Jt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new XX(this,e)}async disconnect(e){let t=new Jt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Jt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Jt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Jt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Jt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Jt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Jt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Jt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Jt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Jt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Jt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Jt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=KX.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Jt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Jt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Jt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Jt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Jt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Jt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Jt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Jt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Jt("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(VT(o,s))}n.columnsFlat=i,delete n.columns}let r=new Jt("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(VT(o,s))}n.columnsFlat=i,delete n.columns}let r=new Jt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var JX=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),tH=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),eH=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),nH=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),qT={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev99.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.19.10",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.10.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.2",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},rH=qT.name,iH=qT.version,YT=qT.version.split("."),ivt=YT[0],ovt=YT[1],svt=YT[2],oH=()=>typeof navigator>"u";function Wk(){let e="https://cdn.jsdelivr.net/npm/".concat(rH,"@").concat(iH,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var PT=null,$T=null,UT=null,zT=null,jT=null;async function sH(){return PT==null&&(PT=typeof BigInt64Array<"u"),$T==null&&($T=await tH()),UT==null&&(UT=await nH()),zT==null&&(zT=await eH()),jT==null&&(jT=await JX()),{bigInt64Array:PT,crossOriginIsolated:oH()||globalThis.crossOriginIsolated||!1,wasmExceptions:$T,wasmSIMD:zT,wasmThreads:UT,wasmBulkMemory:jT}}async function Xk(e){let t=await sH();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var avt=$X(UX());function aH(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var cvt=aH(),cH=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(cH||{});function uH(e,t){return new Promise((n,r)=>{e.useUnsafe(async(i,o)=>{try{let s=await i.runQuery(o,t);n(s)}catch(s){r(s)}})})}function Hk(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):fH(r).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,h=await l(),p=await uH(h,d);return f==="exec"?void 0:f==="arrow"?ja(p):ja(p).toArray()}}}async function fH({log:e=!1}={}){let t=Wk(),n=await Xk(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new qk:new Vk,s=new Gk(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function Bl(e,t,{source:n,clients:r=n?new Set([n]):void 0}){let i=t!==void 0?Ku(e,hl(t)):null;return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function Pl(e,t,{source:n,clients:r=n?new Set([n]):void 0}){let i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Ku(e[l],hl(c)));return a.length>1?vr(a):a[0]});i=o.length>1?pl(o):o[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function $l(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?We(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function GT(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?vr(e.map((l,u)=>We(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}var dH={contains:RS,prefix:LS,suffix:FS,regexp:DS};function WT(e,t,{source:n,clients:r=void 0,method:i="contains"}){let o=dH[i],s=t?o(e,hl(t)):null;return{meta:{type:"match",method:i},source:n,clients:r,value:t,predicate:s}}function XT(e){return typeof e?.getChild=="function"}function HT(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}function Nr(e){return XT(e)?hH(e):pH(e)}function hH(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function pH(e){let t=e.length;if(typeof e[0]=="object"){let n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}var GR={};kr(GR,{Fixed:()=>Ro,Param:()=>Ga,Query:()=>pt,Selection:()=>bo,agg:()=>Vt,align:()=>N4,and:()=>vr,area:()=>y8,areaX:()=>g8,areaY:()=>x8,argmax:()=>tf,argmin:()=>Ju,arrayAgg:()=>yI,arrow:()=>fR,aspectRatio:()=>D4,avg:()=>kh,axis:()=>R4,axisFx:()=>yR,axisFy:()=>gR,axisX:()=>pR,axisY:()=>mR,barX:()=>v8,barY:()=>S8,bin:()=>Q2,cast:()=>Bh,castDouble:()=>ef,castInteger:()=>gI,cell:()=>I8,cellX:()=>T8,cellY:()=>E8,centroid:()=>$h,centroidX:()=>SI,centroidY:()=>II,circle:()=>L8,colorBase:()=>bD,colorClamp:()=>aD,colorConstant:()=>_D,colorDomain:()=>oD,colorExponent:()=>wD,colorInterpolate:()=>fD,colorLabel:()=>pD,colorLegend:()=>VR,colorN:()=>cD,colorNice:()=>lD,colorPercent:()=>mD,colorPivot:()=>dD,colorRange:()=>sD,colorReverse:()=>yD,colorScale:()=>iD,colorScheme:()=>uD,colorSymmetric:()=>hD,colorTickFormat:()=>xD,colorZero:()=>gD,column:()=>Va,contour:()=>Z8,coordinator:()=>di,corr:()=>iI,count:()=>Zn,covarPop:()=>sI,covariance:()=>oI,create:()=>Ya,cume_dist:()=>$S,dateDay:()=>vI,dateMonth:()=>wI,dateMonthDay:()=>_I,delaunayLink:()=>cR,delaunayMesh:()=>lR,denseLine:()=>Q8,dense_rank:()=>BS,density:()=>H8,densityX:()=>W8,densityY:()=>X8,dot:()=>N8,dotX:()=>D8,dotY:()=>R8,entropy:()=>eI,eq:()=>AS,errorbarX:()=>iR,errorbarY:()=>oR,facetGrid:()=>iN,facetLabel:()=>oN,facetMargin:()=>JO,facetMarginBottom:()=>eN,facetMarginLeft:()=>nN,facetMarginRight:()=>rN,facetMarginTop:()=>tN,first:()=>hI,first_value:()=>VS,frame:()=>hR,from:()=>BV,fxAlign:()=>dN,fxAriaDescription:()=>NN,fxAriaLabel:()=>ON,fxAxis:()=>yN,fxDomain:()=>sN,fxFontVariant:()=>MN,fxGrid:()=>SN,fxInset:()=>cN,fxInsetLeft:()=>lN,fxInsetRight:()=>uN,fxLabel:()=>TN,fxLabelAnchor:()=>EN,fxLabelOffset:()=>AN,fxLine:()=>IN,fxPadding:()=>hN,fxPaddingInner:()=>pN,fxPaddingOuter:()=>mN,fxRange:()=>aN,fxReverse:()=>DN,fxRound:()=>fN,fxTickFormat:()=>_N,fxTickPadding:()=>wN,fxTickRotate:()=>vN,fxTickSize:()=>xN,fxTickSpacing:()=>bN,fxTicks:()=>gN,fyAlign:()=>PN,fyAriaDescription:()=>nD,fyAriaLabel:()=>eD,fyAxis:()=>jN,fyDomain:()=>RN,fyFontVariant:()=>tD,fyGrid:()=>HN,fyInset:()=>FN,fyInsetBottom:()=>CN,fyInsetTop:()=>kN,fyLabel:()=>ZN,fyLabelAnchor:()=>KN,fyLabelOffset:()=>JN,fyLine:()=>QN,fyPadding:()=>$N,fyPaddingInner:()=>UN,fyPaddingOuter:()=>zN,fyRange:()=>LN,fyReverse:()=>rD,fyRound:()=>BN,fyTickFormat:()=>WN,fyTickPadding:()=>GN,fyTickRotate:()=>XN,fyTickSize:()=>qN,fyTickSpacing:()=>YN,fyTicks:()=>VN,geo:()=>vR,geojson:()=>Ph,graticule:()=>IR,grid:()=>F4,gridFx:()=>wR,gridFy:()=>_R,gridX:()=>xR,gridY:()=>bR,gt:()=>Lh,gte:()=>MS,hconcat:()=>NV,heatmap:()=>K8,height:()=>T4,hexagon:()=>F8,hexbin:()=>eR,hexgrid:()=>nR,highlight:()=>TR,hspace:()=>LV,hull:()=>uR,image:()=>G8,inset:()=>L4,intervalX:()=>LR,intervalXY:()=>kR,intervalY:()=>FR,isBetween:()=>We,isDistinct:()=>OS,isNotBetween:()=>NS,isNotDistinct:()=>Ku,isNotNull:()=>Is,isNull:()=>ml,kurtosis:()=>tI,label:()=>k4,lag:()=>zS,last:()=>pI,last_value:()=>qS,lead:()=>jS,lengthBase:()=>n8,lengthClamp:()=>KD,lengthConstant:()=>i8,lengthDomain:()=>QD,lengthExponent:()=>r8,lengthNice:()=>JD,lengthPercent:()=>t8,lengthRange:()=>ZD,lengthScale:()=>HD,lengthZero:()=>e8,line:()=>b8,lineX:()=>w8,lineY:()=>_8,link:()=>dR,literal:()=>hl,loadCSV:()=>MI,loadExtension:()=>EI,loadJSON:()=>OI,loadObjects:()=>RI,loadParquet:()=>NI,loadSpatial:()=>DI,lt:()=>Ts,lte:()=>Es,mad:()=>WS,margin:()=>_4,marginBottom:()=>O4,marginLeft:()=>E4,marginRight:()=>A4,marginTop:()=>M4,margins:()=>w4,max:()=>ui,median:()=>HS,menu:()=>IV,min:()=>fi,mode:()=>ZS,name:()=>x4,nearest:()=>NR,nearestX:()=>DR,nearestY:()=>RR,neq:()=>yl,not:()=>ES,nth_value:()=>YS,ntile:()=>US,opacityBase:()=>RD,opacityClamp:()=>TD,opacityConstant:()=>FD,opacityDomain:()=>SD,opacityExponent:()=>LD,opacityLabel:()=>AD,opacityLegend:()=>qR,opacityNice:()=>ED,opacityPercent:()=>MD,opacityRange:()=>ID,opacityReverse:()=>OD,opacityScale:()=>vD,opacityTickFormat:()=>DD,opacityZero:()=>ND,or:()=>pl,padding:()=>C4,pan:()=>CR,panX:()=>BR,panY:()=>PR,panZoom:()=>$R,panZoomX:()=>UR,panZoomY:()=>zR,percent_rank:()=>PS,plot:()=>zV,product:()=>XS,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,quantile:()=>QS,rBase:()=>GD,rClamp:()=>zD,rConstant:()=>XD,rDomain:()=>$D,rExponent:()=>WD,rLabel:()=>VD,rNice:()=>jD,rPercent:()=>qD,rRange:()=>UD,rScale:()=>PD,rZero:()=>YD,rank:()=>CS,raster:()=>J8,rasterTile:()=>tR,rect:()=>A8,rectX:()=>M8,rectY:()=>O8,regressionY:()=>rR,row_number:()=>kS,ruleX:()=>P8,ruleY:()=>$8,search:()=>TV,skewness:()=>JS,slider:()=>EV,sphere:()=>SR,spike:()=>Y8,sql:()=>q,stddev:()=>Ch,stddevPop:()=>rI,stringAgg:()=>mI,style:()=>S4,sum:()=>Pr,symbolDomain:()=>CD,symbolLegend:()=>YR,symbolRange:()=>BD,symbolScale:()=>kD,table:()=>AV,text:()=>k8,textX:()=>C8,textY:()=>B8,tickX:()=>U8,tickY:()=>z8,toggle:()=>ju,toggleColor:()=>OR,toggleX:()=>ER,toggleY:()=>AR,toggleZ:()=>MR,varPop:()=>nI,variance:()=>KS,vconcat:()=>OV,vector:()=>j8,vectorX:()=>V8,vectorY:()=>q8,voronoi:()=>sR,voronoiMesh:()=>aR,vspace:()=>RV,width:()=>I4,xAlign:()=>G4,xAriaDescription:()=>fO,xAriaLabel:()=>uO,xAxis:()=>Q4,xBase:()=>mO,xClamp:()=>q4,xConstant:()=>gO,xDomain:()=>P4,xExponent:()=>yO,xFontVariant:()=>lO,xGrid:()=>rO,xInset:()=>z4,xInsetLeft:()=>j4,xInsetRight:()=>V4,xLabel:()=>oO,xLabelAnchor:()=>sO,xLabelArrow:()=>aO,xLabelOffset:()=>cO,xLine:()=>iO,xNice:()=>U4,xPadding:()=>W4,xPaddingInner:()=>X4,xPaddingOuter:()=>H4,xPercent:()=>dO,xRange:()=>$4,xReverse:()=>hO,xRound:()=>Y4,xScale:()=>B4,xTickFormat:()=>eO,xTickPadding:()=>tO,xTickRotate:()=>nO,xTickSize:()=>K4,xTickSpacing:()=>J4,xTicks:()=>Z4,xZero:()=>pO,xyDomain:()=>v4,yAlign:()=>AO,yAriaDescription:()=>GO,yAriaLabel:()=>YO,yAxis:()=>DO,yBase:()=>QO,yClamp:()=>TO,yConstant:()=>KO,yDomain:()=>bO,yExponent:()=>ZO,yFontVariant:()=>qO,yGrid:()=>PO,yInset:()=>vO,yInsetBottom:()=>IO,yInsetTop:()=>SO,yLabel:()=>UO,yLabelAnchor:()=>zO,yLabelArrow:()=>jO,yLabelOffset:()=>VO,yLine:()=>$O,yNice:()=>_O,yPadding:()=>MO,yPaddingInner:()=>OO,yPaddingOuter:()=>NO,yPercent:()=>WO,yRange:()=>wO,yReverse:()=>XO,yRound:()=>EO,yScale:()=>xO,yTickFormat:()=>CO,yTickPadding:()=>kO,yTickRotate:()=>BO,yTickSize:()=>LO,yTickSpacing:()=>FO,yTicks:()=>RO,yZero:()=>HO});var Ro=Symbol("Fixed"),Nn=Symbol("Transient"),Yp=Symbol("Transform");var t4={};kr(t4,{Area:()=>Du,Arrow:()=>a0,BarX:()=>Ru,BarY:()=>Lu,Cell:()=>Fu,Contour:()=>x0,Density:()=>_0,Dot:()=>ku,Frame:()=>t0,Geo:()=>v0,Hexgrid:()=>S0,Image:()=>I0,Line:()=>Cu,Link:()=>o0,Mark:()=>xt,Raster:()=>p0,Rect:()=>Nu,RuleX:()=>Yy,RuleY:()=>Gy,Text:()=>Au,TickX:()=>u0,TickY:()=>f0,Tip:()=>e0,Vector:()=>Ou,WaffleX:()=>E0,WaffleY:()=>A0,area:()=>i0,areaX:()=>Kc,areaY:()=>La,arrow:()=>WU,auto:()=>iz,autoSpec:()=>T6,axisFx:()=>Wv,axisFy:()=>Gv,axisX:()=>Xy,axisY:()=>Wy,barX:()=>fs,barY:()=>ds,bin:()=>Ra,binX:()=>ls,binY:()=>us,bollinger:()=>nl,bollingerX:()=>uz,bollingerY:()=>fz,boxX:()=>dz,boxY:()=>hz,cell:()=>Jc,cellX:()=>HU,cellY:()=>QU,centroid:()=>w2,circle:()=>JU,cluster:()=>fj,column:()=>wn,contour:()=>vz,crosshair:()=>Tz,crosshairX:()=>Ez,crosshairY:()=>Az,delaunayLink:()=>Nz,delaunayMesh:()=>Dz,density:()=>Cz,differenceX:()=>$z,differenceY:()=>Uz,dodgeX:()=>Dj,dodgeY:()=>Rj,dot:()=>Li,dotX:()=>ZU,dotY:()=>KU,filter:()=>o9,find:()=>p9,formatIsoDate:()=>Q3,formatMonth:()=>b$,formatNumber:()=>H3,formatWeekday:()=>w$,frame:()=>Qd,geo:()=>_2,geoCentroid:()=>jz,graticule:()=>qz,gridFx:()=>Zv,gridFy:()=>Hv,gridX:()=>Qv,gridY:()=>Xv,group:()=>By,groupX:()=>Bc,groupY:()=>Pc,groupZ:()=>Cy,hexagon:()=>tz,hexbin:()=>Yz,hexgrid:()=>Gz,hull:()=>Rz,identity:()=>X,image:()=>Xz,indexOf:()=>ye,initializer:()=>xe,interpolateNearest:()=>y0,interpolateNone:()=>b2,interpolatorBarycentric:()=>m0,interpolatorRandomWalk:()=>g0,legend:()=>mU,line:()=>Bu,lineX:()=>tl,lineY:()=>el,linearRegressionX:()=>Zz,linearRegressionY:()=>Kz,link:()=>u2,map:()=>Lr,mapX:()=>nh,mapY:()=>rh,marks:()=>on,normalize:()=>N2,normalizeX:()=>Cj,normalizeY:()=>Bj,numberInterval:()=>h3,plot:()=>Zd,pointer:()=>qc,pointerX:()=>Yc,pointerY:()=>Na,raster:()=>xz,rect:()=>Jy,rectX:()=>Xd,rectY:()=>Hd,reverse:()=>s9,ruleX:()=>ii,ruleY:()=>oi,scale:()=>$c,select:()=>zj,selectFirst:()=>N0,selectLast:()=>D0,selectMaxX:()=>F2,selectMaxY:()=>k2,selectMinX:()=>R2,selectMinY:()=>L2,shiftX:()=>Pj,shiftY:()=>$j,shuffle:()=>a9,sort:()=>pv,sphere:()=>Vz,spike:()=>H$,stackX:()=>p6,stackX1:()=>_U,stackX2:()=>vU,stackY:()=>m6,stackY1:()=>SU,stackY2:()=>IU,text:()=>cs,textX:()=>$v,textY:()=>Uv,tickX:()=>y2,tickY:()=>g2,timeInterval:()=>Ny,tip:()=>i2,transform:()=>rn,tree:()=>Y6,treeLink:()=>E2,treeNode:()=>T0,utcInterval:()=>gu,valueof:()=>gt,vector:()=>f6,vectorX:()=>Vv,vectorY:()=>qv,voronoi:()=>Lz,voronoiMesh:()=>Fz,waffleX:()=>gj,waffleY:()=>xj,window:()=>ih,windowX:()=>oz,windowY:()=>sz});function Nt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rr(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function eo(e){let t,n,r;e.length!==2?(t=Nt,n=(a,c)=>Nt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Nt||e===rr?e:mH,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function mH(){return 0}function Gp(e){return e===null?NaN:+e}function*Qk(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Zk=eo(Nt),Kk=Zk.right,yH=Zk.left,gH=eo(Gp).center,Qs=Kk;var Wp=Jk(t5),QT=Jk(xH);function Jk(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(Of(a,l,i,o,s),Of(a,i,l,o,s),Of(a,l,i,o,s),Nf(c,i,l,o,s),Nf(c,l,i,o,s),Nf(c,i,l,o,s)):a?(Of(a,i,l,o,s),Of(a,l,i,o,s),Of(a,i,l,o,s)):c&&(Nf(c,i,l,o,s),Nf(c,l,i,o,s),Nf(c,i,l,o,s)),t}}function Of(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Nf(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function xH(e){let t=t5(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function t5(e){let t=Math.floor(e);if(t===e)return bH(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function bH(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function Lo(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function wH(e){return e.length|0}function _H(e){return!(e>0)}function vH(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function SH(e){return t=>e(...t)}function Xb(...e){let t=typeof e[e.length-1]=="function"&&SH(e.pop());e=e.map(vH);let n=e.map(wH),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(_H))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function Hb(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function fc(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function wi(e,t){let n=fc(e,t);return n&&Math.sqrt(n)}function ne(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var Dn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var ir=class extends Map{constructor(t,n=r5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(ZT(this,t))}has(t){return super.has(ZT(this,t))}set(t,n){return super.set(e5(this,t),n)}delete(t){return super.delete(n5(this,t))}},or=class extends Set{constructor(t,n=r5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has(ZT(this,t))}add(t){return super.add(e5(this,t))}delete(t){return super.delete(n5(this,t))}};function ZT({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function e5({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function n5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function r5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Xp(e){return e}function Rn(e,...t){return JT(e,Xp,Xp,t)}function no(e,t,...n){return JT(e,Xp,t,n)}function KT(e,t,...n){return JT(e,Array.from,t,n)}function JT(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new ir,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function tE(e,t){return Array.from(t,n=>e[n])}function Zs(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Ul(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Ul(n[i],n[o]))),tE(e,r)}return e.sort(Hp(n))}function Hp(e=Nt){if(e===Nt)return Ul;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Ul(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Df(e,t,n){return(t.length!==2?Zs(no(e,t,n),([r,i],[o,s])=>Nt(i,s)||Nt(r,o)):Zs(Rn(e,n),([r,i],[o,s])=>t(i,s)||Nt(r,o))).map(([r])=>r)}var IH=Math.sqrt(50),TH=Math.sqrt(10),EH=Math.sqrt(2);function Qb(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=IH?10:o>=TH?5:o>=EH?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?Qb(e,t,n*2):[a,c,l]}function Ln(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?Qb(t,e,n):Qb(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Ks(e,t,n){return t=+t,e=+e,n=+n,Qb(e,t,n)[2]}function Rf(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Ks(t,e,n):Ks(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Lf(e,t,n){let r;for(;;){let i=Ks(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function dc(e){return Math.max(1,Math.ceil(Math.log(Lo(e))/Math.LN2)+1)}function Qt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function Zb(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function ue(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Kb(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function Jb(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Ul:Hp(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));Jb(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Qp(e,n,t),i(e[r],o)>0&&Qp(e,n,r);s<a;){for(Qp(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Qp(e,n,a):(++a,Qp(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Qp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function zl(e,t=Nt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Nt(s,i)>0:Nt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function sr(e,t,n){if(e=Float64Array.from(Qk(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ue(e);if(t>=1)return Qt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Qt(Jb(e,o).subarray(0,o+1)),a=ue(e.subarray(o+1));return s+(a-s)*(i-o)}}function eE(e,t,n=Gp){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function t1(e,t,n){let r=Lo(e),i=sr(e,.75)-sr(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Zp(e,t,n){let r=Lo(e),i=wi(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Js(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function ro(e,t){return sr(e,.5,t)}function*MH(e){for(let t of e)yield*t}function Ff(e){return Array.from(MH(e))}function kf(e,t){let n=new ir;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function e1(e,t=OH){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function OH(e,t){return[e,t]}function qe(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function Kp(e,t=Nt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Nt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Nt?(a,c)=>Ul(n[a],n[c]):Hp(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function n1(e,t=Nt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Nt(s,i)<0:Nt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function Fn(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function hc(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function i5(e){return e}var nE=1,rE=2,iE=3,r1=4,o5=1e-6;function NH(e){return"translate("+e+",0)"}function DH(e){return"translate(0,"+e+")"}function RH(e){return t=>+e(t)}function LH(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function FH(){return!this.__axis}function kH(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===nE||e===r1?-1:1,u=e===r1||e===rE?"x":"y",f=e===nE||e===iE?NH:DH;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):i5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,w=(t.bandwidth?LH:RH)(t.copy(),c),v=h.selection?h.selection():h,_=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),A=T.exit(),E=T.enter().append("g").attr("class","tick"),O=T.select("line"),I=T.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),O=O.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),I=I.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===nE?"0em":e===iE?"0.71em":"0.32em")),h!==v&&(_=_.transition(h),T=T.transition(h),O=O.transition(h),I=I.transition(h),A=A.transition(h).attr("opacity",o5).attr("transform",function(D){return isFinite(D=w(D))?f(D+c):this.getAttribute("transform")}),E.attr("opacity",o5).attr("transform",function(D){var k=this.parentNode.__axis;return f((k&&isFinite(k=k(D))?k:w(D))+c)})),A.remove(),_.attr("d",e===r1||e===rE?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),T.attr("opacity",1).attr("transform",function(D){return f(w(D)+c)}),O.attr(u+"2",l*o),I.attr(u,l*y).text(m),v.filter(FH).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===rE?"start":e===r1?"end":"middle"),v.each(function(){this.__axis=w})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function oE(e){return kH(iE,e)}var CH={value:()=>{}};function a5(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new i1(n)}function i1(e){this._=e}function BH(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}i1.prototype=a5.prototype={constructor:i1,on:function(e,t){var n=this._,r=BH(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=PH(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=s5(n[i],e.name,t);else if(t==null)for(i in n)n[i]=s5(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new i1(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function PH(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function s5(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CH,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jl=a5;var o1="http://www.w3.org/1999/xhtml",ar={svg:"http://www.w3.org/2000/svg",xhtml:o1,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ta(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ar.hasOwnProperty(t)?{space:ar[t],local:e}:e}function $H(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===o1&&t.documentElement.namespaceURI===o1?t.createElement(e):t.createElementNS(n,e)}}function UH(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ea(e){var t=ta(e);return(t.local?UH:$H)(t)}function zH(){}function Vl(e){return e==null?zH:function(){return this.querySelector(e)}}function c5(e){typeof e!="function"&&(e=Vl(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Ue(r,this._parents)}function sE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function jH(){return[]}function Jp(e){return e==null?jH:function(){return this.querySelectorAll(e)}}function VH(e){return function(){return sE(e.apply(this,arguments))}}function l5(e){typeof e=="function"?e=VH(e):e=Jp(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Ue(r,i)}function tm(e){return function(){return this.matches(e)}}function s1(e){return function(t){return t.matches(e)}}var qH=Array.prototype.find;function YH(e){return function(){return qH.call(this.children,e)}}function GH(){return this.firstElementChild}function u5(e){return this.select(e==null?GH:YH(typeof e=="function"?e:s1(e)))}var WH=Array.prototype.filter;function XH(){return Array.from(this.children)}function HH(e){return function(){return WH.call(this.children,e)}}function f5(e){return this.selectAll(e==null?XH:HH(typeof e=="function"?e:s1(e)))}function d5(e){typeof e!="function"&&(e=tm(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Ue(r,this._parents)}function a1(e){return new Array(e.length)}function h5(){return new Ue(this._enter||this._groups.map(a1),this._parents)}function em(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}em.prototype={constructor:em,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function p5(e){return function(){return e}}function QH(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new em(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function ZH(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new em(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function KH(e){return e.__data__}function m5(e,t){if(!arguments.length)return Array.from(this,KH);var n=t?ZH:QH,r=this._parents,i=this._groups;typeof e!="function"&&(e=p5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=JH(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);n(u,f,m,y,g,h,t);for(var x=0,b=0,w,v;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(v=y[b])&&++b<p;);w._next=v||null}}return s=new Ue(s,r),s._enter=a,s._exit=c,s}function JH(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function y5(){return new Ue(this._exit||this._groups.map(a1),this._parents)}function g5(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function x5(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Ue(a,this._parents)}function b5(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function w5(e){e||(e=tQ);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Ue(i,this._parents).order()}function tQ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function v5(){return Array.from(this)}function S5(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function I5(){let e=0;for(let t of this)++e;return e}function T5(){return!this.node()}function E5(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function eQ(e){return function(){this.removeAttribute(e)}}function nQ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rQ(e,t){return function(){this.setAttribute(e,t)}}function iQ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function A5(e,t){var n=ta(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?nQ:eQ:typeof t=="function"?n.local?sQ:oQ:n.local?iQ:rQ)(n,t))}function c1(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function aQ(e){return function(){this.style.removeProperty(e)}}function cQ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lQ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function M5(e,t,n){return arguments.length>1?this.each((t==null?aQ:typeof t=="function"?lQ:cQ)(e,t,n??"")):pc(this.node(),e)}function pc(e,t){return e.style.getPropertyValue(t)||c1(e).getComputedStyle(e,null).getPropertyValue(t)}function uQ(e){return function(){delete this[e]}}function fQ(e,t){return function(){this[e]=t}}function dQ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function O5(e,t){return arguments.length>1?this.each((t==null?uQ:typeof t=="function"?dQ:fQ)(e,t)):this.node()[e]}function N5(e){return e.trim().split(/^|\s+/)}function aE(e){return e.classList||new D5(e)}function D5(e){this._node=e,this._names=N5(e.getAttribute("class")||"")}D5.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function R5(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function L5(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function hQ(e){return function(){R5(this,e)}}function pQ(e){return function(){L5(this,e)}}function mQ(e,t){return function(){(t.apply(this,arguments)?R5:L5)(this,e)}}function F5(e,t){var n=N5(e+"");if(arguments.length<2){for(var r=aE(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?mQ:t?hQ:pQ)(n,t))}function yQ(){this.textContent=""}function gQ(e){return function(){this.textContent=e}}function xQ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function k5(e){return arguments.length?this.each(e==null?yQ:(typeof e=="function"?xQ:gQ)(e)):this.node().textContent}function bQ(){this.innerHTML=""}function wQ(e){return function(){this.innerHTML=e}}function _Q(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function C5(e){return arguments.length?this.each(e==null?bQ:(typeof e=="function"?_Q:wQ)(e)):this.node().innerHTML}function vQ(){this.nextSibling&&this.parentNode.appendChild(this)}function B5(){return this.each(vQ)}function SQ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P5(){return this.each(SQ)}function $5(e){var t=typeof e=="function"?e:ea(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function IQ(){return null}function U5(e,t){var n=typeof e=="function"?e:ea(e),r=t==null?IQ:typeof t=="function"?t:Vl(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function TQ(){var e=this.parentNode;e&&e.removeChild(this)}function z5(){return this.each(TQ)}function EQ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function AQ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function j5(e){return this.select(e?AQ:EQ)}function V5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function MQ(e){return function(t){e.call(this,t,this.__data__)}}function OQ(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function NQ(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function DQ(e,t,n){return function(){var r=this.__on,i,o=MQ(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function q5(e,t,n){var r=OQ(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?DQ:NQ,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function Y5(e,t,n){var r=c1(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function RQ(e,t){return function(){return Y5(this,e,t)}}function LQ(e,t){return function(){return Y5(this,e,t.apply(this,arguments))}}function G5(e,t){return this.each((typeof t=="function"?LQ:RQ)(e,t))}function*W5(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var cE=[null];function Ue(e,t){this._groups=e,this._parents=t}function X5(){return new Ue([[document.documentElement]],cE)}function FQ(){return this}Ue.prototype=X5.prototype={constructor:Ue,select:c5,selectAll:l5,selectChild:u5,selectChildren:f5,filter:d5,data:m5,enter:h5,exit:y5,join:g5,merge:x5,selection:FQ,order:b5,sort:w5,call:_5,nodes:v5,node:S5,size:I5,empty:T5,each:E5,attr:A5,style:M5,property:O5,classed:F5,text:k5,html:C5,raise:B5,lower:P5,append:$5,insert:U5,remove:z5,clone:j5,datum:V5,on:q5,dispatch:G5,[Symbol.iterator]:W5};var na=X5;function jt(e){return typeof e=="string"?new Ue([[document.querySelector(e)]],[document.documentElement]):new Ue([[e]],cE)}function H5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zn(e,t){if(e=H5(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var l1={capture:!0,passive:!1};function u1(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var t=e.document.documentElement,n=jt(e).on("dragstart.drag",u1,l1);"onselectstart"in t?n.on("selectstart.drag",u1,l1):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rm(e,t){var n=e.document.documentElement,r=jt(e).on("dragstart.drag",null);t&&(r.on("click.drag",u1,l1),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function ra(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mc(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ko(){}var yc=.7,Gl=1/yc,Cf="\\s*([+-]?\\d+)\\s*",im="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kQ=/^#([0-9a-f]{3,8})$/,CQ=new RegExp(`^rgb\\(${Cf},${Cf},${Cf}\\)$`),BQ=new RegExp(`^rgb\\(${Fo},${Fo},${Fo}\\)$`),PQ=new RegExp(`^rgba\\(${Cf},${Cf},${Cf},${im}\\)$`),$Q=new RegExp(`^rgba\\(${Fo},${Fo},${Fo},${im}\\)$`),UQ=new RegExp(`^hsl\\(${im},${Fo},${Fo}\\)$`),zQ=new RegExp(`^hsla\\(${im},${Fo},${Fo},${im}\\)$`),Q5={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ra(ko,Xr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Z5,formatHex:Z5,formatHex8:jQ,formatHsl:VQ,formatRgb:K5,toString:K5});function Z5(){return this.rgb().formatHex()}function jQ(){return this.rgb().formatHex8()}function VQ(){return iC(this).formatHsl()}function K5(){return this.rgb().formatRgb()}function Xr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kQ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?J5(t):n===3?new Qe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?f1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?f1(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=CQ.exec(e))?new Qe(t[1],t[2],t[3],1):(t=BQ.exec(e))?new Qe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PQ.exec(e))?f1(t[1],t[2],t[3],t[4]):(t=$Q.exec(e))?f1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=UQ.exec(e))?nC(t[1],t[2]/100,t[3]/100,1):(t=zQ.exec(e))?nC(t[1],t[2]/100,t[3]/100,t[4]):Q5.hasOwnProperty(e)?J5(Q5[e]):e==="transparent"?new Qe(NaN,NaN,NaN,0):null}function J5(e){return new Qe(e>>16&255,e>>8&255,e&255,1)}function f1(e,t,n,r){return r<=0&&(e=t=n=NaN),new Qe(e,t,n,r)}function om(e){return e instanceof ko||(e=Xr(e)),e?(e=e.rgb(),new Qe(e.r,e.g,e.b,e.opacity)):new Qe}function cn(e,t,n,r){return arguments.length===1?om(e):new Qe(e,t,n,r??1)}function Qe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ra(Qe,cn,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qe(Yl(this.r),Yl(this.g),Yl(this.b),h1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tC,formatHex:tC,formatHex8:qQ,formatRgb:eC,toString:eC}));function tC(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}`}function qQ(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}${ql((isNaN(this.opacity)?1:this.opacity)*255)}`}function eC(){let e=h1(this.opacity);return`${e===1?"rgb(":"rgba("}${Yl(this.r)}, ${Yl(this.g)}, ${Yl(this.b)}${e===1?")":`, ${e})`}`}function h1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ql(e){return e=Yl(e),(e<16?"0":"")+e.toString(16)}function nC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new io(e,t,n,r)}function iC(e){if(e instanceof io)return new io(e.h,e.s,e.l,e.opacity);if(e instanceof ko||(e=Xr(e)),!e)return new io;if(e instanceof io)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new io(s,a,c,e.opacity)}function sm(e,t,n,r){return arguments.length===1?iC(e):new io(e,t,n,r??1)}function io(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ra(io,sm,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new io(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new io(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Qe(lE(e>=240?e-240:e+120,i,r),lE(e,i,r),lE(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new io(rC(this.h),d1(this.s),d1(this.l),h1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=h1(this.opacity);return`${e===1?"hsl(":"hsla("}${rC(this.h)}, ${d1(this.s)*100}%, ${d1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rC(e){return e=(e||0)%360,e<0?e+360:e}function d1(e){return Math.max(0,Math.min(1,e||0))}function lE(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var p1=Math.PI/180,m1=180/Math.PI;var y1=18,oC=.96422,sC=1,aC=.82521,cC=4/29,Bf=6/29,lC=3*Bf*Bf,YQ=Bf*Bf*Bf;function uC(e){if(e instanceof Co)return new Co(e.l,e.a,e.b,e.opacity);if(e instanceof ia)return fC(e);e instanceof Qe||(e=om(e));var t=hE(e.r),n=hE(e.g),r=hE(e.b),i=uE((.2225045*t+.7168786*n+.0606169*r)/sC),o,s;return t===n&&n===r?o=s=i:(o=uE((.4360747*t+.3850649*n+.1430804*r)/oC),s=uE((.0139322*t+.0971045*n+.7141733*r)/aC)),new Co(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Pf(e,t,n,r){return arguments.length===1?uC(e):new Co(e,t,n,r??1)}function Co(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ra(Co,Pf,mc(ko,{brighter(e){return new Co(this.l+y1*(e??1),this.a,this.b,this.opacity)},darker(e){return new Co(this.l-y1*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=oC*fE(t),e=sC*fE(e),n=aC*fE(n),new Qe(dE(3.1338561*t-1.6168667*e-.4906146*n),dE(-.9787684*t+1.9161415*e+.033454*n),dE(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function uE(e){return e>YQ?Math.pow(e,1/3):e/lC+cC}function fE(e){return e>Bf?e*e*e:lC*(e-cC)}function dE(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function hE(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function GQ(e){if(e instanceof ia)return new ia(e.h,e.c,e.l,e.opacity);if(e instanceof Co||(e=uC(e)),e.a===0&&e.b===0)return new ia(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*m1;return new ia(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function am(e,t,n,r){return arguments.length===1?GQ(e):new ia(e,t,n,r??1)}function ia(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function fC(e){if(isNaN(e.h))return new Co(e.l,0,0,e.opacity);var t=e.h*p1;return new Co(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ra(ia,am,mc(ko,{brighter(e){return new ia(this.h,this.c,this.l+y1*(e??1),this.opacity)},darker(e){return new ia(this.h,this.c,this.l-y1*(e??1),this.opacity)},rgb(){return fC(this).rgb()}}));var mC=-.14861,pE=1.78277,mE=-.29227,g1=-.90649,cm=1.97294,dC=cm*g1,hC=cm*pE,pC=pE*mE-g1*mC;function WQ(e){if(e instanceof Wl)return new Wl(e.h,e.s,e.l,e.opacity);e instanceof Qe||(e=om(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(pC*r+dC*t-hC*n)/(pC+dC-hC),o=r-i,s=(cm*(n-i)-mE*o)/g1,a=Math.sqrt(s*s+o*o)/(cm*i*(1-i)),c=a?Math.atan2(s,o)*m1-120:NaN;return new Wl(c<0?c+360:c,a,i,e.opacity)}function cr(e,t,n,r){return arguments.length===1?WQ(e):new Wl(e,t,n,r??1)}function Wl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ra(Wl,cr,mc(ko,{brighter(e){return e=e==null?Gl:Math.pow(Gl,e),new Wl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yc:Math.pow(yc,e),new Wl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*p1,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Qe(255*(t+n*(mC*r+pE*i)),255*(t+n*(mE*r+g1*i)),255*(t+n*(cm*r)),this.opacity)}}));function yE(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function yC(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return yE((n-r/t)*t,s,i,o,a)}}function gC(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return yE((n-r/t)*t,i,o,s,a)}}var $f=e=>()=>e;function xC(e,t){return function(n){return e+n*t}}function XQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Uf(e,t){var n=t-e;return n?xC(e,n>180||n<-180?n-360*Math.round(n/360):n):$f(isNaN(e)?t:e)}function bC(e){return(e=+e)==1?Oe:function(t,n){return n-t?XQ(t,n,e):$f(isNaN(t)?n:t)}}function Oe(e,t){var n=t-e;return n?xC(e,n):$f(isNaN(e)?t:e)}var _i=function e(t){var n=bC(t);function r(i,o){var s=n((i=cn(i)).r,(o=cn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Oe(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function wC(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=cn(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var gE=wC(yC),HQ=wC(gC);function _C(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function vC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function SC(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Hr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function IC(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ee(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function TC(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Hr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var bE=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xE=new RegExp(bE.source,"g");function QQ(e){return function(){return e}}function ZQ(e){return function(t){return e(t)+""}}function lm(e,t){var n=bE.lastIndex=xE.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=bE.exec(e))&&(i=xE.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Ee(r,i)})),n=xE.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?ZQ(c[0].x):QQ(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Hr(e,t){var n=typeof t,r;return t==null||n==="boolean"?$f(t):(n==="number"?Ee:n==="string"?(r=Xr(t))?(t=r,_i):lm:t instanceof Xr?_i:t instanceof Date?IC:vC(t)?_C:Array.isArray(t)?SC:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?TC:Ee)(e,t)}function Xl(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var EC=180/Math.PI,x1={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wE(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*EC,skewX:Math.atan(c)*EC,scaleX:s,scaleY:a}}var b1;function AC(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?x1:wE(t.a,t.b,t.c,t.d,t.e,t.f)}function MC(e){return e==null?x1:(b1||(b1=document.createElementNS("http://www.w3.org/2000/svg","g")),b1.setAttribute("transform",e),(e=b1.transform.baseVal.consolidate())?(e=e.matrix,wE(e.a,e.b,e.c,e.d,e.e,e.f)):x1)}function OC(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ee(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ee(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Ee(l,f)},{i:m-2,x:Ee(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var _E=OC(AC,"px, ","px)","deg)"),vE=OC(MC,", ",")",")");var KQ=1e-12;function NC(e){return((e=Math.exp(e))+1/e)/2}function JQ(e){return((e=Math.exp(e))-1/e)/2}function tZ(e){return((e=Math.exp(2*e))-1)/(e+1)}var SE=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<KQ)g=Math.log(d/l)/t,y=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*g)]};else{var x=Math.sqrt(m),b=(d*d-l*l+r*m)/(2*l*n*x),w=(d*d-l*l-r*m)/(2*d*n*x),v=Math.log(Math.sqrt(b*b+1)-b),_=Math.log(Math.sqrt(w*w+1)-w);g=(_-v)/t,y=function(T){var A=T*g,E=NC(v),O=l/(n*x)*(E*tZ(t*A+v)-JQ(v));return[a+O*h,c+O*p,l*E/NC(t*A+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function DC(e){return function(t,n){var r=e((t=sm(t)).h,(n=sm(n)).h),i=Oe(t.s,n.s),o=Oe(t.l,n.l),s=Oe(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var IE=DC(Uf),eZ=DC(Oe);function w1(e,t){var n=Oe((e=Pf(e)).l,(t=Pf(t)).l),r=Oe(e.a,t.a),i=Oe(e.b,t.b),o=Oe(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function RC(e){return function(t,n){var r=e((t=am(t)).h,(n=am(n)).h),i=Oe(t.c,n.c),o=Oe(t.l,n.l),s=Oe(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var TE=RC(Uf),nZ=RC(Oe);function LC(e){return function t(n){n=+n;function r(i,o){var s=e((i=cr(i)).h,(o=cr(o)).h),a=Oe(i.s,o.s),c=Oe(i.l,o.l),l=Oe(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var rZ=LC(Uf),zf=LC(Oe);function Bo(e,t){t===void 0&&(t=e,e=Hr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function jn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var jf=0,fm=0,um=0,kC=1e3,_1,dm,v1=0,Hl=0,S1=0,hm=typeof performance=="object"&&performance.now?performance:Date,CC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mm(){return Hl||(CC(iZ),Hl=hm.now()+S1)}function iZ(){Hl=0}function pm(){this._call=this._time=this._next=null}pm.prototype=I1.prototype={constructor:pm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mm():+n)+(t==null?0:+t),!this._next&&dm!==this&&(dm?dm._next=this:_1=this,dm=this),this._call=e,this._time=n,EE()},stop:function(){this._call&&(this._call=null,this._time=1/0,EE())}};function I1(e,t,n){var r=new pm;return r.restart(e,t,n),r}function BC(){mm(),++jf;for(var e=_1,t;e;)(t=Hl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jf}function FC(){Hl=(v1=hm.now())+S1,jf=fm=0;try{BC()}finally{jf=0,sZ(),Hl=0}}function oZ(){var e=hm.now(),t=e-v1;t>kC&&(S1-=t,v1=e)}function sZ(){for(var e,t=_1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:_1=n);dm=e,EE(r)}function EE(e){if(!jf){fm&&(fm=clearTimeout(fm));var t=e-Hl;t>24?(e<1/0&&(fm=setTimeout(FC,e-hm.now()-S1)),um&&(um=clearInterval(um))):(um||(v1=hm.now(),um=setInterval(oZ,kC)),jf=1,CC(FC))}}function T1(e,t,n){var r=new pm;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var aZ=jl("start","end","cancel","interrupt"),cZ=[],UC=0,PC=1,A1=2,E1=3,$C=4,M1=5,ym=6;function gc(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;lZ(e,n,{name:t,index:r,group:i,on:aZ,tween:cZ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:UC})}function gm(e,t){var n=ln(e,t);if(n.state>UC)throw new Error("too late; already scheduled");return n}function kn(e,t){var n=ln(e,t);if(n.state>E1)throw new Error("too late; already running");return n}function ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function lZ(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=I1(o,0,n.time);function o(l){n.state=PC,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==PC)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===E1)return T1(s);h.state===$C?(h.state=ym,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=ym,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(T1(function(){n.state===E1&&(n.state=$C,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=A1,n.on.call("start",e,e.__data__,n.index,n.group),n.state===A1){for(n.state=E1,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=M1,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===M1&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ym,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Po(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>A1&&r.state<M1,r.state=ym,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function zC(e){return this.each(function(){Po(this,e)})}function uZ(e,t){var n,r;return function(){var i=kn(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function fZ(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=kn(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function jC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ln(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?uZ:fZ)(n,e,t))}function Vf(e,t,n){var r=e._id;return e.each(function(){var i=kn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ln(i,r).value[t]}}function O1(e,t){var n;return(typeof t=="number"?Ee:t instanceof Xr?_i:(n=Xr(t))?(t=n,_i):lm)(e,t)}function dZ(e){return function(){this.removeAttribute(e)}}function hZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pZ(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function mZ(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function yZ(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function gZ(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function VC(e,t){var n=ta(e),r=n==="transform"?vE:O1;return this.attrTween(e,typeof t=="function"?(n.local?gZ:yZ)(n,r,Vf(this,"attr."+e,t)):t==null?(n.local?hZ:dZ)(n):(n.local?mZ:pZ)(n,r,t))}function xZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function bZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wZ(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&bZ(e,o)),n}return i._value=t,i}function _Z(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&xZ(e,o)),n}return i._value=t,i}function qC(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ta(e);return this.tween(n,(r.local?wZ:_Z)(r,t))}function vZ(e,t){return function(){gm(this,e).delay=+t.apply(this,arguments)}}function SZ(e,t){return t=+t,function(){gm(this,e).delay=t}}function YC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vZ:SZ)(t,e)):ln(this.node(),t).delay}function IZ(e,t){return function(){kn(this,e).duration=+t.apply(this,arguments)}}function TZ(e,t){return t=+t,function(){kn(this,e).duration=t}}function GC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IZ:TZ)(t,e)):ln(this.node(),t).duration}function EZ(e,t){if(typeof t!="function")throw new Error;return function(){kn(this,e).ease=t}}function WC(e){var t=this._id;return arguments.length?this.each(EZ(t,e)):ln(this.node(),t).ease}function AZ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;kn(this,e).ease=n}}function XC(e){if(typeof e!="function")throw new Error;return this.each(AZ(this._id,e))}function HC(e){typeof e!="function"&&(e=tm(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new lr(r,this._parents,this._name,this._id)}function QC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new lr(s,this._parents,this._name,this._id)}function MZ(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function OZ(e,t,n){var r,i,o=MZ(t)?gm:kn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function ZC(e,t){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(e):this.each(OZ(n,e,t))}function NZ(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function KC(){return this.on("end.remove",NZ(this._id))}function JC(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vl(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,gc(l[d],t,n,d,l,ln(u,n)));return new lr(o,this._parents,t,n)}function tB(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jp(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=ln(u,n),m=0,y=d.length;m<y;++m)(h=d[m])&&gc(h,t,n,m,d,p);o.push(d),s.push(u)}return new lr(o,s,t,n)}var DZ=na.prototype.constructor;function eB(){return new DZ(this._groups,this._parents)}function RZ(e,t){var n,r,i;return function(){var o=pc(this,e),s=(this.style.removeProperty(e),pc(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function nB(e){return function(){this.style.removeProperty(e)}}function LZ(e,t,n){var r,i=n+"",o;return function(){var s=pc(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function FZ(e,t,n){var r,i,o;return function(){var s=pc(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),pc(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function kZ(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=kn(this,e),l=c.on,u=c.value[o]==null?a||(a=nB(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function rB(e,t,n){var r=(e+="")=="transform"?_E:O1;return t==null?this.styleTween(e,RZ(e,r)).on("end.style."+e,nB(e)):typeof t=="function"?this.styleTween(e,FZ(e,r,Vf(this,"style."+e,t))).each(kZ(this._id,e)):this.styleTween(e,LZ(e,r,t),n).on("end.style."+e,null)}function CZ(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function BZ(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&CZ(e,s,n)),r}return o._value=t,o}function iB(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,BZ(e,t,n??""))}function PZ(e){return function(){this.textContent=e}}function $Z(e){return function(){var t=e(this);this.textContent=t??""}}function oB(e){return this.tween("text",typeof e=="function"?$Z(Vf(this,"text",e)):PZ(e==null?"":e+""))}function UZ(e){return function(t){this.textContent=e.call(this,t)}}function zZ(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&UZ(i)),t}return r._value=e,r}function sB(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zZ(e))}function aB(){for(var e=this._name,t=this._id,n=N1(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ln(c,t);gc(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new lr(r,this._parents,e,n)}function cB(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=kn(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var jZ=0;function lr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function lB(e){return na().transition(e)}function N1(){return++jZ}var oa=na.prototype;lr.prototype=lB.prototype={constructor:lr,select:JC,selectAll:tB,selectChild:oa.selectChild,selectChildren:oa.selectChildren,filter:HC,merge:QC,selection:eB,transition:aB,call:oa.call,nodes:oa.nodes,node:oa.node,size:oa.size,empty:oa.empty,each:oa.each,on:ZC,attr:VC,attrTween:qC,style:rB,styleTween:iB,text:oB,textTween:sB,remove:KC,tween:jC,delay:YC,duration:GC,ease:WC,easeVarying:XC,end:cB,[Symbol.iterator]:oa[Symbol.iterator]};function D1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var VZ={time:null,delay:0,duration:250,ease:D1};function qZ(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function uB(e){var t,n;e instanceof lr?(t=e._id,e=e._name):(t=N1(),(n=VZ).time=mm(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&gc(c,e,t,l,s,n||qZ(c,t));return new lr(r,this._parents,e,t)}na.prototype.interrupt=zC;na.prototype.transition=uB;var R1=e=>()=>e;function AE(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function fB(e){e.stopImmediatePropagation()}function L1(e){e.preventDefault(),e.stopImmediatePropagation()}var dB={name:"drag"},ME={name:"space"},qf={name:"handle"},Yf={name:"center"},{abs:hB,max:Vn,min:qn}=Math;function pB(e){return[+e[0],+e[1]]}function NE(e){return[pB(e[0]),pB(e[1])]}var F1={name:"x",handles:["w","e"].map(xm),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},k1={name:"y",handles:["n","s"].map(xm),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},YZ={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(xm),input:function(e){return e==null?null:NE(e)},output:function(e){return e}},sa={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},mB={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},yB={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},GZ={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},WZ={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function xm(e){return{type:e}}function XZ(e){return!e.ctrlKey&&!e.button}function HZ(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function QZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function OE(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ZZ(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function DE(){return FE(F1)}function RE(){return FE(k1)}function LE(){return FE(YZ)}function FE(e){var t=HZ,n=XZ,r=QZ,i=!0,o=jl("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([xm("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",sa.overlay).merge(g).each(function(){var b=OE(this).extent;jt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([xm("selection")]).enter().append("rect").attr("class","selection").attr("cursor",sa.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return sa[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,v=u(b,arguments),_=w.selection,T=e.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),A=Hr(_,T);function E(O){w.selection=O===1&&T===null?null:A(O),l.call(b),v.brush()}return _!==null&&T!==null?E:E(1)}):y.each(function(){var b=this,w=arguments,v=b.__brush,_=e.input(typeof g=="function"?g.apply(b,w):g,v.extent),T=u(b,w).beforestart();Po(b),v.selection=_===null?null:_,l.call(b),T.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=jt(this),g=OE(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=jt(this.that).datum();o.call(y,this.that,new AE(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(y){if(a&&!y.touches||!n.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?dB:i&&y.altKey?Yf:qf,w=e===k1?null:GZ[x],v=e===F1?null:WZ[x],_=OE(g),T=_.extent,A=_.selection,E=T[0][0],O,I,D=T[0][1],k,S,M=T[1][0],N,L,B=T[1][1],C,P,$=0,U=0,H,nt=w&&v&&i&&y.shiftKey,ot,at,G=Array.from(y.touches||[y],tt=>{let ce=tt.identifier;return tt=zn(tt,g),tt.point0=tt.slice(),tt.identifier=ce,tt});Po(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){A&&(H=!0);let tt=[G[0],G[1]||G[0]];_.selection=A=[[O=e===k1?E:qn(tt[0][0],tt[1][0]),k=e===F1?D:qn(tt[0][1],tt[1][1])],[N=e===k1?M:Vn(tt[0][0],tt[1][0]),C=e===F1?B:Vn(tt[0][1],tt[1][1])]],G.length>1&&Ct(y)}else O=A[0][0],k=A[0][1],N=A[1][0],C=A[1][1];I=O,S=k,L=N,P=C;var V=jt(g).attr("pointer-events","none"),Q=V.selectAll(".overlay").attr("cursor",sa[x]);if(y.touches)st.moved=z,st.ended=ht;else{var rt=jt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&rt.on("keydown.brush",Xt,!0).on("keyup.brush",Zt,!0),nm(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ce of tt.changedTouches||[tt])for(let Fr of G)Fr.identifier===ce.identifier&&(Fr.cur=zn(ce,g));if(nt&&!ot&&!at&&G.length===1){let ce=G[0];hB(ce.cur[0]-ce[0])>hB(ce.cur[1]-ce[1])?at=!0:ot=!0}for(let ce of G)ce.cur&&(ce[0]=ce.cur[0],ce[1]=ce.cur[1]);H=!0,L1(tt),Ct(tt)}function Ct(tt){let ce=G[0],Fr=ce.point0;var ho;switch($=ce[0]-Fr[0],U=ce[1]-Fr[1],b){case ME:case dB:{w&&($=Vn(E-O,qn(M-N,$)),I=O+$,L=N+$),v&&(U=Vn(D-k,qn(B-C,U)),S=k+U,P=C+U);break}case qf:{G[1]?(w&&(I=Vn(E,qn(M,G[0][0])),L=Vn(E,qn(M,G[1][0])),w=1),v&&(S=Vn(D,qn(B,G[0][1])),P=Vn(D,qn(B,G[1][1])),v=1)):(w<0?($=Vn(E-O,qn(M-O,$)),I=O+$,L=N):w>0&&($=Vn(E-N,qn(M-N,$)),I=O,L=N+$),v<0?(U=Vn(D-k,qn(B-k,U)),S=k+U,P=C):v>0&&(U=Vn(D-C,qn(B-C,U)),S=k,P=C+U));break}case Yf:{w&&(I=Vn(E,qn(M,O-$*w)),L=Vn(E,qn(M,N+$*w))),v&&(S=Vn(D,qn(B,k-U*v)),P=Vn(D,qn(B,C+U*v)));break}}L<I&&(w*=-1,ho=O,O=N,N=ho,ho=I,I=L,L=ho,x in mB&&Q.attr("cursor",sa[x=mB[x]])),P<S&&(v*=-1,ho=k,k=C,C=ho,ho=S,S=P,P=ho,x in yB&&Q.attr("cursor",sa[x=yB[x]])),_.selection&&(A=_.selection),ot&&(I=A[0][0],L=A[1][0]),at&&(S=A[0][1],P=A[1][1]),(A[0][0]!==I||A[0][1]!==S||A[1][0]!==L||A[1][1]!==P)&&(_.selection=[[I,S],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(fB(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else rm(tt.view,H),rt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);V.attr("pointer-events","all"),Q.attr("cursor",sa.overlay),_.selection&&(A=_.selection),ZZ(A)&&(_.selection=null,l.call(g)),st.end(tt,b.name)}function Xt(tt){switch(tt.keyCode){case 16:{nt=w&&v;break}case 18:{b===qf&&(w&&(N=L-$*w,O=I+$*w),v&&(C=P-U*v,k=S+U*v),b=Yf,Ct(tt));break}case 32:{(b===qf||b===Yf)&&(w<0?N=L-$:w>0&&(O=I-$),v<0?C=P-U:v>0&&(k=S-U),b=ME,Q.attr("cursor",sa.selection),Ct(tt));break}default:return}L1(tt)}function Zt(tt){switch(tt.keyCode){case 16:{nt&&(ot=at=nt=!1,Ct(tt));break}case 18:{b===Yf&&(w<0?N=L:w>0&&(O=I),v<0?C=P:v>0&&(k=S),b=qf,Ct(tt));break}case 32:{b===ME&&(tt.altKey?(w&&(N=L-$*w,O=I+$*w),v&&(C=P-U*v,k=S+U*v),b=Yf):(w<0?N=L:w>0&&(O=I),v<0?C=P:v>0&&(k=S),b=qf),Q.attr("cursor",sa[x]),Ct(tt));break}default:return}L1(tt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=NE(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:R1(NE(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:R1(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:R1(!!y),c):r},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var kE=Math.PI,CE=2*kE,Ql=1e-6,KZ=CE-Ql;function gB(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function JZ(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return gB;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var xc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?gB:JZ(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>Ql)if(!(Math.abs(f*c-l*u)>Ql)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((kE-Math.acos((m+d-y)/(2*g*x)))/2),w=b/x,v=b/g;Math.abs(w-1)>Ql&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=n+v*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Ql||Math.abs(this._y1-u)>Ql)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%CE+CE),d>KZ?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>Ql&&this._append`A${r},${r},0,${+(d>=kE)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function xB(){return new xc}xB.prototype=xc.prototype;function ur(e=3){return new xc(+e)}var tK=Array.prototype,C1=tK.slice;function bB(e,t){return e-t}function wB(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var $o=e=>()=>e;function _B(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=eK(e,t[n]))return i;return 0}function eK(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(nK(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function nK(e,t,n){var r;return rK(e,t,n)&&iK(e[r=+(e[0]===t[0])],n[r],t[r])}function rK(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function iK(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function vB(){}var aa=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function bc(){var e=1,t=1,n=dc,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(bB);else{let f=ne(l,oK);for(u=Ln(...Lf(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),wB(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(_B((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,x,b;for(p=m=-1,g=Zl(l[0],u),aa[g<<1].forEach(w);++p<e-1;)y=g,g=Zl(l[p+1],u),aa[y|g<<1].forEach(w);for(aa[g<<0].forEach(w);++m<t-1;){for(p=-1,g=Zl(l[m*e+e],u),x=Zl(l[m*e],u),aa[g<<1|x<<2].forEach(w);++p<e-1;)y=g,g=Zl(l[m*e+e+p+1],u),b=x,x=Zl(l[m*e+p+1],u),aa[y|g<<1|x<<2|b<<3].forEach(w);aa[g|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,aa[x<<2].forEach(w);++p<e-1;)b=x,x=Zl(l[m*e+p+1],u),aa[x<<2|b<<3].forEach(w);aa[x<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],A=a(_),E=a(T),O,I;(O=h[A])?(I=d[E])?(delete h[O.end],delete d[I.start],O===I?(O.ring.push(T),f(O.ring)):d[O.start]=h[I.end]={start:O.start,end:I.end,ring:O.ring.concat(I.ring)}):(delete h[O.end],O.ring.push(T),h[O.end=E]=O):(O=d[E])?(I=h[A])?(delete d[O.start],delete h[I.end],O===I?(O.ring.push(T),f(O.ring)):d[I.start]=h[O.end]={start:I.start,end:O.end,ring:I.ring.concat(O.ring)}):(delete d[O.start],O.ring.unshift(_),d[O.start=A]=O):d[A]=h[E]={start:A,end:E,ring:[_,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,y=p|0,g=BE(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=SB(h,BE(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=SB(p,BE(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?$o(C1.call(l)):$o(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:vB,i):r===c},i}function oK(e){return isFinite(e)?e:NaN}function Zl(e,t){return e==null?!1:+e>=t}function BE(e){return e==null||isNaN(e=+e)?-1/0:e}function SB(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function sK(e){return e[0]}function aK(e){return e[1]}function cK(){return 1}function PE(){var e=sK,t=aK,n=cK,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=$o(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let k of x){var _=(e(k,++v,x)+a)*w,T=(t(k,v,x)+a)*w,A=+n(k,v,x);if(A&&_>=0&&_<c&&T>=0&&T<l){var E=Math.floor(_),O=Math.floor(T),I=_-E-.5,D=T-O-.5;b[E+O*c]+=(1-I)*(1-D)*A,b[E+1+O*c]+=I*(1-D)*A,b[E+1+(O+1)*c]+=I*D*A,b[E+(O+1)*c]+=(1-I)*D*A}}return Wp({data:b,width:c,height:l},o*w),b}function d(x){var b=f(x),w=u(b),v=Math.pow(2,2*s);return Array.isArray(w)||(w=Ln(Number.MIN_VALUE,Qt(b)/v,w)),bc().size([c,l]).thresholds(w.map(_=>_*v))(b).map((_,T)=>(_.value=+w[T],h(_)))}d.contours=function(x){var b=f(x),w=bc().size([c,l]),v=Math.pow(2,2*s),_=T=>{T=+T;var A=h(w.contour(b,T*v));return A.value=T,A};return Object.defineProperty(_,"max",{get:()=>Qt(b)/v}),_};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:$o(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:$o(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:$o(+x),d):n},d.size=function(x){if(!arguments.length)return[r,i];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,i=w,g()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?$o(C1.call(x)):$o(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},d}var te=11102230246251565e-32,Ze=134217729,bm=(3+8*te)*te;function Kl(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function wm(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Y(e){return new Float64Array(e)}var lK=(3+16*te)*te,uK=(2+12*te)*te,fK=(9+64*te)*te*te,Gf=Y(4),IB=Y(8),TB=Y(12),EB=Y(16),fr=Y(4);function dK(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,w,v,_,T,A,E=e-i,O=n-i,I=t-o,D=r-o;w=E*D,d=Ze*E,h=d-(d-E),p=E-h,d=Ze*D,m=d-(d-D),y=D-m,v=p*y-(w-h*m-p*m-h*y),_=I*O,d=Ze*I,h=d-(d-I),p=I-h,d=Ze*O,m=d-(d-O),y=O-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,Gf[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,Gf[1]=b-(g+f)+(f-_),A=x+g,f=A-x,Gf[2]=x-(A-f)+(g-f),Gf[3]=A;let k=wm(4,Gf),S=uK*s;if(k>=S||-k>=S||(f=e-E,a=e-(E+f)+(f-i),f=n-O,l=n-(O+f)+(f-i),f=t-I,c=t-(I+f)+(f-o),f=r-D,u=r-(D+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=fK*s+bm*Math.abs(k),k+=E*u+D*a-(I*l+O*c),k>=S||-k>=S))return k;w=a*D,d=Ze*a,h=d-(d-a),p=a-h,d=Ze*D,m=d-(d-D),y=D-m,v=p*y-(w-h*m-p*m-h*y),_=c*O,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*O,m=d-(d-O),y=O-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let M=Kl(4,Gf,4,fr,IB);w=E*u,d=Ze*E,h=d-(d-E),p=E-h,d=Ze*u,m=d-(d-u),y=u-m,v=p*y-(w-h*m-p*m-h*y),_=I*l,d=Ze*I,h=d-(d-I),p=I-h,d=Ze*l,m=d-(d-l),y=l-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let N=Kl(M,IB,4,fr,TB);w=a*u,d=Ze*a,h=d-(d-a),p=a-h,d=Ze*u,m=d-(d-u),y=u-m,v=p*y-(w-h*m-p*m-h*y),_=c*l,d=Ze*c,h=d-(d-c),p=c-h,d=Ze*l,m=d-(d-l),y=l-m,T=p*y-(_-h*m-p*m-h*y),g=v-T,f=v-g,fr[0]=v-(g+f)+(f-T),x=w+g,f=x-w,b=w-(x-f)+(g-f),g=b-_,f=b-g,fr[1]=b-(g+f)+(f-_),A=x+g,f=A-x,fr[2]=x-(A-f)+(g-f),fr[3]=A;let L=Kl(N,TB,4,fr,EB);return EB[L-1]}function Wf(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=lK*l?c:-dK(e,t,n,r,i,o,l)}var X6t=(7+56*te)*te,H6t=(3+28*te)*te,Q6t=(26+288*te)*te*te,Z6t=Y(4),K6t=Y(4),J6t=Y(4),t4t=Y(4),e4t=Y(4),n4t=Y(4),r4t=Y(4),i4t=Y(4),o4t=Y(4),s4t=Y(8),a4t=Y(8),c4t=Y(8),l4t=Y(4),u4t=Y(8),f4t=Y(8),d4t=Y(8),h4t=Y(12),p4t=Y(192),m4t=Y(192);var x4t=(10+96*te)*te,b4t=(4+48*te)*te,w4t=(44+576*te)*te*te,_4t=Y(4),v4t=Y(4),S4t=Y(4),I4t=Y(4),T4t=Y(4),E4t=Y(4),A4t=Y(4),M4t=Y(4),O4t=Y(8),N4t=Y(8),D4t=Y(8),R4t=Y(8),L4t=Y(8),F4t=Y(8),k4t=Y(8),C4t=Y(8),B4t=Y(8),P4t=Y(4),$4t=Y(4),U4t=Y(4),z4t=Y(8),j4t=Y(16),V4t=Y(16),q4t=Y(16),Y4t=Y(32),G4t=Y(32),W4t=Y(48),X4t=Y(64),H4t=Y(1152),Q4t=Y(1152);var tOt=(16+224*te)*te,eOt=(5+72*te)*te,nOt=(71+1408*te)*te*te,rOt=Y(4),iOt=Y(4),oOt=Y(4),sOt=Y(4),aOt=Y(4),cOt=Y(4),lOt=Y(4),uOt=Y(4),fOt=Y(4),dOt=Y(4),hOt=Y(24),pOt=Y(24),mOt=Y(24),yOt=Y(24),gOt=Y(24),xOt=Y(24),bOt=Y(24),wOt=Y(24),_Ot=Y(24),vOt=Y(24),SOt=Y(1152),IOt=Y(1152),TOt=Y(1152),EOt=Y(1152),AOt=Y(1152),MOt=Y(2304),OOt=Y(2304),NOt=Y(3456),DOt=Y(5760),ROt=Y(8),LOt=Y(8),FOt=Y(8),kOt=Y(16),COt=Y(24),BOt=Y(48),POt=Y(48),$Ot=Y(96),UOt=Y(192),zOt=Y(384),jOt=Y(384),VOt=Y(384),qOt=Y(768);var YOt=Y(96),GOt=Y(96),WOt=Y(96),XOt=Y(1152);var MB=Math.pow(2,-52),B1=new Uint32Array(512),Hf=class e{static from(t,n=xK,r=bK){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){let O=t[2*E],I=t[2*E+1];O<a&&(a=O),I<c&&(c=I),O>l&&(l=O),I>u&&(u=I),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,O=1/0;E<s;E++){let I=$E(f,d,t[2*E],t[2*E+1]);I<O&&(h=E,O=I)}let y=t[2*h],g=t[2*h+1];for(let E=0,O=1/0;E<s;E++){if(E===h)continue;let I=$E(y,g,t[2*E],t[2*E+1]);I<O&&I>0&&(p=E,O=I)}let x=t[2*p],b=t[2*p+1],w=1/0;for(let E=0;E<s;E++){if(E===h||E===p)continue;let O=yK(y,g,x,b,t[2*E],t[2*E+1]);O<w&&(m=E,w=O)}let v=t[2*m],_=t[2*m+1];if(w===1/0){for(let I=0;I<s;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];Xf(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),O=0;for(let I=0,D=-1/0;I<s;I++){let k=this._ids[I],S=this._dists[k];S>D&&(E[O++]=k,D=S)}this.hull=E.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Wf(y,g,x,b,v,_)<0){let E=p,O=x,I=b;p=m,x=v,b=_,m=E,v=O,_=I}let T=gK(y,g,x,b,v,_);this._cx=T.x,this._cy=T.y;for(let E=0;E<s;E++)this._dists[E]=$E(t[2*E],t[2*E+1],T.x,T.y);Xf(this._ids,this._dists,0,s-1),this._hullStart=h;let A=3;r[h]=n[m]=p,r[p]=n[h]=m,r[m]=n[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(x,b)]=p,o[this._hashKey(v,_)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let E=0,O,I;E<this._ids.length;E++){let D=this._ids[E],k=t[2*D],S=t[2*D+1];if(E>0&&Math.abs(k-O)<=MB&&Math.abs(S-I)<=MB||(O=k,I=S,D===h||D===p||D===m))continue;let M=0;for(let P=0,$=this._hashKey(k,S);P<this._hashSize&&(M=o[($+P)%this._hashSize],!(M!==-1&&M!==r[M]));P++);M=n[M];let N=M,L;for(;L=r[N],Wf(k,S,t[2*N],t[2*N+1],t[2*L],t[2*L+1])>=0;)if(N=L,N===M){N=-1;break}if(N===-1)continue;let B=this._addTriangle(N,D,r[N],-1,-1,i[N]);i[D]=this._legalize(B+2),i[N]=B,A++;let C=r[N];for(;L=r[C],Wf(k,S,t[2*C],t[2*C+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(C,D,L,i[D],-1,i[C]),i[D]=this._legalize(B+2),r[C]=C,A--,C=L;if(N===M)for(;L=n[N],Wf(k,S,t[2*L],t[2*L+1],t[2*N],t[2*N+1])<0;)B=this._addTriangle(L,D,N,-1,i[N],i[L]),this._legalize(B+2),i[L]=B,r[N]=N,A--,N=L;this._hullStart=n[D]=N,r[N]=n[C]=D,r[D]=C,o[this._hashKey(k,S)]=D,o[this._hashKey(t[2*N],t[2*N+1])]=N}this.hull=new Uint32Array(A);for(let E=0,O=this._hullStart;E<A;E++)this.hull[E]=O,O=r[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(pK(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=B1[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if(mK(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let g=r[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<B1.length&&(B1[o++]=x)}else{if(o===0)break;t=B1[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function pK(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function $E(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function mK(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function yK(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function gK(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Xf(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;_m(e,i,o),t[e[n]]>t[e[r]]&&_m(e,n,r),t[e[o]]>t[e[r]]&&_m(e,o,r),t[e[n]]>t[e[o]]&&_m(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;_m(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Xf(e,t,o,r),Xf(e,t,n,s-1)):(Xf(e,t,n,s-1),Xf(e,t,o,r))}}function _m(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function xK(e){return e[0]}function bK(e){return e[1]}var vi=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var wc=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var vm=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,y=0,g=r.length,x,b;m<g;m+=3,y+=2){let w=r[m]*2,v=r[m+1]*2,_=r[m+2]*2,T=t[w],A=t[w+1],E=t[v],O=t[v+1],I=t[_],D=t[_+1],k=E-T,S=O-A,M=I-T,N=D-A,L=(k*N-S*M)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let B=1e9*Math.sign((o-T)*N-(s-A)*M);x=(T+I)/2-B*N,b=(A+D)/2+B*M}else{let B=1/L,C=k*k+S*S,P=M*M+N*N;x=T+(N*C-S*P)*B,b=A+(k*P-M*C)*B}a[y]=x,a[y+1]=b}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new vi:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new vi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new vi:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new wc;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var wK=2*Math.PI,Qf=Math.pow;function _K(e){return e[0]}function vK(e){return e[1]}function SK(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function IK(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Si=class e{static from(t,n=_K,r=vK,i){return new e("length"in t?TK(t,n,r,i):Float64Array.from(EK(t,n,r,i)))}constructor(t){this._delaunator=new Hf(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&SK(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=IK(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Hf(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new vm(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=Qf(n-l[t*2],2)+Qf(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Qf(n-l[p*2],2)+Qf(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Qf(n-l[h*2],2)+Qf(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new vi:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new vi:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,wK)}return r&&r.value()}renderHull(t){let n=t==null?t=new vi:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new wc;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new vi:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new wc;return this.renderTriangle(t,n),n.value()}};function TK(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*EK(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function OB(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Jl(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Uo(e){return e=Jl(Math.abs(e)),e?e[1]:NaN}function NB(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function DB(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var AK=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zo(e){if(!(t=AK.exec(e)))throw new Error("invalid format: "+e);var t;return new P1({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zo.prototype=P1.prototype;function P1(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}P1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function RB(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var UE;function LB(e,t){var n=Jl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(UE=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jl(e,Math.max(0,t+o-1))[0]}function zE(e,t){var n=Jl(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var jE={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:OB,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>zE(e*100,t),r:zE,s:LB,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function VE(e){return e}var FB=Array.prototype.map,kB=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function CB(e){var t=e.grouping===void 0||e.thousands===void 0?VE:NB(FB.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?VE:DB(FB.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=zo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,w=f.trim,v=f.type;v==="n"?(x=!0,v="g"):jE[v]||(b===void 0&&(b=12),w=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?r:/[%p]/.test(v)?s:"",A=jE[v],E=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function O(I){var D=_,k=T,S,M,N;if(v==="c")k=A(I)+k,I="";else{I=+I;var L=I<0||1/I<0;if(I=isNaN(I)?c:A(Math.abs(I),b),w&&(I=RB(I)),L&&+I==0&&p!=="+"&&(L=!1),D=(L?p==="("?p:a:p==="-"||p==="("?"":p)+D,k=(v==="s"?kB[8+UE/3]:"")+k+(L&&p==="("?")":""),E){for(S=-1,M=I.length;++S<M;)if(N=I.charCodeAt(S),48>N||N>57){k=(N===46?i+I.slice(S+1):I.slice(S))+k,I=I.slice(0,S);break}}}x&&!y&&(I=t(I,1/0));var B=D.length+I.length+k.length,C=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(I=t(C+I,C.length?g-k.length:1/0),C=""),h){case"<":I=D+I+k+C;break;case"=":I=D+C+I+k;break;case"^":I=C.slice(0,B=C.length>>1)+D+I+k+C.slice(B);break;default:I=C+D+I+k;break}return o(I)}return O.toString=function(){return f+""},O}function u(f,d){var h=l((f=zo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Uo(d)/3)))*3,m=Math.pow(10,-p),y=kB[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var $1,Ii,U1;qE({thousands:",",grouping:[3],currency:["$",""]});function qE(e){return $1=CB(e),Ii=$1.format,U1=$1.formatPrefix,$1}function YE(e){return Math.max(0,-Uo(Math.abs(e)))}function GE(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Uo(t)/3)))*3-Uo(Math.abs(e)))}function WE(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Uo(t)-Uo(e))+1}var et=1e-6,tu=1e-12,Dt=Math.PI,pe=Dt/2,XE=Dt/4,pn=Dt*2,ze=180/Dt,qt=Dt/180,Pt=Math.abs,Ti=Math.atan,Ke=Math.atan2,J=Math.cos,Sm=Math.ceil,z1=Math.exp;var j1=Math.hypot,eu=Math.log,V1=Math.pow,K=Math.sin,Yn=Math.sign||function(e){return e>0?1:e<0?-1:0},me=Math.sqrt,Zf=Math.tan;function q1(e){return e>1?0:e<-1?Dt:Math.acos(e)}function Ae(e){return e>1?pe:e<-1?-pe:Math.asin(e)}function Je(){}function Y1(e,t){e&&PB.hasOwnProperty(e.type)&&PB[e.type](e,t)}var BB={Feature:function(e,t){Y1(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Y1(n[r].geometry,t)}},PB={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){HE(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)HE(n[r],t,0)},Polygon:function(e,t){$B(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)$B(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Y1(n[r],t)}};function HE(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function $B(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)HE(e[n],t,1);t.polygonEnd()}function Qr(e,t){e&&BB.hasOwnProperty(e.type)?BB[e.type](e,t):Y1(e,t)}function Im(e){return[Ke(e[1],e[0]),Ae(e[2])]}function jo(e){var t=e[0],n=e[1],r=J(n);return[r*J(t),r*K(t),K(n)]}function Tm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Kf(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function G1(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Em(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Am(e){var t=me(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Mm,W1,X1,H1,Q1,Z1,K1,J1,QE,ZE,KE,jB,VB,dr,hr,pr,oo={sphere:Je,point:JE,lineStart:UB,lineEnd:zB,polygonStart:function(){oo.lineStart=NK,oo.lineEnd=DK},polygonEnd:function(){oo.lineStart=UB,oo.lineEnd=zB}};function JE(e,t){e*=qt,t*=qt;var n=J(t);Om(n*J(e),n*K(e),K(t))}function Om(e,t,n){++Mm,X1+=(e-X1)/Mm,H1+=(t-H1)/Mm,Q1+=(n-Q1)/Mm}function UB(){oo.point=MK}function MK(e,t){e*=qt,t*=qt;var n=J(t);dr=n*J(e),hr=n*K(e),pr=K(t),oo.point=OK,Om(dr,hr,pr)}function OK(e,t){e*=qt,t*=qt;var n=J(t),r=n*J(e),i=n*K(e),o=K(t),s=Ke(me((s=hr*o-pr*i)*s+(s=pr*r-dr*o)*s+(s=dr*i-hr*r)*s),dr*r+hr*i+pr*o);W1+=s,Z1+=s*(dr+(dr=r)),K1+=s*(hr+(hr=i)),J1+=s*(pr+(pr=o)),Om(dr,hr,pr)}function zB(){oo.point=JE}function NK(){oo.point=RK}function DK(){qB(jB,VB),oo.point=JE}function RK(e,t){jB=e,VB=t,e*=qt,t*=qt,oo.point=qB;var n=J(t);dr=n*J(e),hr=n*K(e),pr=K(t),Om(dr,hr,pr)}function qB(e,t){e*=qt,t*=qt;var n=J(t),r=n*J(e),i=n*K(e),o=K(t),s=hr*o-pr*i,a=pr*r-dr*o,c=dr*i-hr*r,l=j1(s,a,c),u=Ae(l),f=l&&-u/l;QE.add(f*s),ZE.add(f*a),KE.add(f*c),W1+=u,Z1+=u*(dr+(dr=r)),K1+=u*(hr+(hr=i)),J1+=u*(pr+(pr=o)),Om(dr,hr,pr)}function tA(e){Mm=W1=X1=H1=Q1=Z1=K1=J1=0,QE=new Dn,ZE=new Dn,KE=new Dn,Qr(e,oo);var t=+QE,n=+ZE,r=+KE,i=j1(t,n,r);return i<tu&&(t=Z1,n=K1,r=J1,W1<et&&(t=X1,n=H1,r=Q1),i=j1(t,n,r),i<tu)?[NaN,NaN]:[Ke(n,t)*ze,Ae(r/i)*ze]}function Nm(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function eA(e,t){return Pt(e)>Dt&&(e-=Math.round(e/pn)*pn),[e,t]}eA.invert=eA;function nA(e,t,n){return(e%=pn)?t||n?Nm(GB(e),WB(t,n)):GB(e):t||n?WB(t,n):eA}function YB(e){return function(t,n){return t+=e,Pt(t)>Dt&&(t-=Math.round(t/pn)*pn),[t,n]}}function GB(e){var t=YB(e);return t.invert=YB(-e),t}function WB(e,t){var n=J(e),r=K(e),i=J(t),o=K(t);function s(a,c){var l=J(c),u=J(a)*l,f=K(a)*l,d=K(c),h=d*n+u*r;return[Ke(f*i-h*o,u*n-d*r),Ae(h*i+f*o)]}return s.invert=function(a,c){var l=J(c),u=J(a)*l,f=K(a)*l,d=K(c),h=d*i-f*o;return[Ke(f*i+d*o,u*n+h*r),Ae(h*n-u*r)]},s}function XB(e){e=nA(e[0]*qt,e[1]*qt,e.length>2?e[2]*qt:0);function t(n){return n=e(n[0]*qt,n[1]*qt),n[0]*=ze,n[1]*=ze,n}return t.invert=function(n){return n=e.invert(n[0]*qt,n[1]*qt),n[0]*=ze,n[1]*=ze,n},t}function QB(e,t,n,r,i,o){if(n){var s=J(t),a=K(t),c=r*n;i==null?(i=t+r*pn,o=t-c/2):(i=HB(s,i),o=HB(s,o),(r>0?i<o:i>o)&&(i+=r*pn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Im([s,-a*J(u),-a*K(u)]),e.point(l[0],l[1])}}function HB(e,t){t=jo(t),t[0]-=e,Am(t);var n=q1(-t[1]);return((-t[2]<0?-n:n)+pn-et)%pn}function tw(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Je,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Jf(e,t){return Pt(e[0]-t[0])<et&&Pt(e[1]-t[1])<et}function ew(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function nw(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(Jf(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new ew(y,p,null,!0)),s.push(x.o=new ew(y,null,x,!1)),o.push(x=new ew(g,p,null,!1)),s.push(x.o=new ew(g,null,x,!0))}}),!!o.length){for(s.sort(t),ZB(o),ZB(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function ZB(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function rA(e){return Pt(e[0])<=Dt?e[0]:Yn(e[0])*((Pt(e[0])+Dt)%pn-Dt)}function KB(e,t){var n=rA(t),r=t[1],i=K(r),o=[K(n),-J(n),0],s=0,a=0,c=new Dn;i===1?r=pe+et:i===-1&&(r=-pe-et);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=rA(h),m=h[1]/2+XE,y=K(m),g=J(m),x=0;x<d;++x,p=w,y=_,g=T,h=b){var b=f[x],w=rA(b),v=b[1]/2+XE,_=K(v),T=J(v),A=w-p,E=A>=0?1:-1,O=E*A,I=O>Dt,D=y*_;if(c.add(Ke(D*E*K(O),g*T+D*J(O))),s+=I?A+E*pn:A,I^p>=n^w>=n){var k=Kf(jo(h),jo(b));Am(k);var S=Kf(o,k);Am(S);var M=(I^A>=0?-1:1)*Ae(S[2]);(r>M||r===M&&(k[0]||k[1]))&&(a+=I^A>=0?1:-1)}}return(s<-et||s<et&&c<-tu)^a&1}function rw(e,t,n,r){return function(i){var o=t(i),s=tw(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Ff(u);var w=KB(l,r);u.length?(c||(i.polygonStart(),c=!0),nw(u,FK,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(w,v){e(w,v)&&i.point(w,v)}function p(w,v){o.point(w,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(w,v){f.push([w,v]),a.point(w,v)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,T=v.length,A,E,O;if(f.pop(),l.push(f),f=null,!!T){if(w&1){if(E=v[0],(A=E.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<A;++_)i.point((O=E[_])[0],O[1]);i.lineEnd()}return}T>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(LK))}}return d}}function LK(e){return e.length>1}function FK(e,t){return((e=e.x)[0]<0?e[1]-pe-et:pe-e[1])-((t=t.x)[0]<0?t[1]-pe-et:pe-t[1])}var iA=rw(function(){return!0},kK,BK,[-Dt,-pe]);function kK(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Dt:-Dt,c=Pt(o-t);Pt(c-Dt)<et?(e.point(t,n=(n+s)/2>0?pe:-pe),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Dt&&(Pt(t-r)<et&&(t-=r*et),Pt(o-a)<et&&(o-=a*et),n=CK(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function CK(e,t,n,r){var i,o,s=K(e-n);return Pt(s)>et?Ti((K(t)*(o=J(r))*K(n)-K(r)*(i=J(t))*K(e))/(i*o*s)):(t+r)/2}function BK(e,t,n,r){var i;if(e==null)i=n*pe,r.point(-Dt,i),r.point(0,i),r.point(Dt,i),r.point(Dt,0),r.point(Dt,-i),r.point(0,-i),r.point(-Dt,-i),r.point(-Dt,0),r.point(-Dt,i);else if(Pt(e[0]-t[0])>et){var o=e[0]<t[0]?Dt:-Dt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function JB(e){var t=J(e),n=6*qt,r=t>0,i=Pt(t)>et;function o(u,f,d,h){QB(h,e,n,d,u,f)}function s(u,f){return J(u)*J(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var x=[y,g],b,w=s(y,g),v=r?w?0:l(y,g):w?l(y+(y<0?Dt:-Dt),g):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Jf(f,b)||Jf(x,b))&&(x[2]=1)),w!==h)m=0,w?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&r^w){var _;!(v&d)&&(_=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(_[0][0],_[0][1]),u.point(_[1][0],_[1][1]),u.lineEnd()):(u.point(_[1][0],_[1][1]),u.lineEnd(),u.lineStart(),u.point(_[0][0],_[0][1],3)))}w&&(!f||!Jf(f,x))&&u.point(x[0],x[1]),f=x,h=w,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=jo(u),p=jo(f),m=[1,0,0],y=Kf(h,p),g=Tm(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var w=t*g/b,v=-t*x/b,_=Kf(m,y),T=Em(m,w),A=Em(y,v);G1(T,A);var E=_,O=Tm(T,E),I=Tm(E,E),D=O*O-I*(Tm(T,T)-1);if(!(D<0)){var k=me(D),S=Em(E,(-O-k)/I);if(G1(S,T),S=Im(S),!d)return S;var M=u[0],N=f[0],L=u[1],B=f[1],C;N<M&&(C=M,M=N,N=C);var P=N-M,$=Pt(P-Dt)<et,U=$||P<et;if(!$&&B<L&&(C=L,L=B,B=C),U?$?L+B>0^S[1]<(Pt(S[0]-M)<et?L:B):L<=S[1]&&S[1]<=B:P>Dt^(M<=S[0]&&S[0]<=N)){var H=Em(E,(-O+k)/I);return G1(H,T),[S,Im(H)]}}}function l(u,f){var d=r?e:Dt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return rw(s,a,o,r?[0,-e]:[-Dt,e-Dt])}function t7(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Dm=1e9,iw=-Dm;function td(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Pt(l[0]-e)<et?u>0?0:3:Pt(l[0]-n)<et?u>0?2:1:Pt(l[1]-t)<et?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=tw(),d,h,p,m,y,g,x,b,w,v,_,T={point:A,lineStart:D,lineEnd:k,polygonStart:O,polygonEnd:I};function A(M,N){i(M,N)&&u.point(M,N)}function E(){for(var M=0,N=0,L=h.length;N<L;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,H,nt=$[0],ot=$[1];C<P;++C)U=nt,H=ot,$=B[C],nt=$[0],ot=$[1],H<=r?ot>r&&(nt-U)*(r-H)>(ot-H)*(e-U)&&++M:ot<=r&&(nt-U)*(r-H)<(ot-H)*(e-U)&&--M;return M}function O(){u=f,d=[],h=[],_=!0}function I(){var M=E(),N=_&&M,L=(d=Ff(d)).length;(N||L)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&nw(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function D(){T.point=S,h&&h.push(p=[]),v=!0,w=!1,x=b=NaN}function k(){d&&(S(m,y),g&&w&&f.rejoin(),d.push(f.result())),T.point=A,w&&u.lineEnd()}function S(M,N){var L=i(M,N);if(h&&p.push([M,N]),v)m=M,y=N,g=L,v=!1,L&&(u.lineStart(),u.point(M,N));else if(L&&w)u.point(M,N);else{var B=[x=Math.max(iw,Math.min(Dm,x)),b=Math.max(iw,Math.min(Dm,b))],C=[M=Math.max(iw,Math.min(Dm,M)),N=Math.max(iw,Math.min(Dm,N))];t7(B,C,e,t,n,r)?(w||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),L||u.lineEnd(),_=!1):L&&(u.lineStart(),u.point(M,N),_=!1)}x=M,b=N,w=L}return T}}function e7(e,t,n){var r=qe(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function n7(e,t,n){var r=qe(e,t-et,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function oA(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return qe(Sm(r/u)*u,n,u).map(p).concat(qe(Sm(a/f)*f,s,f).map(m)).concat(qe(Sm(t/c)*c,e,c).filter(function(b){return Pt(b%u)>et}).map(d)).concat(qe(Sm(o/l)*l,i,l).filter(function(b){return Pt(b%f)>et}).map(h))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[r,a],[n,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,d=e7(o,i,90),h=n7(t,e,y),p=e7(a,s,90),m=n7(r,n,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function sA(){return oA()()}var Rm=e=>e;var aA=new Dn,cA=new Dn,r7,i7,lA,uA,_c={point:Je,lineStart:Je,lineEnd:Je,polygonStart:function(){_c.lineStart=PK,_c.lineEnd=UK},polygonEnd:function(){_c.lineStart=_c.lineEnd=_c.point=Je,aA.add(Pt(cA)),cA=new Dn},result:function(){var e=aA/2;return aA=new Dn,e}};function PK(){_c.point=$K}function $K(e,t){_c.point=o7,r7=lA=e,i7=uA=t}function o7(e,t){cA.add(uA*e-lA*t),lA=e,uA=t}function UK(){o7(r7,i7)}var fA=_c;var ed=1/0,ow=ed,Lm=-ed,sw=Lm,zK={point:jK,lineStart:Je,lineEnd:Je,polygonStart:Je,polygonEnd:Je,result:function(){var e=[[ed,ow],[Lm,sw]];return Lm=sw=-(ow=ed=1/0),e}};function jK(e,t){e<ed&&(ed=e),e>Lm&&(Lm=e),t<ow&&(ow=t),t>sw&&(sw=t)}var nd=zK;var dA=0,hA=0,Fm=0,aw=0,cw=0,rd=0,pA=0,mA=0,km=0,c7,l7,Vo,qo,so={point:nu,lineStart:s7,lineEnd:a7,polygonStart:function(){so.lineStart=YK,so.lineEnd=GK},polygonEnd:function(){so.point=nu,so.lineStart=s7,so.lineEnd=a7},result:function(){var e=km?[pA/km,mA/km]:rd?[aw/rd,cw/rd]:Fm?[dA/Fm,hA/Fm]:[NaN,NaN];return dA=hA=Fm=aw=cw=rd=pA=mA=km=0,e}};function nu(e,t){dA+=e,hA+=t,++Fm}function s7(){so.point=VK}function VK(e,t){so.point=qK,nu(Vo=e,qo=t)}function qK(e,t){var n=e-Vo,r=t-qo,i=me(n*n+r*r);aw+=i*(Vo+e)/2,cw+=i*(qo+t)/2,rd+=i,nu(Vo=e,qo=t)}function a7(){so.point=nu}function YK(){so.point=WK}function GK(){u7(c7,l7)}function WK(e,t){so.point=u7,nu(c7=Vo=e,l7=qo=t)}function u7(e,t){var n=e-Vo,r=t-qo,i=me(n*n+r*r);aw+=i*(Vo+e)/2,cw+=i*(qo+t)/2,rd+=i,i=qo*e-Vo*t,pA+=i*(Vo+e),mA+=i*(qo+t),km+=i*3,nu(Vo=e,qo=t)}var yA=so;function lw(e){this._context=e}lw.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,pn);break}}},result:Je};var xA=new Dn,gA,f7,d7,Cm,Bm,uw={point:Je,lineStart:function(){uw.point=XK},lineEnd:function(){gA&&h7(f7,d7),uw.point=Je},polygonStart:function(){gA=!0},polygonEnd:function(){gA=null},result:function(){var e=+xA;return xA=new Dn,e}};function XK(e,t){uw.point=h7,f7=Cm=e,d7=Bm=t}function h7(e,t){Cm-=e,Bm-=t,xA.add(me(Cm*Cm+Bm*Bm)),Cm=e,Bm=t}var bA=uw;var p7,fw,m7,y7,id=class{constructor(t){this._append=t==null?g7:HK(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==m7||this._append!==fw){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,m7=r,fw=this._append,y7=this._,this._=i}this._+=y7;break}}}result(){let t=this._;return this._="",t.length?t:null}};function g7(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HK(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return g7;if(t!==p7){let n=10**t;p7=t,fw=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return fw}function mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Qr(a,i(o))),o.result()}return s.area=function(a){return Qr(a,i(fA)),fA.result()},s.measure=function(a){return Qr(a,i(bA)),bA.result()},s.bounds=function(a){return Qr(a,i(nd)),nd.result()},s.centroid=function(a){return Qr(a,i(yA)),yA.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Rm):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new id(n)):new lw(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new id(n)),s},s.projection(e).digits(n).context(t)}function ru(e){return{stream:od(e)}}function od(e){return function(t){var n=new wA;for(var r in e)n[r]=e[r];return n.stream=t,n}}function wA(){}wA.prototype={constructor:wA,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function _A(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Qr(n,e.stream(nd)),t(nd.result()),r!=null&&e.clipExtent(r),e}function Pm(e,t,n){return _A(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function dw(e,t,n){return Pm(e,[[0,0],t],n)}function hw(e,t,n){return _A(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function pw(e,t,n){return _A(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var x7=16,QK=J(30*qt);function vA(e,t){return+t?KK(e,t):ZK(e)}function ZK(e){return od({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function KK(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-r,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var w=s+d,v=a+h,_=c+p,T=me(w*w+v*v+_*_),A=Ae(_/=T),E=Pt(Pt(_)-1)<et||Pt(o-f)<et?(o+f)/2:Ke(v,w),O=e(E,A),I=O[0],D=O[1],k=I-r,S=D-i,M=x*k-g*S;(M*M/b>t||Pt((g*k+x*S)/b-.5)>.3||s*d+a*h+c*p<QK)&&(n(r,i,o,s,a,c,I,D,E,w/=T,v/=T,_,m,y),y.point(I,D),n(I,D,E,w,v,_,l,u,f,d,h,p,m,y))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),y.lineStart=v},polygonEnd:function(){r.polygonEnd(),y.lineStart=x}};function g(A,E){A=e(A,E),r.point(A[0],A[1])}function x(){f=NaN,y.point=b,r.lineStart()}function b(A,E){var O=jo([A,E]),I=e(A,E);n(f,d,u,h,p,m,f=I[0],d=I[1],u=A,h=O[0],p=O[1],m=O[2],x7,r),r.point(f,d)}function w(){y.point=g,r.lineEnd()}function v(){x(),y.point=_,y.lineEnd=T}function _(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function T(){n(f,d,u,h,p,m,o,s,i,a,c,l,x7,r),y.lineEnd=w,w()}return y}}var JK=od({point:function(e,t){this.stream.point(e*qt,t*qt)}});function tJ(e){return od({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function eJ(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function b7(e,t,n,r,i,o){if(!o)return eJ(e,t,n,r,i);var s=J(o),a=K(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(m,y){return m*=r,y*=i,[c*m-l*y+t,n-l*m-c*y]}return p.invert=function(m,y){return[r*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Cn(e){return SA(function(){return e})()}function SA(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=iA,y=null,g,x,b,w=Rm,v=.5,_,T,A,E,O;function I(M){return A(M[0]*qt,M[1]*qt)}function D(M){return M=A.invert(M[0],M[1]),M&&[M[0]*ze,M[1]*ze]}I.stream=function(M){return E&&O===M?E:E=JK(tJ(u)(m(_(w(O=M)))))},I.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},I.postclip=function(M){return arguments.length?(w=M,y=g=x=b=null,S()):w},I.clipAngle=function(M){return arguments.length?(m=+M?JB(p=M*qt):(p=null,iA),S()):p*ze},I.clipExtent=function(M){return arguments.length?(w=M==null?(y=g=x=b=null,Rm):td(y=+M[0][0],g=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):y==null?null:[[y,g],[x,b]]},I.scale=function(M){return arguments.length?(n=+M,k()):n},I.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],k()):[r,i]},I.center=function(M){return arguments.length?(o=M[0]%360*qt,s=M[1]%360*qt,k()):[o*ze,s*ze]},I.rotate=function(M){return arguments.length?(a=M[0]%360*qt,c=M[1]%360*qt,l=M.length>2?M[2]%360*qt:0,k()):[a*ze,c*ze,l*ze]},I.angle=function(M){return arguments.length?(f=M%360*qt,k()):f*ze},I.reflectX=function(M){return arguments.length?(d=M?-1:1,k()):d<0},I.reflectY=function(M){return arguments.length?(h=M?-1:1,k()):h<0},I.precision=function(M){return arguments.length?(_=vA(T,v=M*M),S()):me(v)},I.fitExtent=function(M,N){return Pm(I,M,N)},I.fitSize=function(M,N){return dw(I,M,N)},I.fitWidth=function(M,N){return hw(I,M,N)},I.fitHeight=function(M,N){return pw(I,M,N)};function k(){var M=b7(n,0,0,d,h,f).apply(null,t(o,s)),N=b7(n,r-M[0],i-M[1],d,h,f);return u=nA(a,c,l),T=Nm(t,N),A=Nm(u,T),_=vA(T,v),S()}function S(){return E=O=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&D,k()}}function sd(e){var t=0,n=Dt/3,r=SA(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*qt,n=o[1]*qt):[t*ze,n*ze]},i}function w7(e){var t=J(e);function n(r,i){return[r*t,K(i)/t]}return n.invert=function(r,i){return[r/t,Ae(i*t)]},n}function _7(e,t){var n=K(e),r=(n+K(t))/2;if(Pt(r)<et)return w7(e);var i=1+n*(2*r-n),o=me(i)/r;function s(a,c){var l=me(i-2*r*K(c))/r;return[l*K(a*=r),o-l*J(a)]}return s.invert=function(a,c){var l=o-c,u=Ke(a,Pt(l))*Yn(l);return l*r<0&&(u-=Dt*Yn(a)*Yn(l)),[u/r,Ae((i-(a*a+l*l)*r*r)/(2*r))]},s}function vc(){return sd(_7).scale(155.424).center([0,33.6442])}function $m(){return vc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function nJ(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function IA(){var e,t,n=$m(),r,i=vc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=vc().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=nJ([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+et,m+.12*h+et],[p-.214*h-et,m+.234*h-et]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+et,m+.166*h+et],[p-.115*h-et,m+.234*h-et]]).stream(l),f()},u.fitExtent=function(d,h){return Pm(u,d,h)},u.fitSize=function(d,h){return dw(u,d,h)},u.fitWidth=function(d,h){return hw(u,d,h)},u.fitHeight=function(d,h){return pw(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function mw(e){return function(t,n){var r=J(t),i=J(n),o=e(r*i);return o===1/0?[2,0]:[o*i*K(t),o*K(n)]}}function Yo(e){return function(t,n){var r=me(t*t+n*n),i=e(r),o=K(i),s=J(i);return[Ke(t*o,r*s),Ae(r&&n*o/r)]}}var TA=mw(function(e){return me(2/(1+e))});TA.invert=Yo(function(e){return 2*Ae(e/2)});function EA(){return Cn(TA).scale(124.75).clipAngle(180-.001)}var AA=mw(function(e){return(e=q1(e))&&e/K(e)});AA.invert=Yo(function(e){return e});function MA(){return Cn(AA).scale(79.4188).clipAngle(180-.001)}function ad(e,t){return[e,eu(Zf((pe+t)/2))]}ad.invert=function(e,t){return[e,2*Ti(z1(t))-pe]};function OA(){return NA(ad).scale(961/pn)}function NA(e){var t=Cn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Dt*r(),d=t(XB(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===ad?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function yw(e){return Zf((pe+e)/2)}function v7(e,t){var n=J(e),r=e===t?K(e):eu(n/J(t))/eu(yw(t)/yw(e)),i=n*V1(yw(e),r)/r;if(!r)return ad;function o(s,a){i>0?a<-pe+et&&(a=-pe+et):a>pe-et&&(a=pe-et);var c=i/V1(yw(a),r);return[c*K(r*s),i-c*J(r*s)]}return o.invert=function(s,a){var c=i-a,l=Yn(r)*me(s*s+c*c),u=Ke(s,Pt(c))*Yn(c);return c*r<0&&(u-=Dt*Yn(s)*Yn(c)),[u/r,2*Ti(V1(i/l,1/r))-pe]},o}function DA(){return sd(v7).scale(109.5).parallels([30,30])}function cd(e,t){return[e,t]}cd.invert=cd;function RA(){return Cn(cd).scale(152.63)}function S7(e,t){var n=J(e),r=e===t?K(e):(n-J(t))/(t-e),i=n/r+e;if(Pt(r)<et)return cd;function o(s,a){var c=i-a,l=r*s;return[c*K(l),i-c*J(l)]}return o.invert=function(s,a){var c=i-a,l=Ke(s,Pt(c))*Yn(c);return c*r<0&&(l-=Dt*Yn(s)*Yn(c)),[l/r,i-Yn(r)*me(s*s+c*c)]},o}function LA(){return sd(S7).scale(131.154).center([0,13.9389])}var Um=1.340264,zm=-.081106,jm=893e-6,Vm=.003796,gw=me(3)/2,rJ=12;function FA(e,t){var n=Ae(gw*K(t)),r=n*n,i=r*r*r;return[e*J(n)/(gw*(Um+3*zm*r+i*(7*jm+9*Vm*r))),n*(Um+zm*r+i*(jm+Vm*r))]}FA.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<rJ&&(a=n*(Um+zm*r+i*(jm+Vm*r))-t,c=Um+3*zm*r+i*(7*jm+9*Vm*r),n-=s=a/c,r=n*n,i=r*r*r,!(Pt(s)<tu));++o);return[gw*e*(Um+3*zm*r+i*(7*jm+9*Vm*r))/J(n),Ae(K(n)/gw)]};function kA(){return Cn(FA).scale(177.158)}function CA(e,t){var n=J(t),r=J(e)*n;return[n*K(e)/r,K(t)/r]}CA.invert=Yo(Ti);function BA(){return Cn(CA).scale(144.049).clipAngle(60)}function PA(e,t){return[J(t)*K(e),K(t)]}PA.invert=Yo(Ae);function $A(){return Cn(PA).scale(249.5).clipAngle(90+et)}function UA(e,t){var n=J(t),r=1+J(e)*n;return[n*K(e)/r,K(t)/r]}UA.invert=Yo(function(e){return 2*Ti(e)});function zA(){return Cn(UA).scale(250).clipAngle(142)}function jA(e,t){return[eu(Zf((pe+t)/2)),-e]}jA.invert=function(e,t){return[-t,2*Ti(z1(e))-pe]};function VA(){var e=NA(jA),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function iJ(e,t){return e.parent===t.parent?1:2}function oJ(e){return e.reduce(sJ,0)/e.length}function sJ(e,t){return e+t.x}function aJ(e){return 1+e.reduce(cJ,0)}function cJ(e,t){return Math.max(e,t.y)}function lJ(e){for(var t;t=e.children;)e=t[0];return e}function uJ(e){for(var t;t=e.children;)e=t[t.length-1];return e}function xw(){var e=iJ,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=oJ(h),d.y=aJ(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=lJ(o),l=uJ(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function fJ(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function I7(){return this.eachAfter(fJ)}function T7(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E7(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function A7(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function M7(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O7(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function N7(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function D7(e){for(var t=this,n=dJ(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function dJ(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function R7(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function L7(){return Array.from(this)}function F7(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function k7(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*C7(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function qA(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=mJ)):t===void 0&&(t=pJ);for(var n=new Sc(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Sc(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(YA)}function hJ(){return qA(this).eachBefore(yJ)}function pJ(e){return e.children}function mJ(e){return Array.isArray(e)?e[1]:null}function yJ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function YA(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Sc(e){this.data=e,this.depth=this.height=0,this.parent=null}Sc.prototype=qA.prototype={constructor:Sc,count:I7,each:T7,eachAfter:A7,eachBefore:E7,find:M7,sum:O7,sort:N7,path:D7,ancestors:R7,descendants:L7,leaves:F7,links:k7,copy:hJ,[Symbol.iterator]:C7};function bw(e){return e==null?null:gJ(e)}function gJ(e){if(typeof e!="function")throw new Error;return e}var xJ={depth:-1},B7={},GA={};function bJ(e){return e.id}function wJ(e){return e.parentId}function ww(){var e=bJ,t=wJ,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(n!=null){let g=o.map((w,v)=>_J(n(w,v,i))),x=g.map(P7),b=new Set(g).add("");for(let w of x)b.has(w)||(b.add(w),g.push(w),x.push(P7(w)),o.push(GA));s=(w,v)=>g[v],a=(w,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Sc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?B7:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=y.get(p),!d)throw new Error("missing: "+p);if(d===B7)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===GA&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===GA);--g)h.data=null}if(f.parent=xJ,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(YA),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=bw(i),r):e},r.parentId=function(i){return arguments.length?(t=bw(i),r):t},r.path=function(i){return arguments.length?(n=bw(i),r):n},r}function _J(e){e=`${e}`;let t=e.length;return WA(e,t-1)&&!WA(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function P7(e){let t=e.length;if(t<2)return"";for(;--t>1&&!WA(e,t););return e.slice(0,t)}function WA(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function vJ(e,t){return e.parent===t.parent?1:2}function XA(e){var t=e.children;return t?t[0]:e.t}function HA(e){var t=e.children;return t?t[t.length-1]:e.t}function SJ(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function IJ(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function TJ(e,t,n){return e.a.parent===t.parent?e.a:n}function _w(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}_w.prototype=Object.create(Sc.prototype);function EJ(e){for(var t=new _w(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new _w(o[s],s)),i.parent=n;return(t.parent=new _w(null,0)).children=[t],t}function iu(){var e=vJ,t=1,n=1,r=null;function i(l){var u=EJ(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){IJ(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],y=d.m,g=h.m,x=p.m,b=m.m,w;p=HA(p),d=XA(d),p&&d;)m=XA(m),h=HA(h),h.a=l,w=p.z+x-d.z-y+e(p._,d._),w>0&&(SJ(TJ(p,l,f),l,w),y+=w,g+=w),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!HA(h)&&(h.t=p,h.m+=x-g),d&&!XA(m)&&(m.t=d,m.m+=y-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var $7=23283064365386963e-26;function ou(e=Math.random()){let t=(0<=e&&e<1?e/$7:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,$7*(t>>>0))}function tn(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function qm(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var Ym=Symbol("implicit");function su(){var e=new ir,t=[],n=[],r=Ym;function i(o){let s=e.get(o);if(s===void 0){if(r!==Ym)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new ir;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return su(t,n).unknown(r)},tn.apply(i,arguments),i}function Ic(){var e=su().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=qe(d).map(function(g){return p+o*g});return n(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Ic(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},tn.apply(f(),arguments)}function U7(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return U7(t())},e}function QA(){return U7(Ic.apply(null,arguments).paddingInner(1))}function ZA(e){return function(){return e}}function ld(e){return+e}var z7=[0,1];function Dr(e){return e}function KA(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:ZA(isNaN(t)?NaN:.5)}function AJ(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function MJ(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=KA(i,r),o=n(s,o)):(r=KA(r,i),o=n(o,s)),function(a){return o(r(a))}}function OJ(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=KA(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Qs(e,a,1,r)-1;return o[c](i[c](a))}}function Go(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function au(){var e=z7,t=z7,n=Hr,r,i,o,s=Dr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Dr&&(s=AJ(e[0],e[d-1])),a=d>2?OJ:MJ,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),Ee)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,ld),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Xl,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Dr,u()):s!==Dr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Gm(){return au()(Dr,Dr)}function JA(e,t,n,r){var i=Rf(e,t,n),o;switch(r=zo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=GE(i,s))&&(r.precision=o),U1(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=WE(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=YE(i))&&(r.precision=o-(r.type==="%")*2);break}}return Ii(r)}function ca(e){var t=e.domain;return e.ticks=function(n){var r=t();return Ln(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return JA(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Ks(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function la(){var e=Gm();return e.copy=function(){return Go(e,la())},tn.apply(e,arguments),ca(e)}function Wm(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,ld),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Wm(e).unknown(t)},e=arguments.length?Array.from(e,ld):[0,1],ca(n)}function Xm(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function j7(e){return Math.log(e)}function V7(e){return Math.exp(e)}function NJ(e){return-Math.log(-e)}function DJ(e){return-Math.exp(-e)}function RJ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function LJ(e){return e===10?RJ:e===Math.E?Math.exp:t=>Math.pow(e,t)}function FJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function q7(e){return(t,n)=>-e(-t,n)}function tM(e){let t=e(j7,V7),n=t.domain,r=10,i,o;function s(){return i=FJ(r),o=LJ(r),n()[0]<0?(i=q7(i),o=q7(o),e(NJ,DJ)):e(j7,V7),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(r%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Ln(l,u,y))}else g=Ln(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=zo(c)).precision==null&&(c.trim=!0),c=Ii(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(Xm(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Hm(){let e=tM(au()).domain([1,10]);return e.copy=()=>Go(e,Hm()).base(e.base()),tn.apply(e,arguments),e}function Y7(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function G7(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function eM(e){var t=1,n=e(Y7(t),G7(t));return n.constant=function(r){return arguments.length?e(Y7(t=+r),G7(t)):t},ca(n)}function Qm(){var e=eM(au());return e.copy=function(){return Go(e,Qm()).constant(e.constant())},tn.apply(e,arguments)}function W7(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function kJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function CJ(e){return e<0?-e*e:e*e}function nM(e){var t=e(Dr,Dr),n=1;function r(){return n===1?e(Dr,Dr):n===.5?e(kJ,CJ):e(W7(n),W7(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},ca(t)}function Zm(){var e=nM(au());return e.copy=function(){return Go(e,Zm()).exponent(e.exponent())},tn.apply(e,arguments),e}function Km(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=eE(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Qs(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Nt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return Km().domain(e).range(t).unknown(r)},tn.apply(o,arguments)}function Jm(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Qs(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Jm().domain(e).range(t).unknown(n)},tn.apply(i,arguments)}var rM=new Date,iM=new Date;function ge(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>ge(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(rM.setTime(+o),iM.setTime(+s),e(rM),e(iM),Math.floor(n(rM,iM))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var ty=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ty.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ty);var ikt=ty.range;var yn=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),X7=yn.range;var ua=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),BJ=ua.range,fa=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),PJ=fa.range;var da=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),$J=da.range,ha=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),UJ=ha.range;var Ei=ge(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),zJ=Ei.range,uu=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),jJ=uu.range,fu=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),VJ=fu.range;function du(e){return ge(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Zr=du(0),Tc=du(1),vw=du(2),Sw=du(3),Xo=du(4),Iw=du(5),Tw=du(6),Q7=Zr.range,qJ=Tc.range,YJ=vw.range,GJ=Sw.range,WJ=Xo.range,XJ=Iw.range,HJ=Tw.range;function hu(e){return ge(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Kr=hu(0),Ec=hu(1),Ew=hu(2),Aw=hu(3),Ho=hu(4),Mw=hu(5),Ow=hu(6),Z7=Kr.range,QJ=Ec.range,ZJ=Ew.range,KJ=Aw.range,JJ=Ho.range,ttt=Mw.range,ett=Ow.range;var pa=ge(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),ntt=pa.range,ma=ge(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),rtt=ma.range;var Gn=ge(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Gn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var itt=Gn.range,Wn=ge(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Wn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var ott=Wn.range;function J7(e,t,n,r,i,o){let s=[[yn,1,1e3],[yn,5,5*1e3],[yn,15,15*1e3],[yn,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=eo(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Rf(l/31536e6,u/31536e6,f));if(h===0)return ty.every(Math.max(Rf(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[oM,ny]=J7(Wn,ma,Kr,fu,ha,fa),[sM,aM]=J7(Gn,pa,Zr,Ei,da,ua);function cM(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function lM(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function ry(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function uM(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=iy(i),u=oy(i),f=iy(o),d=oy(o),h=iy(s),p=oy(s),m=iy(a),y=oy(a),g=iy(c),x=oy(c),b={a:L,A:B,b:C,B:P,c:null,d:oP,e:oP,f:Ott,g:$tt,G:ztt,H:Ett,I:Att,j:Mtt,L:uP,m:Ntt,M:Dtt,p:$,q:U,Q:cP,s:lP,S:Rtt,u:Ltt,U:Ftt,V:ktt,w:Ctt,W:Btt,x:null,X:null,y:Ptt,Y:Utt,Z:jtt,"%":aP},w={a:H,A:nt,b:ot,B:at,c:null,d:sP,e:sP,f:Gtt,g:net,G:iet,H:Vtt,I:qtt,j:Ytt,L:dP,m:Wtt,M:Xtt,p:G,q:st,Q:cP,s:lP,S:Htt,u:Qtt,U:Ztt,V:Ktt,w:Jtt,W:tet,x:null,X:null,y:eet,Y:ret,Z:oet,"%":aP},v={a:O,A:I,b:D,B:k,c:S,d:rP,e:rP,f:vtt,g:nP,G:eP,H:iP,I:iP,j:xtt,L:_tt,m:gtt,M:btt,p:E,q:ytt,Q:Itt,s:Ttt,S:wtt,u:ftt,U:dtt,V:htt,w:utt,W:ptt,x:M,X:N,y:nP,Y:eP,Z:mtt,"%":Stt};b.x=_(n,b),b.X=_(r,b),b.c=_(t,b),w.x=_(n,w),w.X=_(r,w),w.c=_(t,w);function _(V,Q){return function(rt){var z=[],Ct=-1,ht=0,Xt=V.length,Zt,tt,ce;for(rt instanceof Date||(rt=new Date(+rt));++Ct<Xt;)V.charCodeAt(Ct)===37&&(z.push(V.slice(ht,Ct)),(tt=tP[Zt=V.charAt(++Ct)])!=null?Zt=V.charAt(++Ct):tt=Zt==="e"?" ":"0",(ce=Q[Zt])&&(Zt=ce(rt,tt)),z.push(Zt),ht=Ct+1);return z.push(V.slice(ht,Ct)),z.join("")}}function T(V,Q){return function(rt){var z=ry(1900,void 0,1),Ct=A(z,V,rt+="",0),ht,Xt;if(Ct!=rt.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(ht=lM(ry(z.y,0,1)),Xt=ht.getUTCDay(),ht=Xt>4||Xt===0?Ec.ceil(ht):Ec(ht),ht=uu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=cM(ry(z.y,0,1)),Xt=ht.getDay(),ht=Xt>4||Xt===0?Tc.ceil(ht):Tc(ht),ht=Ei.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Xt="Z"in z?lM(ry(z.y,0,1)).getUTCDay():cM(ry(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Xt+5)%7:z.w+z.U*7-(Xt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,lM(z)):cM(z)}}function A(V,Q,rt,z){for(var Ct=0,ht=Q.length,Xt=rt.length,Zt,tt;Ct<ht;){if(z>=Xt)return-1;if(Zt=Q.charCodeAt(Ct++),Zt===37){if(Zt=Q.charAt(Ct++),tt=v[Zt in tP?Q.charAt(Ct++):Zt],!tt||(z=tt(V,rt,z))<0)return-1}else if(Zt!=rt.charCodeAt(z++))return-1}return z}function E(V,Q,rt){var z=l.exec(Q.slice(rt));return z?(V.p=u.get(z[0].toLowerCase()),rt+z[0].length):-1}function O(V,Q,rt){var z=h.exec(Q.slice(rt));return z?(V.w=p.get(z[0].toLowerCase()),rt+z[0].length):-1}function I(V,Q,rt){var z=f.exec(Q.slice(rt));return z?(V.w=d.get(z[0].toLowerCase()),rt+z[0].length):-1}function D(V,Q,rt){var z=g.exec(Q.slice(rt));return z?(V.m=x.get(z[0].toLowerCase()),rt+z[0].length):-1}function k(V,Q,rt){var z=m.exec(Q.slice(rt));return z?(V.m=y.get(z[0].toLowerCase()),rt+z[0].length):-1}function S(V,Q,rt){return A(V,t,Q,rt)}function M(V,Q,rt){return A(V,n,Q,rt)}function N(V,Q,rt){return A(V,r,Q,rt)}function L(V){return s[V.getDay()]}function B(V){return o[V.getDay()]}function C(V){return c[V.getMonth()]}function P(V){return a[V.getMonth()]}function $(V){return i[+(V.getHours()>=12)]}function U(V){return 1+~~(V.getMonth()/3)}function H(V){return s[V.getUTCDay()]}function nt(V){return o[V.getUTCDay()]}function ot(V){return c[V.getUTCMonth()]}function at(V){return a[V.getUTCMonth()]}function G(V){return i[+(V.getUTCHours()>=12)]}function st(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var Q=_(V+="",b);return Q.toString=function(){return V},Q},parse:function(V){var Q=T(V+="",!1);return Q.toString=function(){return V},Q},utcFormat:function(V){var Q=_(V+="",w);return Q.toString=function(){return V},Q},utcParse:function(V){var Q=T(V+="",!0);return Q.toString=function(){return V},Q}}}var tP={"-":"",_:" ",0:"0"},gn=/^\s*\d+/,att=/^%/,ctt=/[\\^$*+?|[\]().{}]/g;function re(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function ltt(e){return e.replace(ctt,"\\$&")}function iy(e){return new RegExp("^(?:"+e.map(ltt).join("|")+")","i")}function oy(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function utt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function ftt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function dtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function htt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function ptt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function eP(e,t,n){var r=gn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function nP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function mtt(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function ytt(e,t,n){var r=gn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function gtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function rP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function xtt(e,t,n){var r=gn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function iP(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function btt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function wtt(e,t,n){var r=gn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function _tt(e,t,n){var r=gn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function vtt(e,t,n){var r=gn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Stt(e,t,n){var r=att.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Itt(e,t,n){var r=gn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Ttt(e,t,n){var r=gn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function oP(e,t){return re(e.getDate(),t,2)}function Ett(e,t){return re(e.getHours(),t,2)}function Att(e,t){return re(e.getHours()%12||12,t,2)}function Mtt(e,t){return re(1+Ei.count(Gn(e),e),t,3)}function uP(e,t){return re(e.getMilliseconds(),t,3)}function Ott(e,t){return uP(e,t)+"000"}function Ntt(e,t){return re(e.getMonth()+1,t,2)}function Dtt(e,t){return re(e.getMinutes(),t,2)}function Rtt(e,t){return re(e.getSeconds(),t,2)}function Ltt(e){var t=e.getDay();return t===0?7:t}function Ftt(e,t){return re(Zr.count(Gn(e)-1,e),t,2)}function fP(e){var t=e.getDay();return t>=4||t===0?Xo(e):Xo.ceil(e)}function ktt(e,t){return e=fP(e),re(Xo.count(Gn(e),e)+(Gn(e).getDay()===4),t,2)}function Ctt(e){return e.getDay()}function Btt(e,t){return re(Tc.count(Gn(e)-1,e),t,2)}function Ptt(e,t){return re(e.getFullYear()%100,t,2)}function $tt(e,t){return e=fP(e),re(e.getFullYear()%100,t,2)}function Utt(e,t){return re(e.getFullYear()%1e4,t,4)}function ztt(e,t){var n=e.getDay();return e=n>=4||n===0?Xo(e):Xo.ceil(e),re(e.getFullYear()%1e4,t,4)}function jtt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+re(t/60|0,"0",2)+re(t%60,"0",2)}function sP(e,t){return re(e.getUTCDate(),t,2)}function Vtt(e,t){return re(e.getUTCHours(),t,2)}function qtt(e,t){return re(e.getUTCHours()%12||12,t,2)}function Ytt(e,t){return re(1+uu.count(Wn(e),e),t,3)}function dP(e,t){return re(e.getUTCMilliseconds(),t,3)}function Gtt(e,t){return dP(e,t)+"000"}function Wtt(e,t){return re(e.getUTCMonth()+1,t,2)}function Xtt(e,t){return re(e.getUTCMinutes(),t,2)}function Htt(e,t){return re(e.getUTCSeconds(),t,2)}function Qtt(e){var t=e.getUTCDay();return t===0?7:t}function Ztt(e,t){return re(Kr.count(Wn(e)-1,e),t,2)}function hP(e){var t=e.getUTCDay();return t>=4||t===0?Ho(e):Ho.ceil(e)}function Ktt(e,t){return e=hP(e),re(Ho.count(Wn(e),e)+(Wn(e).getUTCDay()===4),t,2)}function Jtt(e){return e.getUTCDay()}function tet(e,t){return re(Ec.count(Wn(e)-1,e),t,2)}function eet(e,t){return re(e.getUTCFullYear()%100,t,2)}function net(e,t){return e=hP(e),re(e.getUTCFullYear()%100,t,2)}function ret(e,t){return re(e.getUTCFullYear()%1e4,t,4)}function iet(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ho(e):Ho.ceil(e),re(e.getUTCFullYear()%1e4,t,4)}function oet(){return"+0000"}function aP(){return"%"}function cP(e){return+e}function lP(e){return Math.floor(+e/1e3)}var ud,fd,pP,Qo,mP;fM({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function fM(e){return ud=uM(e),fd=ud.format,pP=ud.parse,Qo=ud.utcFormat,mP=ud.utcParse,ud}function set(e){return new Date(e)}function aet(e){return e instanceof Date?+e:+new Date(+e)}function Nw(e,t,n,r,i,o,s,a,c,l){var u=Gm(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function v(_){return(c(_)<_?h:a(_)<_?p:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?g:x:n(_)<_?b:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?d(Array.from(_,aet)):d().map(set)},u.ticks=function(_){var T=d();return e(T[0],T[T.length-1],_??10)},u.tickFormat=function(_,T){return T==null?v:l(T)},u.nice=function(_){var T=d();return(!_||typeof _.range!="function")&&(_=t(T[0],T[T.length-1],_??10)),_?d(Xm(T,_)):u},u.copy=function(){return Go(u,Nw(e,t,n,r,i,o,s,a,c,l))},u}function Dw(){return tn.apply(Nw(sM,aM,Gn,pa,Zr,Ei,da,ua,yn,fd).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Rw(){return tn.apply(Nw(oM,ny,Wn,ma,Kr,uu,ha,fa,yn,Qo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function sy(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Lw(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=Dr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=Bo(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(Hr),h.rangeRound=p(Xl),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function ay(){var e=ca(Lw()(Dr));return e.copy=function(){return sy(e,ay())},qm.apply(e,arguments)}function Fw(){var e=tM(Lw()).domain([.1,1,10]);return e.copy=function(){return sy(e,Fw()).base(e.base())},qm.apply(e,arguments)}function kw(){var e=eM(Lw());return e.copy=function(){return sy(e,kw()).constant(e.constant())},qm.apply(e,arguments)}function Cw(){var e=nM(Lw());return e.copy=function(){return sy(e,Cw()).exponent(e.exponent())},qm.apply(e,arguments)}function W(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var dM=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var hM=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var pM=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var mM=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var yM=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var gM=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var xM=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var bM=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var wM=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var _M=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var vM=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var mt=e=>gE(e[e.length-1]);var Bw=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Pw=mt(Bw);var $w=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Uw=mt($w);var zw=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),jw=mt(zw);var Vw=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),qw=mt(Vw);var cy=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),dd=mt(cy);var Yw=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),Gw=mt(Yw);var ly=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),hd=mt(ly);var Ww=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),Xw=mt(Ww);var Hw=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Qw=mt(Hw);var Zw=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Kw=mt(Zw);var Jw=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),t_=mt(Jw);var e_=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),n_=mt(e_);var r_=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),i_=mt(r_);var o_=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),s_=mt(o_);var a_=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),c_=mt(a_);var l_=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),u_=mt(l_);var f_=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),d_=mt(f_);var h_=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),p_=mt(h_);var m_=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),y_=mt(m_);var g_=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),x_=mt(g_);var b_=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),w_=mt(b_);var __=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),v_=mt(__);var S_=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),I_=mt(S_);var T_=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),E_=mt(T_);var A_=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),M_=mt(A_);var O_=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),N_=mt(O_);var D_=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),R_=mt(D_);function L_(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var F_=zf(cr(300,.5,0),cr(-240,.5,1));var C_=zf(cr(-100,.75,.35),cr(80,1.5,.8)),B_=zf(cr(260,.75,.35),cr(80,1.5,.8)),k_=cr();function P_(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return k_.h=360*e-100,k_.s=1.5-1.5*t,k_.l=.8-.9*t,k_+""}var $_=cn(),cet=Math.PI/3,uet=Math.PI*2/3;function U_(e){var t;return e=(.5-e)*Math.PI,$_.r=255*(t=Math.sin(e))*t,$_.g=255*(t=Math.sin(e+cet))*t,$_.b=255*(t=Math.sin(e+uet))*t,$_+""}function z_(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function j_(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var V_=j_(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),q_=j_(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Y_=j_(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),G_=j_(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function en(e){return function(){return e}}var SM=Math.cos;var pd=Math.min,uy=Math.sin,ie=Math.sqrt,IM=1e-12,pu=Math.PI,O7t=pu/2,md=2*pu;function W_(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new xc(t)}var L7t=Array.prototype.slice;function X_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yP(e){this._context=e}yP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ya(e){return new yP(e)}function H_(e){return e[0]}function Q_(e){return e[1]}function fy(e,t){var n=en(!0),r=null,i=ya,o=null,s=W_(a);e=typeof e=="function"?e:e===void 0?H_:en(e),t=typeof t=="function"?t:t===void 0?Q_:en(t);function a(c){var l,u=(c=X_(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:en(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:en(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:en(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function yd(e,t,n){var r=null,i=en(!0),o=null,s=ya,a=null,c=W_(l);e=typeof e=="function"?e:e===void 0?H_:en(+e),t=typeof t=="function"?t:t===void 0?en(0):en(+t),n=typeof n=="function"?n:n===void 0?Q_:en(+n);function l(f){var d,h,p,m=(f=X_(f)).length,y,g=!1,x,b=new Array(m),w=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],w[p]);a.lineEnd(),a.areaEnd()}g&&(b[d]=+e(y,d,f),w[d]=+t(y,d,f),a.point(r?+r(y,d,f):b[d],n?+n(y,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return fy().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:en(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:en(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:en(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:en(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:en(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:en(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:en(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var Z_=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function TM(e){return new Z_(e,!0)}function EM(e){return new Z_(e,!1)}var fet=ie(3),dy={draw(e,t){let n=ie(t+pd(t/28,.75))*.59436,r=n/2,i=r*fet;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var ga={draw(e,t){let n=ie(t/pu);e.moveTo(n,0),e.arc(0,0,n,0,md)}};var hy={draw(e,t){let n=ie(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var gP=ie(1/3),det=gP*2,py={draw(e,t){let n=ie(t/det),r=n*gP;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var my={draw(e,t){let n=ie(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var yy={draw(e,t){let n=ie(t-pd(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var gy={draw(e,t){let n=ie(t),r=-n/2;e.rect(r,r,n,n)}};var xy={draw(e,t){let n=ie(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var het=.8908130915292852,xP=uy(pu/10)/uy(7*pu/10),pet=uy(md/10)*xP,met=-SM(md/10)*xP,by={draw(e,t){let n=ie(t*het),r=pet*n,i=met*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=md*o/5,a=SM(s),c=uy(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var AM=ie(3),wy={draw(e,t){let n=-ie(t/(AM*3));e.moveTo(0,n*2),e.lineTo(-AM*n,-n),e.lineTo(AM*n,-n),e.closePath()}};var yet=ie(3),_y={draw(e,t){let n=ie(t)*.6824,r=n/2,i=n*yet/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var Ai=-.5,Mi=ie(3)/2,MM=1/ie(12),get=(MM/2+1)*3,vy={draw(e,t){let n=ie(t/get),r=n/2,i=n*MM,o=r,s=n*MM+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Ai*r-Mi*i,Mi*r+Ai*i),e.lineTo(Ai*o-Mi*s,Mi*o+Ai*s),e.lineTo(Ai*a-Mi*c,Mi*a+Ai*c),e.lineTo(Ai*r+Mi*i,Ai*i-Mi*r),e.lineTo(Ai*o+Mi*s,Ai*s-Mi*o),e.lineTo(Ai*a+Mi*c,Ai*c-Mi*a),e.closePath()}};var gd={draw(e,t){let n=ie(t-pd(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var K_=[ga,hy,py,gy,by,wy,vy],OM=[ga,yy,gd,_y,dy,xy,my];function Oi(){}function xd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Sy(e){this._context=e}Sy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:xd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NM(e){return new Sy(e)}function bP(e){this._context=e}bP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DM(e){return new bP(e)}function wP(e){this._context=e}wP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:xd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RM(e){return new wP(e)}function _P(e,t){this._basis=new Sy(e),this._beta=t}_P.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var LM=function e(t){function n(r){return t===1?new Sy(r):new _P(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function bd(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function J_(e,t){this._context=e,this._k=(1-t)/6}J_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:bd(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var FM=function e(t){function n(r){return new J_(r,t)}return n.tension=function(r){return e(+r)},n}(0);function tv(e,t){this._context=e,this._k=(1-t)/6}tv.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var kM=function e(t){function n(r){return new tv(r,t)}return n.tension=function(r){return e(+r)},n}(0);function ev(e,t){this._context=e,this._k=(1-t)/6}ev.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:bd(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var CM=function e(t){function n(r){return new ev(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Iy(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>IM){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>IM){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function vP(e,t){this._context=e,this._alpha=t}vP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var BM=function e(t){function n(r){return t?new vP(r,t):new J_(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function SP(e,t){this._context=e,this._alpha=t}SP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var PM=function e(t){function n(r){return t?new SP(r,t):new tv(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function IP(e,t){this._context=e,this._alpha=t}IP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Iy(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var $M=function e(t){function n(r){return t?new IP(r,t):new ev(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function TP(e){this._context=e}TP.prototype={areaStart:Oi,areaEnd:Oi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function UM(e){return new TP(e)}function EP(e){return e<0?-1:1}function AP(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(EP(o)+EP(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function MP(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function zM(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function nv(e){this._context=e}nv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zM(this,this._t0,MP(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zM(this,MP(this,n=AP(this,e,t)),n);break;default:zM(this,this._t0,n=AP(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function OP(e){this._context=new NP(e)}(OP.prototype=Object.create(nv.prototype)).point=function(e,t){nv.prototype.point.call(this,t,e)};function NP(e){this._context=e}NP.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function jM(e){return new nv(e)}function VM(e){return new OP(e)}function RP(e){this._context=e}RP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=DP(e),i=DP(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function DP(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function qM(e){return new RP(e)}function rv(e,t){this._context=e,this._t=t}rv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function YM(e){return new rv(e,.5)}function GM(e){return new rv(e,0)}function WM(e){return new rv(e,1)}var Ty=e=>()=>e;function XM(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Jr(e,t,n){this.k=e,this.x=t,this.y=n}Jr.prototype={constructor:Jr,scale:function(e){return e===1?this:new Jr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Jr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ey=new Jr(1,0,0);HM.prototype=Jr.prototype;function HM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ey;return e.__zoom}function iv(e){e.stopImmediatePropagation()}function wd(e){e.preventDefault(),e.stopImmediatePropagation()}function xet(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bet(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function LP(){return this.__zoom||Ey}function wet(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _et(){return navigator.maxTouchPoints||"ontouchstart"in this}function vet(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function QM(){var e=xet,t=bet,n=vet,r=wet,i=_et,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=SE,l=jl("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",LP).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",O).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,N,L){var B=S.selection?S.selection():S;B.property("__zoom",LP),S!==B?v(S,M,N,L):B.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,N,L){g.scaleTo(S,function(){var B=this.__zoom.k,C=typeof M=="function"?M.apply(this,arguments):M;return B*C},N,L)},g.scaleTo=function(S,M,N,L){g.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?w(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof M=="function"?M.apply(this,arguments):M;return n(b(x(C,U),P,$),B,s)},N,L)},g.translateBy=function(S,M,N,L){g.transform(S,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,L)},g.translateTo=function(S,M,N,L,B){g.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=L==null?w(C):typeof L=="function"?L.apply(this,arguments):L;return n(Ey.translate($[0],$[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},L,B)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new Jr(M,S.x,S.y)}function b(S,M,N){var L=M[0]-N[0]*S.k,B=M[1]-N[1]*S.k;return L===S.x&&B===S.y?S:new Jr(S.k,L,B)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,N,L){S.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,C=arguments,P=_(B,C).event(L),$=t.apply(B,C),U=N==null?w($):typeof N=="function"?N.apply(B,C):N,H=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),nt=B.__zoom,ot=typeof M=="function"?M.apply(B,C):M,at=c(nt.invert(U).concat(H/nt.k),ot.invert(U).concat(H/ot.k));return function(G){if(G===1)G=ot;else{var st=at(G),V=H/st[2];G=new Jr(V,U[0]-st[0]*V,U[1]-st[1]*V)}P.zoom(null,G)}})}function _(S,M,N){return!N&&S.__zooming||new T(S,M)}function T(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}T.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,M){return this.mouse&&S!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var M=jt(this.that).datum();l.call(S,this.that,new XM(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var N=_(this,M).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),C=zn(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=L.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(L.k===B)return;N.mouse=[C,L.invert(C)],Po(this),N.start()}wd(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(b(x(L,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function E(S,...M){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=_(this,M,!0).event(S),B=jt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",H,!0),C=zn(S,N),P=S.clientX,$=S.clientY;nm(S.view),iv(S),L.mouse=[C,this.__zoom.invert(C)],Po(this),L.start();function U(nt){if(wd(nt),!L.moved){var ot=nt.clientX-P,at=nt.clientY-$;L.moved=ot*ot+at*at>m}L.event(nt).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=zn(nt,N),L.mouse[1]),L.extent,s))}function H(nt){B.on("mousemove.zoom mouseup.zoom",null),rm(nt.view,L.moved),wd(nt),L.event(nt).end()}}function O(S,...M){if(e.apply(this,arguments)){var N=this.__zoom,L=zn(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(L),C=N.k*(S.shiftKey?.5:2),P=n(b(x(N,C),L,B),t.apply(this,M),s);wd(S),a>0?jt(this).transition().duration(a).call(v,P,L,S):jt(this).call(g.transform,P,L,S)}}function I(S,...M){if(e.apply(this,arguments)){var N=S.touches,L=N.length,B=_(this,M,S.changedTouches.length===L).event(S),C,P,$,U;for(iv(S),P=0;P<L;++P)$=N[P],U=zn($,this),U=[U,this.__zoom.invert(U),$.identifier],B.touch0?!B.touch1&&B.touch0[2]!==U[2]&&(B.touch1=U,B.taps=0):(B.touch0=U,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),Po(this),B.start())}}function D(S,...M){if(this.__zooming){var N=_(this,M).event(S),L=S.changedTouches,B=L.length,C,P,$,U;for(wd(S),C=0;C<B;++C)P=L[C],$=zn(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=$:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=$);if(P=N.that.__zoom,N.touch1){var H=N.touch0[0],nt=N.touch0[1],ot=N.touch1[0],at=N.touch1[1],G=(G=ot[0]-H[0])*G+(G=ot[1]-H[1])*G,st=(st=at[0]-nt[0])*st+(st=at[1]-nt[1])*st;P=x(P,Math.sqrt(G/st)),$=[(H[0]+ot[0])/2,(H[1]+ot[1])/2],U=[(nt[0]+at[0])/2,(nt[1]+at[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(b(P,$,U),N.extent,s))}}function k(S,...M){if(this.__zooming){var N=_(this,M).event(S),L=S.changedTouches,B=L.length,C,P;for(iv(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=L[C],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=zn(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<y)){var $=jt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Ty(+S),g):r},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ty(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Ty(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Ty([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function Ne(e){return e!=null&&!Number.isNaN(e)}function xn(e,t){return+Ne(t)-+Ne(e)||Nt(e,t)}function mu(e,t){return+Ne(t)-+Ne(e)||rr(e,t)}function Ay(e){return e!=null&&`${e}`!=""}function _d(e){return isFinite(e)?e:NaN}function mr(e){return e>0&&isFinite(e)?e:NaN}function Ac(e){return e<0&&isFinite(e)?e:NaN}function vd(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${Iet(e.getUTCFullYear(),4)}-${xa(e.getUTCMonth()+1,2)}-${xa(e.getUTCDate(),2)}${n||r||i||o?`T${xa(n,2)}:${xa(r,2)}${i||o?`:${xa(i,2)}${o?`.${xa(o,3)}`:""}`:""}Z`:""}`}function Iet(e){return e<0?`-${xa(-e,6)}`:e>9999?`+${xa(e,6)}`:xa(e,4)}function xa(e,t){return`${e}`.padStart(t,"0")}var Tet=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function My(e,t){return Tet.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function ba(e){if(e==null)return;let t=e[0],n=e[e.length-1];return rr(t,n)}var Id=1e3,Oc=Id*60,Nc=Oc*60,Ko=Nc*24,Zo=Ko*7,yu=Ko*30,Mc=Ko*365,ZM=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",Id],["5 seconds",5*Id],["15 seconds",15*Id],["30 seconds",30*Id],["minute",Oc],["5 minutes",5*Oc],["15 minutes",15*Oc],["30 minutes",30*Oc],["hour",Nc],["3 hours",3*Nc],["6 hours",6*Nc],["12 hours",12*Nc],["day",Ko],["2 days",2*Ko],["week",Zo],["2 weeks",2*Zo],["month",yu],["3 months",3*yu],["6 months",6*yu],["year",Mc],["2 years",2*Mc],["5 years",5*Mc],["10 years",10*Mc],["20 years",20*Mc],["50 years",50*Mc],["100 years",100*Mc]],KM=new Map([["second",Id],["minute",Oc],["hour",Nc],["day",Ko],["monday",Zo],["tuesday",Zo],["wednesday",Zo],["thursday",Zo],["friday",Zo],["saturday",Zo],["sunday",Zo],["week",Zo],["month",yu],["year",Mc]]),kP=new Map([["second",yn],["minute",ua],["hour",da],["day",Ei],["monday",Tc],["tuesday",vw],["wednesday",Sw],["thursday",Xo],["friday",Iw],["saturday",Tw],["sunday",Zr],["week",Zr],["month",pa],["year",Gn]]),JM=new Map([["second",yn],["minute",fa],["hour",ha],["day",fu],["monday",Ec],["tuesday",Ew],["wednesday",Aw],["thursday",Ho],["friday",Mw],["saturday",Ow],["sunday",Kr],["week",Kr],["month",ma],["year",Wn]]),Td=Symbol("intervalDuration"),sv=Symbol("intervalType");for(let[e,t]of kP)t[Td]=KM.get(e),t[sv]="time";for(let[e,t]of JM)t[Td]=KM.get(e),t[sv]="utc";var Oy=[["year",Wn,"utc"],["month",ma,"utc"],["day",fu,"utc",6*yu],["hour",ha,"utc",3*Ko],["minute",fa,"utc",6*Nc],["second",yn,"utc",30*Oc]],ov=[["year",Gn,"time"],["month",pa,"time"],["day",Ei,"time",6*yu],["hour",da,"time",3*Ko],["minute",ua,"time",6*Nc],["second",yn,"time",30*Oc]],Eet=[Oy[0],ov[0],Oy[1],ov[1],Oy[2],ov[2],...Oy.slice(3)];function av(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=JM.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function Ny(e){return CP(av(e),"time")}function gu(e){return CP(av(e),"utc")}function CP([e,t],n){let r=(n==="time"?kP:JM).get(e);return t>1&&(r=r.every(t),r[Td]=KM.get(e)*t,r[sv]=n),r}function t3(e,t){if(!(t>1))return;let n=e[Td];if(!ZM.some(([,i])=>i===n)||n%Ko===0&&Ko<n&&n<yu)return;let[r]=ZM[eo(([,i])=>Math.log(i)).center(ZM,Math.log(n*t))];return(e[sv]==="time"?Ny:gu)(r)}function FP(e,t,n){let r=t==="time"?fd:Qo;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=Aet(n);switch(e){case"millisecond":return Sd(r(".%L"),r(":%M:%S"),i);case"second":return Sd(r(":%S"),r("%-I:%M"),i);case"minute":return Sd(r("%-I:%M"),r("%p"),i);case"hour":return Sd(r("%-I %p"),r("%b %-d"),i);case"day":return Sd(r("%-d"),r("%b"),i);case"month":return Sd(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function Aet(e){return e==="left"||e==="right"?(t,n)=>`
|
|
11
|
+
]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new He(r,i)))}slice(t,r){let n=this.schema;[t,r]=Im({length:this.numRows},t,r);let i=e_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new He(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Dt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Gt(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=N_(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...N_(o,s))}};PB=Symbol.toStringTag;wn[PB]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ad(Em),e.get=ad(sr.getVisitFn(D.Struct)),e.set=r_(Vr.getVisitFn(D.Struct)),e.indexOf=n_(su.getVisitFn(D.Struct)),"Table"))(wn.prototype);var $B,He=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof me))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dt({nullCount:0,type:new Re(this.schema.fields),children:this.schema.fields.map(r=>Dt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=UB(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=jt.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new me(n),a=Dt({type:new Re(n),length:o,children:i,nullCount:0});[this.schema,this.data]=UB(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=zB(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return sr.visit(this.data,t)}at(t){return this.get(ru(t,this.numRows))}set(t,r){return Vr.visit(this.data,t,r)}indexOf(t,r){return su.visit(this.data,t,r)}[Symbol.iterator](){return cd.visit(new Gt([this.data]))}toArray(){return[...this]}concat(...t){return new wn(this.schema,[this,...t])}slice(t,r){let[n]=new Gt([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Gt([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new Gt([Dt({type:new bn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new me(o,new Map(this.schema.metadata)),i=Dt({type:new Re(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new Re(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Dt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Dt({type:new Re(r.fields),length:this.numRows,children:n});return new e(r,i)}};$B=Symbol.toStringTag;He[$B]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(He.prototype);function UB(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Dt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new Re(i),length:r,children:o})]}function zB(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])zB(a.children,l?.children,r);if(K.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var mu=class extends He{constructor(t){let r=t.fields.map(i=>Dt({type:i.type})),n=Dt({type:new Re(t.fields),nullCount:0,children:r});super(t,n)}};var So=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):he.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Vt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new br).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,he.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Vt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var kE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return xm.startNull(r),xm.endNull(r)}visitInt(t,r){return ho.startInt(r),ho.addBitWidth(r,t.bitWidth),ho.addIsSigned(r,t.isSigned),ho.endInt(r)}visitFloat(t,r){return Mc.startFloatingPoint(r),Mc.addPrecision(r,t.precision),Mc.endFloatingPoint(r)}visitBinary(t,r){return hm.startBinary(r),hm.endBinary(r)}visitLargeBinary(t,r){return mm.startLargeBinary(r),mm.endLargeBinary(r)}visitBool(t,r){return pm.startBool(r),pm.endBool(r)}visitUtf8(t,r){return _m.startUtf8(r),_m.endUtf8(r)}visitLargeUtf8(t,r){return ym.startLargeUtf8(r),ym.endLargeUtf8(r)}visitDecimal(t,r){return Xo.startDecimal(r),Xo.addScale(r,t.scale),Xo.addPrecision(r,t.precision),Xo.addBitWidth(r,t.bitWidth),Xo.endDecimal(r)}visitDate(t,r){return Ic.startDate(r),Ic.addUnit(r,t.unit),Ic.endDate(r)}visitTime(t,r){return Ks.startTime(r),Ks.addUnit(r,t.unit),Ks.addBitWidth(r,t.bitWidth),Ks.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Js.startTimestamp(r),Js.addUnit(r,t.unit),n!==void 0&&Js.addTimezone(r,n),Js.endTimestamp(r)}visitInterval(t,r){return Nc.startInterval(r),Nc.addUnit(r,t.unit),Nc.endInterval(r)}visitDuration(t,r){return Tc.startDuration(r),Tc.addUnit(r,t.unit),Tc.endDuration(r)}visitList(t,r){return gm.startList(r),gm.endList(r)}visitStruct(t,r){return bm.startStruct_(r),bm.endStruct_(r)}visitUnion(t,r){po.startTypeIdsVector(r,t.typeIds.length);let n=po.createTypeIdsVector(r,t.typeIds);return po.startUnion(r),po.addMode(r,t.mode),po.addTypeIds(r,n),po.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Go.startDictionaryEncoding(r),Go.addId(r,BigInt(t.id)),Go.addIsOrdered(r,t.isOrdered),n!==void 0&&Go.addIndexType(r,n),Go.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return Ac.startFixedSizeBinary(r),Ac.addByteWidth(r,t.byteWidth),Ac.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Ec.startFixedSizeList(r),Ec.addListSize(r,t.listSize),Ec.endFixedSizeList(r)}visitMap(t,r){return Oc.startMap(r),Oc.addKeysSorted(r,t.keysSorted),Oc.endMap(r)}},O_=new kE;function YB(e,t=new Map){return new me(lQ(e,t),R_(e.metadata),t)}function BE(e){return new Yr(e.count,GB(e.columns),XB(e.columns))}function WB(e){return new Wn(BE(e.data),e.id,e.isDelta)}function lQ(e,t){return(e.fields||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function jB(e,t){return(e.children||[]).filter(Boolean).map(r=>jt.fromJSON(r,t))}function GB(e){return(e||[]).reduce((t,r)=>[...t,new $i(r.count,uQ(r.VALIDITY)),...GB(r.children)],[])}function XB(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new Yn(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Yn(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Yn(t.length,i.OFFSET.length)),i.DATA&&t.push(new Yn(t.length,i.DATA.length)),t=XB(i.children,t)}return t}function uQ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function HB(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=VB(e,jB(e,t)),i=new jt(e.name,s,e.nullable,R_(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?qB(n):new Ho,a=new li(t.get(r),n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,R_(e.metadata))):(n=(n=o.indexType)?qB(n):new Ho,t.set(r,s=VB(e,jB(e,t))),a=new li(s,n,r,o.isOrdered),i=new jt(e.name,a,e.nullable,R_(e.metadata))),i||null}function R_(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function qB(e){return new _r(e.isSigned,e.bitWidth)}function VB(e,t){let r=e.type.name;switch(r){case"NONE":return new bn;case"null":return new bn;case"binary":return new ta;case"largebinary":return new ea;case"utf8":return new ra;case"largeutf8":return new na;case"bool":return new ia;case"list":return new go((t||[])[0]);case"struct":return new Re(t||[]);case"struct_":return new Re(t||[])}switch(r){case"int":{let n=e.type;return new _r(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Bi(be[n.precision])}case"decimal":{let n=e.type;return new oa(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new sa(Xe[n.unit])}case"time":{let n=e.type;return new aa(ct[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new ca(ct[n.unit],n.timezone)}case"interval":{let n=e.type;return new la(xr[n.unit])}case"duration":{let n=e.type;return new ua(ct[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new xo(Se[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new fa(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new bo(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new _o((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var fQ=eu,dQ=ai,Gn=class e{static fromJSON(t,r){let n=new e(0,he.V5,r);return n._createHeader=hQ(t,r),n}static decode(t){t=new dQ(St(t));let r=So.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=pQ(r,o),s}static encode(t){let r=new fQ,n=-1;return t.isSchema()?n=me.encode(r,t.header()):t.isRecordBatch()?n=Yr.encode(r,t.header()):t.isDictionaryBatch()&&(n=Wn.encode(r,t.header())),So.startMessage(r),So.addVersion(r,he.V5),So.addHeader(r,n),So.addHeaderType(r,t.headerType),So.addBodyLength(r,BigInt(t.bodyLength)),So.finishMessageBuffer(r,So.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof me)return new e(0,he.V5,Vt.Schema,t);if(t instanceof Yr)return new e(r,he.V5,Vt.RecordBatch,t);if(t instanceof Wn)return new e(r,he.V5,Vt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Vt.Schema}isRecordBatch(){return this.headerType===Vt.RecordBatch}isDictionaryBatch(){return this.headerType===Vt.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=re(t)}},Yr=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=re(t)}},Wn=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=re(r)}},Yn=class{constructor(t,r){this.offset=re(t),this.length=re(r)}},$i=class{constructor(t,r){this.length=re(t),this.nullCount=re(r)}};function hQ(e,t){return()=>{switch(t){case Vt.Schema:return me.fromJSON(e);case Vt.RecordBatch:return Yr.fromJSON(e);case Vt.DictionaryBatch:return Wn.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}function pQ(e,t){return()=>{switch(t){case Vt.Schema:return me.decode(e.header(new qn),new Map,e.version());case Vt.RecordBatch:return Yr.decode(e.header(new ci),e.version());case Vt.DictionaryBatch:return Wn.decode(e.header(new Zs),e.version())}throw new Error(`Unrecognized Message type: { name: ${Vt[t]}, type: ${t} }`)}}jt.encode=TQ;jt.decode=SQ;jt.fromJSON=HB;me.encode=IQ;me.decode=mQ;me.fromJSON=YB;Yr.encode=AQ;Yr.decode=yQ;Yr.fromJSON=BE;Wn.encode=EQ;Wn.decode=gQ;Wn.fromJSON=WB;$i.encode=MQ;$i.decode=bQ;Yn.encode=NQ;Yn.decode=xQ;function mQ(e,t=new Map,r=he.V5){let n=vQ(e,t);return new me(n,D_(e),t,r)}function yQ(e,t=he.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Yr(e.length(),_Q(e),wQ(e,t))}function gQ(e,t=he.V5){return new Wn(Yr.decode(e.data(),t),e.id(),e.isDelta())}function xQ(e){return new Yn(e.offset(),e.length())}function bQ(e){return new $i(e.length(),e.nullCount())}function _Q(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=$i.decode(r));return t}function wQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<he.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Yn.decode(n));return r}function vQ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=jt.decode(n,t));return r}function QB(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=jt.decode(n,t));return r}function SQ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=KB(e,QB(e,t)),n=new jt(e.name(),i,e.nullable(),D_(e))):t.has(r=re(a.id()))?(o=(o=a.indexType())?ZB(o):new Ho,s=new li(t.get(r),o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),D_(e))):(o=(o=a.indexType())?ZB(o):new Ho,t.set(r,i=KB(e,QB(e,t))),s=new li(i,o,r,a.isOrdered()),n=new jt(e.name(),s,e.nullable(),D_(e))),n||null}function D_(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function ZB(e){return new _r(e.isSigned(),e.bitWidth())}function KB(e,t){let r=e.typeType();switch(r){case Ie.NONE:return new bn;case Ie.Null:return new bn;case Ie.Binary:return new ta;case Ie.LargeBinary:return new ea;case Ie.Utf8:return new ra;case Ie.LargeUtf8:return new na;case Ie.Bool:return new ia;case Ie.List:return new go((t||[])[0]);case Ie.Struct_:return new Re(t||[])}switch(r){case Ie.Int:{let n=e.type(new ho);return new _r(n.isSigned(),n.bitWidth())}case Ie.FloatingPoint:{let n=e.type(new Mc);return new Bi(n.precision())}case Ie.Decimal:{let n=e.type(new Xo);return new oa(n.scale(),n.precision(),n.bitWidth())}case Ie.Date:{let n=e.type(new Ic);return new sa(n.unit())}case Ie.Time:{let n=e.type(new Ks);return new aa(n.unit(),n.bitWidth())}case Ie.Timestamp:{let n=e.type(new Js);return new ca(n.unit(),n.timezone())}case Ie.Interval:{let n=e.type(new Nc);return new la(n.unit())}case Ie.Duration:{let n=e.type(new Tc);return new ua(n.unit())}case Ie.Union:{let n=e.type(new po);return new xo(n.mode(),n.typeIdsArray()||[],t||[])}case Ie.FixedSizeBinary:{let n=e.type(new Ac);return new fa(n.byteWidth())}case Ie.FixedSizeList:{let n=e.type(new Ec);return new bo(n.listSize(),(t||[])[0])}case Ie.Map:{let n=e.type(new Oc);return new _o((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ie[r]}" (${r})`)}function IQ(e,t){let r=t.fields.map(o=>jt.encode(e,o));qn.startFieldsVector(e,r.length);let n=qn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?qn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return br.startKeyValue(e),br.addKey(e,a),br.addValue(e,c),br.endKeyValue(e)})):-1;return qn.startSchema(e),qn.addFields(e,n),qn.addEndianness(e,OQ?Sc.Little:Sc.Big),i!==-1&&qn.addCustomMetadata(e,i),qn.endSchema(e)}function TQ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;K.isDictionary(o)?(s=o.dictionary.typeId,i=O_.visit(o,e),n=O_.visit(o.dictionary,e)):n=O_.visit(o,e);let a=(o.children||[]).map(u=>jt.encode(e,u)),c=sn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?sn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return br.startKeyValue(e),br.addKey(e,d),br.addValue(e,h),br.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),sn.startField(e),sn.addType(e,n),sn.addTypeType(e,s),sn.addChildren(e,c),sn.addNullable(e,!!t.nullable),r!==-1&&sn.addName(e,r),i!==-1&&sn.addDictionary(e,i),l!==-1&&sn.addCustomMetadata(e,l),sn.endField(e)}function AQ(e,t){let r=t.nodes||[],n=t.buffers||[];ci.startNodesVector(e,r.length);for(let s of r.slice().reverse())$i.encode(e,s);let i=e.endVector();ci.startBuffersVector(e,n.length);for(let s of n.slice().reverse())Yn.encode(e,s);let o=e.endVector();return ci.startRecordBatch(e),ci.addLength(e,BigInt(t.length)),ci.addNodes(e,i),ci.addBuffers(e,o),ci.endRecordBatch(e)}function EQ(e,t){let r=Yr.encode(e,t.data);return Zs.startDictionaryBatch(e),Zs.addId(e,BigInt(t.id)),Zs.addIsDelta(e,t.isDelta),Zs.addData(e,r),Zs.endDictionaryBatch(e)}function MQ(e,t){return Kf.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function NQ(e,t){return Zf.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var OQ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var UE=e=>`Expected ${Vt[e]} Message in stream, but was null or length 0.`,$E=e=>`Header pointer of flatbuffer-encoded ${Vt[e]} Message is null or length 0.`,JB=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,t5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,yd=class{constructor(t){this.source=t instanceof Ko?t:new Ko(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?De:t.value===-1&&(t=this.readMetadataLength()).done?De:(t=this.readMetadata(t.value)).done?De:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=St(this.source.read(t));if(r.byteLength<t)throw new Error(t5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Vt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i}readMetadataLength(){let t=this.source.read(L_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(JB(t,r.byteLength));return{done:!1,value:Gn.decode(r)}}},ry=class{constructor(t,r){this.source=t instanceof Pi?t:d1(t)?new Cc(t,r):new Pi(t)}[Symbol.asyncIterator](){return this}next(){return Q(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?De:t.value===-1&&(t=yield this.readMetadataLength()).done?De:(t=yield this.readMetadata(t.value)).done?De:t})}throw(t){return Q(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Q(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Q(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value})}readMessageBody(t){return Q(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=St(yield this.source.read(t));if(r.byteLength<t)throw new Error(t5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Q(this,arguments,void 0,function*(t=!1){let r=Vt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error($E(r));return i})}readMetadataLength(){return Q(this,void 0,void 0,function*(){let t=yield this.source.read(L_),r=t&&new ai(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Q(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return De;if(r.byteLength<t)throw new Error(JB(t,r.byteLength));return{done:!1,value:Gn.decode(r)}})}},ny=class extends yd{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Mm?t:new Mm(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Gn.fromJSON(t.schema,Vt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Gn.fromJSON(r,Vt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Gn.fromJSON(r,Vt.RecordBatch)}}return this._body=[],De}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(UE(t));return r.value}readSchema(){let t=Vt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error($E(t));return n}},L_=4,PE="ARROW1",gd=new Uint8Array(PE.length);for(let e=0;e<PE.length;e+=1)gd[e]=PE.codePointAt(e);function F_(e,t=0){for(let r=-1,n=gd.length;++r<n;)if(gd[r]!==e[t+r])return!1;return!0}var xd=gd.length,zE=xd+L_,e5=xd*2+L_;var Wr=class e extends cu{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return co(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return qr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return qr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:u1(t)?DQ(t):d1(t)?CQ(t):co(t)?Q(this,void 0,void 0,function*(){return yield e.from(yield t)}):h1(t)||am(t)||m1(t)||Fi(t)?FQ(new Pi(t)):LQ(new Ko(t))}static readAll(t){return t instanceof e?t.isSync()?r5(t):n5(t):u1(t)||ArrayBuffer.isView(t)||lo(t)||f1(t)?r5(t):n5(t)}},ts=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oi(this,arguments,function*(){yield Ut(yield*Hf(ao(this[Symbol.iterator]())))})}},kc=class extends Wr{constructor(t){super(t),this._impl=t}readAll(){return Q(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=ao(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bc=class extends ts{constructor(t){super(t),this._impl=t}},iy=class extends kc{constructor(t){super(t),this._impl=t}},C_=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let n=this._loadVectors(t,r,this.schema.fields),i=Dt({type:new Re(this.schema.fields),length:t.length,children:n});return new He(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new Gt(l)):new Gt(l)).memoize()}_loadVectors(t,r,n){return new Dm(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},bd=class extends C_{constructor(t,r){super(r),this._reader=u1(t)?new ny(this._handle=t):new yd(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=i5(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):De}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):De}next(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new mu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},_d=class extends C_{constructor(t,r){super(r),this._reader=new ry(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Q(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Q(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=i5(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):De})}return(t){return Q(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):De})}next(){return Q(this,void 0,void 0,function*(){if(this.closed)return De;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new mu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},k_=class extends bd{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Nm?t:new Nm(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Vt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-zE,n=t.readInt32(r),i=t.readAt(r-n,n);return pa.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},jE=class extends _d{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Cc?t:new Cc(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Q(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Q(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return Q(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Vt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Q(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-zE,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return pa.decode(i)})}_readNextMessageAndValidate(t){return Q(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},qE=class extends bd{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new a_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function i5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*r5(e){let t=Wr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function n5(e){return oi(this,arguments,function*(){let r=yield Ut(Wr.from(e));try{if(!(yield Ut(r.open({autoDestroy:!1}))).closed)do yield yield Ut(r);while(!(yield Ut(r.reset().open())).closed)}finally{yield Ut(r.cancel())}})}function DQ(e){return new ts(new qE(e))}function LQ(e){let t=e.peek(xd+7&-8);return t&&t.byteLength>=4?F_(t)?new Bc(new k_(e.read())):new ts(new bd(e)):new ts(new bd(function*(){}()))}function FQ(e){return Q(this,void 0,void 0,function*(){let t=yield e.peek(xd+7&-8);return t&&t.byteLength>=4?F_(t)?new Bc(new k_(yield e.read())):new kc(new _d(e)):new kc(new _d(function(){return oi(this,arguments,function*(){})}()))})}function CQ(e){return Q(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Cc(e,t);return t>=e5&&F_(yield r.readAt(0,xd+7&-8))?new iy(new jE(r)):new kc(new _d(r))})}var ke=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof He?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Gt)return this.visitMany(t.data),this;let{type:r}=t;if(!K.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(K.isUnion(r))this.nodes.push(new $i(n,0));else{let{nullCount:i}=t;K.isNull(r)||Io.call(this,i<=0?new Uint8Array(0):iu(t.offset,n,t.nullBitmap)),this.nodes.push(new $i(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Io(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Yn(this._byteLength,t)),this._byteLength+=t,this}function kQ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Io.call(this,i),r.mode===Se.Sparse)return VE.call(this,e);if(r.mode===Se.Dense){if(e.offset<=0)return Io.call(this,o),VE.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Io.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function BQ(e){let t;return e.nullCount>=e.length?Io.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Io.call(this,iu(e.offset,e.length,t)):Io.call(this,ou(e.values))}function va(e){return Io.call(this,e.values.subarray(0,e.length*e.stride))}function B_(e){let{length:t,values:r,valueOffsets:n}=e,i=re(n[0]),o=re(n[t]),s=Math.min(o-i,r.byteLength-i);return Io.call(this,g1(-i,t+1,n)),Io.call(this,r.subarray(i,i+s)),this}function YE(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Io.call(this,g1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function VE(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ke.prototype.visitBool=BQ;ke.prototype.visitInt=va;ke.prototype.visitFloat=va;ke.prototype.visitUtf8=B_;ke.prototype.visitLargeUtf8=B_;ke.prototype.visitBinary=B_;ke.prototype.visitLargeBinary=B_;ke.prototype.visitFixedSizeBinary=va;ke.prototype.visitDate=va;ke.prototype.visitTimestamp=va;ke.prototype.visitTime=va;ke.prototype.visitDecimal=va;ke.prototype.visitList=YE;ke.prototype.visitStruct=VE;ke.prototype.visitUnion=kQ;ke.prototype.visitInterval=va;ke.prototype.visitDuration=va;ke.prototype.visitFixedSizeList=YE;ke.prototype.visitMap=YE;var yu=class extends cu{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Zo,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,xn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return co(t)?t.then(r=>this.writeAll(r)):Fi(t)?GE(this,t):WE(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Zo?this._sink=t:(this._sink=new Zo,t&&_k(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&wk(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!pu(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof wn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof He&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!pu(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof He?t instanceof mu||this._writeRecordBatch(t):t instanceof wn?this.writeAll(t.batches):lo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Gn.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Vt.RecordBatch?this._recordBatchBlocks.push(new ma(a,t.bodyLength,this._position)):t.headerType===Vt.DictionaryBatch&&this._dictionaryBlocks.push(new ma(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=St(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Gn.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(gd)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=ke.assemble(t),s=new Yr(t.numRows,n,i),a=Gn.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=ke.assemble(new Gt([t])),c=new Yr(t.length,o,s),l=new Wn(c,r,n),u=Gn.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,u]of s.entries())this._writeDictionaryBatch(u,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},gu=class e extends yu{static writeAll(t,r){let n=new e(r);return co(t)?t.then(i=>n.writeAll(i)):Fi(t)?GE(n,t):WE(n,t)}},xu=class e extends yu{static writeAll(t){let r=new e;return co(t)?t.then(n=>r.writeAll(n)):Fi(t)?GE(r,t):WE(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=pa.encode(new pa(t,he.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function WE(e,t){let r=t;t instanceof wn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function GE(e,t){return Q(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=ao(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function o5(e,t){if(Fi(e))return UQ(e,t);if(lo(e))return PQ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function PQ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=St(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function UQ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Q(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Q(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Q(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Q(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=St(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function c5(e){return new XE(e)}var XE=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=xk(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=uu(o),this._getSize=i!=="bytes"?s5:a5;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?s5:a5}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},s5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},a5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function P_(e,t){let r=new Zo,n=null,i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield r.close()})},start(a){return Q(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Q(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Q(this,void 0,void 0,function*(){return yield(yield Wr.from(r)).open(t)})}function s(a,c){return Q(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function U_(e,t){let r=new this(e),n=new Pi(r),i=new ReadableStream({cancel(){return Q(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Q(this,void 0,void 0,function*(){yield o(s)})},start(s){return Q(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Q(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function $_(e,t="stream"){return(t==="stream"?gu:xu).writeAll(e).toUint8Array(!0)}var qQ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},sE),RE),vE),aE),JA),wE),rE),{compareSchemas:pu,compareFields:kB,compareTypes:BB});qr.toDOMStream=o5;Le.throughDOM=c5;Wr.throughDOM=P_;Bc.throughDOM=P_;ts.throughDOM=P_;yu.throughDOM=U_;xu.throughDOM=U_;gu.throughDOM=U_;var VQ=Object.create,u5=Object.defineProperty,YQ=Object.getOwnPropertyDescriptor,WQ=Object.getOwnPropertyNames,GQ=Object.getPrototypeOf,XQ=Object.prototype.hasOwnProperty,HQ=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),QQ=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WQ(t))!XQ.call(e,i)&&i!==r&&u5(e,i,{get:()=>t[i],enumerable:!(n=YQ(t,i))||n.enumerable});return e},ZQ=(e,t,r)=>(r=e!=null?VQ(GQ(e)):{},QQ(t||!e||!e.__esModule?u5(r,"default",{value:e,enumerable:!0}):r,e)),KQ=HQ((e,t)=>{t.exports=Worker}),JQ=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(JQ||{}),tZ=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(tZ||{}),eZ=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(eZ||{}),rZ=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(rZ||{}),nZ=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(nZ||{}),iZ=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(iZ||{}),f5=class{log(e){}},d5=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var oZ=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(oZ||{}),sZ=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),r=Wr.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new wn(r)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let r=new h5(this._bindings,this._conn,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new aZ(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=$_(e,"stream");await this.insertArrowFromIPCStream(r,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},h5=class{constructor(e,t,r){this.db=e,this.conn=t,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},aZ=class{constructor(e,t,r){this.bindings=e,this.connectionId=t,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=Wr.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new wn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new h5(this.bindings,this.connectionId,t),n=await Wr.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},cZ=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(cZ||{}),lZ=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(lZ||{}),oe=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((r,n)=>{this.promiseResolver=r,this.promiseRejecter=n})}};function z_(e){switch(e.typeId){case D.Binary:return{sqlType:"binary"};case D.Bool:return{sqlType:"bool"};case D.Date:return{sqlType:"date"};case D.DateDay:return{sqlType:"date32[d]"};case D.DateMillisecond:return{sqlType:"date64[ms]"};case D.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case D.Float:return{sqlType:"float"};case D.Float16:return{sqlType:"float16"};case D.Float32:return{sqlType:"float32"};case D.Float64:return{sqlType:"float64"};case D.Int:return{sqlType:"int32"};case D.Int16:return{sqlType:"int16"};case D.Int32:return{sqlType:"int32"};case D.Int64:return{sqlType:"int64"};case D.Uint16:return{sqlType:"uint16"};case D.Uint32:return{sqlType:"uint32"};case D.Uint64:return{sqlType:"uint64"};case D.Uint8:return{sqlType:"uint8"};case D.IntervalDayTime:return{sqlType:"interval[dt]"};case D.IntervalYearMonth:return{sqlType:"interval[m]"};case D.List:return{sqlType:"list",valueType:z_(e.valueType)};case D.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case D.Null:return{sqlType:"null"};case D.Utf8:return{sqlType:"utf8"};case D.Struct:return{sqlType:"struct",fields:e.children.map(t=>tM(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:z_(t.keyType),valueType:z_(t.valueType)}}case D.Time:return{sqlType:"time[s]"};case D.TimeMicrosecond:return{sqlType:"time[us]"};case D.TimeMillisecond:return{sqlType:"time[ms]"};case D.TimeNanosecond:return{sqlType:"time[ns]"};case D.TimeSecond:return{sqlType:"time[s]"};case D.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case D.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case D.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case D.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case D.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function tM(e,t){let r=z_(t);return r.name=e,r}var uZ=new TextEncoder,p5=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,r)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,e),this._worker.postMessage({messageId:r,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let r=e.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(r.data);return}}let n=this._pendingRequests.get(r.requestId);if(!n){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let i=new Error(r.data.message);i.name=r.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=r.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){n.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){n.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){n.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){n.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){n.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){n.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){n.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){n.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){n.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){n.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){n.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){n.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){n.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(r.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new oe("RESET",null);return await this.postTask(e)}async ping(){let e=new oe("PING",null);await this.postTask(e)}async dropFile(e){let t=new oe("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new oe("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new oe("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new oe("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new oe("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new oe("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new oe("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new oe("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new oe("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new sZ(this,e)}async disconnect(e){let t=new oe("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new oe("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new oe("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new oe("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new oe("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new oe("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new oe("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new oe("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new oe("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new oe("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new oe("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new oe("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=uZ.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new oe("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let r=new oe("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new oe("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new oe("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new oe("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new oe("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new oe("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new oe("INSERT_ARROW_FROM_IPC_STREAM",[e,t,r]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_CSV_FROM_PATH",[e,t,r]);await this.postTask(n)}async insertJSONFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(tM(o,s))}r.columnsFlat=i,delete r.columns}let n=new oe("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var fZ=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),dZ=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),hZ=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),pZ=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),eM={name:"@duckdb/duckdb-wasm",version:"1.29.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},mZ=eM.name,yZ=eM.version,rM=eM.version.split("."),XMt=rM[0],HMt=rM[1],QMt=rM[2],gZ=()=>typeof navigator>"u";function m5(){let e="https://cdn.jsdelivr.net/npm/".concat(mZ,"@").concat(yZ,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var HE=null,QE=null,ZE=null,KE=null,JE=null;async function xZ(){return HE==null&&(HE=typeof BigInt64Array<"u"),QE==null&&(QE=await dZ()),ZE==null&&(ZE=await pZ()),KE==null&&(KE=await hZ()),JE==null&&(JE=await fZ()),{bigInt64Array:HE,crossOriginIsolated:gZ()||globalThis.crossOriginIsolated||!1,wasmExceptions:QE,wasmSIMD:KE,wasmThreads:ZE,wasmBulkMemory:JE}}async function y5(e){let t=await xZ();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var ZMt=ZQ(KQ());function bZ(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var KMt=bZ(),_Z=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(_Z||{});function vZ(e,t){return new Promise((r,n)=>{e.useUnsafe(async(i,o)=>{try{let s=await i.runQuery(o,t);r(s)}catch(s){n(s)}})})}function g5(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):SZ(n).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,h=await l(),p=await vZ(h,d);return f==="exec"?void 0:f==="arrow"?pc(p):pc(p).toArray()}}}async function SZ({log:e=!1}={}){let t=m5(),r=await y5(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new d5:new f5,s=new p5(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function bu(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=t!==void 0?Yf(e,Er(t)):null;return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function Sa(e,t,{source:r,clients:n=r?new Set([r]):void 0}){let i=null;if(t){let o=t.length&&e.length===1?[cA(e[0],t.map(s=>Er(s[0])))]:t.map(s=>on(s.map((a,c)=>Yf(e[c],Er(a)))));i=t.length===0?Er(!1):o.length>1?Oi(o):o[0]}return{meta:{type:"point"},source:r,clients:n,value:t,predicate:i}}function _u(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?jr(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}function nM(e,t,{source:r,clients:n=r?new Set([r]):void 0,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?on(e.map((l,u)=>jr(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:r,clients:n,value:t,predicate:a}}var IZ={contains:pA,prefix:mA,suffix:yA,regexp:hA};function iM(e,t,{source:r,clients:n=void 0,method:i="contains"}){let o=IZ[i],s=t?o(e,Er(t)):null;return{meta:{type:"match",method:i},source:r,clients:n,value:t,predicate:s}}function oM(e){return typeof e?.getChild=="function"}function sM(){let e=new Set,t,r=new Promise(n=>t=n);return{pending(n){e.add(n)},ready(n){return e.delete(n),e.size===0},resolve(){r=new Promise(n=>{t(),t=n})},get promise(){return r}}}function Xn(e){return oM(e)?TZ(e):AZ(e)}function TZ(e){let{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function AZ(e){let t=e.length;if(typeof e[0]=="object"){let r=t?Object.keys(e[0]):[],n={};return r.length>0&&r.forEach(i=>{n[i]=e.map(o=>o[i])}),{numRows:t,columns:n}}else return{numRows:t,values:e}}var aC={};Jn(aC,{Fixed:()=>es,Param:()=>vc,Query:()=>ft,Selection:()=>qo,align:()=>j8,and:()=>on,area:()=>OL,areaX:()=>RL,areaY:()=>DL,argmax:()=>xc,argmin:()=>bc,ariaDescription:()=>Q8,ariaLabel:()=>H8,arrayAgg:()=>TT,arrow:()=>TF,aspectRatio:()=>q8,avg:()=>Xp,axis:()=>V8,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,bin:()=>I8,cast:()=>qf,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,centroid:()=>tm,centroidX:()=>fA,centroidY:()=>dA,circle:()=>GL,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorLegend:()=>iC,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,column:()=>Gs,contour:()=>fF,coordinator:()=>Li,corr:()=>AT,count:()=>Mr,covarPop:()=>MT,covariance:()=>ET,createSchema:()=>NA,createTable:()=>_c,cume_dist:()=>wA,dateDay:()=>JT,dateMonth:()=>ZT,dateMonthDay:()=>KT,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,dense_rank:()=>bA,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,entropy:()=>NT,eq:()=>iA,errorbarX:()=>xF,errorbarY:()=>bF,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,first:()=>OT,first_value:()=>IA,float32:()=>XT,float64:()=>Ge,frame:()=>EF,from:()=>yW,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,geo:()=>kF,geojson:()=>Jp,graticule:()=>PF,grid:()=>W8,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,gt:()=>Di,gte:()=>oA,hconcat:()=>lW,heatmap:()=>dF,height:()=>B8,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,highlight:()=>UF,hspace:()=>dW,hull:()=>IF,image:()=>sF,inset:()=>Y8,int32:()=>ve,intervalX:()=>$F,intervalXY:()=>jF,intervalY:()=>zF,isBetween:()=>jr,isDistinct:()=>sA,isNotBetween:()=>aA,isNotDistinct:()=>Yf,isNotNull:()=>Ri,isNull:()=>Kl,kurtosis:()=>RT,lag:()=>SA,last:()=>CT,last_value:()=>TA,lead:()=>Wf,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,literal:()=>Er,loadCSV:()=>DA,loadExtension:()=>OA,loadJSON:()=>LA,loadObjects:()=>kA,loadParquet:()=>FA,loadSpatial:()=>CA,lt:()=>ze,lte:()=>ri,mad:()=>DT,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,max:()=>zr,median:()=>LT,menu:()=>nW,min:()=>zn,mode:()=>FT,name:()=>O8,nearest:()=>qF,nearestX:()=>VF,nearestY:()=>YF,neq:()=>so,not:()=>nA,nth_value:()=>AA,ntile:()=>vA,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityLegend:()=>oC,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,or:()=>Oi,padding:()=>X8,pan:()=>ZF,panX:()=>KF,panY:()=>JF,panZoom:()=>tC,panZoomX:()=>eC,panZoomY:()=>rC,percent_rank:()=>_A,plot:()=>_W,product:()=>kT,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,quantile:()=>BT,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,rank:()=>xA,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,region:()=>WF,regressionY:()=>gF,row_number:()=>gA,ruleX:()=>KL,ruleY:()=>JL,search:()=>iW,skewness:()=>qT,slider:()=>oW,sphere:()=>BF,spike:()=>oF,sql:()=>tr,stddev:()=>Zp,stddevPop:()=>VT,stringAgg:()=>YT,style:()=>C8,sum:()=>de,symbolDomain:()=>QD,symbolLegend:()=>sC,symbolRange:()=>ZD,symbolScale:()=>HD,table:()=>sW,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,toggle:()=>Tf,toggleColor:()=>QF,toggleX:()=>GF,toggleY:()=>XF,toggleZ:()=>HF,varPop:()=>GT,variance:()=>WT,vconcat:()=>cW,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF,vspace:()=>fW,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var es=Symbol("Fixed"),Gr=Symbol("Transient"),oy=Symbol("Transform");var f8={};Jn(f8,{Area:()=>hf,Arrow:()=>w0,BarX:()=>pf,BarY:()=>mf,Cell:()=>yf,Contour:()=>D0,Density:()=>C0,Dot:()=>gf,Frame:()=>p0,Geo:()=>k0,Hexgrid:()=>B0,Image:()=>P0,Line:()=>xf,Link:()=>b0,Mark:()=>vt,Raster:()=>M0,Rect:()=>df,RuleX:()=>o0,RuleY:()=>s0,Text:()=>lf,TickX:()=>I0,TickY:()=>T0,Tip:()=>m0,Vector:()=>ff,WaffleX:()=>$0,WaffleY:()=>z0,area:()=>x0,areaX:()=>Tl,areaY:()=>ac,arrow:()=>mq,auto:()=>Aq,autoSpec:()=>kN,axisFx:()=>zS,axisFy:()=>$S,axisX:()=>c0,axisY:()=>a0,barX:()=>Fs,barY:()=>Cs,bin:()=>sc,binX:()=>Ds,binY:()=>Ls,bollinger:()=>Nl,bollingerX:()=>Dq,bollingerY:()=>Lq,boxX:()=>Fq,boxY:()=>Cq,cell:()=>Al,cellX:()=>gq,cellY:()=>xq,centroid:()=>pI,circle:()=>wq,cluster:()=>LV,column:()=>Br,contour:()=>Vq,crosshair:()=>Gq,crosshairX:()=>Xq,crosshairY:()=>Hq,delaunayLink:()=>Kq,delaunayMesh:()=>Jq,density:()=>iV,differenceX:()=>aV,differenceY:()=>cV,dodgeX:()=>JV,dodgeY:()=>tY,dot:()=>to,dotX:()=>bq,dotY:()=>_q,filter:()=>E$,find:()=>k$,formatIsoDate:()=>aN,formatMonth:()=>zz,formatNumber:()=>sN,formatWeekday:()=>jz,frame:()=>jh,geo:()=>mI,geoCentroid:()=>uV,graticule:()=>dV,gridFx:()=>YS,gridFy:()=>qS,gridX:()=>VS,gridY:()=>jS,group:()=>Zg,groupX:()=>ul,groupY:()=>fl,groupZ:()=>Qg,hexagon:()=>vq,hexbin:()=>hV,hexgrid:()=>pV,hull:()=>tV,identity:()=>G,image:()=>yV,indexOf:()=>Ee,initializer:()=>Ne,interpolateNearest:()=>O0,interpolateNone:()=>hI,interpolatorBarycentric:()=>N0,interpolatorRandomWalk:()=>R0,legend:()=>Bj,line:()=>bf,lineX:()=>El,lineY:()=>Ml,linearRegressionX:()=>bV,linearRegressionY:()=>_V,link:()=>iI,map:()=>Zn,mapX:()=>Xh,mapY:()=>Hh,marks:()=>yr,normalize:()=>II,normalizeX:()=>iY,normalizeY:()=>oY,numberInterval:()=>I4,plot:()=>qh,pointer:()=>gl,pointerX:()=>xl,pointerY:()=>ic,raster:()=>$q,rect:()=>h0,rectX:()=>$h,rectY:()=>zh,reverse:()=>M$,ruleX:()=>vi,ruleY:()=>Si,scale:()=>dl,select:()=>lY,selectFirst:()=>V0,selectLast:()=>Y0,selectMaxX:()=>MI,selectMaxY:()=>NI,selectMinX:()=>AI,selectMinY:()=>EI,shiftX:()=>sY,shiftY:()=>aY,shuffle:()=>N$,sort:()=>cS,sphere:()=>fV,spike:()=>gj,stackX:()=>TN,stackX1:()=>qj,stackX2:()=>Vj,stackY:()=>AN,stackY1:()=>Yj,stackY2:()=>Wj,text:()=>Rs,textX:()=>LS,textY:()=>FS,tickX:()=>uI,tickY:()=>fI,timeInterval:()=>Vg,tip:()=>KS,transform:()=>mr,tree:()=>r8,treeLink:()=>_I,treeNode:()=>U0,utcInterval:()=>Ku,valueof:()=>_t,vector:()=>vN,vectorX:()=>BS,vectorY:()=>PS,voronoi:()=>eV,voronoiMesh:()=>rV,waffleX:()=>UV,waffleY:()=>$V,window:()=>Qh,windowX:()=>Eq,windowY:()=>Mq});function Ft(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function To(e){let t,r,n;e.length!==2?(t=Ft,r=(a,c)=>Ft(e(a),c),n=(a,c)=>e(a)-c):(t=e===Ft||e===vn?e:EZ,r=e,n=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;r(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&n(a[f-1],c)>-n(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function EZ(){return 0}function sy(e){return e===null?NaN:+e}function*x5(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var b5=To(Ft),_5=b5.right,MZ=b5.left,NZ=To(sy).center,Ia=_5;var ay=w5(v5),aM=w5(OZ);function w5(e){return function(t,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!r&&!n)return t;let a=r&&e(r),c=n&&e(n),l=i.slice();return a&&c?(wd(a,l,i,o,s),wd(a,i,l,o,s),wd(a,l,i,o,s),vd(c,i,l,o,s),vd(c,l,i,o,s),vd(c,i,l,o,s)):a?(wd(a,i,l,o,s),wd(a,l,i,o,s),wd(a,i,l,o,s)):c&&(vd(c,i,l,o,s),vd(c,l,i,o,s),vd(c,i,l,o,s)),t}}function wd(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function vd(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function OZ(e){let t=v5(e);return(r,n,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(r,n,i+0,o+0,s),t(r,n,i+1,o+1,s),t(r,n,i+2,o+2,s),t(r,n,i+3,o+3,s)}}function v5(e){let t=Math.floor(e);if(t===e)return RZ(e);let r=e-t,n=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+r*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/n,l-=o[Math.max(s,d-u)]}}function RZ(e){let t=2*e+1;return(r,n,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*n[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=n[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=n[Math.min(o,l+c)],r[l]=a/t,a-=n[Math.max(i,l-c)]}}function rs(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(i=+i)>=i&&++r}return r}function DZ(e){return e.length|0}function LZ(e){return!(e>0)}function FZ(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function CZ(e){return t=>e(...t)}function j_(...e){let t=typeof e[e.length-1]=="function"&&CZ(e.pop());e=e.map(FZ);let r=e.map(DZ),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some(LZ))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=n;for(;++i[s]===r[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function q_(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?i=>r+=+i||0:i=>r+=+t(i,n++,e)||0)}function Pc(e,t){let r=0,n,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function zi(e,t){let r=Pc(e,t);return r&&Math.sqrt(r)}function ce(e,t){let r,n;if(t===void 0)for(let i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}var Xr=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,n=0;for(let i=0;i<this._n&&i<32;i++){let o=r[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(r[n++]=a),t=s}return r[n]=t,this._n=n+1,this}valueOf(){let t=this._partials,r=this._n,n,i,o,s=0;if(r>0){for(s=t[--r];r>0&&(n=s,i=t[--r],s=n+i,o=i-(s-n),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(i=o*2,n=s+i,i==n-s&&(s=n))}return s}};var Sn=class extends Map{constructor(t,r=T5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(cM(this,t))}has(t){return super.has(cM(this,t))}set(t,r){return super.set(S5(this,t),r)}delete(t){return super.delete(I5(this,t))}},In=class extends Set{constructor(t,r=T5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(cM(this,t))}add(t){return super.add(S5(this,t))}delete(t){return super.delete(I5(this,t))}};function cM({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function S5({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function I5({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function T5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cy(e){return e}function Hr(e,...t){return uM(e,cy,cy,t)}function Ao(e,t,...r){return uM(e,cy,t,r)}function lM(e,t,...r){return uM(e,Array.from,t,r)}function uM(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Sn,c=n[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function fM(e,t){return Array.from(t,r=>e[r])}function Ta(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),n.sort((i,o)=>{for(let s of t){let a=wu(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>wu(r[i],r[o]))),fM(e,n)}return e.sort(ly(r))}function ly(e=Ft){if(e===Ft)return wu;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function wu(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Sd(e,t,r){return(t.length!==2?Ta(Ao(e,t,r),([n,i],[o,s])=>Ft(i,s)||Ft(n,o)):Ta(Hr(e,r),([n,i],[o,s])=>t(i,s)||Ft(n,o))).map(([n])=>n)}var kZ=Math.sqrt(50),BZ=Math.sqrt(10),PZ=Math.sqrt(2);function V_(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=kZ?10:o>=BZ?5:o>=PZ?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=r&&r<2?V_(e,t,r*2):[a,c,l]}function Qr(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,s]=n?V_(t,e,r):V_(e,t,r);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(n)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Aa(e,t,r){return t=+t,e=+e,r=+r,V_(e,t,r)[2]}function Id(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?Aa(t,e,r):Aa(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Td(e,t,r){let n;for(;;){let i=Aa(e,t,r);if(i===n||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),n=i}}function Uc(e){return Math.max(1,Math.ceil(Math.log(rs(e))/Math.LN2)+1)}function Kt(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function Y_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Ht(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function W_(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);return n}function G_(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?wu:ly(i);n>r;){if(n-r>600){let c=n-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(n,Math.floor(t+(c-l)*f/c+d));G_(e,t,h,p,i)}let o=e[t],s=r,a=n;for(uy(e,r,t),i(e[n],o)>0&&uy(e,r,n);s<a;){for(uy(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?uy(e,r,a):(++a,uy(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function uy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function vu(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)>0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)>0:t(i,i)===0)&&(r=i,n=!0);return r}function Tn(e,t,r){if(e=Float64Array.from(x5(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ht(e);if(t>=1)return Kt(e);var n,i=(n-1)*t,o=Math.floor(i),s=Kt(G_(e,o).subarray(0,o+1)),a=Ht(e.subarray(o+1));return s+(a-s)*(i-o)}}function dM(e,t,r=sy){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),a=+r(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function X_(e,t,r){let n=rs(e),i=Tn(e,.75)-Tn(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function fy(e,t,r){let n=rs(e),i=zi(e);return n&&i?Math.ceil((r-t)*Math.cbrt(n)/(3.49*i)):1}function Ea(e,t){let r=0,n=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}function Eo(e,t){return Tn(e,.5,t)}function*$Z(e){for(let t of e)yield*t}function Ad(e){return Array.from($Z(e))}function Ed(e,t){let r=new Sn;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(let[o,s]of r)s>i&&(i=s,n=o);return n}function H_(e,t=zZ){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function zZ(e,t){return[e,t]}function er(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function dy(e,t=Ft){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e),n=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=Ft);let i=(a,c)=>t(r[a],r[c]),o,s;return e=Uint32Array.from(r,(a,c)=>c),e.sort(t===Ft?(a,c)=>wu(r[a],r[c]):ly(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),n[a]=s):n[a]=NaN}),n}function Q_(e,t=Ft){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?Ft(s,i)<0:Ft(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)<0:t(i,i)===0)&&(r=i,n=!0);return r}function Zr(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}function $c(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function A5(e){return e}var hM=1,pM=2,mM=3,Z_=4,E5=1e-6;function jZ(e){return"translate("+e+",0)"}function qZ(e){return"translate(0,"+e+")"}function VZ(e){return t=>+e(t)}function YZ(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function WZ(){return!this.__axis}function GZ(e,t){var r=[],n=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===hM||e===Z_?-1:1,u=e===Z_||e===pM?"x":"y",f=e===hM||e===mM?jZ:qZ;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,r):A5),y=Math.max(o,0)+a,g=t.range(),x=+g[0]+c,b=+g[g.length-1]+c,_=(t.bandwidth?YZ:VZ)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),A=T.exit(),E=T.enter().append("g").attr("class","tick"),N=T.select("line"),I=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(E),N=N.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),I=I.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===hM?"0em":e===mM?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),N=N.transition(h),I=I.transition(h),A=A.transition(h).attr("opacity",E5).attr("transform",function(R){return isFinite(R=_(R))?f(R+c):this.getAttribute("transform")}),E.attr("opacity",E5).attr("transform",function(R){var C=this.parentNode.__axis;return f((C&&isFinite(C=C(R))?C:_(R))+c)})),A.remove(),w.attr("d",e===Z_||e===pM?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),T.attr("opacity",1).attr("transform",function(R){return f(_(R)+c)}),N.attr(u+"2",l*o),I.attr(u,l*y).text(m),v.filter(WZ).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===pM?"start":e===Z_?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),d):n&&n.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function yM(e){return GZ(mM,e)}var XZ={value:()=>{}};function N5(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new K_(r)}function K_(e){this._=e}function HZ(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}K_.prototype=N5.prototype={constructor:K_,on:function(e,t){var r=this._,n=HZ(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=QZ(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=n[o]).type)r[i]=M5(r[i],e.name,t);else if(t==null)for(i in r)r[i]=M5(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new K_(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,o;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,i=o.length;n<i;++n)o[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,o=n.length;i<o;++i)n[i].value.apply(t,r)}};function QZ(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function M5(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=XZ,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Su=N5;var J_="http://www.w3.org/1999/xhtml",An={svg:"http://www.w3.org/2000/svg",xhtml:J_,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ma(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),An.hasOwnProperty(t)?{space:An[t],local:e}:e}function ZZ(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===J_&&t.documentElement.namespaceURI===J_?t.createElement(e):t.createElementNS(r,e)}}function KZ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Na(e){var t=Ma(e);return(t.local?KZ:ZZ)(t)}function JZ(){}function Iu(e){return e==null?JZ:function(){return this.querySelector(e)}}function O5(e){typeof e!="function"&&(e=Iu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Qe(n,this._parents)}function gM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function tK(){return[]}function hy(e){return e==null?tK:function(){return this.querySelectorAll(e)}}function eK(e){return function(){return gM(e.apply(this,arguments))}}function R5(e){typeof e=="function"?e=eK(e):e=hy(e);for(var t=this._groups,r=t.length,n=[],i=[],o=0;o<r;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(n.push(e.call(c,c.__data__,l,s)),i.push(c));return new Qe(n,i)}function py(e){return function(){return this.matches(e)}}function tw(e){return function(t){return t.matches(e)}}var rK=Array.prototype.find;function nK(e){return function(){return rK.call(this.children,e)}}function iK(){return this.firstElementChild}function D5(e){return this.select(e==null?iK:nK(typeof e=="function"?e:tw(e)))}var oK=Array.prototype.filter;function sK(){return Array.from(this.children)}function aK(e){return function(){return oK.call(this.children,e)}}function L5(e){return this.selectAll(e==null?sK:aK(typeof e=="function"?e:tw(e)))}function F5(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Qe(n,this._parents)}function ew(e){return new Array(e.length)}function C5(){return new Qe(this._enter||this._groups.map(ew),this._parents)}function my(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}my.prototype={constructor:my,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function k5(e){return function(){return e}}function cK(e,t,r,n,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],n[s]=a):r[s]=new my(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function lK(e,t,r,n,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(n[a]=c,c.__data__=o[a],l.delete(h)):r[a]=new my(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function uK(e){return e.__data__}function B5(e,t){if(!arguments.length)return Array.from(this,uK);var r=t?lK:cK,n=this._parents,i=this._groups;typeof e!="function"&&(e=k5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=n[l],f=i[l],d=f.length,h=fK(e.call(u,u&&u.__data__,l,n)),p=h.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(d);r(u,f,m,y,g,h,t);for(var x=0,b=0,_,v;x<p;++x)if(_=m[x]){for(x>=b&&(b=x+1);!(v=y[b])&&++b<p;);_._next=v||null}}return s=new Qe(s,n),s._enter=a,s._exit=c,s}function fK(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function P5(){return new Qe(this._exit||this._groups.map(ew),this._parents)}function U5(e,t,r){var n=this.enter(),i=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?o.remove():r(o),n&&i?n.merge(i).order():i}function $5(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,o=n.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=r[c],u=n[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=r[c];return new Qe(a,this._parents)}function z5(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,o=n[i],s;--i>=0;)(s=n[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function j5(e){e||(e=dK);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),o=0;o<n;++o){for(var s=r[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Qe(i,this._parents).order()}function dK(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function V5(){return Array.from(this)}function Y5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length;i<o;++i){var s=n[i];if(s)return s}return null}function W5(){let e=0;for(let t of this)++e;return e}function G5(){return!this.node()}function X5(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function hK(e){return function(){this.removeAttribute(e)}}function pK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mK(e,t){return function(){this.setAttribute(e,t)}}function yK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function xK(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function H5(e,t){var r=Ma(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?pK:hK:typeof t=="function"?r.local?xK:gK:r.local?yK:mK)(r,t))}function rw(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bK(e){return function(){this.style.removeProperty(e)}}function _K(e,t,r){return function(){this.style.setProperty(e,t,r)}}function wK(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function Q5(e,t,r){return arguments.length>1?this.each((t==null?bK:typeof t=="function"?wK:_K)(e,t,r??"")):zc(this.node(),e)}function zc(e,t){return e.style.getPropertyValue(t)||rw(e).getComputedStyle(e,null).getPropertyValue(t)}function vK(e){return function(){delete this[e]}}function SK(e,t){return function(){this[e]=t}}function IK(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Z5(e,t){return arguments.length>1?this.each((t==null?vK:typeof t=="function"?IK:SK)(e,t)):this.node()[e]}function K5(e){return e.trim().split(/^|\s+/)}function xM(e){return e.classList||new J5(e)}function J5(e){this._node=e,this._names=K5(e.getAttribute("class")||"")}J5.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function t7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function e7(e,t){for(var r=xM(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function TK(e){return function(){t7(this,e)}}function AK(e){return function(){e7(this,e)}}function EK(e,t){return function(){(t.apply(this,arguments)?t7:e7)(this,e)}}function r7(e,t){var r=K5(e+"");if(arguments.length<2){for(var n=xM(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?EK:t?TK:AK)(r,t))}function MK(){this.textContent=""}function NK(e){return function(){this.textContent=e}}function OK(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function n7(e){return arguments.length?this.each(e==null?MK:(typeof e=="function"?OK:NK)(e)):this.node().textContent}function RK(){this.innerHTML=""}function DK(e){return function(){this.innerHTML=e}}function LK(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function i7(e){return arguments.length?this.each(e==null?RK:(typeof e=="function"?LK:DK)(e)):this.node().innerHTML}function FK(){this.nextSibling&&this.parentNode.appendChild(this)}function o7(){return this.each(FK)}function CK(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function s7(){return this.each(CK)}function a7(e){var t=typeof e=="function"?e:Na(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kK(){return null}function c7(e,t){var r=typeof e=="function"?e:Na(e),n=t==null?kK:typeof t=="function"?t:Iu(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function BK(){var e=this.parentNode;e&&e.removeChild(this)}function l7(){return this.each(BK)}function PK(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function UK(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function u7(e){return this.select(e?UK:PK)}function f7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function $K(e){return function(t){e.call(this,t,this.__data__)}}function zK(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function jK(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,o;r<i;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function qK(e,t,r){return function(){var n=this.__on,i,o=$K(t);if(n){for(var s=0,a=n.length;s<a;++s)if((i=n[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=r),i.value=t;return}}this.addEventListener(e.type,o,r),i={type:e.type,name:e.name,value:t,listener:o,options:r},n?n.push(i):this.__on=[i]}}function d7(e,t,r){var n=zK(e+""),i,o=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=n[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?qK:jK,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function h7(e,t,r){var n=rw(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function VK(e,t){return function(){return h7(this,e,t)}}function YK(e,t){return function(){return h7(this,e,t.apply(this,arguments))}}function p7(e,t){return this.each((typeof t=="function"?YK:VK)(e,t))}function*m7(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length,s;i<o;++i)(s=n[i])&&(yield s)}var bM=[null];function Qe(e,t){this._groups=e,this._parents=t}function y7(){return new Qe([[document.documentElement]],bM)}function WK(){return this}Qe.prototype=y7.prototype={constructor:Qe,select:O5,selectAll:R5,selectChild:D5,selectChildren:L5,filter:F5,data:B5,enter:C5,exit:P5,join:U5,merge:$5,selection:WK,order:z5,sort:j5,call:q5,nodes:V5,node:Y5,size:W5,empty:G5,each:X5,attr:H5,style:Q5,property:Z5,classed:r7,text:n7,html:i7,raise:o7,lower:s7,append:a7,insert:c7,remove:l7,clone:u7,datum:f7,on:d7,dispatch:p7,[Symbol.iterator]:m7};var Oa=y7;function Qt(e){return typeof e=="string"?new Qe([[document.querySelector(e)]],[document.documentElement]):new Qe([[e]],bM)}function g7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function an(e,t){if(e=g7(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var nw={capture:!0,passive:!1};function iw(e){e.preventDefault(),e.stopImmediatePropagation()}function yy(e){var t=e.document.documentElement,r=Qt(e).on("dragstart.drag",iw,nw);"onselectstart"in t?r.on("selectstart.drag",iw,nw):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function gy(e,t){var r=e.document.documentElement,n=Qt(e).on("dragstart.drag",null);t&&(n.on("click.drag",iw,nw),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function Ra(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function jc(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function is(){}var qc=.7,Eu=1/qc,Md="\\s*([+-]?\\d+)\\s*",xy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ns="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",GK=/^#([0-9a-f]{3,8})$/,XK=new RegExp(`^rgb\\(${Md},${Md},${Md}\\)$`),HK=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),QK=new RegExp(`^rgba\\(${Md},${Md},${Md},${xy}\\)$`),ZK=new RegExp(`^rgba\\(${ns},${ns},${ns},${xy}\\)$`),KK=new RegExp(`^hsl\\(${xy},${ns},${ns}\\)$`),JK=new RegExp(`^hsla\\(${xy},${ns},${ns},${xy}\\)$`),x7={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ra(is,di,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:b7,formatHex:b7,formatHex8:tJ,formatHsl:eJ,formatRgb:_7,toString:_7});function b7(){return this.rgb().formatHex()}function tJ(){return this.rgb().formatHex8()}function eJ(){return A7(this).formatHsl()}function _7(){return this.rgb().formatRgb()}function di(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=GK.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?w7(t):r===3?new cr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ow(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ow(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=XK.exec(e))?new cr(t[1],t[2],t[3],1):(t=HK.exec(e))?new cr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QK.exec(e))?ow(t[1],t[2],t[3],t[4]):(t=ZK.exec(e))?ow(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=KK.exec(e))?I7(t[1],t[2]/100,t[3]/100,1):(t=JK.exec(e))?I7(t[1],t[2]/100,t[3]/100,t[4]):x7.hasOwnProperty(e)?w7(x7[e]):e==="transparent"?new cr(NaN,NaN,NaN,0):null}function w7(e){return new cr(e>>16&255,e>>8&255,e&255,1)}function ow(e,t,r,n){return n<=0&&(e=t=r=NaN),new cr(e,t,r,n)}function by(e){return e instanceof is||(e=di(e)),e?(e=e.rgb(),new cr(e.r,e.g,e.b,e.opacity)):new cr}function wr(e,t,r,n){return arguments.length===1?by(e):new cr(e,t,r,n??1)}function cr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ra(cr,wr,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new cr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cr(Au(this.r),Au(this.g),Au(this.b),aw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:v7,formatHex:v7,formatHex8:rJ,formatRgb:S7,toString:S7}));function v7(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}`}function rJ(){return`#${Tu(this.r)}${Tu(this.g)}${Tu(this.b)}${Tu((isNaN(this.opacity)?1:this.opacity)*255)}`}function S7(){let e=aw(this.opacity);return`${e===1?"rgb(":"rgba("}${Au(this.r)}, ${Au(this.g)}, ${Au(this.b)}${e===1?")":`, ${e})`}`}function aw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Au(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tu(e){return e=Au(e),(e<16?"0":"")+e.toString(16)}function I7(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Mo(e,t,r,n)}function A7(e){if(e instanceof Mo)return new Mo(e.h,e.s,e.l,e.opacity);if(e instanceof is||(e=di(e)),!e)return new Mo;if(e instanceof Mo)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-t)/a+2:s=(t-r)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Mo(s,a,c,e.opacity)}function _y(e,t,r,n){return arguments.length===1?A7(e):new Mo(e,t,r,n??1)}function Mo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mo,_y,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new Mo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new cr(_M(e>=240?e-240:e+120,i,n),_M(e,i,n),_M(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Mo(T7(this.h),sw(this.s),sw(this.l),aw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=aw(this.opacity);return`${e===1?"hsl(":"hsla("}${T7(this.h)}, ${sw(this.s)*100}%, ${sw(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T7(e){return e=(e||0)%360,e<0?e+360:e}function sw(e){return Math.max(0,Math.min(1,e||0))}function _M(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var cw=Math.PI/180,lw=180/Math.PI;var uw=18,E7=.96422,M7=1,N7=.82521,O7=4/29,Nd=6/29,R7=3*Nd*Nd,nJ=Nd*Nd*Nd;function D7(e){if(e instanceof os)return new os(e.l,e.a,e.b,e.opacity);if(e instanceof Da)return L7(e);e instanceof cr||(e=by(e));var t=IM(e.r),r=IM(e.g),n=IM(e.b),i=wM((.2225045*t+.7168786*r+.0606169*n)/M7),o,s;return t===r&&r===n?o=s=i:(o=wM((.4360747*t+.3850649*r+.1430804*n)/E7),s=wM((.0139322*t+.0971045*r+.7141733*n)/N7)),new os(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Od(e,t,r,n){return arguments.length===1?D7(e):new os(e,t,r,n??1)}function os(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ra(os,Od,jc(is,{brighter(e){return new os(this.l+uw*(e??1),this.a,this.b,this.opacity)},darker(e){return new os(this.l-uw*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=E7*vM(t),e=M7*vM(e),r=N7*vM(r),new cr(SM(3.1338561*t-1.6168667*e-.4906146*r),SM(-.9787684*t+1.9161415*e+.033454*r),SM(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function wM(e){return e>nJ?Math.pow(e,1/3):e/R7+O7}function vM(e){return e>Nd?e*e*e:R7*(e-O7)}function SM(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function IM(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function iJ(e){if(e instanceof Da)return new Da(e.h,e.c,e.l,e.opacity);if(e instanceof os||(e=D7(e)),e.a===0&&e.b===0)return new Da(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*lw;return new Da(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function wy(e,t,r,n){return arguments.length===1?iJ(e):new Da(e,t,r,n??1)}function Da(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function L7(e){if(isNaN(e.h))return new os(e.l,0,0,e.opacity);var t=e.h*cw;return new os(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ra(Da,wy,jc(is,{brighter(e){return new Da(this.h,this.c,this.l+uw*(e??1),this.opacity)},darker(e){return new Da(this.h,this.c,this.l-uw*(e??1),this.opacity)},rgb(){return L7(this).rgb()}}));var B7=-.14861,TM=1.78277,AM=-.29227,fw=-.90649,vy=1.97294,F7=vy*fw,C7=vy*TM,k7=TM*AM-fw*B7;function oJ(e){if(e instanceof Mu)return new Mu(e.h,e.s,e.l,e.opacity);e instanceof cr||(e=by(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(k7*n+F7*t-C7*r)/(k7+F7-C7),o=n-i,s=(vy*(r-i)-AM*o)/fw,a=Math.sqrt(s*s+o*o)/(vy*i*(1-i)),c=a?Math.atan2(s,o)*lw-120:NaN;return new Mu(c<0?c+360:c,a,i,e.opacity)}function En(e,t,r,n){return arguments.length===1?oJ(e):new Mu(e,t,r,n??1)}function Mu(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ra(Mu,En,jc(is,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Mu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qc:Math.pow(qc,e),new Mu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*cw,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new cr(255*(t+r*(B7*n+TM*i)),255*(t+r*(AM*n+fw*i)),255*(t+r*(vy*n)),this.opacity)}}));function EM(e,t,r,n,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*r+(1+3*e+3*o-3*s)*n+s*i)/6}function P7(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],s=n>0?e[n-1]:2*i-o,a=n<t-1?e[n+2]:2*o-i;return EM((r-n/t)*t,s,i,o,a)}}function U7(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return EM((r-n/t)*t,i,o,s,a)}}var Rd=e=>()=>e;function $7(e,t){return function(r){return e+r*t}}function sJ(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Dd(e,t){var r=t-e;return r?$7(e,r>180||r<-180?r-360*Math.round(r/360):r):Rd(isNaN(e)?t:e)}function z7(e){return(e=+e)==1?Be:function(t,r){return r-t?sJ(t,r,e):Rd(isNaN(t)?r:t)}}function Be(e,t){var r=t-e;return r?$7(e,r):Rd(isNaN(e)?t:e)}var ji=function e(t){var r=z7(t);function n(i,o){var s=r((i=wr(i)).r,(o=wr(o)).r),a=r(i.g,o.g),c=r(i.b,o.b),l=Be(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return n.gamma=e,n}(1);function j7(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),s,a;for(s=0;s<r;++s)a=wr(t[s]),n[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return n=e(n),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=n(c),a.g=i(c),a.b=o(c),a+""}}}var MM=j7(P7),aJ=j7(U7);function q7(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function V7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Y7(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=hi(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function W7(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Fe(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function G7(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=hi(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var OM=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NM=new RegExp(OM.source,"g");function cJ(e){return function(){return e}}function lJ(e){return function(t){return e(t)+""}}function Sy(e,t){var r=OM.lastIndex=NM.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=OM.exec(e))&&(i=NM.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Fe(n,i)})),r=NM.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?lJ(c[0].x):cJ(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function hi(e,t){var r=typeof t,n;return t==null||r==="boolean"?Rd(t):(r==="number"?Fe:r==="string"?(n=di(t))?(t=n,ji):Sy:t instanceof di?ji:t instanceof Date?W7:V7(t)?q7:Array.isArray(t)?Y7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?G7:Fe)(e,t)}function Nu(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var X7=180/Math.PI,dw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function RM(e,t,r,n,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),e*n<t*r&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*X7,skewX:Math.atan(c)*X7,scaleX:s,scaleY:a}}var hw;function H7(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dw:RM(t.a,t.b,t.c,t.d,t.e,t.f)}function Q7(e){return e==null?dw:(hw||(hw=document.createElementNS("http://www.w3.org/2000/svg","g")),hw.setAttribute("transform",e),(e=hw.transform.baseVal.consolidate())?(e=e.matrix,RM(e.a,e.b,e.c,e.d,e.e,e.f)):dw)}function Z7(e,t,r,n){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,r);p.push({i:m-4,x:Fe(l,f)},{i:m-2,x:Fe(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:Fe(l,u)})):u&&f.push(i(f)+"rotate("+u+n)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:Fe(l,u)}):u&&f.push(i(f)+"skewX("+u+n)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Fe(l,f)},{i:m-2,x:Fe(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,y;++p<m;)f[(y=d[p]).i]=y.x(h);return f.join("")}}}var DM=Z7(H7,"px, ","px)","deg)"),LM=Z7(Q7,", ",")",")");var uJ=1e-12;function K7(e){return((e=Math.exp(e))+1/e)/2}function fJ(e){return((e=Math.exp(e))-1/e)/2}function dJ(e){return((e=Math.exp(2*e))-1)/(e+1)}var FM=function e(t,r,n){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,y,g;if(m<uJ)g=Math.log(d/l)/t,y=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*g)]};else{var x=Math.sqrt(m),b=(d*d-l*l+n*m)/(2*l*r*x),_=(d*d-l*l-n*m)/(2*d*r*x),v=Math.log(Math.sqrt(b*b+1)-b),w=Math.log(Math.sqrt(_*_+1)-_);g=(w-v)/t,y=function(T){var A=T*g,E=K7(v),N=l/(r*x)*(E*dJ(t*A+v)-fJ(v));return[a+N*h,c+N*p,l*E/K7(t*A+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function J7(e){return function(t,r){var n=e((t=_y(t)).h,(r=_y(r)).h),i=Be(t.s,r.s),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var CM=J7(Dd),hJ=J7(Be);function pw(e,t){var r=Be((e=Od(e)).l,(t=Od(t)).l),n=Be(e.a,t.a),i=Be(e.b,t.b),o=Be(e.opacity,t.opacity);return function(s){return e.l=r(s),e.a=n(s),e.b=i(s),e.opacity=o(s),e+""}}function tP(e){return function(t,r){var n=e((t=wy(t)).h,(r=wy(r)).h),i=Be(t.c,r.c),o=Be(t.l,r.l),s=Be(t.opacity,r.opacity);return function(a){return t.h=n(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var kM=tP(Dd),pJ=tP(Be);function eP(e){return function t(r){r=+r;function n(i,o){var s=e((i=En(i)).h,(o=En(o)).h),a=Be(i.s,o.s),c=Be(i.l,o.l),l=Be(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,r)),i.opacity=l(u),i+""}}return n.gamma=t,n}(1)}var mJ=eP(Dd),Ld=eP(Be);function ss(e,t){t===void 0&&(t=e,e=hi);for(var r=0,n=t.length-1,i=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(i,i=t[++r]);return function(s){var a=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[a](s-a)}}function cn(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Fd=0,Ty=0,Iy=0,nP=1e3,mw,Ay,yw=0,Ou=0,gw=0,Ey=typeof performance=="object"&&performance.now?performance:Date,iP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ny(){return Ou||(iP(yJ),Ou=Ey.now()+gw)}function yJ(){Ou=0}function My(){this._call=this._time=this._next=null}My.prototype=xw.prototype={constructor:My,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Ny():+r)+(t==null?0:+t),!this._next&&Ay!==this&&(Ay?Ay._next=this:mw=this,Ay=this),this._call=e,this._time=r,BM()},stop:function(){this._call&&(this._call=null,this._time=1/0,BM())}};function xw(e,t,r){var n=new My;return n.restart(e,t,r),n}function oP(){Ny(),++Fd;for(var e=mw,t;e;)(t=Ou-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fd}function rP(){Ou=(yw=Ey.now())+gw,Fd=Ty=0;try{oP()}finally{Fd=0,xJ(),Ou=0}}function gJ(){var e=Ey.now(),t=e-yw;t>nP&&(gw-=t,yw=e)}function xJ(){for(var e,t=mw,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:mw=r);Ay=e,BM(n)}function BM(e){if(!Fd){Ty&&(Ty=clearTimeout(Ty));var t=e-Ou;t>24?(e<1/0&&(Ty=setTimeout(rP,e-Ey.now()-gw)),Iy&&(Iy=clearInterval(Iy))):(Iy||(yw=Ey.now(),Iy=setInterval(gJ,nP)),Fd=1,iP(rP))}}function bw(e,t,r){var n=new My;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var bJ=Su("start","end","cancel","interrupt"),_J=[],cP=0,sP=1,ww=2,_w=3,aP=4,vw=5,Oy=6;function Vc(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;wJ(e,r,{name:t,index:n,group:i,on:bJ,tween:_J,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:cP})}function Ry(e,t){var r=vr(e,t);if(r.state>cP)throw new Error("too late; already scheduled");return r}function Kr(e,t){var r=vr(e,t);if(r.state>_w)throw new Error("too late; already running");return r}function vr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function wJ(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=xw(o,0,r.time);function o(l){r.state=sP,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var u,f,d,h;if(r.state!==sP)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===_w)return bw(s);h.state===aP?(h.state=Oy,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=Oy,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(bw(function(){r.state===_w&&(r.state=aP,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=ww,r.on.call("start",e,e.__data__,r.index,r.group),r.state===ww){for(r.state=_w,i=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=vw,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===vw&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Oy,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function as(e,t){var r=e.__transition,n,i,o=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){o=!1;continue}i=n.state>ww&&n.state<vw,n.state=Oy,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function lP(e){return this.each(function(){as(this,e)})}function vJ(e,t){var r,n;return function(){var i=Kr(this,e),o=i.tween;if(o!==r){n=r=o;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function SJ(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=Kr(this,e),s=o.tween;if(s!==n){i=(n=s).slice();for(var a={name:t,value:r},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function uP(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=vr(this.node(),r).tween,i=0,o=n.length,s;i<o;++i)if((s=n[i]).name===e)return s.value;return null}return this.each((t==null?vJ:SJ)(r,e,t))}function Cd(e,t,r){var n=e._id;return e.each(function(){var i=Kr(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return vr(i,n).value[t]}}function Sw(e,t){var r;return(typeof t=="number"?Fe:t instanceof di?ji:(r=di(t))?(t=r,ji):Sy)(e,t)}function IJ(e){return function(){this.removeAttribute(e)}}function TJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===n?o:o=t(n=s,r)}}function EJ(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?o:o=t(n=s,r)}}function MJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function NJ(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function fP(e,t){var r=Ma(e),n=r==="transform"?LM:Sw;return this.attrTween(e,typeof t=="function"?(r.local?NJ:MJ)(r,n,Cd(this,"attr."+e,t)):t==null?(r.local?TJ:IJ)(r):(r.local?EJ:AJ)(r,n,t))}function OJ(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function RJ(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function DJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&RJ(e,o)),r}return i._value=t,i}function LJ(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&OJ(e,o)),r}return i._value=t,i}function dP(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=Ma(e);return this.tween(r,(n.local?DJ:LJ)(n,t))}function FJ(e,t){return function(){Ry(this,e).delay=+t.apply(this,arguments)}}function CJ(e,t){return t=+t,function(){Ry(this,e).delay=t}}function hP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FJ:CJ)(t,e)):vr(this.node(),t).delay}function kJ(e,t){return function(){Kr(this,e).duration=+t.apply(this,arguments)}}function BJ(e,t){return t=+t,function(){Kr(this,e).duration=t}}function pP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kJ:BJ)(t,e)):vr(this.node(),t).duration}function PJ(e,t){if(typeof t!="function")throw new Error;return function(){Kr(this,e).ease=t}}function mP(e){var t=this._id;return arguments.length?this.each(PJ(t,e)):vr(this.node(),t).ease}function UJ(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Kr(this,e).ease=r}}function yP(e){if(typeof e!="function")throw new Error;return this.each(UJ(this._id,e))}function gP(e){typeof e!="function"&&(e=py(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Mn(n,this._parents,this._name,this._id)}function xP(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,o=Math.min(n,i),s=new Array(n),a=0;a<o;++a)for(var c=t[a],l=r[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<n;++a)s[a]=t[a];return new Mn(s,this._parents,this._name,this._id)}function $J(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function zJ(e,t,r){var n,i,o=$J(t)?Ry:Kr;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function bP(e,t){var r=this._id;return arguments.length<2?vr(this.node(),r).on.on(e):this.each(zJ(r,e,t))}function jJ(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function _P(){return this.on("end.remove",jJ(this._id))}function wP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Iu(e));for(var n=this._groups,i=n.length,o=new Array(i),s=0;s<i;++s)for(var a=n[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Vc(l[d],t,r,d,l,vr(u,r)));return new Mn(o,this._parents,t,r)}function vP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=hy(e));for(var n=this._groups,i=n.length,o=[],s=[],a=0;a<i;++a)for(var c=n[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=vr(u,r),m=0,y=d.length;m<y;++m)(h=d[m])&&Vc(h,t,r,m,d,p);o.push(d),s.push(u)}return new Mn(o,s,t,r)}var qJ=Oa.prototype.constructor;function SP(){return new qJ(this._groups,this._parents)}function VJ(e,t){var r,n,i;return function(){var o=zc(this,e),s=(this.style.removeProperty(e),zc(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function IP(e){return function(){this.style.removeProperty(e)}}function YJ(e,t,r){var n,i=r+"",o;return function(){var s=zc(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function WJ(e,t,r){var n,i,o;return function(){var s=zc(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),zc(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function GJ(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=Kr(this,e),l=c.on,u=c.value[o]==null?a||(a=IP(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function TP(e,t,r){var n=(e+="")=="transform"?DM:Sw;return t==null?this.styleTween(e,VJ(e,n)).on("end.style."+e,IP(e)):typeof t=="function"?this.styleTween(e,WJ(e,n,Cd(this,"style."+e,t))).each(GJ(this._id,e)):this.styleTween(e,YJ(e,n,t),r).on("end.style."+e,null)}function XJ(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function HJ(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&XJ(e,s,r)),n}return o._value=t,o}function AP(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,HJ(e,t,r??""))}function QJ(e){return function(){this.textContent=e}}function ZJ(e){return function(){var t=e(this);this.textContent=t??""}}function EP(e){return this.tween("text",typeof e=="function"?ZJ(Cd(this,"text",e)):QJ(e==null?"":e+""))}function KJ(e){return function(t){this.textContent=e.call(this,t)}}function JJ(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&KJ(i)),t}return n._value=e,n}function MP(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,JJ(e))}function NP(){for(var e=this._name,t=this._id,r=Iw(),n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=vr(c,t);Vc(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mn(n,this._parents,e,r)}function OP(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};r.each(function(){var l=Kr(this,n),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var ttt=0;function Mn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function RP(e){return Oa().transition(e)}function Iw(){return++ttt}var La=Oa.prototype;Mn.prototype=RP.prototype={constructor:Mn,select:wP,selectAll:vP,selectChild:La.selectChild,selectChildren:La.selectChildren,filter:gP,merge:xP,selection:SP,transition:NP,call:La.call,nodes:La.nodes,node:La.node,size:La.size,empty:La.empty,each:La.each,on:bP,attr:fP,attrTween:dP,style:TP,styleTween:AP,text:EP,textTween:MP,remove:_P,tween:uP,delay:hP,duration:pP,ease:mP,easeVarying:yP,end:OP,[Symbol.iterator]:La[Symbol.iterator]};function Tw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ett={time:null,delay:0,duration:250,ease:Tw};function rtt(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function DP(e){var t,r;e instanceof Mn?(t=e._id,e=e._name):(t=Iw(),(r=ett).time=Ny(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Vc(c,e,t,l,s,r||rtt(c,t));return new Mn(n,this._parents,e,t)}Oa.prototype.interrupt=lP;Oa.prototype.transition=DP;var Aw=e=>()=>e;function PM(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function LP(e){e.stopImmediatePropagation()}function Ew(e){e.preventDefault(),e.stopImmediatePropagation()}var FP={name:"drag"},UM={name:"space"},kd={name:"handle"},Bd={name:"center"},{abs:CP,max:ln,min:un}=Math;function kP(e){return[+e[0],+e[1]]}function zM(e){return[kP(e[0]),kP(e[1])]}var Mw={name:"x",handles:["w","e"].map(Dy),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Nw={name:"y",handles:["n","s"].map(Dy),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},ntt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Dy),input:function(e){return e==null?null:zM(e)},output:function(e){return e}},Fa={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},BP={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},PP={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},itt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ott={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Dy(e){return{type:e}}function stt(e){return!e.ctrlKey&&!e.button}function att(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function ctt(){return navigator.maxTouchPoints||"ontouchstart"in this}function $M(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ltt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function jM(){return YM(Mw)}function qM(){return YM(Nw)}function VM(){return YM(ntt)}function YM(e){var t=att,r=stt,n=ctt,i=!0,o=Su("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([Dy("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Fa.overlay).merge(g).each(function(){var b=$M(this).extent;Qt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),y.selectAll(".selection").data([Dy("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Fa.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Fa[b.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(n).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,x){y.tween?y.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,_=b.__brush,v=u(b,arguments),w=_.selection,T=e.input(typeof g=="function"?g.apply(this,arguments):g,_.extent),A=hi(w,T);function E(N){_.selection=N===1&&T===null?null:A(N),l.call(b),v.brush()}return w!==null&&T!==null?E:E(1)}):y.each(function(){var b=this,_=arguments,v=b.__brush,w=e.input(typeof g=="function"?g.apply(b,_):g,v.extent),T=u(b,_).beforestart();as(b),v.selection=w===null?null:w,l.call(b),T.start(x).brush(x).end(x)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Qt(this),g=$M(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,x){var b=y.__brush.emitter;return b&&(!x||!b.clean)?b:new f(y,g,x)}function f(y,g,x){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,x){var b=Qt(this.that).datum();o.call(y,this.that,new PM(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(y){if(a&&!y.touches||!r.apply(this,arguments))return;var g=this,x=y.target.__data__.type,b=(i&&y.metaKey?x="overlay":x)==="selection"?FP:i&&y.altKey?Bd:kd,_=e===Nw?null:itt[x],v=e===Mw?null:ott[x],w=$M(g),T=w.extent,A=w.selection,E=T[0][0],N,I,R=T[0][1],C,S,M=T[1][0],O,L,B=T[1][1],k,P,U=0,$=0,X,rt=_&&v&&i&&y.shiftKey,ot,at,Y=Array.from(y.touches||[y],tt=>{let ge=tt.identifier;return tt=an(tt,g),tt.point0=tt.slice(),tt.identifier=ge,tt});as(g);var st=u(g,arguments,!0).beforestart();if(x==="overlay"){A&&(X=!0);let tt=[Y[0],Y[1]||Y[0]];w.selection=A=[[N=e===Nw?E:un(tt[0][0],tt[1][0]),C=e===Mw?R:un(tt[0][1],tt[1][1])],[O=e===Nw?M:ln(tt[0][0],tt[1][0]),k=e===Mw?B:ln(tt[0][1],tt[1][1])]],Y.length>1&&Pt(y)}else N=A[0][0],C=A[0][1],O=A[1][0],k=A[1][1];I=N,S=C,L=O,P=k;var q=Qt(g).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Fa[x]);if(y.touches)st.moved=z,st.ended=ht;else{var nt=Qt(y.view).on("mousemove.brush",z,!0).on("mouseup.brush",ht,!0);i&&nt.on("keydown.brush",Zt,!0).on("keyup.brush",Jt,!0),yy(y.view)}l.call(g),st.start(y,b.name);function z(tt){for(let ge of tt.changedTouches||[tt])for(let Kn of Y)Kn.identifier===ge.identifier&&(Kn.cur=an(ge,g));if(rt&&!ot&&!at&&Y.length===1){let ge=Y[0];CP(ge.cur[0]-ge[0])>CP(ge.cur[1]-ge[1])?at=!0:ot=!0}for(let ge of Y)ge.cur&&(ge[0]=ge.cur[0],ge[1]=ge.cur[1]);X=!0,Ew(tt),Pt(tt)}function Pt(tt){let ge=Y[0],Kn=ge.point0;var Bo;switch(U=ge[0]-Kn[0],$=ge[1]-Kn[1],b){case UM:case FP:{_&&(U=ln(E-N,un(M-O,U)),I=N+U,L=O+U),v&&($=ln(R-C,un(B-k,$)),S=C+$,P=k+$);break}case kd:{Y[1]?(_&&(I=ln(E,un(M,Y[0][0])),L=ln(E,un(M,Y[1][0])),_=1),v&&(S=ln(R,un(B,Y[0][1])),P=ln(R,un(B,Y[1][1])),v=1)):(_<0?(U=ln(E-N,un(M-N,U)),I=N+U,L=O):_>0&&(U=ln(E-O,un(M-O,U)),I=N,L=O+U),v<0?($=ln(R-C,un(B-C,$)),S=C+$,P=k):v>0&&($=ln(R-k,un(B-k,$)),S=C,P=k+$));break}case Bd:{_&&(I=ln(E,un(M,N-U*_)),L=ln(E,un(M,O+U*_))),v&&(S=ln(R,un(B,C-$*v)),P=ln(R,un(B,k+$*v)));break}}L<I&&(_*=-1,Bo=N,N=O,O=Bo,Bo=I,I=L,L=Bo,x in BP&&H.attr("cursor",Fa[x=BP[x]])),P<S&&(v*=-1,Bo=C,C=k,k=Bo,Bo=S,S=P,P=Bo,x in PP&&H.attr("cursor",Fa[x=PP[x]])),w.selection&&(A=w.selection),ot&&(I=A[0][0],L=A[1][0]),at&&(S=A[0][1],P=A[1][1]),(A[0][0]!==I||A[0][1]!==S||A[1][0]!==L||A[1][1]!==P)&&(w.selection=[[I,S],[L,P]],l.call(g),st.brush(tt,b.name))}function ht(tt){if(LP(tt),tt.touches){if(tt.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else gy(tt.view,X),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Fa.overlay),w.selection&&(A=w.selection),ltt(A)&&(w.selection=null,l.call(g)),st.end(tt,b.name)}function Zt(tt){switch(tt.keyCode){case 16:{rt=_&&v;break}case 18:{b===kd&&(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=Bd,Pt(tt));break}case 32:{(b===kd||b===Bd)&&(_<0?O=L-U:_>0&&(N=I-U),v<0?k=P-$:v>0&&(C=S-$),b=UM,H.attr("cursor",Fa.selection),Pt(tt));break}default:return}Ew(tt)}function Jt(tt){switch(tt.keyCode){case 16:{rt&&(ot=at=rt=!1,Pt(tt));break}case 18:{b===Bd&&(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=kd,Pt(tt));break}case 32:{b===UM&&(tt.altKey?(_&&(O=L-U*_,N=I+U*_),v&&(k=P-$*v,C=S+$*v),b=Bd):(_<0?O=L:_>0&&(N=I),v<0?k=P:v>0&&(C=S),b=kd),H.attr("cursor",Fa[x]),Pt(tt));break}default:return}Ew(tt)}}function h(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=zM(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Aw(zM(y)),c):t},c.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Aw(!!y),c):r},c.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Aw(!!y),c):n},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var WM=Math.PI,GM=2*WM,Ru=1e-6,utt=GM-Ru;function UP(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function ftt(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return UP;let r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}var Yc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?UP:ftt(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=n-t,l=i-r,u=s-t,f=a-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Ru)if(!(Math.abs(f*c-l*u)>Ru)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,p=i-a,m=c*c+l*l,y=h*h+p*p,g=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((WM-Math.acos((m+d-y)/(2*g*x)))/2),_=b/x,v=b/g;Math.abs(_-1)>Ru&&this._append`L${t+_*u},${r+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=r+v*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),l=t+a,u=r+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Ru||Math.abs(this._y1-u)>Ru)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%GM+GM),d>utt?this._append`A${n},${n},0,1,${f},${t-a},${r-c}A${n},${n},0,1,${f},${this._x1=l},${this._y1=u}`:d>Ru&&this._append`A${n},${n},0,${+(d>=WM)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};function $P(){return new Yc}$P.prototype=Yc.prototype;function Nn(e=3){return new Yc(+e)}var dtt=Array.prototype,Ow=dtt.slice;function zP(e,t){return e-t}function jP(e){for(var t=0,r=e.length,n=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n}var cs=e=>()=>e;function qP(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=htt(e,t[r]))return i;return 0}function htt(e,t){for(var r=t[0],n=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(ptt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function ptt(e,t,r){var n;return mtt(e,t,r)&&ytt(e[n=+(e[0]===t[0])],r[n],t[n])}function mtt(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function ytt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function VP(){}var Ca=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Wc(){var e=1,t=1,r=Uc,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(zP);else{let f=ce(l,gtt);for(u=Qr(...Td(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){n(p,l,f),jP(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,y=d.length,g;m<y;++m)if(qP((g=d[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,y,g,x,b;for(p=m=-1,g=Du(l[0],u),Ca[g<<1].forEach(_);++p<e-1;)y=g,g=Du(l[p+1],u),Ca[y|g<<1].forEach(_);for(Ca[g<<0].forEach(_);++m<t-1;){for(p=-1,g=Du(l[m*e+e],u),x=Du(l[m*e],u),Ca[g<<1|x<<2].forEach(_);++p<e-1;)y=g,g=Du(l[m*e+e+p+1],u),b=x,x=Du(l[m*e+p+1],u),Ca[y|g<<1|x<<2|b<<3].forEach(_);Ca[g|x<<3].forEach(_)}for(p=-1,x=l[m*e]>=u,Ca[x<<2].forEach(_);++p<e-1;)b=x,x=Du(l[m*e+p+1],u),Ca[x<<2|b<<3].forEach(_);Ca[x<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],A=a(w),E=a(T),N,I;(N=h[A])?(I=d[E])?(delete h[N.end],delete d[I.start],N===I?(N.ring.push(T),f(N.ring)):d[N.start]=h[I.end]={start:N.start,end:I.end,ring:N.ring.concat(I.ring)}):(delete h[N.end],N.ring.push(T),h[N.end=E]=N):(N=d[E])?(I=h[A])?(delete d[N.start],delete h[I.end],N===I?(N.ring.push(T),f(N.ring)):d[I.start]=h[N.end]={start:I.start,end:N.end,ring:I.ring.concat(N.ring)}):(delete d[N.start],N.ring.unshift(w),d[N.start=A]=N):d[A]=h[E]={start:A,end:E,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,y=p|0,g=XM(u[y*e+m]);h>0&&h<e&&m===h&&(d[0]=YP(h,XM(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(d[1]=YP(p,XM(u[(y-1)*e+m]),g,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(r=typeof l=="function"?l:Array.isArray(l)?cs(Ow.call(l)):cs(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:VP,i):n===c},i}function gtt(e){return isFinite(e)?e:NaN}function Du(e,t){return e==null?!1:+e>=t}function XM(e){return e==null||isNaN(e=+e)?-1/0:e}function YP(e,t,r,n){let i=n-t,o=r-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function xtt(e){return e[0]}function btt(e){return e[1]}function _tt(){return 1}function HM(){var e=xtt,t=btt,r=_tt,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=cs(20);function f(x){var b=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let C of x){var w=(e(C,++v,x)+a)*_,T=(t(C,v,x)+a)*_,A=+r(C,v,x);if(A&&w>=0&&w<c&&T>=0&&T<l){var E=Math.floor(w),N=Math.floor(T),I=w-E-.5,R=T-N-.5;b[E+N*c]+=(1-I)*(1-R)*A,b[E+1+N*c]+=I*(1-R)*A,b[E+1+(N+1)*c]+=I*R*A,b[E+(N+1)*c]+=(1-I)*R*A}}return ay({data:b,width:c,height:l},o*_),b}function d(x){var b=f(x),_=u(b),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Qr(Number.MIN_VALUE,Kt(b)/v,_)),Wc().size([c,l]).thresholds(_.map(w=>w*v))(b).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(x){var b=f(x),_=Wc().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var A=h(_.contour(b,T*v));return A.value=T,A};return Object.defineProperty(w,"max",{get:()=>Kt(b)/v}),w};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=n+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:cs(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:cs(+x),d):t},d.weight=function(x){return arguments.length?(r=typeof x=="function"?x:cs(+x),d):r},d.size=function(x){if(!arguments.length)return[n,i];var b=+x[0],_=+x[1];if(!(b>=0&&_>=0))throw new Error("invalid size");return n=b,i=_,g()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),g()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?cs(Ow.call(x)):cs(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,g()},d}var ne=11102230246251565e-32,lr=134217729,Ly=(3+8*ne)*ne;function Lu(e,t,r,n,i){let o,s,a,c,l=t[0],u=n[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=n[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<r;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<r;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Fy(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function V(e){return new Float64Array(e)}var wtt=(3+16*ne)*ne,vtt=(2+12*ne)*ne,Stt=(9+64*ne)*ne*ne,Pd=V(4),WP=V(8),GP=V(12),XP=V(16),On=V(4);function Itt(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,m,y,g,x,b,_,v,w,T,A,E=e-i,N=r-i,I=t-o,R=n-o;_=E*R,d=lr*E,h=d-(d-E),p=E-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=I*N,d=lr*I,h=d-(d-I),p=I-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,Pd[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,Pd[1]=b-(g+f)+(f-w),A=x+g,f=A-x,Pd[2]=x-(A-f)+(g-f),Pd[3]=A;let C=Fy(4,Pd),S=vtt*s;if(C>=S||-C>=S||(f=e-E,a=e-(E+f)+(f-i),f=r-N,l=r-(N+f)+(f-i),f=t-I,c=t-(I+f)+(f-o),f=n-R,u=n-(R+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=Stt*s+Ly*Math.abs(C),C+=E*u+R*a-(I*l+N*c),C>=S||-C>=S))return C;_=a*R,d=lr*a,h=d-(d-a),p=a-h,d=lr*R,m=d-(d-R),y=R-m,v=p*y-(_-h*m-p*m-h*y),w=c*N,d=lr*c,h=d-(d-c),p=c-h,d=lr*N,m=d-(d-N),y=N-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let M=Lu(4,Pd,4,On,WP);_=E*u,d=lr*E,h=d-(d-E),p=E-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=I*l,d=lr*I,h=d-(d-I),p=I-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let O=Lu(M,WP,4,On,GP);_=a*u,d=lr*a,h=d-(d-a),p=a-h,d=lr*u,m=d-(d-u),y=u-m,v=p*y-(_-h*m-p*m-h*y),w=c*l,d=lr*c,h=d-(d-c),p=c-h,d=lr*l,m=d-(d-l),y=l-m,T=p*y-(w-h*m-p*m-h*y),g=v-T,f=v-g,On[0]=v-(g+f)+(f-T),x=_+g,f=x-_,b=_-(x-f)+(g-f),g=b-w,f=b-g,On[1]=b-(g+f)+(f-w),A=x+g,f=A-x,On[2]=x-(A-f)+(g-f),On[3]=A;let L=Lu(O,GP,4,On,XP);return XP[L-1]}function Ud(e,t,r,n,i,o){let s=(t-o)*(r-i),a=(e-i)*(n-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=wtt*l?c:-Itt(e,t,r,n,i,o,l)}var PFt=(7+56*ne)*ne,UFt=(3+28*ne)*ne,$Ft=(26+288*ne)*ne*ne,zFt=V(4),jFt=V(4),qFt=V(4),VFt=V(4),YFt=V(4),WFt=V(4),GFt=V(4),XFt=V(4),HFt=V(4),QFt=V(8),ZFt=V(8),KFt=V(8),JFt=V(4),tCt=V(8),eCt=V(8),rCt=V(8),nCt=V(12),iCt=V(192),oCt=V(192);var cCt=(10+96*ne)*ne,lCt=(4+48*ne)*ne,uCt=(44+576*ne)*ne*ne,fCt=V(4),dCt=V(4),hCt=V(4),pCt=V(4),mCt=V(4),yCt=V(4),gCt=V(4),xCt=V(4),bCt=V(8),_Ct=V(8),wCt=V(8),vCt=V(8),SCt=V(8),ICt=V(8),TCt=V(8),ACt=V(8),ECt=V(8),MCt=V(4),NCt=V(4),OCt=V(4),RCt=V(8),DCt=V(16),LCt=V(16),FCt=V(16),CCt=V(32),kCt=V(32),BCt=V(48),PCt=V(64),UCt=V(1152),$Ct=V(1152);var VCt=(16+224*ne)*ne,YCt=(5+72*ne)*ne,WCt=(71+1408*ne)*ne*ne,GCt=V(4),XCt=V(4),HCt=V(4),QCt=V(4),ZCt=V(4),KCt=V(4),JCt=V(4),tkt=V(4),ekt=V(4),rkt=V(4),nkt=V(24),ikt=V(24),okt=V(24),skt=V(24),akt=V(24),ckt=V(24),lkt=V(24),ukt=V(24),fkt=V(24),dkt=V(24),hkt=V(1152),pkt=V(1152),mkt=V(1152),ykt=V(1152),gkt=V(1152),xkt=V(2304),bkt=V(2304),_kt=V(3456),wkt=V(5760),vkt=V(8),Skt=V(8),Ikt=V(8),Tkt=V(16),Akt=V(24),Ekt=V(48),Mkt=V(48),Nkt=V(96),Okt=V(192),Rkt=V(384),Dkt=V(384),Lkt=V(384),Fkt=V(768);var Ckt=V(96),kkt=V(96),Bkt=V(96),Pkt=V(1152);var QP=Math.pow(2,-52),Rw=new Uint32Array(512),zd=class e{static from(t,r=Ott,n=Rtt){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=r(a),o[2*s+1]=n(a)}return new e(o)}constructor(t){let r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){let{coords:t,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let E=0;E<s;E++){let N=t[2*E],I=t[2*E+1];N<a&&(a=N),I<c&&(c=I),N>l&&(l=N),I>u&&(u=I),this._ids[E]=E}let f=(a+l)/2,d=(c+u)/2,h,p,m;for(let E=0,N=1/0;E<s;E++){let I=QM(f,d,t[2*E],t[2*E+1]);I<N&&(h=E,N=I)}let y=t[2*h],g=t[2*h+1];for(let E=0,N=1/0;E<s;E++){if(E===h)continue;let I=QM(y,g,t[2*E],t[2*E+1]);I<N&&I>0&&(p=E,N=I)}let x=t[2*p],b=t[2*p+1],_=1/0;for(let E=0;E<s;E++){if(E===h||E===p)continue;let N=Mtt(y,g,x,b,t[2*E],t[2*E+1]);N<_&&(m=E,_=N)}let v=t[2*m],w=t[2*m+1];if(_===1/0){for(let I=0;I<s;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];$d(this._ids,this._dists,0,s-1);let E=new Uint32Array(s),N=0;for(let I=0,R=-1/0;I<s;I++){let C=this._ids[I],S=this._dists[C];S>R&&(E[N++]=C,R=S)}this.hull=E.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Ud(y,g,x,b,v,w)<0){let E=p,N=x,I=b;p=m,x=v,b=w,m=E,v=N,w=I}let T=Ntt(y,g,x,b,v,w);this._cx=T.x,this._cy=T.y;for(let E=0;E<s;E++)this._dists[E]=QM(t[2*E],t[2*E+1],T.x,T.y);$d(this._ids,this._dists,0,s-1),this._hullStart=h;let A=3;n[h]=r[m]=p,n[p]=r[h]=m,n[m]=r[p]=h,i[h]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=h,o[this._hashKey(x,b)]=p,o[this._hashKey(v,w)]=m,this.trianglesLen=0,this._addTriangle(h,p,m,-1,-1,-1);for(let E=0,N,I;E<this._ids.length;E++){let R=this._ids[E],C=t[2*R],S=t[2*R+1];if(E>0&&Math.abs(C-N)<=QP&&Math.abs(S-I)<=QP||(N=C,I=S,R===h||R===p||R===m))continue;let M=0;for(let P=0,U=this._hashKey(C,S);P<this._hashSize&&(M=o[(U+P)%this._hashSize],!(M!==-1&&M!==n[M]));P++);M=r[M];let O=M,L;for(;L=n[O],Ud(C,S,t[2*O],t[2*O+1],t[2*L],t[2*L+1])>=0;)if(O=L,O===M){O=-1;break}if(O===-1)continue;let B=this._addTriangle(O,R,n[O],-1,-1,i[O]);i[R]=this._legalize(B+2),i[O]=B,A++;let k=n[O];for(;L=n[k],Ud(C,S,t[2*k],t[2*k+1],t[2*L],t[2*L+1])<0;)B=this._addTriangle(k,R,L,i[R],-1,i[k]),i[R]=this._legalize(B+2),n[k]=k,A--,k=L;if(O===M)for(;L=r[O],Ud(C,S,t[2*L],t[2*L+1],t[2*O],t[2*O+1])<0;)B=this._addTriangle(L,R,O,-1,i[O],i[L]),this._legalize(B+2),i[L]=B,n[O]=O,A--,O=L;this._hullStart=r[R]=O,n[O]=r[k]=R,n[R]=k,o[this._hashKey(C,S)]=R,o[this._hashKey(t[2*O],t[2*O+1])]=O}this.hull=new Uint32Array(A);for(let E=0,N=this._hullStart;E<A;E++)this.hull[E]=N,N=n[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Att(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:r,_halfedges:n,coords:i}=this,o=0,s=0;for(;;){let a=n[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=Rw[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=r[s],h=r[t],p=r[u],m=r[f];if(Ett(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){r[t]=m,r[a]=d;let g=n[f];if(g===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,g),this._link(a,n[s]),this._link(s,f);let x=l+(a+1)%3;o<Rw.length&&(Rw[o++]=x)}else{if(o===0)break;t=Rw[--o]}}return s}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,n,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=r,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function Att(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function QM(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function Ett(e,t,r,n,i,o,s,a){let c=e-s,l=t-a,u=r-s,f=n-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,y=d*d+h*h;return c*(f*y-m*h)-l*(u*y-m*d)+p*(u*h-f*d)<0}function Mtt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Ntt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function $d(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){let o=e[i],s=t[o],a=i-1;for(;a>=r&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=r+n>>1,o=r+1,s=n;Cy(e,i,o),t[e[r]]>t[e[n]]&&Cy(e,r,n),t[e[o]]>t[e[n]]&&Cy(e,o,n),t[e[r]]>t[e[o]]&&Cy(e,r,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Cy(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?($d(e,t,o,n),$d(e,t,r,s-1)):($d(e,t,r,s-1),$d(e,t,o,n))}}function Cy(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Ott(e){return e[0]}function Rtt(e){return e[1]}var qi=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,n){t=+t,r=+r,n=+n;let i=t+n,o=r;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),n&&(this._+=`A${n},${n},0,1,1,${t-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,r,n,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}};var Gc=class{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}};var ky=class{constructor(t,[r,n,i,o]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((o=+o)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=r,this.ymax=o,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:r,triangles:n},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let m=0,y=0,g=n.length,x,b;m<g;m+=3,y+=2){let _=n[m]*2,v=n[m+1]*2,w=n[m+2]*2,T=t[_],A=t[_+1],E=t[v],N=t[v+1],I=t[w],R=t[w+1],C=E-T,S=N-A,M=I-T,O=R-A,L=(C*O-S*M)*2;if(Math.abs(L)<1e-9){if(o===void 0){o=s=0;for(let k of r)o+=t[k*2],s+=t[k*2+1];o/=r.length,s/=r.length}let B=1e9*Math.sign((o-T)*O-(s-A)*M);x=(T+I)/2-B*O,b=(A+R)/2+B*M}else{let B=1/L,k=C*C+S*S,P=M*M+O*O;x=T+(O*k-S*P)*B,b=A+(C*P-M*k)*B}a[y]=x,a[y+1]=b}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<r.length;++m)c=r[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let r=t==null?t=new qi:void 0,{delaunay:{halfedges:n,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],y=s[h+1],g=s[p],x=s[p+1];this._renderSegment(m,y,g,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return r&&r.value()}renderBounds(t){let r=t==null?t=new qi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){let n=r==null?r=new qi:void 0,i=this._clip(t);if(i===null||!i.length)return;r.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&r.lineTo(i[s],i[s+1]);return r.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let r=0,n=t.length/2;r<n;++r){let i=this.cellPolygon(r);i&&(i.index=r,yield i)}}cellPolygon(t){let r=new Gc;return this.renderCell(t,r),r.value()}_renderSegment(t,r,n,i,o){let s,a=this._regioncode(t,r),c=this._regioncode(n,i);a===0&&c===0?(o.moveTo(t,r),o.lineTo(n,i)):(s=this._clipSegment(t,r,n,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,r,n){return r=+r,r!==r||(n=+n,n!==n)?!1:this.delaunay._step(t,r,n)===t}*neighbors(t){let r=this._clip(t);if(r)for(let n of this.delaunay.neighbors(t)){let i=this._clip(n);if(i){t:for(let o=0,s=r.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(r[o]===i[a]&&r[o+1]===i[a+1]&&r[(o+2)%s]===i[(a+c-2)%c]&&r[(o+3)%s]===i[(a+c-1)%c]){yield n;break t}}}}_cell(t){let{circumcenters:r,delaunay:{inedges:n,halfedges:i,triangles:o}}=this,s=n[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(r[l*2],r[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let r=this._cell(t);if(r===null)return null;let{vectors:n}=this,i=t*4;return this._simplify(n[i]||n[i+1]?this._clipInfinite(t,r,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(t,r))}_clipFinite(t,r){let n=r.length,i=null,o,s,a=r[n-2],c=r[n-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<n;h+=2)if(o=a,s=c,a=r[h],c=r[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,x,m,y]=p,f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}f=d,d=this._edgecode(g,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(g,x):i=[g,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,r,n,i,o,s){let a=o<s;for(a&&([t,r,n,i,o,s]=[n,i,t,r,s,o]);;){if(o===0&&s===0)return a?[n,i,t,r]:[t,r,n,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(n-t)*(this.ymax-r)/(i-r),l=this.ymax):u&4?(c=t+(n-t)*(this.ymin-r)/(i-r),l=this.ymin):u&2?(l=r+(i-r)*(this.xmax-t)/(n-t),c=this.xmax):(l=r+(i-r)*(this.xmin-t)/(n-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(n=c,i=l,s=this._regioncode(n,i))}}_clipInfinite(t,r,n,i,o,s){let a=Array.from(r),c;if((c=this._project(a[0],a[1],n,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,r,n,i,o){for(;r!==n;){let s,a;switch(r){case 5:r=4;continue;case 4:r=6,s=this.xmax,a=this.ymin;break;case 6:r=2;continue;case 2:r=10,s=this.xmax,a=this.ymax;break;case 10:r=8;continue;case 8:r=9,s=this.xmin,a=this.ymax;break;case 9:r=1;continue;case 1:r=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,r,n,i){let o=1/0,s,a,c;if(i<0){if(r<=this.ymin)return null;(s=(this.ymin-r)/i)<o&&(c=this.ymin,a=t+(o=s)*n)}else if(i>0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)<o&&(c=this.ymax,a=t+(o=s)*n)}if(n>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/n)<o&&(a=this.xmax,c=r+(o=s)*i)}else if(n<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/n)<o&&(a=this.xmin,c=r+(o=s)*i)}return[a,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){let n=(r+2)%t.length,i=(r+4)%t.length;(t[r]===t[n]&&t[n]===t[i]||t[r+1]===t[n+1]&&t[n+1]===t[i+1])&&(t.splice(n,2),r-=2)}t.length||(t=null)}return t}};var Dtt=2*Math.PI,jd=Math.pow;function Ltt(e){return e[0]}function Ftt(e){return e[1]}function Ctt(e){let{triangles:t,coords:r}=e;for(let n=0;n<t.length;n+=3){let i=2*t[n],o=2*t[n+1],s=2*t[n+2];if((r[s]-r[i])*(r[o+1]-r[i+1])-(r[o]-r[i])*(r[s+1]-r[i+1])>1e-10)return!1}return!0}function ktt(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var Vi=class e{static from(t,r=Ltt,n=Ftt,i){return new e("length"in t?Btt(t,r,n,i):Float64Array.from(Ptt(t,r,n,i)))}constructor(t){this._delaunator=new zd(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&Ctt(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){let p=ktt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new zd(r)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=n.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(n[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new ky(this,t)}*neighbors(t){let{inedges:r,hull:n,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=r[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=n[(i[t]+1)%n.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,n=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;let i=n,o;for(;(o=this._step(n,t,r))>=0&&o!==n&&o!==i;)n=o;return o}_step(t,r,n){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=jd(r-l[t*2],2)+jd(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=jd(r-l[p*2],2)+jd(n-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&jd(r-l[h*2],2)+jd(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new qi:void 0,{points:n,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(n[l],n[l+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;let n=t==null?t=new qi:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+r,c),t.arc(a,c,r,0,Dtt)}return n&&n.value()}renderHull(t){let r=t==null?t=new qi:void 0,{hull:n,points:i}=this,o=n[0]*2,s=n.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*n[a];t.lineTo(i[c],i[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){let t=new Gc;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new qi:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return r.moveTo(i[s],i[s+1]),r.lineTo(i[a],i[a+1]),r.lineTo(i[c],i[c+1]),r.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:t}=this;for(let r=0,n=t.length/3;r<n;++r)yield this.trianglePolygon(r)}trianglePolygon(t){let r=new Gc;return this.renderTriangle(t,r),r.value()}};function Btt(e,t,r,n){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(n,a,s,e),o[s*2+1]=r.call(n,a,s,e)}return o}function*Ptt(e,t,r,n){let i=0;for(let o of e)yield t.call(n,o,i,e),yield r.call(n,o,i,e),++i}function ZP(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Fu(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ls(e){return e=Fu(Math.abs(e)),e?e[1]:NaN}function KP(e,t){return function(r,n){for(var i=r.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>n&&(a=Math.max(1,n-c)),o.push(r.substring(i-=a,i+a)),!((c+=a+1)>n));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function JP(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Utt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function us(e){if(!(t=Utt.exec(e)))throw new Error("invalid format: "+e);var t;return new Dw({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}us.prototype=Dw.prototype;function Dw(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Dw.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function t9(e){t:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break t;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var ZM;function e9(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ZM=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Fu(e,Math.max(0,t+o-1))[0]}function KM(e,t){var r=Fu(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var JM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ZP,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>KM(e*100,t),r:KM,s:e9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function t3(e){return e}var r9=Array.prototype.map,n9=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function i9(e){var t=e.grouping===void 0||e.thousands===void 0?t3:KP(r9.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?t3:JP(r9.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=us(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,x=f.comma,b=f.precision,_=f.trim,v=f.type;v==="n"?(x=!0,v="g"):JM[v]||(b===void 0&&(b=12),_=!0,v="g"),(y||d==="0"&&h==="=")&&(y=!0,d="0",h="=");var w=m==="$"?r:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?n:/[%p]/.test(v)?s:"",A=JM[v],E=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function N(I){var R=w,C=T,S,M,O;if(v==="c")C=A(I)+C,I="";else{I=+I;var L=I<0||1/I<0;if(I=isNaN(I)?c:A(Math.abs(I),b),_&&(I=t9(I)),L&&+I==0&&p!=="+"&&(L=!1),R=(L?p==="("?p:a:p==="-"||p==="("?"":p)+R,C=(v==="s"?n9[8+ZM/3]:"")+C+(L&&p==="("?")":""),E){for(S=-1,M=I.length;++S<M;)if(O=I.charCodeAt(S),48>O||O>57){C=(O===46?i+I.slice(S+1):I.slice(S))+C,I=I.slice(0,S);break}}}x&&!y&&(I=t(I,1/0));var B=R.length+I.length+C.length,k=B<g?new Array(g-B+1).join(d):"";switch(x&&y&&(I=t(k+I,k.length?g-C.length:1/0),k=""),h){case"<":I=R+I+C+k;break;case"=":I=R+k+I+C;break;case"^":I=k.slice(0,B=k.length>>1)+R+I+C+k.slice(B);break;default:I=k+R+I+C;break}return o(I)}return N.toString=function(){return f+""},N}function u(f,d){var h=l((f=us(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ls(d)/3)))*3,m=Math.pow(10,-p),y=n9[8+p/3];return function(g){return h(m*g)+y}}return{format:l,formatPrefix:u}}var Lw,Yi,Fw;e3({thousands:",",grouping:[3],currency:["$",""]});function e3(e){return Lw=i9(e),Yi=Lw.format,Fw=Lw.formatPrefix,Lw}function r3(e){return Math.max(0,-ls(Math.abs(e)))}function n3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ls(t)/3)))*3-ls(Math.abs(e)))}function i3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ls(t)-ls(e))+1}var et=1e-6,Cu=1e-12,Ct=Math.PI,Te=Ct/2,o3=Ct/4,Rr=Ct*2,Ze=180/Ct,Yt=Ct/180,$t=Math.abs,Wi=Math.atan,ur=Math.atan2,J=Math.cos,By=Math.ceil,Cw=Math.exp;var kw=Math.hypot,ku=Math.log,Bw=Math.pow,Z=Math.sin,fn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ae=Math.sqrt,qd=Math.tan;function Pw(e){return e>1?0:e<-1?Ct:Math.acos(e)}function Ce(e){return e>1?Te:e<-1?-Te:Math.asin(e)}function fr(){}function Uw(e,t){e&&s9.hasOwnProperty(e.type)&&s9[e.type](e,t)}var o9={Feature:function(e,t){Uw(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)Uw(r[n].geometry,t)}},s9={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){s3(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)s3(r[n],t,0)},Polygon:function(e,t){a9(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)a9(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)Uw(r[n],t)}};function s3(e,t,r){var n=-1,i=e.length-r,o;for(t.lineStart();++n<i;)o=e[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function a9(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)s3(e[r],t,1);t.polygonEnd()}function pi(e,t){e&&o9.hasOwnProperty(e.type)?o9[e.type](e,t):Uw(e,t)}function Py(e){return[ur(e[1],e[0]),Ce(e[2])]}function fs(e){var t=e[0],r=e[1],n=J(r);return[n*J(t),n*Z(t),Z(r)]}function Uy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Vd(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function $w(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function $y(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function zy(e){var t=Ae(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var jy,zw,jw,qw,Vw,Yw,Ww,Gw,a3,c3,l3,u9,f9,Rn,Dn,Ln,No={sphere:fr,point:u3,lineStart:c9,lineEnd:l9,polygonStart:function(){No.lineStart=jtt,No.lineEnd=qtt},polygonEnd:function(){No.lineStart=c9,No.lineEnd=l9}};function u3(e,t){e*=Yt,t*=Yt;var r=J(t);qy(r*J(e),r*Z(e),Z(t))}function qy(e,t,r){++jy,jw+=(e-jw)/jy,qw+=(t-qw)/jy,Vw+=(r-Vw)/jy}function c9(){No.point=$tt}function $tt(e,t){e*=Yt,t*=Yt;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),No.point=ztt,qy(Rn,Dn,Ln)}function ztt(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=ur(Ae((s=Dn*o-Ln*i)*s+(s=Ln*n-Rn*o)*s+(s=Rn*i-Dn*n)*s),Rn*n+Dn*i+Ln*o);zw+=s,Yw+=s*(Rn+(Rn=n)),Ww+=s*(Dn+(Dn=i)),Gw+=s*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function l9(){No.point=u3}function jtt(){No.point=Vtt}function qtt(){d9(u9,f9),No.point=u3}function Vtt(e,t){u9=e,f9=t,e*=Yt,t*=Yt,No.point=d9;var r=J(t);Rn=r*J(e),Dn=r*Z(e),Ln=Z(t),qy(Rn,Dn,Ln)}function d9(e,t){e*=Yt,t*=Yt;var r=J(t),n=r*J(e),i=r*Z(e),o=Z(t),s=Dn*o-Ln*i,a=Ln*n-Rn*o,c=Rn*i-Dn*n,l=kw(s,a,c),u=Ce(l),f=l&&-u/l;a3.add(f*s),c3.add(f*a),l3.add(f*c),zw+=u,Yw+=u*(Rn+(Rn=n)),Ww+=u*(Dn+(Dn=i)),Gw+=u*(Ln+(Ln=o)),qy(Rn,Dn,Ln)}function f3(e){jy=zw=jw=qw=Vw=Yw=Ww=Gw=0,a3=new Xr,c3=new Xr,l3=new Xr,pi(e,No);var t=+a3,r=+c3,n=+l3,i=kw(t,r,n);return i<Cu&&(t=Yw,r=Ww,n=Gw,zw<et&&(t=jw,r=qw,n=Vw),i=kw(t,r,n),i<Cu)?[NaN,NaN]:[ur(r,t)*Ze,Ce(n/i)*Ze]}function Vy(e,t){function r(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(r.invert=function(n,i){return n=t.invert(n,i),n&&e.invert(n[0],n[1])}),r}function d3(e,t){return $t(e)>Ct&&(e-=Math.round(e/Rr)*Rr),[e,t]}d3.invert=d3;function h3(e,t,r){return(e%=Rr)?t||r?Vy(p9(e),m9(t,r)):p9(e):t||r?m9(t,r):d3}function h9(e){return function(t,r){return t+=e,$t(t)>Ct&&(t-=Math.round(t/Rr)*Rr),[t,r]}}function p9(e){var t=h9(e);return t.invert=h9(-e),t}function m9(e,t){var r=J(e),n=Z(e),i=J(t),o=Z(t);function s(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*r+u*n;return[ur(f*i-h*o,u*r-d*n),Ce(h*i+f*o)]}return s.invert=function(a,c){var l=J(c),u=J(a)*l,f=Z(a)*l,d=Z(c),h=d*i-f*o;return[ur(f*i+d*o,u*r+h*n),Ce(h*r-u*n)]},s}function y9(e){e=h3(e[0]*Yt,e[1]*Yt,e.length>2?e[2]*Yt:0);function t(r){return r=e(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r}return t.invert=function(r){return r=e.invert(r[0]*Yt,r[1]*Yt),r[0]*=Ze,r[1]*=Ze,r},t}function x9(e,t,r,n,i,o){if(r){var s=J(t),a=Z(t),c=n*r;i==null?(i=t+n*Rr,o=t-c/2):(i=g9(s,i),o=g9(s,o),(n>0?i<o:i>o)&&(i+=n*Rr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=Py([s,-a*J(u),-a*Z(u)]),e.point(l[0],l[1])}}function g9(e,t){t=fs(t),t[0]-=e,zy(t);var r=Pw(-t[1]);return((-t[2]<0?-r:r)+Rr-et)%Rr}function Xw(){var e=[],t;return{point:function(r,n,i){t.push([r,n,i])},lineStart:function(){e.push(t=[])},lineEnd:fr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Yd(e,t){return $t(e[0]-t[0])<et&&$t(e[1]-t[1])<et}function Hw(e,t,r,n){this.x=e,this.z=t,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function Qw(e,t,r,n,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],x;if(Yd(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*et}o.push(x=new Hw(y,p,null,!0)),s.push(x.o=new Hw(y,null,x,!1)),o.push(x=new Hw(g,p,null,!1)),s.push(x.o=new Hw(g,null,x,!0))}}),!!o.length){for(s.sort(t),b9(o),b9(s),a=0,c=s.length;a<c;++a)s[a].e=r=!r;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function b9(e){if(t=e.length){for(var t,r=0,n=e[0],i;++r<t;)n.n=i=e[r],i.p=n,n=i;n.n=i=e[0],i.p=n}}function p3(e){return $t(e[0])<=Ct?e[0]:fn(e[0])*(($t(e[0])+Ct)%Rr-Ct)}function _9(e,t){var r=p3(t),n=t[1],i=Z(n),o=[Z(r),-J(r),0],s=0,a=0,c=new Xr;i===1?n=Te+et:i===-1&&(n=-Te-et);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=p3(h),m=h[1]/2+o3,y=Z(m),g=J(m),x=0;x<d;++x,p=_,y=w,g=T,h=b){var b=f[x],_=p3(b),v=b[1]/2+o3,w=Z(v),T=J(v),A=_-p,E=A>=0?1:-1,N=E*A,I=N>Ct,R=y*w;if(c.add(ur(R*E*Z(N),g*T+R*J(N))),s+=I?A+E*Rr:A,I^p>=r^_>=r){var C=Vd(fs(h),fs(b));zy(C);var S=Vd(o,C);zy(S);var M=(I^A>=0?-1:1)*Ce(S[2]);(n>M||n===M&&(C[0]||C[1]))&&(a+=I^A>=0?1:-1)}}return(s<-et||s<et&&c<-Cu)^a&1}function Zw(e,t,r,n){return function(i){var o=t(i),s=Xw(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:y,polygonStart:function(){d.point=g,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=y,u=Ad(u);var _=_9(l,n);u.length?(c||(i.polygonStart(),c=!0),Qw(u,Wtt,_,r,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function m(){d.point=p,o.lineStart()}function y(){d.point=h,o.lineEnd()}function g(_,v){f.push([_,v]),a.point(_,v)}function x(){a.lineStart(),f=[]}function b(){g(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,A,E,N;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(E=v[0],(A=E.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<A;++w)i.point((N=E[w])[0],N[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(Ytt))}}return d}}function Ytt(e){return e.length>1}function Wtt(e,t){return((e=e.x)[0]<0?e[1]-Te-et:Te-e[1])-((t=t.x)[0]<0?t[1]-Te-et:Te-t[1])}var m3=Zw(function(){return!0},Gtt,Htt,[-Ct,-Te]);function Gtt(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Ct:-Ct,c=$t(o-t);$t(c-Ct)<et?(e.point(t,r=(r+s)/2>0?Te:-Te),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),i=0):n!==a&&c>=Ct&&($t(t-n)<et&&(t-=n*et),$t(o-a)<et&&(o-=a*et),r=Xtt(t,r,o,s),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),i=0),e.point(t=o,r=s),n=a},lineEnd:function(){e.lineEnd(),t=r=NaN},clean:function(){return 2-i}}}function Xtt(e,t,r,n){var i,o,s=Z(e-r);return $t(s)>et?Wi((Z(t)*(o=J(n))*Z(r)-Z(n)*(i=J(t))*Z(e))/(i*o*s)):(t+n)/2}function Htt(e,t,r,n){var i;if(e==null)i=r*Te,n.point(-Ct,i),n.point(0,i),n.point(Ct,i),n.point(Ct,0),n.point(Ct,-i),n.point(0,-i),n.point(-Ct,-i),n.point(-Ct,0),n.point(-Ct,i);else if($t(e[0]-t[0])>et){var o=e[0]<t[0]?Ct:-Ct;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function w9(e){var t=J(e),r=2*Yt,n=t>0,i=$t(t)>et;function o(u,f,d,h){x9(h,e,r,d,u,f)}function s(u,f){return J(u)*J(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(y,g){var x=[y,g],b,_=s(y,g),v=n?_?0:l(y,g):_?l(y+(y<0?Ct:-Ct),g):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(b=c(f,x),(!b||Yd(f,b)||Yd(x,b))&&(x[2]=1)),_!==h)m=0,_?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&n^_){var w;!(v&d)&&(w=c(x,f,!0))&&(m=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!Yd(f,x))&&u.point(x[0],x[1]),f=x,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=fs(u),p=fs(f),m=[1,0,0],y=Vd(h,p),g=Uy(y,y),x=y[0],b=g-x*x;if(!b)return!d&&u;var _=t*g/b,v=-t*x/b,w=Vd(m,y),T=$y(m,_),A=$y(y,v);$w(T,A);var E=w,N=Uy(T,E),I=Uy(E,E),R=N*N-I*(Uy(T,T)-1);if(!(R<0)){var C=Ae(R),S=$y(E,(-N-C)/I);if($w(S,T),S=Py(S),!d)return S;var M=u[0],O=f[0],L=u[1],B=f[1],k;O<M&&(k=M,M=O,O=k);var P=O-M,U=$t(P-Ct)<et,$=U||P<et;if(!U&&B<L&&(k=L,L=B,B=k),$?U?L+B>0^S[1]<($t(S[0]-M)<et?L:B):L<=S[1]&&S[1]<=B:P>Ct^(M<=S[0]&&S[0]<=O)){var X=$y(E,(-N+C)/I);return $w(X,T),[S,Py(X)]}}}function l(u,f){var d=n?e:Ct-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Zw(s,a,o,n?[0,-e]:[-Ct,e-Ct])}function v9(e,t,r,n,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=r-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=n-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Yy=1e9,Kw=-Yy;function Wd(e,t,r,n){function i(l,u){return e<=l&&l<=r&&t<=u&&u<=n}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:r,h>1?n:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return $t(l[0]-e)<et?u>0?0:3:$t(l[0]-r)<et?u>0?2:1:$t(l[1]-t)<et?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Xw(),d,h,p,m,y,g,x,b,_,v,w,T={point:A,lineStart:R,lineEnd:C,polygonStart:N,polygonEnd:I};function A(M,O){i(M,O)&&u.point(M,O)}function E(){for(var M=0,O=0,L=h.length;O<L;++O)for(var B=h[O],k=1,P=B.length,U=B[0],$,X,rt=U[0],ot=U[1];k<P;++k)$=rt,X=ot,U=B[k],rt=U[0],ot=U[1],X<=n?ot>n&&(rt-$)*(n-X)>(ot-X)*(e-$)&&++M:ot<=n&&(rt-$)*(n-X)<(ot-X)*(e-$)&&--M;return M}function N(){u=f,d=[],h=[],w=!0}function I(){var M=E(),O=w&&M,L=(d=Ad(d)).length;(O||L)&&(l.polygonStart(),O&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Qw(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function R(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,x=b=NaN}function C(){d&&(S(m,y),g&&_&&f.rejoin(),d.push(f.result())),T.point=A,_&&u.lineEnd()}function S(M,O){var L=i(M,O);if(h&&p.push([M,O]),v)m=M,y=O,g=L,v=!1,L&&(u.lineStart(),u.point(M,O));else if(L&&_)u.point(M,O);else{var B=[x=Math.max(Kw,Math.min(Yy,x)),b=Math.max(Kw,Math.min(Yy,b))],k=[M=Math.max(Kw,Math.min(Yy,M)),O=Math.max(Kw,Math.min(Yy,O))];v9(B,k,e,t,r,n)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(k[0],k[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(M,O),w=!1)}x=M,b=O,_=L}return T}}function S9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function I9(e,t,r){var n=er(e,t-et,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function y3(){var e,t,r,n,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:x()}}function x(){return er(By(n/u)*u,r,u).map(p).concat(er(By(a/f)*f,s,f).map(m)).concat(er(By(t/c)*c,e,c).filter(function(b){return $t(b%u)>et}).map(d)).concat(er(By(o/l)*l,i,l).filter(function(b){return $t(b%f)>et}).map(h))}return g.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},g.outline=function(){return{type:"Polygon",coordinates:[p(n).concat(m(s).slice(1),p(r).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(b){return arguments.length?g.extentMajor(b).extentMinor(b):g.extentMinor()},g.extentMajor=function(b){return arguments.length?(n=+b[0][0],r=+b[1][0],a=+b[0][1],s=+b[1][1],n>r&&(b=n,n=r,r=b),a>s&&(b=a,a=s,s=b),g.precision(y)):[[n,a],[r,s]]},g.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),g.precision(y)):[[t,o],[e,i]]},g.step=function(b){return arguments.length?g.stepMajor(b).stepMinor(b):g.stepMinor()},g.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],g):[u,f]},g.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],g):[c,l]},g.precision=function(b){return arguments.length?(y=+b,d=S9(o,i,90),h=I9(t,e,y),p=S9(a,s,90),m=I9(n,r,y),g):y},g.extentMajor([[-180,-90+et],[180,90-et]]).extentMinor([[-180,-80-et],[180,80+et]])}function g3(){return y3()()}var Wy=e=>e;var x3=new Xr,b3=new Xr,T9,A9,_3,w3,Xc={point:fr,lineStart:fr,lineEnd:fr,polygonStart:function(){Xc.lineStart=Qtt,Xc.lineEnd=Ktt},polygonEnd:function(){Xc.lineStart=Xc.lineEnd=Xc.point=fr,x3.add($t(b3)),b3=new Xr},result:function(){var e=x3/2;return x3=new Xr,e}};function Qtt(){Xc.point=Ztt}function Ztt(e,t){Xc.point=E9,T9=_3=e,A9=w3=t}function E9(e,t){b3.add(w3*e-_3*t),_3=e,w3=t}function Ktt(){E9(T9,A9)}var v3=Xc;var Gd=1/0,Jw=Gd,Gy=-Gd,tv=Gy,Jtt={point:tet,lineStart:fr,lineEnd:fr,polygonStart:fr,polygonEnd:fr,result:function(){var e=[[Gd,Jw],[Gy,tv]];return Gy=tv=-(Jw=Gd=1/0),e}};function tet(e,t){e<Gd&&(Gd=e),e>Gy&&(Gy=e),t<Jw&&(Jw=t),t>tv&&(tv=t)}var Xd=Jtt;var S3=0,I3=0,Xy=0,ev=0,rv=0,Hd=0,T3=0,A3=0,Hy=0,O9,R9,ds,hs,Oo={point:Bu,lineStart:M9,lineEnd:N9,polygonStart:function(){Oo.lineStart=net,Oo.lineEnd=iet},polygonEnd:function(){Oo.point=Bu,Oo.lineStart=M9,Oo.lineEnd=N9},result:function(){var e=Hy?[T3/Hy,A3/Hy]:Hd?[ev/Hd,rv/Hd]:Xy?[S3/Xy,I3/Xy]:[NaN,NaN];return S3=I3=Xy=ev=rv=Hd=T3=A3=Hy=0,e}};function Bu(e,t){S3+=e,I3+=t,++Xy}function M9(){Oo.point=eet}function eet(e,t){Oo.point=ret,Bu(ds=e,hs=t)}function ret(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);ev+=i*(ds+e)/2,rv+=i*(hs+t)/2,Hd+=i,Bu(ds=e,hs=t)}function N9(){Oo.point=Bu}function net(){Oo.point=oet}function iet(){D9(O9,R9)}function oet(e,t){Oo.point=D9,Bu(O9=ds=e,R9=hs=t)}function D9(e,t){var r=e-ds,n=t-hs,i=Ae(r*r+n*n);ev+=i*(ds+e)/2,rv+=i*(hs+t)/2,Hd+=i,i=hs*e-ds*t,T3+=i*(ds+e),A3+=i*(hs+t),Hy+=i*3,Bu(ds=e,hs=t)}var E3=Oo;function nv(e){this._context=e}nv.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Rr);break}}},result:fr};var N3=new Xr,M3,L9,F9,Qy,Zy,iv={point:fr,lineStart:function(){iv.point=set},lineEnd:function(){M3&&C9(L9,F9),iv.point=fr},polygonStart:function(){M3=!0},polygonEnd:function(){M3=null},result:function(){var e=+N3;return N3=new Xr,e}};function set(e,t){iv.point=C9,L9=Qy=e,F9=Zy=t}function C9(e,t){Qy-=e,Zy-=t,N3.add(Ae(Qy*Qy+Zy*Zy)),Qy=e,Zy=t}var O3=iv;var k9,ov,B9,P9,Qd=class{constructor(t){this._append=t==null?U9:aet(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==B9||this._append!==ov){let n=this._radius,i=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,B9=n,ov=this._append,P9=this._,this._=i}this._+=P9;break}}}result(){let t=this._;return this._="",t.length?t:null}};function U9(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function aet(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return U9;if(t!==k9){let r=10**t;k9=t,ov=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return ov}function Dr(e,t){let r=3,n=4.5,i,o;function s(a){return a&&(typeof n=="function"&&o.pointRadius(+n.apply(this,arguments)),pi(a,i(o))),o.result()}return s.area=function(a){return pi(a,i(v3)),v3.result()},s.measure=function(a){return pi(a,i(O3)),O3.result()},s.bounds=function(a){return pi(a,i(Xd)),Xd.result()},s.centroid=function(a){return pi(a,i(E3)),E3.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Wy):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Qd(r)):new nv(t=a),typeof n!="function"&&o.pointRadius(n),s):t},s.pointRadius=function(a){return arguments.length?(n=typeof a=="function"?a:(o.pointRadius(+a),+a),s):n},s.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);r=c}return t===null&&(o=new Qd(r)),s},s.projection(e).digits(r).context(t)}function Pu(e){return{stream:Zd(e)}}function Zd(e){return function(t){var r=new R3;for(var n in e)r[n]=e[n];return r.stream=t,r}}function R3(){}R3.prototype={constructor:R3,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function D3(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),pi(r,e.stream(Xd)),t(Xd.result()),n!=null&&e.clipExtent(n),e}function Ky(e,t,r){return D3(e,function(n){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(o-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,c])},r)}function sv(e,t,r){return Ky(e,[[0,0],t],r)}function av(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][0]-n[0][0]),s=(i-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];e.scale(150*o).translate([s,a])},r)}function cv(e,t,r){return D3(e,function(n){var i=+t,o=i/(n[1][1]-n[0][1]),s=-o*n[0][0],a=(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])},r)}var $9=16,cet=J(30*Yt);function L3(e,t){return+t?fet(e,t):uet(e)}function uet(e){return Zd({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function fet(e,t){function r(n,i,o,s,a,c,l,u,f,d,h,p,m,y){var g=l-n,x=u-i,b=g*g+x*x;if(b>4*t&&m--){var _=s+d,v=a+h,w=c+p,T=Ae(_*_+v*v+w*w),A=Ce(w/=T),E=$t($t(w)-1)<et||$t(o-f)<et?(o+f)/2:ur(v,_),N=e(E,A),I=N[0],R=N[1],C=I-n,S=R-i,M=x*C-g*S;(M*M/b>t||$t((g*C+x*S)/b-.5)>.3||s*d+a*h+c*p<cet)&&(r(n,i,o,s,a,c,I,R,E,_/=T,v/=T,w,m,y),y.point(I,R),r(I,R,E,_,v,w,l,u,f,d,h,p,m,y))}}return function(n){var i,o,s,a,c,l,u,f,d,h,p,m,y={point:g,lineStart:x,lineEnd:_,polygonStart:function(){n.polygonStart(),y.lineStart=v},polygonEnd:function(){n.polygonEnd(),y.lineStart=x}};function g(A,E){A=e(A,E),n.point(A[0],A[1])}function x(){f=NaN,y.point=b,n.lineStart()}function b(A,E){var N=fs([A,E]),I=e(A,E);r(f,d,u,h,p,m,f=I[0],d=I[1],u=A,h=N[0],p=N[1],m=N[2],$9,n),n.point(f,d)}function _(){y.point=g,n.lineEnd()}function v(){x(),y.point=w,y.lineEnd=T}function w(A,E){b(i=A,E),o=f,s=d,a=h,c=p,l=m,y.point=b}function T(){r(f,d,u,h,p,m,o,s,i,a,c,l,$9,n),y.lineEnd=_,_()}return y}}var det=Zd({point:function(e,t){this.stream.point(e*Yt,t*Yt)}});function het(e){return Zd({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function pet(e,t,r,n,i){function o(s,a){return s*=n,a*=i,[t+e*s,r-e*a]}return o.invert=function(s,a){return[(s-t)/e*n,(r-a)/e*i]},o}function z9(e,t,r,n,i,o){if(!o)return pet(e,t,r,n,i);var s=J(o),a=Z(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*r-s*t)/e,h=(a*t+s*r)/e;function p(m,y){return m*=n,y*=i,[c*m-l*y+t,r-l*m-c*y]}return p.invert=function(m,y){return[n*(u*m-f*y+d),i*(h-f*m-u*y)]},p}function Jr(e){return F3(function(){return e})()}function F3(e){var t,r=150,n=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=m3,y=null,g,x,b,_=Wy,v=.5,w,T,A,E,N;function I(M){return A(M[0]*Yt,M[1]*Yt)}function R(M){return M=A.invert(M[0],M[1]),M&&[M[0]*Ze,M[1]*Ze]}I.stream=function(M){return E&&N===M?E:E=det(het(u)(m(w(_(N=M)))))},I.preclip=function(M){return arguments.length?(m=M,p=void 0,S()):m},I.postclip=function(M){return arguments.length?(_=M,y=g=x=b=null,S()):_},I.clipAngle=function(M){return arguments.length?(m=+M?w9(p=M*Yt):(p=null,m3),S()):p*Ze},I.clipExtent=function(M){return arguments.length?(_=M==null?(y=g=x=b=null,Wy):Wd(y=+M[0][0],g=+M[0][1],x=+M[1][0],b=+M[1][1]),S()):y==null?null:[[y,g],[x,b]]},I.scale=function(M){return arguments.length?(r=+M,C()):r},I.translate=function(M){return arguments.length?(n=+M[0],i=+M[1],C()):[n,i]},I.center=function(M){return arguments.length?(o=M[0]%360*Yt,s=M[1]%360*Yt,C()):[o*Ze,s*Ze]},I.rotate=function(M){return arguments.length?(a=M[0]%360*Yt,c=M[1]%360*Yt,l=M.length>2?M[2]%360*Yt:0,C()):[a*Ze,c*Ze,l*Ze]},I.angle=function(M){return arguments.length?(f=M%360*Yt,C()):f*Ze},I.reflectX=function(M){return arguments.length?(d=M?-1:1,C()):d<0},I.reflectY=function(M){return arguments.length?(h=M?-1:1,C()):h<0},I.precision=function(M){return arguments.length?(w=L3(T,v=M*M),S()):Ae(v)},I.fitExtent=function(M,O){return Ky(I,M,O)},I.fitSize=function(M,O){return sv(I,M,O)},I.fitWidth=function(M,O){return av(I,M,O)},I.fitHeight=function(M,O){return cv(I,M,O)};function C(){var M=z9(r,0,0,d,h,f).apply(null,t(o,s)),O=z9(r,n-M[0],i-M[1],d,h,f);return u=h3(a,c,l),T=Vy(t,O),A=Vy(u,T),w=L3(T,v),S()}function S(){return E=N=null,I}return function(){return t=e.apply(this,arguments),I.invert=t.invert&&R,C()}}function Kd(e){var t=0,r=Ct/3,n=F3(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*Yt,r=o[1]*Yt):[t*Ze,r*Ze]},i}function j9(e){var t=J(e);function r(n,i){return[n*t,Z(i)/t]}return r.invert=function(n,i){return[n/t,Ce(i*t)]},r}function q9(e,t){var r=Z(e),n=(r+Z(t))/2;if($t(n)<et)return j9(e);var i=1+r*(2*n-r),o=Ae(i)/n;function s(a,c){var l=Ae(i-2*n*Z(c))/n;return[l*Z(a*=n),o-l*J(a)]}return s.invert=function(a,c){var l=o-c,u=ur(a,$t(l))*fn(l);return l*n<0&&(u-=Ct*fn(a)*fn(l)),[u/n,Ce((i-(a*a+l*l)*n*n)/(2*n))]},s}function Hc(){return Kd(q9).scale(155.424).center([0,33.6442])}function Jy(){return Hc().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function met(e){var t=e.length;return{point:function(r,n){for(var i=-1;++i<t;)e[i].point(r,n)},sphere:function(){for(var r=-1;++r<t;)e[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)e[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)e[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)e[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)e[r].polygonEnd()}}}function C3(){var e,t,r=Jy(),n,i=Hc().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Hc().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,n.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=r.scale(),p=r.translate(),m=(d[0]-p[0])/h,y=(d[1]-p[1])/h;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:r).invert(d)},u.stream=function(d){return e&&t===d?e:e=met([r.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(r.precision(d),i.precision(d),s.precision(d),f()):r.precision()},u.scale=function(d){return arguments.length?(r.scale(d),i.scale(d*.35),s.scale(d),u.translate(r.translate())):r.scale()},u.translate=function(d){if(!arguments.length)return r.translate();var h=r.scale(),p=+d[0],m=+d[1];return n=r.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+et,m+.12*h+et],[p-.214*h-et,m+.234*h-et]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+et,m+.166*h+et],[p-.115*h-et,m+.234*h-et]]).stream(l),f()},u.fitExtent=function(d,h){return Ky(u,d,h)},u.fitSize=function(d,h){return sv(u,d,h)},u.fitWidth=function(d,h){return av(u,d,h)},u.fitHeight=function(d,h){return cv(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function lv(e){return function(t,r){var n=J(t),i=J(r),o=e(n*i);return o===1/0?[2,0]:[o*i*Z(t),o*Z(r)]}}function ps(e){return function(t,r){var n=Ae(t*t+r*r),i=e(n),o=Z(i),s=J(i);return[ur(t*o,n*s),Ce(n&&r*o/n)]}}var k3=lv(function(e){return Ae(2/(1+e))});k3.invert=ps(function(e){return 2*Ce(e/2)});function B3(){return Jr(k3).scale(124.75).clipAngle(180-.001)}var P3=lv(function(e){return(e=Pw(e))&&e/Z(e)});P3.invert=ps(function(e){return e});function U3(){return Jr(P3).scale(79.4188).clipAngle(180-.001)}function Jd(e,t){return[e,ku(qd((Te+t)/2))]}Jd.invert=function(e,t){return[e,2*Wi(Cw(t))-Te]};function $3(){return z3(Jd).scale(961/Rr)}function z3(e){var t=Jr(e),r=t.center,n=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(n(f),u()):n()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(r(f),u()):r()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Ct*n(),d=t(y9(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Jd?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function uv(e){return qd((Te+e)/2)}function V9(e,t){var r=J(e),n=e===t?Z(e):ku(r/J(t))/ku(uv(t)/uv(e)),i=r*Bw(uv(e),n)/n;if(!n)return Jd;function o(s,a){i>0?a<-Te+et&&(a=-Te+et):a>Te-et&&(a=Te-et);var c=i/Bw(uv(a),n);return[c*Z(n*s),i-c*J(n*s)]}return o.invert=function(s,a){var c=i-a,l=fn(n)*Ae(s*s+c*c),u=ur(s,$t(c))*fn(c);return c*n<0&&(u-=Ct*fn(s)*fn(c)),[u/n,2*Wi(Bw(i/l,1/n))-Te]},o}function j3(){return Kd(V9).scale(109.5).parallels([30,30])}function th(e,t){return[e,t]}th.invert=th;function q3(){return Jr(th).scale(152.63)}function Y9(e,t){var r=J(e),n=e===t?Z(e):(r-J(t))/(t-e),i=r/n+e;if($t(n)<et)return th;function o(s,a){var c=i-a,l=n*s;return[c*Z(l),i-c*J(l)]}return o.invert=function(s,a){var c=i-a,l=ur(s,$t(c))*fn(c);return c*n<0&&(l-=Ct*fn(s)*fn(c)),[l/n,i-fn(n)*Ae(s*s+c*c)]},o}function V3(){return Kd(Y9).scale(131.154).center([0,13.9389])}var tg=1.340264,eg=-.081106,rg=893e-6,ng=.003796,fv=Ae(3)/2,yet=12;function Y3(e,t){var r=Ce(fv*Z(t)),n=r*r,i=n*n*n;return[e*J(r)/(fv*(tg+3*eg*n+i*(7*rg+9*ng*n))),r*(tg+eg*n+i*(rg+ng*n))]}Y3.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<yet&&(a=r*(tg+eg*n+i*(rg+ng*n))-t,c=tg+3*eg*n+i*(7*rg+9*ng*n),r-=s=a/c,n=r*r,i=n*n*n,!($t(s)<Cu));++o);return[fv*e*(tg+3*eg*n+i*(7*rg+9*ng*n))/J(r),Ce(Z(r)/fv)]};function W3(){return Jr(Y3).scale(177.158)}function G3(e,t){var r=J(t),n=J(e)*r;return[r*Z(e)/n,Z(t)/n]}G3.invert=ps(Wi);function X3(){return Jr(G3).scale(144.049).clipAngle(60)}function H3(e,t){return[J(t)*Z(e),Z(t)]}H3.invert=ps(Ce);function Q3(){return Jr(H3).scale(249.5).clipAngle(90+et)}function Z3(e,t){var r=J(t),n=1+J(e)*r;return[r*Z(e)/n,Z(t)/n]}Z3.invert=ps(function(e){return 2*Wi(e)});function K3(){return Jr(Z3).scale(250).clipAngle(142)}function J3(e,t){return[ku(qd((Te+t)/2)),-e]}J3.invert=function(e,t){return[-t,2*Wi(Cw(e))-Te]};function t6(){var e=z3(J3),t=e.center,r=e.rotate;return e.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},e.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function get(e,t){return e.parent===t.parent?1:2}function xet(e){return e.reduce(bet,0)/e.length}function bet(e,t){return e+t.x}function _et(e){return 1+e.reduce(wet,0)}function wet(e,t){return Math.max(e,t.y)}function vet(e){for(var t;t=e.children;)e=t[0];return e}function Iet(e){for(var t;t=e.children;)e=t[t.length-1];return e}function dv(){var e=get,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=xet(h),d.y=_et(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=vet(o),l=Iet(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(n?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*r}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*r})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(n=!1,t=+o[0],r=+o[1],i):n?null:[t,r]},i.nodeSize=function(o){return arguments.length?(n=!0,t=+o[0],r=+o[1],i):n?[t,r]:null},i}function Tet(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function W9(){return this.eachAfter(Tet)}function G9(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function X9(e,t){for(var r=this,n=[r],i,o,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function H9(e,t){for(var r=this,n=[r],i=[],o,s,a,c=-1;r=n.pop();)if(i.push(r),o=r.children)for(s=0,a=o.length;s<a;++s)n.push(o[s]);for(;r=i.pop();)e.call(t,r,++c,this);return this}function Q9(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function Z9(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}function K9(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function J9(e){for(var t=this,r=Aet(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function Aet(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}function tU(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function eU(){return Array.from(this)}function rU(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function nU(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*iU(){var e=this,t,r=[e],n,i,o;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,o=n.length;i<o;++i)r.push(n[i]);while(r.length)}function e6(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Net)):t===void 0&&(t=Met);for(var r=new Qc(e),n,i=[r],o,s,a,c;n=i.pop();)if((s=t(n.data))&&(c=(s=Array.from(s)).length))for(n.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Qc(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(r6)}function Eet(){return e6(this).eachBefore(Oet)}function Met(e){return e.children}function Net(e){return Array.isArray(e)?e[1]:null}function Oet(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function r6(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Qc(e){this.data=e,this.depth=this.height=0,this.parent=null}Qc.prototype=e6.prototype={constructor:Qc,count:W9,each:G9,eachAfter:H9,eachBefore:X9,find:Q9,sum:Z9,sort:K9,path:J9,ancestors:tU,descendants:eU,leaves:rU,links:nU,copy:Eet,[Symbol.iterator]:iU};function hv(e){return e==null?null:Ret(e)}function Ret(e){if(typeof e!="function")throw new Error;return e}var Det={depth:-1},oU={},n6={};function Let(e){return e.id}function Fet(e){return e.parentId}function pv(){var e=Let,t=Fet,r;function n(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,y=new Map;if(r!=null){let g=o.map((_,v)=>Cet(r(_,v,i))),x=g.map(sU),b=new Set(g).add("");for(let _ of x)b.has(_)||(b.add(_),g.push(_),x.push(sU(_)),o.push(n6));s=(_,v)=>g[v],a=(_,v)=>x[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Qc(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,y.set(m,y.has(m)?oU:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=y.get(p),!d)throw new Error("missing: "+p);if(d===oU)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(r!=null){for(;f.data===n6&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(h=o[g],h.data===n6);--g)h.data=null}if(f.parent=Det,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(r6),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=hv(i),n):e},n.parentId=function(i){return arguments.length?(t=hv(i),n):t},n.path=function(i){return arguments.length?(r=hv(i),n):r},n}function Cet(e){e=`${e}`;let t=e.length;return i6(e,t-1)&&!i6(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function sU(e){let t=e.length;if(t<2)return"";for(;--t>1&&!i6(e,t););return e.slice(0,t)}function i6(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function ket(e,t){return e.parent===t.parent?1:2}function o6(e){var t=e.children;return t?t[0]:e.t}function s6(e){var t=e.children;return t?t[t.length-1]:e.t}function Bet(e,t,r){var n=r/(t.i-e.i);t.c-=n,t.s+=r,e.c+=n,t.z+=r,t.m+=r}function Pet(e){for(var t=0,r=0,n=e.children,i=n.length,o;--i>=0;)o=n[i],o.z+=t,o.m+=t,t+=o.s+(r+=o.c)}function Uet(e,t,r){return e.a.parent===t.parent?e.a:r}function mv(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}mv.prototype=Object.create(Qc.prototype);function $et(e){for(var t=new mv(e,0),r,n=[t],i,o,s,a;r=n.pop();)if(o=r._.children)for(r.children=new Array(a=o.length),s=a-1;s>=0;--s)n.push(i=r.children[s]=new mv(o[s],s)),i.parent=r;return(t.parent=new mv(null,0)).children=[t],t}function Uu(){var e=ket,t=1,r=1,n=null;function i(l){var u=$et(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),n)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,y=t/(d.x+p+m),g=r/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*y,x.y=x.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){Pet(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],y=d.m,g=h.m,x=p.m,b=m.m,_;p=s6(p),d=o6(d),p&&d;)m=o6(m),h=s6(h),h.a=l,_=p.z+x-d.z-y+e(p._,d._),_>0&&(Bet(Uet(p,l,f),l,_),y+=_,g+=_),x+=p.m,y+=d.m,b+=m.m,g+=h.m;p&&!s6(h)&&(h.t=p,h.m+=x-g),d&&!o6(m)&&(m.t=d,m.m+=y-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*r}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(n=!1,t=+l[0],r=+l[1],i):n?null:[t,r]},i.nodeSize=function(l){return arguments.length?(n=!0,t=+l[0],r=+l[1],i):n?[t,r]:null},i}var aU=23283064365386963e-26;function $u(e=Math.random()){let t=(0<=e&&e<1?e/aU:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,aU*(t>>>0))}function dr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function ig(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var og=Symbol("implicit");function zu(){var e=new Sn,t=[],r=[],n=og;function i(o){let s=e.get(o);if(s===void 0){if(n!==og)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Sn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return zu(t,r).unknown(n)},dr.apply(i,arguments),i}function Zc(){var e=zu().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<n,p=h?i:n,m=h?n:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=er(d).map(function(g){return p+o*g});return r(h?y.reverse():y)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,f()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Zc(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},dr.apply(f(),arguments)}function cU(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return cU(t())},e}function a6(){return cU(Zc.apply(null,arguments).paddingInner(1))}function c6(e){return function(){return e}}function eh(e){return+e}var lU=[0,1];function Hn(e){return e}function l6(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:c6(isNaN(t)?NaN:.5)}function zet(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function jet(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=l6(i,n),o=r(s,o)):(n=l6(n,i),o=r(o,s)),function(a){return o(n(a))}}function qet(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=l6(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Ia(e,a,1,n)-1;return o[c](i[c](a))}}function ms(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ju(){var e=lU,t=lU,r=hi,n,i,o,s=Hn,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Hn&&(s=zet(e[0],e[d-1])),a=d>2?qet:jet,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(n),Fe)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,eh),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=Nu,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Hn,u()):s!==Hn},f.interpolate=function(d){return arguments.length?(r=d,u()):r},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return n=d,i=h,u()}}function sg(){return ju()(Hn,Hn)}function u6(e,t,r,n){var i=Id(e,t,r),o;switch(n=us(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=n3(i,s))&&(n.precision=o),Fw(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=i3(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=r3(i))&&(n.precision=o-(n.type==="%")*2);break}}return Yi(n)}function ka(e){var t=e.domain;return e.ticks=function(r){var n=t();return Qr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return u6(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],a=n[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Aa(s,a,r),l===c)return n[i]=s,n[o]=a,t(n);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Ba(){var e=sg();return e.copy=function(){return ms(e,Ba())},dr.apply(e,arguments),ka(e)}function ag(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,eh),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return ag(e).unknown(t)},e=arguments.length?Array.from(e,eh):[0,1],ka(r)}function cg(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return o<i&&(s=r,r=n,n=s,s=i,i=o,o=s),e[r]=t.floor(i),e[n]=t.ceil(o),e}function uU(e){return Math.log(e)}function fU(e){return Math.exp(e)}function Vet(e){return-Math.log(-e)}function Yet(e){return-Math.exp(-e)}function Wet(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Get(e){return e===10?Wet:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Xet(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function dU(e){return(t,r)=>-e(-t,r)}function f6(e){let t=e(uU,fU),r=t.domain,n=10,i,o;function s(){return i=Xet(n),o=Get(n),r()[0]<0?(i=dU(i),o=dU(o),e(Vet,Yet)):e(uU,fU),t}return t.base=function(a){return arguments.length?(n=+a,s()):n},t.domain=function(a){return arguments.length?(r(a),s()):r()},t.ticks=a=>{let c=r(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,y=a==null?10:+a,g=[];if(!(n%1)&&h-d<y){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<n;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}}else for(;d<=h;++d)for(p=n-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Qr(l,u,y))}else g=Qr(d,h,Math.min(h-d,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=us(c)).precision==null&&(c.trim=!0),c=Yi(c)),a===1/0)return c;let l=Math.max(1,n*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*n<n-.5&&(f*=n),f<=l?c(u):""}},t.nice=()=>r(cg(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function lg(){let e=f6(ju()).domain([1,10]);return e.copy=()=>ms(e,lg()).base(e.base()),dr.apply(e,arguments),e}function hU(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function pU(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function d6(e){var t=1,r=e(hU(t),pU(t));return r.constant=function(n){return arguments.length?e(hU(t=+n),pU(t)):t},ka(r)}function ug(){var e=d6(ju());return e.copy=function(){return ms(e,ug()).constant(e.constant())},dr.apply(e,arguments)}function mU(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Het(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Qet(e){return e<0?-e*e:e*e}function h6(e){var t=e(Hn,Hn),r=1;function n(){return r===1?e(Hn,Hn):r===.5?e(Het,Qet):e(mU(r),mU(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},ka(t)}function fg(){var e=h6(ju());return e.copy=function(){return ms(e,fg()).exponent(e.exponent())},dr.apply(e,arguments),e}function dg(){var e=[],t=[],r=[],n;function i(){var s=0,a=Math.max(1,t.length);for(r=new Array(a-1);++s<a;)r[s-1]=dM(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Ia(r,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?r[a-1]:e[0],a<r.length?r[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ft),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return dg().domain(e).range(t).unknown(n)},dr.apply(o,arguments)}function hg(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Ia(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return hg().domain(e).range(t).unknown(r)},dr.apply(i,arguments)}var p6=new Date,m6=new Date;function Me(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>Me(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(p6.setTime(+o),m6.setTime(+s),e(p6),e(m6),Math.floor(r(p6,m6))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var pg=Me(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);pg.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Me(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):pg);var XUt=pg.range;var Lr=Me(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),yU=Lr.range;var Pa=Me(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),Zet=Pa.range,Ua=Me(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),Ket=Ua.range;var $a=Me(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),Jet=$a.range,za=Me(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),trt=za.range;var Gi=Me(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),ert=Gi.range,Yu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),rrt=Yu.range,Wu=Me(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),nrt=Wu.range;function Gu(e){return Me(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var mi=Gu(0),Kc=Gu(1),yv=Gu(2),gv=Gu(3),gs=Gu(4),xv=Gu(5),bv=Gu(6),xU=mi.range,irt=Kc.range,ort=yv.range,srt=gv.range,art=gs.range,crt=xv.range,lrt=bv.range;function Xu(e){return Me(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var yi=Xu(0),Jc=Xu(1),_v=Xu(2),wv=Xu(3),xs=Xu(4),vv=Xu(5),Sv=Xu(6),bU=yi.range,urt=Jc.range,frt=_v.range,drt=wv.range,hrt=xs.range,prt=vv.range,mrt=Sv.range;var ja=Me(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),yrt=ja.range,qa=Me(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),grt=qa.range;var dn=Me(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());dn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var xrt=dn.range,hn=Me(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());hn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Me(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var brt=hn.range;function wU(e,t,r,n,i,o){let s=[[Lr,1,1e3],[Lr,5,5*1e3],[Lr,15,15*1e3],[Lr,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=To(([,,y])=>y).right(s,d);if(h===s.length)return e.every(Id(l/31536e6,u/31536e6,f));if(h===0)return pg.every(Math.max(Id(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[y6,yg]=wU(hn,qa,yi,Wu,za,Ua),[g6,x6]=wU(dn,ja,mi,Gi,$a,Pa);function b6(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function _6(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function gg(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function w6(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=xg(i),u=bg(i),f=xg(o),d=bg(o),h=xg(s),p=bg(s),m=xg(a),y=bg(a),g=xg(c),x=bg(c),b={a:L,A:B,b:k,B:P,c:null,d:EU,e:EU,f:qrt,g:Jrt,G:ent,H:$rt,I:zrt,j:jrt,L:DU,m:Vrt,M:Yrt,p:U,q:$,Q:OU,s:RU,S:Wrt,u:Grt,U:Xrt,V:Hrt,w:Qrt,W:Zrt,x:null,X:null,y:Krt,Y:tnt,Z:rnt,"%":NU},_={a:X,A:rt,b:ot,B:at,c:null,d:MU,e:MU,f:snt,g:ynt,G:xnt,H:nnt,I:int,j:ont,L:FU,m:ant,M:cnt,p:Y,q:st,Q:OU,s:RU,S:lnt,u:unt,U:fnt,V:dnt,w:hnt,W:pnt,x:null,X:null,y:mnt,Y:gnt,Z:bnt,"%":NU},v={a:N,A:I,b:R,B:C,c:S,d:TU,e:TU,f:krt,g:IU,G:SU,H:AU,I:AU,j:Drt,L:Crt,m:Rrt,M:Lrt,p:E,q:Ort,Q:Prt,s:Urt,S:Frt,u:Trt,U:Art,V:Ert,w:Irt,W:Mrt,x:M,X:O,y:IU,Y:SU,Z:Nrt,"%":Brt};b.x=w(r,b),b.X=w(n,b),b.c=w(t,b),_.x=w(r,_),_.X=w(n,_),_.c=w(t,_);function w(q,H){return function(nt){var z=[],Pt=-1,ht=0,Zt=q.length,Jt,tt,ge;for(nt instanceof Date||(nt=new Date(+nt));++Pt<Zt;)q.charCodeAt(Pt)===37&&(z.push(q.slice(ht,Pt)),(tt=vU[Jt=q.charAt(++Pt)])!=null?Jt=q.charAt(++Pt):tt=Jt==="e"?" ":"0",(ge=H[Jt])&&(Jt=ge(nt,tt)),z.push(Jt),ht=Pt+1);return z.push(q.slice(ht,Pt)),z.join("")}}function T(q,H){return function(nt){var z=gg(1900,void 0,1),Pt=A(z,q,nt+="",0),ht,Zt;if(Pt!=nt.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(ht=_6(gg(z.y,0,1)),Zt=ht.getUTCDay(),ht=Zt>4||Zt===0?Jc.ceil(ht):Jc(ht),ht=Yu.offset(ht,(z.V-1)*7),z.y=ht.getUTCFullYear(),z.m=ht.getUTCMonth(),z.d=ht.getUTCDate()+(z.w+6)%7):(ht=b6(gg(z.y,0,1)),Zt=ht.getDay(),ht=Zt>4||Zt===0?Kc.ceil(ht):Kc(ht),ht=Gi.offset(ht,(z.V-1)*7),z.y=ht.getFullYear(),z.m=ht.getMonth(),z.d=ht.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Zt="Z"in z?_6(gg(z.y,0,1)).getUTCDay():b6(gg(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Zt+5)%7:z.w+z.U*7-(Zt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,_6(z)):b6(z)}}function A(q,H,nt,z){for(var Pt=0,ht=H.length,Zt=nt.length,Jt,tt;Pt<ht;){if(z>=Zt)return-1;if(Jt=H.charCodeAt(Pt++),Jt===37){if(Jt=H.charAt(Pt++),tt=v[Jt in vU?H.charAt(Pt++):Jt],!tt||(z=tt(q,nt,z))<0)return-1}else if(Jt!=nt.charCodeAt(z++))return-1}return z}function E(q,H,nt){var z=l.exec(H.slice(nt));return z?(q.p=u.get(z[0].toLowerCase()),nt+z[0].length):-1}function N(q,H,nt){var z=h.exec(H.slice(nt));return z?(q.w=p.get(z[0].toLowerCase()),nt+z[0].length):-1}function I(q,H,nt){var z=f.exec(H.slice(nt));return z?(q.w=d.get(z[0].toLowerCase()),nt+z[0].length):-1}function R(q,H,nt){var z=g.exec(H.slice(nt));return z?(q.m=x.get(z[0].toLowerCase()),nt+z[0].length):-1}function C(q,H,nt){var z=m.exec(H.slice(nt));return z?(q.m=y.get(z[0].toLowerCase()),nt+z[0].length):-1}function S(q,H,nt){return A(q,t,H,nt)}function M(q,H,nt){return A(q,r,H,nt)}function O(q,H,nt){return A(q,n,H,nt)}function L(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function k(q){return c[q.getMonth()]}function P(q){return a[q.getMonth()]}function U(q){return i[+(q.getHours()>=12)]}function $(q){return 1+~~(q.getMonth()/3)}function X(q){return s[q.getUTCDay()]}function rt(q){return o[q.getUTCDay()]}function ot(q){return c[q.getUTCMonth()]}function at(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function st(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",b);return H.toString=function(){return q},H},parse:function(q){var H=T(q+="",!1);return H.toString=function(){return q},H},utcFormat:function(q){var H=w(q+="",_);return H.toString=function(){return q},H},utcParse:function(q){var H=T(q+="",!0);return H.toString=function(){return q},H}}}var vU={"-":"",_:" ",0:"0"},Fr=/^\s*\d+/,wrt=/^%/,vrt=/[\\^$*+?|[\]().{}]/g;function le(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Srt(e){return e.replace(vrt,"\\$&")}function xg(e){return new RegExp("^(?:"+e.map(Srt).join("|")+")","i")}function bg(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Irt(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Trt(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Art(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Ert(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Mrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function SU(e,t,r){var n=Fr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function IU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Nrt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Ort(e,t,r){var n=Fr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Rrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function TU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Drt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function AU(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Lrt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Frt(e,t,r){var n=Fr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Crt(e,t,r){var n=Fr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function krt(e,t,r){var n=Fr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Brt(e,t,r){var n=wrt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Prt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Urt(e,t,r){var n=Fr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function EU(e,t){return le(e.getDate(),t,2)}function $rt(e,t){return le(e.getHours(),t,2)}function zrt(e,t){return le(e.getHours()%12||12,t,2)}function jrt(e,t){return le(1+Gi.count(dn(e),e),t,3)}function DU(e,t){return le(e.getMilliseconds(),t,3)}function qrt(e,t){return DU(e,t)+"000"}function Vrt(e,t){return le(e.getMonth()+1,t,2)}function Yrt(e,t){return le(e.getMinutes(),t,2)}function Wrt(e,t){return le(e.getSeconds(),t,2)}function Grt(e){var t=e.getDay();return t===0?7:t}function Xrt(e,t){return le(mi.count(dn(e)-1,e),t,2)}function LU(e){var t=e.getDay();return t>=4||t===0?gs(e):gs.ceil(e)}function Hrt(e,t){return e=LU(e),le(gs.count(dn(e),e)+(dn(e).getDay()===4),t,2)}function Qrt(e){return e.getDay()}function Zrt(e,t){return le(Kc.count(dn(e)-1,e),t,2)}function Krt(e,t){return le(e.getFullYear()%100,t,2)}function Jrt(e,t){return e=LU(e),le(e.getFullYear()%100,t,2)}function tnt(e,t){return le(e.getFullYear()%1e4,t,4)}function ent(e,t){var r=e.getDay();return e=r>=4||r===0?gs(e):gs.ceil(e),le(e.getFullYear()%1e4,t,4)}function rnt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+le(t/60|0,"0",2)+le(t%60,"0",2)}function MU(e,t){return le(e.getUTCDate(),t,2)}function nnt(e,t){return le(e.getUTCHours(),t,2)}function int(e,t){return le(e.getUTCHours()%12||12,t,2)}function ont(e,t){return le(1+Yu.count(hn(e),e),t,3)}function FU(e,t){return le(e.getUTCMilliseconds(),t,3)}function snt(e,t){return FU(e,t)+"000"}function ant(e,t){return le(e.getUTCMonth()+1,t,2)}function cnt(e,t){return le(e.getUTCMinutes(),t,2)}function lnt(e,t){return le(e.getUTCSeconds(),t,2)}function unt(e){var t=e.getUTCDay();return t===0?7:t}function fnt(e,t){return le(yi.count(hn(e)-1,e),t,2)}function CU(e){var t=e.getUTCDay();return t>=4||t===0?xs(e):xs.ceil(e)}function dnt(e,t){return e=CU(e),le(xs.count(hn(e),e)+(hn(e).getUTCDay()===4),t,2)}function hnt(e){return e.getUTCDay()}function pnt(e,t){return le(Jc.count(hn(e)-1,e),t,2)}function mnt(e,t){return le(e.getUTCFullYear()%100,t,2)}function ynt(e,t){return e=CU(e),le(e.getUTCFullYear()%100,t,2)}function gnt(e,t){return le(e.getUTCFullYear()%1e4,t,4)}function xnt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?xs(e):xs.ceil(e),le(e.getUTCFullYear()%1e4,t,4)}function bnt(){return"+0000"}function NU(){return"%"}function OU(e){return+e}function RU(e){return Math.floor(+e/1e3)}var rh,nh,kU,bs,BU;v6({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function v6(e){return rh=w6(e),nh=rh.format,kU=rh.parse,bs=rh.utcFormat,BU=rh.utcParse,rh}function _nt(e){return new Date(e)}function wnt(e){return e instanceof Date?+e:+new Date(+e)}function Iv(e,t,r,n,i,o,s,a,c,l){var u=sg(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),x=l("%b %d"),b=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?m:o(w)<w?y:n(w)<w?i(w)<w?g:x:r(w)<w?b:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,wnt)):d().map(_nt)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(cg(T,w)):u},u.copy=function(){return ms(u,Iv(e,t,r,n,i,o,s,a,c,l))},u}function Tv(){return dr.apply(Iv(g6,x6,dn,ja,mi,Gi,$a,Pa,Lr,nh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Av(){return dr.apply(Iv(y6,yg,hn,qa,yi,Yu,za,Ua,Lr,bs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function _g(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ev(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Hn,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(n*m<n*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,r]=m,i=u(e=+e),o=u(t=+t),s=u(r=+r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h):[e,t,r]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(y){var g,x,b;return arguments.length?([g,x,b]=y,l=ss(m,[g,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(hi),h.rangeRound=p(Nu),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h}}function wg(){var e=ka(Ev()(Hn));return e.copy=function(){return _g(e,wg())},ig.apply(e,arguments)}function Mv(){var e=f6(Ev()).domain([.1,1,10]);return e.copy=function(){return _g(e,Mv()).base(e.base())},ig.apply(e,arguments)}function Nv(){var e=d6(Ev());return e.copy=function(){return _g(e,Nv()).constant(e.constant())},ig.apply(e,arguments)}function Ov(){var e=h6(Ev());return e.copy=function(){return _g(e,Ov()).exponent(e.exponent())},ig.apply(e,arguments)}function W(e){for(var t=e.length/6|0,r=new Array(t),n=0;n<t;)r[n]="#"+e.slice(n*6,++n*6);return r}var S6=W("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var I6=W("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var T6=W("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var A6=W("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var E6=W("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var M6=W("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var N6=W("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var O6=W("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var R6=W("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var D6=W("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var L6=W("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var pt=e=>MM(e[e.length-1]);var Rv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),Dv=pt(Rv);var Lv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Fv=pt(Lv);var Cv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),kv=pt(Cv);var Bv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),Pv=pt(Bv);var vg=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),ih=pt(vg);var Uv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),$v=pt(Uv);var Sg=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),oh=pt(Sg);var zv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),jv=pt(zv);var qv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Vv=pt(qv);var Yv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),Wv=pt(Yv);var Gv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),Xv=pt(Gv);var Hv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),Qv=pt(Hv);var Zv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),Kv=pt(Zv);var Jv=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),t2=pt(Jv);var e2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),r2=pt(e2);var n2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),i2=pt(n2);var o2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),s2=pt(o2);var a2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),c2=pt(a2);var l2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),u2=pt(l2);var f2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),d2=pt(f2);var h2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),p2=pt(h2);var m2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),y2=pt(m2);var g2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),x2=pt(g2);var b2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),_2=pt(b2);var w2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),v2=pt(w2);var S2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),I2=pt(S2);var T2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),A2=pt(T2);function E2(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var M2=Ld(En(300,.5,0),En(-240,.5,1));var O2=Ld(En(-100,.75,.35),En(80,1.5,.8)),R2=Ld(En(260,.75,.35),En(80,1.5,.8)),N2=En();function D2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return N2.h=360*e-100,N2.s=1.5-1.5*t,N2.l=.8-.9*t,N2+""}var L2=wr(),vnt=Math.PI/3,Snt=Math.PI*2/3;function F2(e){var t;return e=(.5-e)*Math.PI,L2.r=255*(t=Math.sin(e))*t,L2.g=255*(t=Math.sin(e+vnt))*t,L2.b=255*(t=Math.sin(e+Snt))*t,L2+""}function C2(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function k2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var B2=k2(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),P2=k2(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),U2=k2(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),$2=k2(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function hr(e){return function(){return e}}var F6=Math.cos;var sh=Math.min,Ig=Math.sin,ue=Math.sqrt,C6=1e-12,Hu=Math.PI,bVt=Hu/2,ah=2*Hu;function z2(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Yc(t)}var SVt=Array.prototype.slice;function j2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function PU(e){this._context=e}PU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Va(e){return new PU(e)}function q2(e){return e[0]}function V2(e){return e[1]}function Tg(e,t){var r=hr(!0),n=null,i=Va,o=null,s=z2(a);e=typeof e=="function"?e:e===void 0?q2:hr(e),t=typeof t=="function"?t:t===void 0?V2:hr(t);function a(c){var l,u=(c=j2(c)).length,f,d=!1,h;for(n==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&r(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:hr(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:hr(+c),a):t},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:hr(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(o=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=o=null:o=i(n=c),a):n},a}function ch(e,t,r){var n=null,i=hr(!0),o=null,s=Va,a=null,c=z2(l);e=typeof e=="function"?e:e===void 0?q2:hr(+e),t=typeof t=="function"?t:t===void 0?hr(0):hr(+t),r=typeof r=="function"?r:r===void 0?V2:hr(+r);function l(f){var d,h,p,m=(f=j2(f)).length,y,g=!1,x,b=new Array(m),_=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(y=f[d],d,f))===g)if(g=!g)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],_[p]);a.lineEnd(),a.areaEnd()}g&&(b[d]=+e(y,d,f),_[d]=+t(y,d,f),a.point(n?+n(y,d,f):b[d],r?+r(y,d,f):_[d]))}if(x)return a=null,x+""||null}function u(){return Tg().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),n=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:hr(+f),l):e},l.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:hr(+f),l):n},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),r=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:hr(+f),l):t},l.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:hr(+f),l):r},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(r)},l.lineX1=function(){return u().x(n).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:hr(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var Y2=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function k6(e){return new Y2(e,!0)}function B6(e){return new Y2(e,!1)}var Int=ue(3),Ag={draw(e,t){let r=ue(t+sh(t/28,.75))*.59436,n=r/2,i=n*Int;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-i,-n),e.lineTo(i,n),e.moveTo(-i,n),e.lineTo(i,-n)}};var Ya={draw(e,t){let r=ue(t/Hu);e.moveTo(r,0),e.arc(0,0,r,0,ah)}};var Eg={draw(e,t){let r=ue(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var UU=ue(1/3),Tnt=UU*2,Mg={draw(e,t){let r=ue(t/Tnt),n=r*UU;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Ng={draw(e,t){let r=ue(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Og={draw(e,t){let r=ue(t-sh(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Rg={draw(e,t){let r=ue(t),n=-r/2;e.rect(n,n,r,r)}};var Dg={draw(e,t){let r=ue(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Ant=.8908130915292852,$U=Ig(Hu/10)/Ig(7*Hu/10),Ent=Ig(ah/10)*$U,Mnt=-F6(ah/10)*$U,Lg={draw(e,t){let r=ue(t*Ant),n=Ent*r,i=Mnt*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=ah*o/5,a=F6(s),c=Ig(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var P6=ue(3),Fg={draw(e,t){let r=-ue(t/(P6*3));e.moveTo(0,r*2),e.lineTo(-P6*r,-r),e.lineTo(P6*r,-r),e.closePath()}};var Nnt=ue(3),Cg={draw(e,t){let r=ue(t)*.6824,n=r/2,i=r*Nnt/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Xi=-.5,Hi=ue(3)/2,U6=1/ue(12),Ont=(U6/2+1)*3,kg={draw(e,t){let r=ue(t/Ont),n=r/2,i=r*U6,o=n,s=r*U6+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Xi*n-Hi*i,Hi*n+Xi*i),e.lineTo(Xi*o-Hi*s,Hi*o+Xi*s),e.lineTo(Xi*a-Hi*c,Hi*a+Xi*c),e.lineTo(Xi*n+Hi*i,Xi*i-Hi*n),e.lineTo(Xi*o+Hi*s,Xi*s-Hi*o),e.lineTo(Xi*a+Hi*c,Xi*c-Hi*a),e.closePath()}};var lh={draw(e,t){let r=ue(t-sh(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var W2=[Ya,Eg,Mg,Rg,Lg,Fg,kg],$6=[Ya,Og,lh,Cg,Ag,Dg,Ng];function Qi(){}function uh(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Bg(e){this._context=e}Bg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:uh(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function z6(e){return new Bg(e)}function zU(e){this._context=e}zU.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function j6(e){return new zU(e)}function jU(e){this._context=e}jU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:uh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function q6(e){return new jU(e)}function qU(e,t){this._basis=new Bg(e),this._beta=t}qU.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],o=e[r]-n,s=t[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*e[a]+(1-this._beta)*(n+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var V6=function e(t){function r(n){return t===1?new Bg(n):new qU(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function fh(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function G2(e,t){this._context=e,this._k=(1-t)/6}G2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:fh(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:fh(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Y6=function e(t){function r(n){return new G2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function X2(e,t){this._context=e,this._k=(1-t)/6}X2.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:fh(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var W6=function e(t){function r(n){return new X2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function H2(e,t){this._context=e,this._k=(1-t)/6}H2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fh(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var G6=function e(t){function r(n){return new H2(n,t)}return r.tension=function(n){return e(+n)},r}(0);function Pg(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>C6){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>C6){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,i,o,s,e._x2,e._y2)}function VU(e,t){this._context=e,this._alpha=t}VU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Pg(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var X6=function e(t){function r(n){return t?new VU(n,t):new G2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function YU(e,t){this._context=e,this._alpha=t}YU.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Pg(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var H6=function e(t){function r(n){return t?new YU(n,t):new X2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function WU(e,t){this._context=e,this._alpha=t}WU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Pg(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Q6=function e(t){function r(n){return t?new WU(n,t):new H2(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function GU(e){this._context=e}GU.prototype={areaStart:Qi,areaEnd:Qi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Z6(e){return new GU(e)}function XU(e){return e<0?-1:1}function HU(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),a=(o*i+s*n)/(n+i);return(XU(o)+XU(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function QU(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function K6(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-n)/3;e._context.bezierCurveTo(n+a,i+a*t,o-a,s-a*r,o,s)}function Q2(e){this._context=e}Q2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:K6(this,this._t0,QU(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,K6(this,QU(this,r=HU(this,e,t)),r);break;default:K6(this,this._t0,r=HU(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function ZU(e){this._context=new KU(e)}(ZU.prototype=Object.create(Q2.prototype)).point=function(e,t){Q2.prototype.point.call(this,t,e)};function KU(e){this._context=e}KU.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function J6(e){return new Q2(e)}function t4(e){return new ZU(e)}function t$(e){this._context=e}t$.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=JU(e),i=JU(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function JU(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(i[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function e4(e){return new t$(e)}function Z2(e,t){this._context=e,this._t=t}Z2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function r4(e){return new Z2(e,.5)}function n4(e){return new Z2(e,0)}function i4(e){return new Z2(e,1)}var Ug=e=>()=>e;function o4(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function gi(e,t,r){this.k=e,this.x=t,this.y=r}gi.prototype={constructor:gi,scale:function(e){return e===1?this:new gi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $g=new gi(1,0,0);s4.prototype=gi.prototype;function s4(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $g;return e.__zoom}function K2(e){e.stopImmediatePropagation()}function dh(e){e.preventDefault(),e.stopImmediatePropagation()}function Rnt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Dnt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function e$(){return this.__zoom||$g}function Lnt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Fnt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cnt(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],o=e.invertY(t[0][1])-r[0][1],s=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function a4(){var e=Rnt,t=Dnt,r=Cnt,n=Lnt,i=Fnt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=FM,l=Su("start","zoom","end"),u,f,d,h=500,p=150,m=0,y=10;function g(S){S.property("__zoom",e$).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,M,O,L){var B=S.selection?S.selection():S;B.property("__zoom",e$),S!==B?v(S,M,O,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},g.scaleBy=function(S,M,O,L){g.scaleTo(S,function(){var B=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return B*k},O,L)},g.scaleTo=function(S,M,O,L){g.transform(S,function(){var B=t.apply(this,arguments),k=this.__zoom,P=O==null?_(B):typeof O=="function"?O.apply(this,arguments):O,U=k.invert(P),$=typeof M=="function"?M.apply(this,arguments):M;return r(b(x(k,$),P,U),B,s)},O,L)},g.translateBy=function(S,M,O,L){g.transform(S,function(){return r(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),s)},null,L)},g.translateTo=function(S,M,O,L,B){g.transform(S,function(){var k=t.apply(this,arguments),P=this.__zoom,U=L==null?_(k):typeof L=="function"?L.apply(this,arguments):L;return r($g.translate(U[0],U[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof O=="function"?-O.apply(this,arguments):-O),k,s)},L,B)};function x(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new gi(M,S.x,S.y)}function b(S,M,O){var L=M[0]-O[0]*S.k,B=M[1]-O[1]*S.k;return L===S.x&&B===S.y?S:new gi(S.k,L,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,O,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,k=arguments,P=w(B,k).event(L),U=t.apply(B,k),$=O==null?_(U):typeof O=="function"?O.apply(B,k):O,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),rt=B.__zoom,ot=typeof M=="function"?M.apply(B,k):M,at=c(rt.invert($).concat(X/rt.k),ot.invert($).concat(X/ot.k));return function(Y){if(Y===1)Y=ot;else{var st=at(Y),q=X/st[2];Y=new gi(q,$[0]-st[0]*q,$[1]-st[1]*q)}P.zoom(null,Y)}})}function w(S,M,O){return!O&&S.__zooming||new T(S,M)}function T(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}T.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,M){return this.mouse&&S!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var M=Qt(this.that).datum();l.call(S,this.that,new o4(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var O=w(this,M).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,n.apply(this,arguments)))),k=an(S);if(O.wheel)(O.mouse[0][0]!==k[0]||O.mouse[0][1]!==k[1])&&(O.mouse[1]=L.invert(O.mouse[0]=k)),clearTimeout(O.wheel);else{if(L.k===B)return;O.mouse=[k,L.invert(k)],as(this),O.start()}dh(S),O.wheel=setTimeout(P,p),O.zoom("mouse",r(b(x(L,B),O.mouse[0],O.mouse[1]),O.extent,s));function P(){O.wheel=null,O.end()}}function E(S,...M){if(d||!e.apply(this,arguments))return;var O=S.currentTarget,L=w(this,M,!0).event(S),B=Qt(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),k=an(S,O),P=S.clientX,U=S.clientY;yy(S.view),K2(S),L.mouse=[k,this.__zoom.invert(k)],as(this),L.start();function $(rt){if(dh(rt),!L.moved){var ot=rt.clientX-P,at=rt.clientY-U;L.moved=ot*ot+at*at>m}L.event(rt).zoom("mouse",r(b(L.that.__zoom,L.mouse[0]=an(rt,O),L.mouse[1]),L.extent,s))}function X(rt){B.on("mousemove.zoom mouseup.zoom",null),gy(rt.view,L.moved),dh(rt),L.event(rt).end()}}function N(S,...M){if(e.apply(this,arguments)){var O=this.__zoom,L=an(S.changedTouches?S.changedTouches[0]:S,this),B=O.invert(L),k=O.k*(S.shiftKey?.5:2),P=r(b(x(O,k),L,B),t.apply(this,M),s);dh(S),a>0?Qt(this).transition().duration(a).call(v,P,L,S):Qt(this).call(g.transform,P,L,S)}}function I(S,...M){if(e.apply(this,arguments)){var O=S.touches,L=O.length,B=w(this,M,S.changedTouches.length===L).event(S),k,P,U,$;for(K2(S),P=0;P<L;++P)U=O[P],$=an(U,this),$=[$,this.__zoom.invert($),U.identifier],B.touch0?!B.touch1&&B.touch0[2]!==$[2]&&(B.touch1=$,B.taps=0):(B.touch0=$,k=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),as(this),B.start())}}function R(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P,U,$;for(dh(S),k=0;k<B;++k)P=L[k],U=an(P,this),O.touch0&&O.touch0[2]===P.identifier?O.touch0[0]=U:O.touch1&&O.touch1[2]===P.identifier&&(O.touch1[0]=U);if(P=O.that.__zoom,O.touch1){var X=O.touch0[0],rt=O.touch0[1],ot=O.touch1[0],at=O.touch1[1],Y=(Y=ot[0]-X[0])*Y+(Y=ot[1]-X[1])*Y,st=(st=at[0]-rt[0])*st+(st=at[1]-rt[1])*st;P=x(P,Math.sqrt(Y/st)),U=[(X[0]+ot[0])/2,(X[1]+ot[1])/2],$=[(rt[0]+at[0])/2,(rt[1]+at[1])/2]}else if(O.touch0)U=O.touch0[0],$=O.touch0[1];else return;O.zoom("touch",r(b(P,U,$),O.extent,s))}}function C(S,...M){if(this.__zooming){var O=w(this,M).event(S),L=S.changedTouches,B=L.length,k,P;for(K2(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<B;++k)P=L[k],O.touch0&&O.touch0[2]===P.identifier?delete O.touch0:O.touch1&&O.touch1[2]===P.identifier&&delete O.touch1;if(O.touch1&&!O.touch0&&(O.touch0=O.touch1,delete O.touch1),O.touch0)O.touch0[1]=this.__zoom.invert(O.touch0[0]);else if(O.end(),O.taps===2&&(P=an(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<y)){var U=Qt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:Ug(+S),g):n},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Ug(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Ug(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Ug([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(r=S,g):r},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function Pe(e){return e!=null&&!Number.isNaN(e)}function Cr(e,t){return+Pe(t)-+Pe(e)||Ft(e,t)}function Qu(e,t){return+Pe(t)-+Pe(e)||vn(e,t)}function zg(e){return e!=null&&`${e}`!=""}function hh(e){return isFinite(e)?e:NaN}function Fn(e){return e>0&&isFinite(e)?e:NaN}function tl(e){return e<0&&isFinite(e)?e:NaN}function ph(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${knt(e.getUTCFullYear(),4)}-${Wa(e.getUTCMonth()+1,2)}-${Wa(e.getUTCDate(),2)}${r||n||i||o?`T${Wa(r,2)}:${Wa(n,2)}${i||o?`:${Wa(i,2)}${o?`.${Wa(o,3)}`:""}`:""}Z`:""}`}function knt(e){return e<0?`-${Wa(-e,6)}`:e>9999?`+${Wa(e,6)}`:Wa(e,4)}function Wa(e,t){return`${e}`.padStart(t,"0")}var Bnt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function jg(e,t){return Bnt.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ga(e){if(e==null)return;let t=e[0],r=e[e.length-1];return vn(t,r)}var yh=1e3,rl=yh*60,nl=rl*60,ws=nl*24,_s=ws*7,Zu=ws*30,el=ws*365,c4=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",yh],["5 seconds",5*yh],["15 seconds",15*yh],["30 seconds",30*yh],["minute",rl],["5 minutes",5*rl],["15 minutes",15*rl],["30 minutes",30*rl],["hour",nl],["3 hours",3*nl],["6 hours",6*nl],["12 hours",12*nl],["day",ws],["2 days",2*ws],["week",_s],["2 weeks",2*_s],["month",Zu],["3 months",3*Zu],["6 months",6*Zu],["year",el],["2 years",2*el],["5 years",5*el],["10 years",10*el],["20 years",20*el],["50 years",50*el],["100 years",100*el]],l4=new Map([["second",yh],["minute",rl],["hour",nl],["day",ws],["monday",_s],["tuesday",_s],["wednesday",_s],["thursday",_s],["friday",_s],["saturday",_s],["sunday",_s],["week",_s],["month",Zu],["year",el]]),n$=new Map([["second",Lr],["minute",Pa],["hour",$a],["day",Gi],["monday",Kc],["tuesday",yv],["wednesday",gv],["thursday",gs],["friday",xv],["saturday",bv],["sunday",mi],["week",mi],["month",ja],["year",dn]]),u4=new Map([["second",Lr],["minute",Ua],["hour",za],["day",Wu],["monday",Jc],["tuesday",_v],["wednesday",wv],["thursday",xs],["friday",vv],["saturday",Sv],["sunday",yi],["week",yi],["month",qa],["year",hn]]),gh=Symbol("intervalDuration"),tS=Symbol("intervalType");for(let[e,t]of n$)t[gh]=l4.get(e),t[tS]="time";for(let[e,t]of u4)t[gh]=l4.get(e),t[tS]="utc";var qg=[["year",hn,"utc"],["month",qa,"utc"],["day",Wu,"utc",6*Zu],["hour",za,"utc",3*ws],["minute",Ua,"utc",6*nl],["second",Lr,"utc",30*rl]],J2=[["year",dn,"time"],["month",ja,"time"],["day",Gi,"time",6*Zu],["hour",$a,"time",3*ws],["minute",Pa,"time",6*nl],["second",Lr,"time",30*rl]],Pnt=[qg[0],J2[0],qg[1],J2[1],qg[2],J2[2],...qg.slice(3)];function eS(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let i=u4.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(r>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function Vg(e){return i$(eS(e),"time")}function Ku(e){return i$(eS(e),"utc")}function i$([e,t],r){let n=(r==="time"?n$:u4).get(e);return t>1&&(n=n.every(t),n[gh]=l4.get(e)*t,n[tS]=r),n}function f4(e,t){if(!(t>1))return;let r=e[gh];if(!c4.some(([,i])=>i===r)||r%ws===0&&ws<r&&r<Zu)return;let[n]=c4[To(([,i])=>Math.log(i)).center(c4,Math.log(r*t))];return(e[tS]==="time"?Vg:Ku)(n)}function r$(e,t,r){let n=t==="time"?nh:bs;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=Unt(r);switch(e){case"millisecond":return mh(n(".%L"),n(":%M:%S"),i);case"second":return mh(n(":%S"),n("%-I:%M"),i);case"minute":return mh(n("%-I:%M"),n("%p"),i);case"hour":return mh(n("%-I %p"),n("%b %-d"),i);case"day":return mh(n("%-d"),n("%b"),i);case"month":return mh(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function Unt(e){return e==="left"||e==="right"?(t,r)=>`
|
|
12
12
|
${t}
|
|
13
|
-
${
|
|
14
|
-
${t}`:(t,
|
|
15
|
-
${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){let r=Qt(e1(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return FP("millisecond","utc",n);for(let[i,o,s,a]of Met(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return FP(i,s,n)}}function Sd(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-ba(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Dy=Object.getPrototypeOf(Uint8Array),Oet=Object.prototype.toString;function Rr(e){return e instanceof Array||e instanceof Dy}function $P(e){return e instanceof Dy&&!Net(e)}function UP(e){return e?.prototype instanceof Dy&&!Det(e)}function Net(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Det(e){return e===BigInt64Array||e===BigUint64Array}var n3=Symbol("reindex");function gt(e,t,n){let r=typeof t;return r==="string"?KP(e)?r3(e.getChild(t),n):PP(e,i3(t),n):r==="function"?PP(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Wt(e,Ce(t),n):typeof t?.transform=="function"?e3(t.transform(e),n):Ret(e3(t,n),e?.[n3])}function Ret(e,t){return e!=null&&t?Ly(e,t):e}function PP(e,t,n){return Wt(e,UP(n)?(r,i)=>o3(t(r,i)):t,n)}function e3(e,t){return t===void 0?ti(e):JP(e)?r3(e,t):e instanceof t?e:t.from(e,UP(t)&&!$P(e)?o3:void 0)}function r3(e,t){return e==null?e:(t===void 0||t===Array)&&ket(e.type)?s3(e.toArray()):e3(e.toArray(),t)}var Dc=[null],i3=e=>t=>{let n=t[e];return n===void 0&&t.type==="Feature"?t.properties?.[e]:n},ye={transform:yr},X={transform:e=>e};var Ry=()=>1,zP=()=>!0,Ye=e=>e==null?e:`${e}`,ee=e=>e==null?e:+e;var xu=e=>e?e[0]:void 0,Rc=e=>e?e[1]:void 0,jP=e=>e?e[2]:void 0,Ce=e=>()=>e;function Ed(e){let t=+`${e}`.slice(1)/100;return(n,r)=>sr(n,t,r)}function nn(e){return $P(e)?e:Wt(e,o3,Float64Array)}function o3(e){return e==null?NaN:Number(e)}function s3(e){return Wt(e,a3)}function a3(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?My(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Fe(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Cc(e)?[void 0,e]:[e,void 0]}function ae(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function c3(e,t,n){if(e!=null)return un(e,t,n)}function un(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function wa(e){return KP(e)?e:ti(e)}function ti(e){if(e==null||Rr(e))return e;if(JP(e))return r3(e);switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[e]}return Array.from(e)}function Wt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Lc(e,t=Array){return e instanceof t?e.slice():t.from(e)}function l3({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function u3({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function _a(e){return l3(e)||u3(e)||e.interval!==void 0}function bn(e){return e?.toString===Oet}function Jo(e){return bn(e)&&(e.type!==void 0||e.domain!==void 0)}function ei(e){return bn(e)&&typeof e.transform!="function"}function ts(e){return ei(e)&&e.value===void 0&&e.channel===void 0}function f3(e,t,n,r=X){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function je(e,t){return e===void 0&&t===void 0?[xu,Rc]:[e,t]}function Xn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Fe(t)),e===void 0&&([e]=Fe(n)),e}function Fc(e){return Rr(e)?e.length:e?.numRows}function yr(e){let t=Fc(e),n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Ly(e,t){return Rr(e)?Wt(t,n=>e[n],e.constructor):Wt(t,n=>e.at(n))}function Ad(e){return e.length===1?(t,n)=>e(Ly(n,t)):e}function va(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Ni(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cv(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function wn(e){let t;return[{transform:()=>t,label:Pn(e)},n=>t=n]}function Bn(e){return e==null?[e]:wn(e)}function Pn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Md(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return ke(r)||ke(i)?Wt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Wt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function bu(e,t){let n=d3(t?.interval,t?.type);return n?Wt(e,n):e}function d3(e,t){let n=Od(e,t);return n&&(r=>Ne(r)?n.floor(r):r)}function Od(e,t){if(e!=null){if(typeof e=="number")return h3(e);if(typeof e=="string")return(t==="time"?Ny:gu)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function h3(e){e=+e,0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let t=Math.abs(e);return e<0?{floor:n=>Math.floor(n*t)/t,offset:(n,r=1)=>(n*t+Math.floor(r))/t,range:(n,r)=>qe(Math.ceil(n*t),r*t).map(i=>i/t)}:{floor:n=>Math.floor(n/t)*t,offset:(n,r=1)=>n+t*Math.floor(r),range:(n,r)=>qe(Math.ceil(n/t),r/t).map(i=>i*t)}}function es(e,t){if(e=Od(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function VP(e,t){if(e=es(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function qP(e){return kc(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function kc(e){return typeof e?.range=="function"}function Di(e){return e===void 0||ei(e)?e:{value:e}}function YP(e){return e==null?null:{transform:t=>gt(t,e,Float64Array),label:Pn(e)}}function GP(e){if(!gr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function gr(e){return e&&typeof e[Symbol.iterator]=="function"}function lv(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function De(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function ke(e){for(let t of e)if(t!=null)return t instanceof Date}function WP(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&My(t)}function XP(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Sa(e){for(let t of e)if(t!=null)return typeof t=="number"}function uv(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var Let=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function Cc(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||Let.has(e))}function HP(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function oe(e){return e==null||Ia(e)}function Ia(e){return/^\s*none\s*$/i.test(e)}function QP(e){return/^\s*round\s*$/i.test(e)}function fv(e,t){return c3(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ns(e="middle"){return fv(e,"frameAnchor")}function ZP(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function Fet(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function Fy(e){return gr(e)?Fet(e):e}function dv(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=un(e,"clip",["frame","sphere"])),e}function KP(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function JP(e){return e&&typeof e.toArray=="function"&&e.type}function ket(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ri=Symbol("position"),ni=Symbol("color"),wu=Symbol("radius"),_u=Symbol("length"),vu=Symbol("opacity"),Nd=Symbol("symbol"),t9=Symbol("projection"),he=new Map([["x",Ri],["y",Ri],["fx",Ri],["fy",Ri],["r",wu],["color",ni],["opacity",vu],["symbol",Nd],["length",_u],["projection",t9]]);function e9(e){return e===Ri||e===t9}function n9(e){return e===Ri||e===wu||e===_u||e===vu}var p3=Math.sqrt(3),m3=2/p3,Cet={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*m3,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},y3=new Map([["asterisk",dy],["circle",ga],["cross",hy],["diamond",py],["diamond2",my],["hexagon",Cet],["plus",yy],["square",gy],["square2",xy],["star",by],["times",gd],["triangle",wy],["triangle2",_y],["wye",vy]]);function g3(e){return e&&typeof e.draw=="function"}function r9(e){return g3(e)?!0:typeof e!="string"?!1:y3.has(e.toLowerCase())}function Dd(e){if(e==null||g3(e))return e;let t=y3.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function i9(e){if(e==null||g3(e))return[void 0,e];if(typeof e=="string"){let t=y3.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function rn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=w3(e)),t!=null&&!ts(t)&&(r=x3(r,v3(t))),n&&(r=x3(r,_3))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||ts(t))&&{sort:t},transform:x3(r,s)}}function xe({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=w3(e)),t!=null&&!ts(t)&&(r=b3(r,v3(t))),n&&(r=b3(r,_3))),{...i,...(t===null||ts(t))&&{sort:t},initializer:b3(r,o)}}function x3(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,wa(n),r,i)}}function b3(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function hv(e,t){return(e.initializer!=null?xe:rn)(e,t)}function o9(e,t){return hv(t,w3(e))}function w3(e){return(t,n)=>{let r=gt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function s9({sort:e,...t}={}){return{...hv(t,_3),sort:ts(e)?e:null}}function _3(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function a9({seed:e,sort:t,...n}={}){return{...hv(n,c9(e==null?Math.random:ou(e))),sort:ts(t)?t:null}}function pv(e,{sort:t,...n}={}){return{...(ei(e)&&e.channel!==void 0?xe:hv)(n,v3(e)),sort:ts(t)?t:null}}function v3(e){return(typeof e=="function"&&e.length!==1?Bet:c9)(e)}function Bet(e){return(t,n)=>{let r=Rr(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function c9(e){let t,n;({channel:t,value:e,order:n}={...Di(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?mu:xn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=xn;break;case"descending":n=mu;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=gt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Cy(e,t){return mv(null,null,e,t)}function Bc(e={y:"count"},t={}){let{x:n=X}=t;if(n==null)throw new Error("missing channel: x");return mv(n,null,e,t)}function Pc(e={x:"count"},t={}){let{y:n=X}=t;if(n==null)throw new Error("missing channel: y");return mv(null,n,e,t)}function By(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=je(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return mv(n,r,e,t)}function mv(e,t,{data:n=xv,filter:r,sort:i,reverse:o,...s}={},a={}){s=I3(s,a),n=h9(n,X),i=i==null?void 0:f9("sort",i,a),r=r==null?void 0:d9("filter",r,a);let[c,l]=Bn(e),[u,f]=Bn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[w,v]=Bn(d),[_]=Fe(h),[T]=Fe(p),[A,E]=Bn(_),[O,I]=Bn(T);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:O||p},...rn(b,(D,k,S)=>{let M=bu(gt(D,e),S?.x),N=bu(gt(D,t),S?.y),L=gt(D,d),B=gt(D,_),C=gt(D,T),P=Py(s,{z:L,fill:B,stroke:C}),$=[],U=[],H=M&&l([]),nt=N&&f([]),ot=L&&v([]),at=B&&E([]),G=C&&I([]),st=0;for(let V of s)V.initialize(D);i&&i.initialize(D),r&&r.initialize(D);for(let V of k){let Q=[];for(let rt of s)rt.scope("facet",V);i&&i.scope("facet",V),r&&r.scope("facet",V);for(let[rt,z]of rs(V,P))for(let[Ct,ht]of rs(z,N))for(let[Xt,Zt]of rs(ht,M)){let tt={data:D};if(M&&(tt.x=Xt),N&&(tt.y=Ct),P&&(tt.z=rt),!(r&&!r.reduce(Zt,tt))){Q.push(st++),U.push(n.reduceIndex(Zt,D,tt)),M&&H.push(Xt),N&&nt.push(Ct),L&&ot.push(P===L?rt:L[Zt[0]]),B&&at.push(P===B?rt:B[Zt[0]]),C&&G.push(P===C?rt:C[Zt[0]]);for(let ce of s)ce.reduce(Zt,tt);i&&i.reduce(Zt,tt)}}$.push(Q)}return T3($,i,o),{data:U,facets:$}}),...!is(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!is(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:D,output:k})=>[D,k]))}}function is(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function S3(e,t,n=yv){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",Vet]),t.href!=null&&e.href===void 0&&r.push(["href",bv]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Pet(i):n(i,o,t))}function yv(e,t,n,r=gv){let i;bn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=wn(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function Pet(e){return{name:e,initialize(){},scope(){},reduce(){}}}function gv(e,t,n,r=Rd){let i=cv(e,n),o=r(t,i),s,a;return{label:Pn(o===ky?null:i,o.label),initialize(c){s=i===void 0?c:gt(c,i),o.scope==="data"&&(a=o.reduceIndex(yr(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function rs(e,t){return t?Rn(e,n=>t[n]):[[,e]]}function Rd(e,t,n=$et){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&bn(e))return zet(e);if(typeof e=="function")return jet(e);if(/^p\d{2}$/i.test(e))return Ta(Ed(e));switch(`${e}`.toLowerCase()){case"first":return bv;case"last":return qet;case"identity":return xv;case"count":return ky;case"distinct":return Yet;case"sum":return t==null?ky:Get;case"proportion":return u9(t,"data");case"proportion-facet":return u9(t,"facet");case"deviation":return Ta(wi);case"min":return Ta(ue);case"min-index":return Ta(Kb);case"max":return Ta(Qt);case"max-index":return Ta(Zb);case"mean":return l9(Js);case"median":return l9(ro);case"variance":return Ta(fc);case"mode":return Ta(kf)}return n(e)}function $et(e){throw new Error(`invalid reduce: ${e}`)}function I3(e,t){return S3(e,t,f9)}function f9(e,t,n){return yv(e,t,n,d9)}function d9(e,t,n){return gv(e,t,n,h9)}function h9(e,t){return Rd(e,t,Uet)}function Uet(e){switch(`${e}`.toLowerCase()){case"x":return Wet;case"y":return Xet;case"z":return E3}throw new Error(`invalid group reduce: ${e}`)}function Py(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function T3(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>xn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function zet(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function jet(e){return{reduceIndex(t,n,r){return e(Ly(n,t),r)}}}function Ta(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function l9(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return ke(n)?new Date(r):r}}}var xv={reduceIndex(e,t){return Ly(t,e)}},bv={reduceIndex(e,t){return t[e[0]]}},Vet={reduceIndex(e,t){let r=Zs(no(e,o=>o.length,o=>t[o]),Rc),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Fn(o,Rc)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
|
|
16
|
-
`)}},qet={reduceIndex(e,t){return t[e[e.length-1]]}},ky={label:"Frequency",reduceIndex(e){return e.length}},Yet={label:"Distinct",reduceIndex(e,t){let n=new or;for(let r of e)n.add(t[r]);return n.size}},Get=Ta(Fn);function u9(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Fn(n,o=>r[o])/i}}var Wet={reduceIndex(e,t,{x:n}){return n}},Xet={reduceIndex(e,t,{y:n}){return n}},E3={reduceIndex(e,t,{z:n}){return n}};function p9(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(Rr(r)?i=>e(r[i],i,r):i=>e(r.get(i),i,r))]}}}function Ld(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Pn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),M3(a,{scale:t,type:n,value:gt(e,r),label:s,filter:i,hint:o})}function wv(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ld(t,r,n)]))}function Fd(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Wt(o,s)]}));return n.channels=e,n}function M3(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&uv(r,Cc)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&uv(r,HP)?null:"opacity",t.defaultScale="opacity";break;case"symbol":n!==!0&&uv(r,r9)?(t.scale=null,t.value=Wt(r,Dd)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=he.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!he.has(n))throw new Error(`unknown scale: ${n}`);return t}function y9(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!he.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Di(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?x9:g9:Zet(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?Qet(t,r[l]):Het(n,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=gr(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let w=Array.from(new or(g));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?m9(n,"y1","y2"):u==="width"?m9(n,"x1","x2"):A3(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Rd(h===!0?"max":h,w);y.domain=()=>{let _=KT(yr(g),T=>v.reduceIndex(T,w),T=>g[T]);return f&&_.sort(f),d&&_.reverse(),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_.map(xu)}}}}function Het(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function Qet(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function m9(e,t,n){let r=A3(e,t),i=A3(e,n);return Wt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function A3(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function Zet(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return g9;case"descending":return x9}throw new Error(`invalid order: ${e}`)}function g9([e,t],[n,r]){return xn(t,r)||xn(e,n)}function x9([e,t],[n,r]){return mu(t,r)||xn(e,n)}function $y(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}var S9=new Map([["accent",hM],["category10",dM],["dark2",pM],["observable10",mM],["paired",yM],["pastel1",gM],["pastel2",xM],["set1",bM],["set2",wM],["set3",_M],["tableau10",vM]]);function I9(e){return e!=null&&S9.has(`${e}`.toLowerCase())}var b9=new Map([...S9,["brbg",Ea(Bw,Pw)],["prgn",Ea($w,Uw)],["piyg",Ea(zw,jw)],["puor",Ea(Vw,qw)],["rdbu",Ea(cy,dd)],["rdgy",Ea(Yw,Gw)],["rdylbu",Ea(ly,hd)],["rdylgn",Ea(Ww,Xw)],["spectral",Ea(Hw,Qw)],["burd",w9(cy,dd)],["buylrd",w9(ly,hd)],["blues",_n(__,v_)],["greens",_n(S_,I_)],["greys",_n(T_,E_)],["oranges",_n(D_,R_)],["purples",_n(A_,M_)],["reds",_n(O_,N_)],["turbo",Aa(z_)],["viridis",Aa(V_)],["magma",Aa(q_)],["inferno",Aa(Y_)],["plasma",Aa(G_)],["cividis",Aa(L_)],["cubehelix",Aa(F_)],["warm",Aa(C_)],["cool",Aa(B_)],["bugn",_n(Zw,Kw)],["bupu",_n(Jw,t_)],["gnbu",_n(e_,n_)],["orrd",_n(r_,i_)],["pubu",_n(a_,c_)],["pubugn",_n(o_,s_)],["purd",_n(l_,u_)],["rdpu",_n(f_,d_)],["ylgn",_n(m_,y_)],["ylgnbu",_n(h_,p_)],["ylorbr",_n(g_,x_)],["ylorrd",_n(b_,w_)],["rainbow",_9(P_)],["sinebow",_9(U_)]]);function _n(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?jn(t,n):e[n])}function Ea(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?jn(t,n):e[n])}function w9(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?jn(r=>t(1-r),n):e[n].slice().reverse())}function Aa(e){return({length:t})=>jn(e,Math.max(2,Math.floor(t)))}function _9(e){return({length:t})=>jn(e,Math.floor(t)+1).slice(0,-1)}function O3(e){let t=`${e}`.toLowerCase();if(!b9.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return b9.get(t)}function Uy(e,t){let n=O3(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function T9(e,t="greys"){let n=new Set,[r,i]=Uy(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var v9=new Map([["brbg",Pw],["prgn",Uw],["piyg",jw],["puor",qw],["rdbu",dd],["rdgy",Gw],["rdylbu",hd],["rdylgn",Xw],["spectral",Qw],["burd",e=>dd(1-e)],["buylrd",e=>hd(1-e)],["blues",v_],["greens",I_],["greys",E_],["purples",M_],["reds",N_],["oranges",R_],["turbo",z_],["viridis",V_],["magma",q_],["inferno",Y_],["plasma",G_],["cividis",L_],["cubehelix",F_],["warm",C_],["cool",B_],["bugn",Kw],["bupu",t_],["gnbu",n_],["orrd",i_],["pubugn",s_],["pubu",c_],["purd",u_],["rdpu",d_],["ylgnbu",p_],["ylgn",y_],["ylorbr",x_],["ylorrd",w_],["rainbow",P_],["sinebow",U_]]);function kd(e){let t=`${e}`.toLowerCase();if(!v9.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return v9.get(t)}var Ket=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function E9(e){return e!=null&&Ket.has(`${e}`.toLowerCase())}var D3=e=>t=>e(1-t),N3=[0,1],A9=new Map([["number",Ee],["rgb",_i],["hsl",IE],["hcl",TE],["lab",w1]]);function R3(e){let t=`${e}`.toLowerCase();if(!A9.has(t))throw new Error(`unknown interpolator: ${t}`);return A9.get(t)}function Bd(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=k9(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=he.get(e)===wu?nnt(n,a):he.get(e)===_u?rnt(n,a):he.get(e)===vu?N3:void 0,interpolate:h=he.get(e)===ni?u==null&&d!==void 0?_i:kd(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Xl:Ee,reverse:p}){if(f=es(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=R3(h)),p=!!p,d!==void 0){let m=(a=ti(a)).length,y=(d=ti(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=Bo(h,d),d=void 0}}if(h.length===1?(p&&(h=D3(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=N3)),t.interpolate((d===N3?Ce:zy)(h))):t.interpolate(h),s){let[m,y]=ne(a);(m>0||y<0)&&(a=Lc(a),(ba(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=hc(a)),t.domain(a).unknown(c),i&&(t.nice(Jet(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function Jet(e,t){return e===!0?void 0:typeof e=="number"?e:VP(e,t)}function M9(e,t,n){return Bd(e,la(),t,n)}function O9(e,t,n){return L3(e,t,{...n,exponent:.5})}function L3(e,t,{exponent:n=1,...r}){return Bd(e,Zm().exponent(n),t,{...r,type:"pow"})}function N9(e,t,{base:n=10,domain:r=int(t),...i}){return Bd(e,Hm().base(n),t,{...i,domain:r})}function D9(e,t,{constant:n=1,...r}){return Bd(e,Qm().constant(n),t,r)}function R9(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=ont(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?jn(c,i):he.get(e)===ni?Uy(o,i):void 0),s.length>0&&(s=Km(s,n===void 0?{length:i}:n).quantiles()),_v(e,t,{domain:s,range:n,reverse:l,unknown:a})}function L9(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=k9(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ne(o),f;return n===void 0?(f=Ln(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?jn(a,r):he.get(e)===ni?Uy(i,r):void 0):(f=jn(Ee(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),ba(ti(o))<0&&f.reverse(),_v(e,t,{domain:f,range:n,reverse:c,unknown:s})}function _v(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?jn(o,n.length+1):he.get(e)===ni?Uy(i,n.length+1):void 0,reverse:a}){n=ti(n);let c=ba(n);if(!isNaN(c)&&!tnt(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=hc(s)),{type:"threshold",scale:Jm(c<0?hc(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function tnt(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=rr(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function F9(e){return{type:"identity",scale:n9(he.get(e))?Wm():t=>t}}function Cd(e,t=_d){return e.length?[ue(e,({value:n})=>n===void 0?n:ue(n,t)),Qt(e,({value:n})=>n===void 0?n:Qt(n,t))]:[0,1]}function k9(e,t){let n=he.get(e);return(n===wu||n===vu||n===_u?ent:Cd)(t)}function ent(e){return[0,e.length?Qt(e,({value:t})=>t===void 0?t:Qt(t,_d)):1]}function nnt(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=sr(e,.5,({value:s})=>s===void 0?NaN:sr(s,.25,mr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Qt(i);return o<1?i.map(s=>s*o):i}function rnt(e,t){let n=ro(e,({value:o})=>o===void 0?NaN:ro(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Qt(r);return i<1?r.map(o=>o*i):r}function int(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Cd(e,mr);if(n<0)return Cd(e,Ac)}return[1,10]}function ont(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function zy(e){return(t,n)=>r=>e(t+r*(n-t))}var F3=0,k3;function C9(){let e=F3;return F3=0,k3=void 0,e}function Hn(e){e!==k3&&(k3=e,console.warn(e),++F3)}function vv(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Cd(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=he.get(e)===ni?u==null&&f!==void 0?_i:kd(u!==void 0?u:"rdbu"):Ee,reverse:p}){l=+l,a=ti(a);let[m,y]=a;if(a.length>2&&Hn(`Warning: the diverging ${e} scale domain contains extra elements.`),rr(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=R3(h)),f!==void 0&&(h=h.length===1?zy(h)(...f):Bo(h,f)),p&&(h=D3(h)),d){let g=n.apply(l),x=g-n.apply(m),b=n.apply(y)-g;x<b?m=n.invert(g-b):x>b&&(y=n.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function B9(e,t,n){return vv(e,ay(),snt,t,n)}function P9(e,t,n){return C3(e,t,{...n,exponent:.5})}function C3(e,t,{exponent:n=1,...r}){return vv(e,Cw().exponent(n=+n),lnt(n),t,{...r,type:"diverging-pow"})}function $9(e,t,{base:n=10,pivot:r=1,domain:i=Cd(t,r<0?Ac:mr),...o}){return vv(e,Fw().base(n=+n),ant,t,{domain:i,pivot:r,...o})}function U9(e,t,{constant:n=1,...r}){return vv(e,kw().constant(n=+n),unt(n),t,r)}var snt={apply(e){return e},invert(e){return e}},ant={apply:Math.log,invert:Math.exp},cnt={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function lnt(e){return e===.5?cnt:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function unt(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function z9(e,t,n,r){return Bd(e,t,n,r)}function j9(e,t,n){return z9(e,Dw(),t,n)}function V9(e,t,n){return z9(e,Rw(),t,n)}var Pd=Symbol("ordinal");function Y9(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=es(i,r),o===void 0&&(o=Q9(n,i,e)),(r==="categorical"||r===Pd)&&(r="ordinal"),a&&(o=hc(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function G9(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=es(r,n),i===void 0&&(i=Q9(t,r,e));let l;if(he.get(e)===Nd)l=fnt(t),o=o===void 0?dnt(l):Wt(o,Dd);else if(he.get(e)===ni&&(o===void 0&&(n==="ordinal"||n===Pd)&&(o=T9(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=kd(s),f=o[0],d=o[1]-o[0];o=({length:h})=>jn(p=>u(f+d*p),h)}else o=O3(s);if(a===Ym)throw new Error(`implicit unknown on ${e} scale is not supported`);return Y9(e,su().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function W9(e,t,{align:n=.5,padding:r=.5,...i}){return H9(QA().align(n).padding(r),t,i,e)}function X9(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return H9(Ic().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function H9(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=Y9(r,e,t,n),e.round=i,e}function Q9(e,t,n){let r=new or;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ne(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&he.get(n)===Ri)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Zs(r,xn)}function q9(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function fnt(e){return{fill:q9(e,"fill"),stroke:q9(e,"stroke")}}function dnt(e){return oe(e.fill)?OM:K_}function jy(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],w=i$(g,x,{round:he.get(g)===Ri?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:v=g==="fx"||g==="fy"?p:t,percent:_,transform:T,inset:A,insetTop:E=A!==void 0?A:g==="y"?r:0,insetRight:O=A!==void 0?A:g==="x"?i:0,insetBottom:I=A!==void 0?A:g==="y"?o:0,insetLeft:D=A!==void 0?A:g==="x"?s:0}=b||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?hnt(x,w):v,w.transform=T,g==="x"||g==="fx"?(w.insetLeft=+D,w.insetRight=+O):(g==="y"||g==="fy")&&(w.insetTop=+E,w.insetBottom=+I),y[g]=w}}return y}function P3(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=s$(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function e$(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Tv(t):t;i&&Z9(i,s),o&&K9(o,s);let a=i||o?$3(e,t):t;n&&Z9(n,a),r&&K9(r,a)}function hnt(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!os(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Iv(e){return Math.sign(ba(e.domain()))*Math.sign(ba(e.range()))}function Tv(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function $3({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tv(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function Z9(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],os(e)||(e.range=r$(e)),e.scale.range(e.range)}n$(e)}function K9(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],os(e)?e.range.reverse():e.range=r$(e),e.scale.range(e.range)}n$(e)}function n$(e){e.round===void 0&&ynt(e)&&pnt(e)<=30&&e.scale.round(!0)}function pnt({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function r$(e){let t=e.scale.domain().length+U3(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function Ev(e,t,n){return i$(e,n===void 0?void 0:[{hint:n}],{...t})}function i$(e,t=[],n={}){let r=mnt(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&os({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(ke)?Hn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${$d(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`):i.some(WP)?Hn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${$d(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`):i.some(XP)&&Hn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${$d(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${$d(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=Sv(t,n,nn);break;case"identity":switch(he.get(e)){case Ri:n=Sv(t,n,nn);break;case Nd:n=Sv(t,n,gnt);break}break;case"utc":case"time":n=Sv(t,n,s3);break}switch(r){case"diverging":return B9(e,t,n);case"diverging-sqrt":return P9(e,t,n);case"diverging-pow":return C3(e,t,n);case"diverging-log":return $9(e,t,n);case"diverging-symlog":return U9(e,t,n);case"categorical":case"ordinal":case Pd:return G9(e,t,n);case"cyclical":case"sequential":case"linear":return M9(e,t,n);case"sqrt":return O9(e,t,n);case"threshold":return _v(e,t,n);case"quantile":return R9(e,t,n);case"quantize":return L9(e,t,n);case"pow":return L3(e,t,n);case"log":return N9(e,t,n);case"symlog":return D9(e,t,n);case"utc":return V9(e,t,n);case"time":return j9(e,t,n);case"point":return W9(e,t,n);case"band":return X9(e,t,n);case"identity":return F9(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function $d(e){return typeof e=="symbol"?e.description:e}function J9(e){return typeof e=="string"?`${e}`.toLowerCase():e}var t$={toString:()=>"projection"};function mnt(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=J9(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=t$);for(let l of t){let u=J9(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===t$)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=he.get(e);if(c===wu)return"sqrt";if(c===vu||c===_u)return"linear";if(c===Nd)return"ordinal";if((r||i||[]).length>2)return B3(c);if(r!==void 0){if(De(r))return B3(c);if(ke(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(De))return B3(c);if(l.some(ke))return"utc"}if(c===ni){if(s!=null||E9(o))return"diverging";if(I9(o))return"categorical"}return"linear"}function B3(e){switch(e){case Ri:return"point";case ni:return Pd;default:return"ordinal"}}function os({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Pd}function U3({type:e}){return e==="threshold"}function ynt({type:e}){return e==="point"||e==="band"}function ri(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function Sv(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function gnt(e){return Wt(e,Dd)}function $c(e={}){let t;for(let n in e)if(he.has(n)&&Jo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=s$(Ev(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function o$(e){return t=>{if(!he.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function s$({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Lc(n),...r!==void 0&&{range:Lc(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function c$(e,t){let{fx:n,fy:r}=jy(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?Xb(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function l$(e,{x:t,y:n}){return t&&=Y3(t),n&&=Y3(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function Mv(e,{fx:t,fy:n}){let r=yr(e),i=t?.value,o=n?.value;return t&&n?no(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?no(r,s=>(s.fx=i[s[0]],s),s=>i[s]):no(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function u$(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function f$(e){let t=[],n=new Uint32Array(Fn(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var xnt=new Map([["top",z3],["right",q3],["bottom",j3],["left",V3],["top-left",Av(z3,V3)],["top-right",Av(z3,q3)],["bottom-left",Av(j3,V3)],["bottom-right",Av(j3,q3)],["top-empty",wnt],["right-empty",Snt],["bottom-empty",_nt],["left-empty",vnt],["empty",Int]]);function d$(e){if(e==null)return null;let t=xnt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var a$=new WeakMap;function Y3(e){let t=a$.get(e);return t||a$.set(e,t=new ir(Wt(e,(n,r)=>[n,r]))),t}function Uc(e,t){return Y3(e).get(t)}function bnt(e,t,n){return t=Ni(t),n=Ni(n),e.find(r=>Object.is(Ni(r.x),t)&&Object.is(Ni(r.y),n))}function Ov(e,t,n){return bnt(e,t,n)?.empty}function z3(e,{y:t},{y:n}){return t?Uc(t,n)===0:!0}function j3(e,{y:t},{y:n}){return t?Uc(t,n)===t.length-1:!0}function V3(e,{x:t},{x:n}){return t?Uc(t,n)===0:!0}function q3(e,{x:t},{x:n}){return t?Uc(t,n)===t.length-1:!0}function wnt(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,r);if(o>0)return Ov(e,n,t[o-1])}function _nt(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,r);if(o<t.length-1)return Ov(e,n,t[o+1])}function vnt(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,n);if(o>0)return Ov(e,t[o-1],r)}function Snt(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=Uc(t,n);if(o<t.length-1)return Ov(e,t[o+1],r)}function Int(e,t,{empty:n}){return n}function Av(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Nv(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var h$=Math.PI,Ma=2*h$,G3=.618;function p$({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(bn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=W3(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-r,g=f-p-m-n-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Tnt(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[v,_],[T,A]]=mn(e).bounds(c),E=Math.min(y/(T-v),g/(A-_));E>0?(x-=(E*(v+T)-y)/2,b-=(E*(_+A)-g)/2,w=ru({point(O,I){this.stream.point(O*E+x,I*E+b)}})):Hn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?m$():ru({point(v,_){this.stream.point(v+x,_+b)}}),{stream:v=>e.stream(w.stream(l(v)))}}function W3(e){switch(`${e}`.toLowerCase()){case"albers-usa":return ao(IA,.7463,.4673);case"albers":return Dv($m,.7463,.4673);case"azimuthal-equal-area":return ao(EA,4,4);case"azimuthal-equidistant":return ao(MA,Ma,Ma);case"conic-conformal":return Dv(DA,Ma,Ma);case"conic-equal-area":return Dv(vc,6.1702,2.9781);case"conic-equidistant":return Dv(LA,7.312,3.6282);case"equal-earth":return ao(kA,5.4133,2.6347);case"equirectangular":return ao(RA,Ma,h$);case"gnomonic":return ao(BA,3.4641,3.4641);case"identity":return{type:m$};case"reflect-y":return{type:Ent};case"mercator":return ao(OA,Ma,Ma);case"orthographic":return ao($A,2,2);case"stereographic":return ao(zA,2,2);case"transverse-mercator":return ao(VA,Ma,Ma);default:throw new Error(`unknown projection type: ${e}`)}}function Tnt(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return td(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function ao(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),r!=null&&(c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2])),c},aspectRatio:n/t}}function Dv(e,t,n){let{type:r,aspectRatio:i}=ao(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var m$=Ce({stream:e=>e}),Ent=Ce(ru({point(e,t){this.stream.point(e,-t)}}));function X3(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function y$({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(bn(e)&&(e=e.type),e!=null)}function g$(e){if(typeof e?.stream=="function")return G3;if(bn(e)){let t,n;if({domain:t,type:e,...n}=e,t!=null&&e!=null){let r=typeof e=="string"?W3(e).type:e,[[i,o],[s,a]]=mn(r({...n,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:G3}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=W3(e);if(t)return t}return G3}}function ss(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Fd(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&X3("x","y",o,n),r&&(o.x=nn(o.x)),i&&(o.y=nn(o.y)),o}function x$(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Qr(s,o);return[r,i]}function zc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:dv(n)}}function ct(e,{document:t}){return jt(ea(e).call(t.documentElement))}var Rv=Symbol("unset");function jc(e){return(e.length===1?Ant:Mnt)(e)}function Ant(e){let t,n=Rv;return r=>(Object.is(n,r)||(n=r,t=e(r)),t)}function Mnt(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>!Object.is(i,r[o])))&&(n=r,t=e(...r)),t)}var Ont=jc(e=>new Intl.NumberFormat(e)),Nnt=jc((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Dnt=jc((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function H3(e="en-US"){let t=Ont(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function b$(e="en-US",t="short"){let n=Nnt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function w$(e="en-US",t="short"){let n=Dnt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function Q3(e){return vd(e,"Invalid Date")}function Rnt(e="en-US"){let t=H3(e);return n=>(n instanceof Date?Q3:typeof n=="number"?t:Ye)(n)}var as=Rnt();var Be=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Lnt=0,Fnt=0;function Z3(){return`plot-clip-${++Lnt}`}function _$(){return`plot-pattern-${++Fnt}`}function Lv(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:T},{ariaLabel:A,fill:E="currentColor",fillOpacity:O,stroke:I="none",strokeOpacity:D,strokeWidth:k,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:N,paintOrder:L}){E===null&&(a=null,c=null),I===null&&(l=null,f=null),oe(E)?!oe(I)&&(!oe(a)||T?.fill)&&(I="none"):oe(I)&&(!oe(l)||T?.stroke)&&(E="none");let[B,C]=Fe(a,E),[P,$]=ae(c,O),[U,H]=Fe(l,I),[nt,ot]=ae(f,D),[at,G]=ae(g);Ia(H)||(u===void 0&&(u=k),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!QP(d)&&(p=N),!Ia(C)&&w===void 0&&(w=L));let[st,V]=ae(u);return E!==null&&(e.fill=be(C,"currentColor"),e.fillOpacity=Vy($,1)),I!==null&&(e.stroke=be(H,"none"),e.strokeWidth=Vy(V,1),e.strokeOpacity=Vy(ot,1),e.strokeLinejoin=be(d,"miter"),e.strokeLinecap=be(h,"butt"),e.strokeMiterlimit=Vy(p,4),e.strokeDasharray=be(m,"none"),e.strokeDashoffset=be(y,"0")),e.target=Ye(s),e.ariaLabel=Ye(A),e.ariaDescription=Ye(i),e.ariaHidden=Ye(o),e.opacity=Vy(G,1),e.mixBlendMode=be(x,"normal"),e.imageFilter=be(b,"none"),e.paintOrder=be(w,"normal"),e.pointerEvents=be(v,"auto"),e.shapeRendering=be(_,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:nt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function knt(e,t){t&&e.filter(n=>Ay(t[n])).append("title").call(Bnt,t)}function Cnt(e,t){t&&e.filter(([n])=>Ay(t[n])).append("title").call(Pnt,t)}function Bnt(e,t){t&&e.text(n=>as(t[n]))}function Pnt(e,t){t&&e.text(([n])=>as(t[n]))}function Yt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&S$(e,d=>f[d],t),n||knt(e,i)}function Su(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&S$(e,([d])=>f[d],t),n||Cnt(e,i)}function $nt({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function qy(e,t,n){let r=Rn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Hn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*Fv(e,t,n,r){let{z:i}=n,{z:o}=r,s=$nt(r,n),a=[...t,...s];for(let c of o?qy(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ne(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Ni(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Ni(s[d][f])!==l[d]){yield u,l=s.map(p=>Ni(p[f])),u=[f];continue t}}u&&(yield u)}}function Unt(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{e=ct("svg:g",r).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=znt(r,n);break}case"sphere":{i=jnt(r);break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function v$(e){let t=new WeakMap;return(n,r)=>{let i=t.get(n);if(!i){let o=Z3();jt(n.ownerSVGElement).append("clipPath").attr("id",o).call(e,n,r),t.set(n,i=`url(#${o})`)}return i}}var znt=v$((e,t,n)=>{let{width:r,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:c}=n;e.append("rect").attr("x",o).attr("y",a).attr("width",r-s-o).attr("height",i-a-c)}),jnt=v$((e,t)=>{let{projection:n}=t;if(!n)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",mn(n)({type:"Sphere"}))});function Rt(e,t,n,r){Unt(e,t,n,r),ft(e,"class",t.className),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function It(e,t){Vnt(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function S$(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ar.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ar.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function Vnt(e,t,n){n!=null&&e.style(t,n)}function Et(e,t,{x:n,y:r},i=Be,o=Be){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function be(e,t){if((e=Ye(e))!==t)return e}function Vy(e,t){if((e=ee(e))!==t)return e}var qnt=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Vc(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!qnt.test(e))throw new Error(`invalid class name: ${e}`);return e}function Ud(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function vn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}var xt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,className:g,clip:x=i?.clip,channels:b,tip:w,render:v}=r;if(this.data=t,this.sort=ts(l)?l:null,this.initializer=xe(r).initializer,this.transform=this.initializer?r.transform:rn(r).transform,o===null||o===!1?this.facet=null:(this.facet=un(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Dc&&typeof a=="string"?[a]:a,this.fy=t===Dc&&typeof c=="string"?[c]:c),this.facetAnchor=d$(s),n=Fy(n),b!==void 0&&(n={...Ynt(b),...n}),i!==void 0&&(n={...Lv(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,T])=>{if(ei(T.value)){let{value:A,label:E=T.label,scale:O=T.scale}=T.value;T={...T,label:E,scale:O,value:A}}if(t===Dc&&typeof T.value=="string"){let{value:A}=T;T={...T,value:[A]}}return[_,T]}).filter(([_,{value:T,optional:A}])=>{if(T!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${_}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=dv(x),this.tip=Gnt(w),this.className=g?Vc(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:T}=n[_];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=Oa(v,this.render))}initialize(t,n,r){let i=wa(this.data);t===void 0&&i!=null&&(t=[yr(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=wa(i)),t!==void 0&&(t.original=o);let s=wv(this.channels,i);return this.sort!=null&&y9(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ne}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&X3(i,o,n,r.projection)}}scale(t,n,r){let i=Fd(t,n);return r.projection&&this.project(t,i,r),i}};function on(...e){return e.plot=xt.prototype.plot,e}function Oa(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function Ynt(e){return Object.fromEntries(Object.entries(Fy(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:Di(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function Gnt(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?un(e,"tip",["x","y","xy"]):e}function co(e,t){return e?.tip===!0?{...e,tip:t}:bn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function T$(e,t,n={}){let r=.5-Be,i=.5+Be,o=.5+Be,s=.5-Be;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>r&&(r=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=Wnt(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function Wnt({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n&&n.scale.domain().length||1,d=g$(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?os(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=I$("y",t)/(I$("x",e)*o),m=r?r.scale.bandwidth():1,y=n?n.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function I$(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ne(r);return Math.abs(i(s)-i(o))}var E$=new WeakMap;function K3(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:Oa(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=E$.get(y);x||E$.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(H)-1,{x:w,y:v,fx:_,fy:T}=f,A=_?_(u.fx)-h.marginLeft:0,E=T?T(u.fy)-h.marginTop:0;w?.bandwidth&&(A+=w.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let O=u.fi!=null,I;if(O){let G=x.facetStates;G||(x.facetStates=G=new Map),I=G.get(this),I||G.set(this,I=new Map)}let[D,k]=vn(this,h),{px:S,py:M}=d,N=S?G=>S[G]:J3(d,D),L=M?G=>M[G]:t6(d,k),B,C,P,$;function U(G,st){if(O)if($&&($=cancelAnimationFrame($)),G==null)I.delete(u.fi);else{I.set(u.fi,st),$=requestAnimationFrame(()=>{$=null;for(let[V,Q]of I)if(Q<st||Q===st&&V<u.fi){G=null;break}H(G)});return}H(G)}function H(G){if(B===G&&P===x.sticky)return;B=G,P=p.pointerSticky=x.sticky;let st=B==null?[]:[B];O&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let V=m(st,f,d,h,p);if(C){if(O){let Q=C.parentNode,rt=C.getAttribute("transform"),z=V.getAttribute("transform");rt?V.setAttribute("transform",rt):V.removeAttribute("transform"),z?Q.setAttribute("transform",z):Q.removeAttribute("transform"),V.removeAttribute("aria-label"),V.removeAttribute("aria-description"),V.removeAttribute("aria-hidden")}C.replaceWith(V)}if(x.roots[b]=C=V,!(B==null&&I?.size>1)){let Q=B==null?null:Rr(g)?g[B]:g.get(B);p.dispatchValue(Q)}return V}function nt(G){if(x.sticky||G.pointerType==="mouse"&&G.buttons===1)return;let[st,V]=zn(G);st-=A,V-=E;let Q=st<h.marginLeft||st>h.width-h.marginRight?1:e,rt=V<h.marginTop||V>h.height-h.marginBottom?1:t,z=null,Ct=s*s;for(let ht of u){let Xt=Q*(N(ht)-st),Zt=rt*(L(ht)-V),tt=Xt*Xt+Zt*Zt;tt<=Ct&&(z=ht,Ct=tt)}if(z!=null&&(e!==1||t!==1)){let ht=N(z)-st,Xt=L(z)-V;Ct=ht*ht+Xt*Xt}U(z,Ct)}function ot(G){G.pointerType==="mouse"&&B!=null&&(x.sticky&&x.roots.some(st=>st?.contains(G.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,H(B)),G.stopImmediatePropagation()))}function at(G){G.pointerType==="mouse"&&(x.sticky||U(null))}return y.addEventListener("pointerenter",nt),y.addEventListener("pointermove",nt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),H(null)},c)}}function qc(e){return K3(1,1,e)}function Yc(e){return K3(1,.01,e)}function Na(e){return K3(.01,1,e)}function J3({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function t6({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kv(e){return os(e)&&e.interval===void 0?void 0:"tabular-nums"}function A$(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=kv(e),round:p=!0,opacity:m,className:y}=t,g=zc(t);y=Vc(y),m=ae(m)[1],d===null&&(d=()=>null);let x=ct("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(D=>D.append("style").text(`:where(.${y}-ramp) {
|
|
13
|
+
${r}`:e==="top"?(t,r)=>`${r}
|
|
14
|
+
${t}`:(t,r)=>`${t}
|
|
15
|
+
${r}`}function $nt(e){return e==="time"?J2:e==="utc"?qg:Pnt}function o$(e,t,r){let n=Kt(H_(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return r$("millisecond","utc",r);for(let[i,o,s,a]of $nt(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return r$(i,s,r)}}function mh(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-Ga(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var Yg=Object.getPrototypeOf(Uint8Array),znt=Object.prototype.toString;function Qn(e){return e instanceof Array||e instanceof Yg}function a$(e){return e instanceof Yg&&!jnt(e)}function c$(e){return e?.prototype instanceof Yg&&!qnt(e)}function jnt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function qnt(e){return e===BigInt64Array||e===BigUint64Array}var h4=Symbol("reindex");function _t(e,t,r){let n=typeof t;return n==="string"?_$(e)?p4(e.getChild(t),r):s$(e,m4(t),r):n==="function"?s$(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Xt(e,Ye(t),r):typeof t?.transform=="function"?d4(t.transform(e),r):Vnt(d4(t,r),e?.[h4])}function Vnt(e,t){return e!=null&&t?Gg(e,t):e}function s$(e,t,r){return Xt(e,c$(r)?(n,i)=>y4(t(n,i)):t,r)}function d4(e,t){return t===void 0?xi(e):w$(e)?p4(e,t):e instanceof t?e:t.from(e,c$(t)&&!a$(e)?y4:void 0)}function p4(e,t){return e==null?e:(t===void 0||t===Array)&&Gnt(e.type)?g4(e.toArray()):d4(e.toArray(),t)}var il=[null],m4=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},Ee={transform:Cn},G={transform:e=>e};var Wg=()=>1,l$=()=>!0,rr=e=>e==null?e:`${e}`,ie=e=>e==null?e:+e;var Ju=e=>e?e[0]:void 0,ol=e=>e?e[1]:void 0,u$=e=>e?e[2]:void 0,Ye=e=>()=>e;function xh(e){let t=+`${e}`.slice(1)/100;return(r,n)=>Tn(r,t,n)}function pr(e){return a$(e)?e:Xt(e,y4,Float64Array)}function y4(e){return e==null?NaN:Number(e)}function g4(e){return Xt(e,x4)}function x4(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?jg(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function qe(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:ll(e)?[void 0,e]:[e,void 0]}function ye(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function b4(e,t,r){if(e!=null)return Sr(e,t,r)}function Sr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Xa(e){return _$(e)?e:xi(e)}function xi(e){if(e==null||Qn(e))return e;if(w$(e))return p4(e);switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return[e]}return Array.from(e)}function Xt(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function sl(e,t=Array){return e instanceof t?e.slice():t.from(e)}function _4({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function w4({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Ha(e){return _4(e)||w4(e)||e.interval!==void 0}function kr(e){return e?.toString===znt}function vs(e){return kr(e)&&(e.type!==void 0||e.domain!==void 0)}function bi(e){return kr(e)&&typeof e.transform!="function"}function Ss(e){return bi(e)&&e.value===void 0&&e.channel===void 0}function v4(e,t,r,n=G){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function Ke(e,t){return e===void 0&&t===void 0?[Ju,ol]:[e,t]}function pn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=qe(t)),e===void 0&&([e]=qe(r)),e}function al(e){return Qn(e)?e.length:e?.numRows}function Cn(e){let t=al(e),r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function Gg(e,t){return Qn(e)?Xt(t,r=>e[r],e.constructor):Xt(t,r=>e.at(r))}function bh(e){return e.length===1?(t,r)=>e(Gg(r,t)):e}function Qa(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Zi(e){return e!==null&&typeof e=="object"?e.valueOf():e}function rS(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function Br(e){let t;return[{transform:()=>t,label:en(e)},r=>t=r]}function tn(e){return e==null?[e]:Br(e)}function en(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function _h(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return Ve(n)||Ve(i)?Xt(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):Xt(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function tf(e,t){let r=S4(t?.interval,t?.type);return r?Xt(e,r):e}function S4(e,t){let r=wh(e,t);return r&&(n=>Pe(n)?r.floor(n):n)}function wh(e,t){if(e!=null){if(typeof e=="number")return I4(e);if(typeof e=="string")return(t==="time"?Vg:Ku)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function I4(e){e=+e,0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let t=Math.abs(e);return e<0?{floor:r=>Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>er(Math.ceil(r*t),n*t).map(i=>i/t)}:{floor:r=>Math.floor(r/t)*t,offset:(r,n=1)=>r+t*Math.floor(n),range:(r,n)=>er(Math.ceil(r/t),n/t).map(i=>i*t)}}function Is(e,t){if(e=wh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function f$(e,t){if(e=Is(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function d$(e){return cl(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function cl(e){return typeof e?.range=="function"}function Ki(e){return e===void 0||bi(e)?e:{value:e}}function h$(e){return e==null?null:{transform:t=>_t(t,e,Float64Array),label:en(e)}}function p$(e){if(!kn(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function kn(e){return e&&typeof e[Symbol.iterator]=="function"}function nS(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ue(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Ve(e){for(let t of e)if(t!=null)return t instanceof Date}function m$(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&jg(t)}function y$(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Za(e){for(let t of e)if(t!=null)return typeof t=="number"}function iS(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Ynt=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function ll(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||Ynt.has(e))}function g$(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function fe(e){return e==null||Ka(e)}function Ka(e){return/^\s*none\s*$/i.test(e)}function x$(e){return/^\s*round\s*$/i.test(e)}function oS(e,t){return b4(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Ts(e="middle"){return oS(e,"frameAnchor")}function b$(e={},...t){let r=e;for(let n of t)for(let i in n)if(r[i]===void 0){let o=n[i];r===e?r={...r,[i]:o}:r[i]=o}return r}function Wnt(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let i=`${n}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[n,r]}))}function Xg(e){return kn(e)?Wnt(e):e}function sS(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Sr(e,"clip",["frame","sphere"])),e}function _$(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function w$(e){return e&&typeof e.toArray=="function"&&e.type}function Gnt(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Ji=Symbol("position"),_i=Symbol("color"),ef=Symbol("radius"),rf=Symbol("length"),nf=Symbol("opacity"),vh=Symbol("symbol"),v$=Symbol("projection"),_e=new Map([["x",Ji],["y",Ji],["fx",Ji],["fy",Ji],["r",ef],["color",_i],["opacity",nf],["symbol",vh],["length",rf],["projection",v$]]);function S$(e){return e===Ji||e===v$}function I$(e){return e===Ji||e===ef||e===rf||e===nf}var T4=Math.sqrt(3),A4=2/T4,Xnt={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*A4,i=n/2;e.moveTo(0,n),e.lineTo(r,i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-r,i),e.closePath()}},E4=new Map([["asterisk",Ag],["circle",Ya],["cross",Eg],["diamond",Mg],["diamond2",Ng],["hexagon",Xnt],["plus",Og],["square",Rg],["square2",Dg],["star",Lg],["times",lh],["triangle",Fg],["triangle2",Cg],["wye",kg]]);function M4(e){return e&&typeof e.draw=="function"}function T$(e){return M4(e)?!0:typeof e!="string"?!1:E4.has(e.toLowerCase())}function Sh(e){if(e==null||M4(e))return e;let t=E4.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function A$(e){if(e==null||M4(e))return[void 0,e];if(typeof e=="string"){let t=E4.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mr({filter:e,sort:t,reverse:r,transform:n,initializer:i,...o}={},s){if(n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=N4(n,L4(t))),r&&(n=N4(n,D4))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Ss(t))&&{sort:t},transform:N4(n,s)}}function Ne({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=R4(e)),t!=null&&!Ss(t)&&(n=O4(n,L4(t))),r&&(n=O4(n,D4))),{...i,...(t===null||Ss(t))&&{sort:t},initializer:O4(n,o)}}function N4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i){return{data:r,facets:n}=e.call(this,r,n,i),t.call(this,Xa(r),n,i)}}function O4(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i,...o){let s,a,c,l,u,f;return{data:a=r,facets:c=n,channels:s}=e.call(this,r,n,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function aS(e,t){return(e.initializer!=null?Ne:mr)(e,t)}function E$(e,t){return aS(t,R4(e))}function R4(e){return(t,r)=>{let n=_t(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function M$({sort:e,...t}={}){return{...aS(t,D4),sort:Ss(e)?e:null}}function D4(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function N$({seed:e,sort:t,...r}={}){return{...aS(r,O$(e==null?Math.random:$u(e))),sort:Ss(t)?t:null}}function cS(e,{sort:t,...r}={}){return{...(bi(e)&&e.channel!==void 0?Ne:aS)(r,L4(e)),sort:Ss(t)?t:null}}function L4(e){return(typeof e=="function"&&e.length!==1?Hnt:O$)(e)}function Hnt(e){return(t,r)=>{let n=Qn(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:r.map(i=>i.slice().sort(n))}}}function O$(e){let t,r;({channel:t,value:e,order:r}={...Ki(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Qu:Cr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Cr;break;case"descending":r=Qu;break;default:throw new Error(`invalid order: ${r}`)}return(i,o,s)=>{let a;if(t===void 0)a=_t(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>r(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Qg(e,t){return lS(null,null,e,t)}function ul(e={y:"count"},t={}){let{x:r=G}=t;if(r==null)throw new Error("missing channel: x");return lS(r,null,e,t)}function fl(e={x:"count"},t={}){let{y:r=G}=t;if(r==null)throw new Error("missing channel: y");return lS(null,r,e,t)}function Zg(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=Ke(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return lS(r,n,e,t)}function lS(e,t,{data:r=dS,filter:n,sort:i,reverse:o,...s}={},a={}){s=C4(s,a),r=C$(r,G),i=i==null?void 0:L$("sort",i,a),n=n==null?void 0:F$("filter",n,a);let[c,l]=tn(e),[u,f]=tn(t),{z:d,fill:h,stroke:p,x1:m,x2:y,y1:g,y2:x,...b}=a,[_,v]=tn(d),[w]=qe(h),[T]=qe(p),[A,E]=tn(w),[N,I]=tn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:N||p},...mr(b,(R,C,S)=>{let M=tf(_t(R,e),S?.x),O=tf(_t(R,t),S?.y),L=_t(R,d),B=_t(R,w),k=_t(R,T),P=Kg(s,{z:L,fill:B,stroke:k}),U=[],$=[],X=M&&l([]),rt=O&&f([]),ot=L&&v([]),at=B&&E([]),Y=k&&I([]),st=0;for(let q of s)q.initialize(R);i&&i.initialize(R),n&&n.initialize(R);for(let q of C){let H=[];for(let nt of s)nt.scope("facet",q);i&&i.scope("facet",q),n&&n.scope("facet",q);for(let[nt,z]of As(q,P))for(let[Pt,ht]of As(z,O))for(let[Zt,Jt]of As(ht,M)){let tt={data:R};if(M&&(tt.x=Zt),O&&(tt.y=Pt),P&&(tt.z=nt),!(n&&!n.reduce(Jt,tt))){H.push(st++),$.push(r.reduceIndex(Jt,R,tt)),M&&X.push(Zt),O&&rt.push(Pt),L&&ot.push(P===L?nt:L[Jt[0]]),B&&at.push(P===B?nt:B[Jt[0]]),k&&Y.push(P===k?nt:k[Jt[0]]);for(let ge of s)ge.reduce(Jt,tt);i&&i.reduce(Jt,tt)}}U.push(H)}return k4(U,i,o),{data:$,facets:U}}),...!Es(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Es(s,"y")&&(u?{y:u}:{y1:g,y2:x}),...Object.fromEntries(s.map(({name:R,output:C})=>[R,C]))}}function Es(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function F4(e,t,r=uS){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",eit]),t.href!=null&&e.href===void 0&&n.push(["href",hS]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?Qnt(i):r(i,o,t))}function uS(e,t,r,n=fS){let i;kr(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=Br(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function Qnt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function fS(e,t,r,n=Ih){let i=rS(e,r),o=n(t,i),s,a;return{label:en(o===Hg?null:i,o.label),initialize(c){s=i===void 0?c:_t(c,i),o.scope==="data"&&(a=o.reduceIndex(Cn(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function As(e,t){return t?Hr(e,r=>t[r]):[[,e]]}function Ih(e,t,r=Znt){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&kr(e))return Jnt(e);if(typeof e=="function")return tit(e);if(/^p\d{2}$/i.test(e))return Ja(xh(e));switch(`${e}`.toLowerCase()){case"first":return hS;case"last":return rit;case"identity":return dS;case"count":return Hg;case"distinct":return nit;case"sum":return t==null?Hg:iit;case"proportion":return D$(t,"data");case"proportion-facet":return D$(t,"facet");case"deviation":return Ja(zi);case"min":return Ja(Ht);case"min-index":return Ja(W_);case"max":return Ja(Kt);case"max-index":return Ja(Y_);case"mean":return R$(Ea);case"median":return R$(Eo);case"variance":return Ja(Pc);case"mode":return Ja(Ed)}return r(e)}function Znt(e){throw new Error(`invalid reduce: ${e}`)}function C4(e,t){return F4(e,t,L$)}function L$(e,t,r){return uS(e,t,r,F$)}function F$(e,t,r){return fS(e,t,r,C$)}function C$(e,t){return Ih(e,t,Knt)}function Knt(e){switch(`${e}`.toLowerCase()){case"x":return oit;case"y":return sit;case"z":return B4}throw new Error(`invalid group reduce: ${e}`)}function Kg(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function k4(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Cr(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function Jnt(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function tit(e){return{reduceIndex(t,r,n){return e(Gg(r,t),n)}}}function Ja(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function R$(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return Ve(r)?new Date(n):n}}}var dS={reduceIndex(e,t){return Gg(t,e)}},hS={reduceIndex(e,t){return t[e[0]]}},eit={reduceIndex(e,t){let n=Ta(Ao(e,o=>o.length,o=>t[o]),ol),i=n.slice(-5).reverse();if(i.length<n.length){let o=n.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Zr(o,ol)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
|
|
16
|
+
`)}},rit={reduceIndex(e,t){return t[e[e.length-1]]}},Hg={label:"Frequency",reduceIndex(e){return e.length}},nit={label:"Distinct",reduceIndex(e,t){let r=new In;for(let n of e)r.add(t[n]);return r.size}},iit=Ja(Zr);function D$(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>Zr(r,o=>n[o])/i}}var oit={reduceIndex(e,t,{x:r}){return r}},sit={reduceIndex(e,t,{y:r}){return r}},B4={reduceIndex(e,t,{z:r}){return r}};function k$(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(Qn(n)?i=>e(n[i],i,n):i=>e(n.get(i),i,n))]}}}function Th(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=en(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),U4(a,{scale:t,type:r,value:_t(e,n),label:s,filter:i,hint:o})}function pS(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Th(t,n,r)]))}function Ah(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[n,s==null?o:Xt(o,s)]}));return r.channels=e,r}function U4(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&iS(n,ll)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&iS(n,g$)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&iS(n,T$)?(t.scale=null,t.value=Xt(n,Sh)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=_e.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!_e.has(r))throw new Error(`unknown scale: ${r}`);return t}function P$(e,t,r,n,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!_e.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Ki(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?$$:U$:lit(f),h==null||h===!1)continue;let y=l==="fx"||l==="fy"?cit(t,n[l]):ait(r,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[x=0,b=1/0]=kn(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let _=Array.from(new In(g));return d&&(_=_.reverse()),(x!==0||b!==1/0)&&(_=_.slice(x,b)),_};else{let _=u==="data"?e:u==="height"?B$(r,"y1","y2"):u==="width"?B$(r,"x1","x2"):P4(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Ih(h===!0?"max":h,_);y.domain=()=>{let w=lM(Cn(g),T=>v.reduceIndex(T,_),T=>g[T]);return f&&w.sort(f),d&&w.reverse(),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w.map(Ju)}}}}function ait(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function cit(e,t){let r=e.original;if(r===e)return t;let n=t.value,i=t.value=[];for(let o=0;o<r.length;++o){let s=n[r[o][0]];for(let a of e[o])i[a]=s}return t}function B$(e,t,r){let n=P4(e,t),i=P4(e,r);return Xt(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function P4(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function lit(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return U$;case"descending":return $$}throw new Error(`invalid order: ${e}`)}function U$([e,t],[r,n]){return Cr(t,n)||Cr(e,r)}function $$([e,t],[r,n]){return Qu(t,n)||Cr(e,r)}function Jg(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var Y$=new Map([["accent",I6],["category10",S6],["dark2",T6],["observable10",A6],["paired",E6],["pastel1",M6],["pastel2",N6],["set1",O6],["set2",R6],["set3",D6],["tableau10",L6]]);function W$(e){return e!=null&&Y$.has(`${e}`.toLowerCase())}var z$=new Map([...Y$,["brbg",tc(Rv,Dv)],["prgn",tc(Lv,Fv)],["piyg",tc(Cv,kv)],["puor",tc(Bv,Pv)],["rdbu",tc(vg,ih)],["rdgy",tc(Uv,$v)],["rdylbu",tc(Sg,oh)],["rdylgn",tc(zv,jv)],["spectral",tc(qv,Vv)],["burd",j$(vg,ih)],["buylrd",j$(Sg,oh)],["blues",Pr(m2,y2)],["greens",Pr(g2,x2)],["greys",Pr(b2,_2)],["oranges",Pr(T2,A2)],["purples",Pr(w2,v2)],["reds",Pr(S2,I2)],["turbo",ec(C2)],["viridis",ec(B2)],["magma",ec(P2)],["inferno",ec(U2)],["plasma",ec($2)],["cividis",ec(E2)],["cubehelix",ec(M2)],["warm",ec(O2)],["cool",ec(R2)],["bugn",Pr(Yv,Wv)],["bupu",Pr(Gv,Xv)],["gnbu",Pr(Hv,Qv)],["orrd",Pr(Zv,Kv)],["pubu",Pr(e2,r2)],["pubugn",Pr(Jv,t2)],["purd",Pr(n2,i2)],["rdpu",Pr(o2,s2)],["ylgn",Pr(l2,u2)],["ylgnbu",Pr(a2,c2)],["ylorbr",Pr(f2,d2)],["ylorrd",Pr(h2,p2)],["rainbow",q$(D2)],["sinebow",q$(F2)]]);function Pr(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?cn(t,r):e[r])}function tc(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?cn(t,r):e[r])}function j$(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?cn(n=>t(1-n),r):e[r].slice().reverse())}function ec(e){return({length:t})=>cn(e,Math.max(2,Math.floor(t)))}function q$(e){return({length:t})=>cn(e,Math.floor(t)+1).slice(0,-1)}function $4(e){let t=`${e}`.toLowerCase();if(!z$.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return z$.get(t)}function t0(e,t){let r=$4(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function G$(e,t="greys"){let r=new Set,[n,i]=t0(t,2);for(let o of e)if(o!=null)if(o===!0)r.add(i);else if(o===!1)r.add(n);else return;return[...r]}var V$=new Map([["brbg",Dv],["prgn",Fv],["piyg",kv],["puor",Pv],["rdbu",ih],["rdgy",$v],["rdylbu",oh],["rdylgn",jv],["spectral",Vv],["burd",e=>ih(1-e)],["buylrd",e=>oh(1-e)],["blues",y2],["greens",x2],["greys",_2],["purples",v2],["reds",I2],["oranges",A2],["turbo",C2],["viridis",B2],["magma",P2],["inferno",U2],["plasma",$2],["cividis",E2],["cubehelix",M2],["warm",O2],["cool",R2],["bugn",Wv],["bupu",Xv],["gnbu",Qv],["orrd",Kv],["pubugn",t2],["pubu",r2],["purd",i2],["rdpu",s2],["ylgnbu",c2],["ylgn",u2],["ylorbr",d2],["ylorrd",p2],["rainbow",D2],["sinebow",F2]]);function Eh(e){let t=`${e}`.toLowerCase();if(!V$.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return V$.get(t)}var uit=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function X$(e){return e!=null&&uit.has(`${e}`.toLowerCase())}var j4=e=>t=>e(1-t),z4=[0,1],H$=new Map([["number",Fe],["rgb",ji],["hsl",CM],["hcl",kM],["lab",pw]]);function q4(e){let t=`${e}`.toLowerCase();if(!H$.has(t))throw new Error(`unknown interpolator: ${t}`);return H$.get(t)}function Nh(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=nz(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=_e.get(e)===ef?pit(r,a):_e.get(e)===rf?mit(r,a):_e.get(e)===nf?z4:void 0,interpolate:h=_e.get(e)===_i?u==null&&d!==void 0?ji:Eh(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?Nu:Fe,reverse:p}){if(f=Is(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=q4(h)),p=!!p,d!==void 0){let m=(a=xi(a)).length,y=(d=xi(d)).length;if(m!==y){if(h.length===1)throw new Error("invalid piecewise interpolator");h=ss(h,d),d=void 0}}if(h.length===1?(p&&(h=j4(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,y)=>y/(a.length-1)),d.length===2&&(d=z4)),t.interpolate((d===z4?Ye:e0)(h))):t.interpolate(h),s){let[m,y]=ce(a);(m>0||y<0)&&(a=sl(a),(Ga(a)||1)===Math.sign(m)?a[0]=0:a[a.length-1]=0)}return p&&(a=$c(a)),t.domain(a).unknown(c),i&&(t.nice(fit(i,n)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:n,domain:a,range:d,scale:t,interpolate:h,interval:f}}function fit(e,t){return e===!0?void 0:typeof e=="number"?e:f$(e,t)}function Q$(e,t,r){return Nh(e,Ba(),t,r)}function Z$(e,t,r){return V4(e,t,{...r,exponent:.5})}function V4(e,t,{exponent:r=1,...n}){return Nh(e,fg().exponent(r),t,{...n,type:"pow"})}function K$(e,t,{base:r=10,domain:n=yit(t),...i}){return Nh(e,lg().base(r),t,{...i,domain:n})}function J$(e,t,{constant:r=1,...n}){return Nh(e,ug().constant(r),t,n)}function tz(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=git(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?cn(c,i):_e.get(e)===_i?t0(o,i):void 0),s.length>0&&(s=dg(s,r===void 0?{length:i}:r).quantiles()),mS(e,t,{domain:s,range:r,reverse:l,unknown:a})}function ez(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=nz(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ce(o),f;return r===void 0?(f=Qr(l,u,n),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),n=f.length+1,r=a!==void 0?cn(a,n):_e.get(e)===_i?t0(i,n):void 0):(f=cn(Fe(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Ga(xi(o))<0&&f.reverse(),mS(e,t,{domain:f,range:r,reverse:c,unknown:s})}function mS(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?cn(o,r.length+1):_e.get(e)===_i?t0(i,r.length+1):void 0,reverse:a}){r=xi(r);let c=Ga(r);if(!isNaN(c)&&!dit(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=$c(s)),{type:"threshold",scale:hg(c<0?$c(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function dit(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=vn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function rz(e){return{type:"identity",scale:I$(_e.get(e))?ag():t=>t}}function Mh(e,t=hh){return e.length?[Ht(e,({value:r})=>r===void 0?r:Ht(r,t)),Kt(e,({value:r})=>r===void 0?r:Kt(r,t))]:[0,1]}function nz(e,t){let r=_e.get(e);return(r===ef||r===nf||r===rf?hit:Mh)(t)}function hit(e){return[0,e.length?Kt(e,({value:t})=>t===void 0?t:Kt(t,hh)):1]}function pit(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=Tn(e,.5,({value:s})=>s===void 0?NaN:Tn(s,.25,Fn)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/Kt(i);return o<1?i.map(s=>s*o):i}function mit(e,t){let r=Eo(e,({value:o})=>o===void 0?NaN:Eo(o,Math.abs)),n=t.map(o=>12*o/r),i=60/Kt(n);return i<1?n.map(o=>o*i):n}function yit(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Mh(e,Fn);if(r<0)return Mh(e,tl)}return[1,10]}function git(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function e0(e){return(t,r)=>n=>e(t+n*(r-t))}var Y4=0,W4;function iz(){let e=Y4;return Y4=0,W4=void 0,e}function mn(e){e!==W4&&(W4=e,console.warn(e),++Y4)}function yS(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Mh(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=_e.get(e)===_i?u==null&&f!==void 0?ji:Eh(u!==void 0?u:"rdbu"):Fe,reverse:p}){l=+l,a=xi(a);let[m,y]=a;if(a.length>2&&mn(`Warning: the diverging ${e} scale domain contains extra elements.`),vn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof h!="function"&&(h=q4(h)),f!==void 0&&(h=h.length===1?e0(h)(...f):ss(h,f)),p&&(h=j4(h)),d){let g=r.apply(l),x=g-r.apply(m),b=r.apply(y)-g;x<b?m=r.invert(g-b):x>b&&(y=r.invert(g+x))}return t.domain([m,l,y]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:h,scale:t}}function oz(e,t,r){return yS(e,wg(),xit,t,r)}function sz(e,t,r){return G4(e,t,{...r,exponent:.5})}function G4(e,t,{exponent:r=1,...n}){return yS(e,Ov().exponent(r=+r),wit(r),t,{...n,type:"diverging-pow"})}function az(e,t,{base:r=10,pivot:n=1,domain:i=Mh(t,n<0?tl:Fn),...o}){return yS(e,Mv().base(r=+r),bit,t,{domain:i,pivot:n,...o})}function cz(e,t,{constant:r=1,...n}){return yS(e,Nv().constant(r=+r),vit(r),t,n)}var xit={apply(e){return e},invert(e){return e}},bit={apply:Math.log,invert:Math.exp},_it={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function wit(e){return e===.5?_it:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function vit(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function lz(e,t,r,n){return Nh(e,t,r,n)}function uz(e,t,r){return lz(e,Tv(),t,r)}function fz(e,t,r){return lz(e,Av(),t,r)}var Oh=Symbol("ordinal");function hz(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Is(i,n),o===void 0&&(o=xz(r,i,e)),(n==="categorical"||n===Oh)&&(n="ordinal"),a&&(o=$c(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:n,domain:o,range:s,scale:t,hint:c,interval:i}}function pz(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=Is(n,r),i===void 0&&(i=xz(t,n,e));let l;if(_e.get(e)===vh)l=Sit(t),o=o===void 0?Iit(l):Xt(o,Sh);else if(_e.get(e)===_i&&(o===void 0&&(r==="ordinal"||r===Oh)&&(o=G$(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=r==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=Eh(s),f=o[0],d=o[1]-o[0];o=({length:h})=>cn(p=>u(f+d*p),h)}else o=$4(s);if(a===og)throw new Error(`implicit unknown on ${e} scale is not supported`);return hz(e,zu().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function mz(e,t,{align:r=.5,padding:n=.5,...i}){return gz(a6().align(r).padding(n),t,i,e)}function yz(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return gz(Zc().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function gz(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=hz(n,e,t,r),e.round=i,e}function xz(e,t,r){let n=new In;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)n.add(s)}if(t!==void 0){let[i,o]=ce(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&_e.get(r)===Ji)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Ta(n,Cr)}function dz(e,t){let r;for(let{hint:n}of e){let i=n?.[t];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}function Sit(e){return{fill:dz(e,"fill"),stroke:dz(e,"stroke")}}function Iit(e){return fe(e.fill)?$6:W2}function r0(e,{label:t,inset:r=0,insetTop:n=r,insetRight:i=r,insetBottom:o=r,insetLeft:s=r,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let y={};for(let[g,x]of e){let b=m[g],_=Az(g,x,{round:_e.get(g)===Ji?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(_){let{label:v=g==="fx"||g==="fy"?p:t,percent:w,transform:T,inset:A,insetTop:E=A!==void 0?A:g==="y"?n:0,insetRight:N=A!==void 0?A:g==="x"?i:0,insetBottom:I=A!==void 0?A:g==="y"?o:0,insetLeft:R=A!==void 0?A:g==="x"?s:0}=b||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?Tit(x,_):v,_.transform=T,g==="x"||g==="fx"?(_.insetLeft=+R,_.insetRight=+N):(g==="y"||g==="fy")&&(_.insetTop=+E,_.insetBottom=+I),y[g]=_}}return y}function H4(e){let t={},r={scales:t};for(let[n,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[n]=Mz(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Sz(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?bS(t):t;i&&bz(i,s),o&&_z(o,s);let a=i||o?Q4(e,t):t;r&&bz(r,a),n&&_z(n,a)}function Tit(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!Ms(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function xS(e){return Math.sign(Ga(e.domain()))*Math.sign(Ga(e.range()))}function bS(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(r,c),marginBottom:Math.max(n,l),marginLeft:Math.max(i,u),width:o,height:s}}function Q4({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=bS(r);return{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+n+o:c,facet:{width:a,height:c}}}function bz(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+r,c=i-s-n;e.range=[a,Math.max(a,c)],Ms(e)||(e.range=Tz(e)),e.scale.range(e.range)}Iz(e)}function _z(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+r,c=i-s-n;e.range=[Math.max(a,c),a],Ms(e)?e.range.reverse():e.range=Tz(e),e.scale.range(e.range)}Iz(e)}function Iz(e){e.round===void 0&&Mit(e)&&Ait(e)<=30&&e.scale.round(!0)}function Ait({scale:e}){let t=e.domain().length,[r,n]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(n-r)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function Tz(e){let t=e.scale.domain().length+Z4(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(i,o)=>r+o/(t-1)*(n-r))}function _S(e,t,r){return Az(e,r===void 0?void 0:[{hint:r}],{...t})}function Az(e,t=[],r={}){let n=Eit(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Ms({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ve)?mn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Rh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`):i.some(m$)?mn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Rh(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`):i.some(y$)&&mn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Rh(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Rh(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=gS(t,r,pr);break;case"identity":switch(_e.get(e)){case Ji:r=gS(t,r,pr);break;case vh:r=gS(t,r,Nit);break}break;case"utc":case"time":r=gS(t,r,g4);break}switch(n){case"diverging":return oz(e,t,r);case"diverging-sqrt":return sz(e,t,r);case"diverging-pow":return G4(e,t,r);case"diverging-log":return az(e,t,r);case"diverging-symlog":return cz(e,t,r);case"categorical":case"ordinal":case Oh:return pz(e,t,r);case"cyclical":case"sequential":case"linear":return Q$(e,t,r);case"sqrt":return Z$(e,t,r);case"threshold":return mS(e,t,r);case"quantile":return tz(e,t,r);case"quantize":return ez(e,t,r);case"pow":return V4(e,t,r);case"log":return K$(e,t,r);case"symlog":return J$(e,t,r);case"utc":return fz(e,t,r);case"time":return uz(e,t,r);case"point":return mz(e,t,r);case"band":return yz(e,t,r);case"identity":return rz(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Rh(e){return typeof e=="symbol"?e.description:e}function wz(e){return typeof e=="string"?`${e}`.toLowerCase():e}var vz={toString:()=>"projection"};function Eit(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=wz(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=vz);for(let l of t){let u=wz(l.type);if(u!==void 0){if(r===void 0)r=u;else if(r!==u)throw new Error(`scale incompatible with channel: ${r} !== ${u}`)}}if(r===vz)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=_e.get(e);if(c===ef)return"sqrt";if(c===nf||c===rf)return"linear";if(c===vh)return"ordinal";if((n||i||[]).length>2)return X4(c);if(n!==void 0){if(Ue(n))return X4(c);if(Ve(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ue))return X4(c);if(l.some(Ve))return"utc"}if(c===_i){if(s!=null||X$(o))return"diverging";if(W$(o))return"categorical"}return"linear"}function X4(e){switch(e){case Ji:return"point";case _i:return Oh;default:return"ordinal"}}function Ms({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Oh}function Z4({type:e}){return e==="threshold"}function Mit({type:e}){return e==="point"||e==="band"}function wi(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,i=t.length;n<i;++n)if(e(t[n])-r)return!1;return!0}function gS(e,{domain:t,...r},n){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=n(i.value));return{domain:t===void 0?t:n(t),...r}}function Nit(e){return Xt(e,Sh)}function dl(e={}){let t;for(let r in e)if(_e.has(r)&&vs(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Mz(_S(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function Ez(e){return t=>{if(!_e.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Mz({scale:e,type:t,domain:r,range:n,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:sl(r),...n!==void 0&&{range:sl(n)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function Oz(e,t){let{fx:r,fy:n}=r0(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?j_(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function Rz(e,{x:t,y:r}){return t&&=rN(t),r&&=rN(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,i)=>t.get(n.x)-t.get(i.x)||r.get(n.y)-r.get(i.y):t?(n,i)=>t.get(n.x)-t.get(i.x):(n,i)=>r.get(n.y)-r.get(i.y))}function vS(e,{fx:t,fy:r}){let n=Cn(e),i=t?.value,o=r?.value;return t&&r?Ao(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ao(n,s=>(s.fx=i[s[0]],s),s=>i[s]):Ao(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function Dz(e,t,{marginTop:r,marginLeft:n}){return e&&t?({x:i,y:o})=>`translate(${e(i)-n},${t(o)-r})`:e?({x:i})=>`translate(${e(i)-n},0)`:({y:i})=>`translate(0,${t(i)-r})`}function Lz(e){let t=[],r=new Uint32Array(Zr(e,n=>n.length));for(let n of e){let i=0;for(let o of e)n!==o&&(r.set(o,i),i+=o.length);t.push(r.slice(0,i))}return t}var Oit=new Map([["top",K4],["right",eN],["bottom",J4],["left",tN],["top-left",wS(K4,tN)],["top-right",wS(K4,eN)],["bottom-left",wS(J4,tN)],["bottom-right",wS(J4,eN)],["top-empty",Dit],["right-empty",Cit],["bottom-empty",Lit],["left-empty",Fit],["empty",kit]]);function Fz(e){if(e==null)return null;let t=Oit.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var Nz=new WeakMap;function rN(e){let t=Nz.get(e);return t||Nz.set(e,t=new Sn(Xt(e,(r,n)=>[r,n]))),t}function hl(e,t){return rN(e).get(t)}function Rit(e,t,r){return t=Zi(t),r=Zi(r),e.find(n=>Object.is(Zi(n.x),t)&&Object.is(Zi(n.y),r))}function SS(e,t,r){return Rit(e,t,r)?.empty}function K4(e,{y:t},{y:r}){return t?hl(t,r)===0:!0}function J4(e,{y:t},{y:r}){return t?hl(t,r)===t.length-1:!0}function tN(e,{x:t},{x:r}){return t?hl(t,r)===0:!0}function eN(e,{x:t},{x:r}){return t?hl(t,r)===t.length-1:!0}function Dit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,n);if(o>0)return SS(e,r,t[o-1])}function Lit(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,n);if(o<t.length-1)return SS(e,r,t[o+1])}function Fit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,r);if(o>0)return SS(e,t[o-1],n)}function Cit(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=hl(t,r);if(o<t.length-1)return SS(e,t[o+1],n)}function kit(e,t,{empty:r}){return r}function wS(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function IS(e,{channels:{fx:t,fy:r},groups:n}){return t&&r?e.map(({x:i,y:o})=>n.get(i)?.get(o)??[]):t?e.map(({x:i})=>n.get(i)??[]):e.map(({y:i})=>n.get(i)??[])}var Cz=Math.PI,rc=2*Cz,nN=.618;function kz({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(kr(e)){let v;if({type:e,domain:c,inset:v,insetTop:r=v!==void 0?v:r,insetRight:n=v!==void 0?v:n,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=iN(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,y=u-d-h-o-n,g=f-p-m-r-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=Bit(l,d,p,u-h,f-m);let x=d+o,b=p+r,_;if(c!=null){let[[v,w],[T,A]]=Dr(e).bounds(c),E=Math.min(y/(T-v),g/(A-w));E>0?(x-=(E*(v+T)-y)/2,b-=(E*(w+A)-g)/2,_=Pu({point(N,I){this.stream.point(N*E+x,I*E+b)}})):mn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=x===0&&b===0?Bz():Pu({point(v,w){this.stream.point(v+x,w+b)}}),{stream:v=>e.stream(_.stream(l(v)))}}function iN(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ro(C3,.7463,.4673);case"albers":return TS(Jy,.7463,.4673);case"azimuthal-equal-area":return Ro(B3,4,4);case"azimuthal-equidistant":return Ro(U3,rc,rc);case"conic-conformal":return TS(j3,rc,rc);case"conic-equal-area":return TS(Hc,6.1702,2.9781);case"conic-equidistant":return TS(V3,7.312,3.6282);case"equal-earth":return Ro(W3,5.4133,2.6347);case"equirectangular":return Ro(q3,rc,Cz);case"gnomonic":return Ro(X3,3.4641,3.4641);case"identity":return{type:Bz};case"reflect-y":return{type:Pit};case"mercator":return Ro($3,rc,rc);case"orthographic":return Ro(Q3,2,2);case"stereographic":return Ro(K3,2,2);case"transverse-mercator":return Ro(t6,rc,rc);default:throw new Error(`unknown projection type: ${e}`)}}function Bit(e,t,r,n,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Wd(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Ro(e,t,r){return{type:({width:n,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),n!=null&&(c.scale(Math.min(n/t,i/r)),c.translate([n/2,i/2])),c},aspectRatio:r/t}}function TS(e,t,r){let{type:n,aspectRatio:i}=Ro(e,t,r);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=n(o);return s!=null&&(u.parallels(s),a===void 0&&c!=null&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var Bz=Ye({stream:e=>e}),Pit=Ye(Pu({point(e,t){this.stream.point(e,-t)}}));function oN(e,t,r,n){let i=r[e],o=r[t],s=i.length,a=r[e]=new Float64Array(s).fill(NaN),c=r[t]=new Float64Array(s).fill(NaN),l,u=n.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function Pz({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(kr(e)&&(e=e.type),e!=null)}function Uz(e){if(typeof e?.stream=="function")return nN;if(kr(e)){let t,r;if({domain:t,type:e,...r}=e,t!=null&&e!=null){let n=typeof e=="string"?iN(e).type:e,[[i,o],[s,a]]=Dr(n({...r,width:100,height:100})).bounds(t),c=(a-o)/(s-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:nN}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=iN(e);if(t)return t}return nN}}function Ns(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Ah(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&oN("x","y",o,r),n&&(o.x=pr(o.x)),i&&(o.y=pr(o.y)),o}function $z(e){let t=[],r=[],n={scale:"x",value:t},i={scale:"y",value:r},o={point(s,a){t.push(s),r.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)pi(s,o);return[n,i]}function pl(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:sS(r)}}function lt(e,{document:t}){return Qt(Na(e).call(t.documentElement))}var AS=Symbol("unset");function ml(e){return(e.length===1?Uit:$it)(e)}function Uit(e){let t,r=AS;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function $it(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((i,o)=>!Object.is(i,n[o])))&&(r=n,t=e(...n)),t)}var zit=ml(e=>new Intl.NumberFormat(e)),jit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),qit=ml((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function sN(e="en-US"){let t=zit(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function zz(e="en-US",t="short"){let r=jit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function jz(e="en-US",t="short"){let r=qit(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function aN(e){return ph(e,"Invalid Date")}function Vit(e="en-US"){let t=sN(e);return r=>(r instanceof Date?aN:typeof r=="number"?t:rr)(r)}var Os=Vit();var We=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Yit=0,Wit=0;function cN(){return`plot-clip-${++Yit}`}function qz(){return`plot-pattern-${++Wit}`}function ES(e,{title:t,href:r,ariaLabel:n,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:x,imageFilter:b,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:A,fill:E="currentColor",fillOpacity:N,stroke:I="none",strokeOpacity:R,strokeWidth:C,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:O,paintOrder:L}){E===null&&(a=null,c=null),I===null&&(l=null,f=null),fe(E)?!fe(I)&&(!fe(a)||T?.fill)&&(I="none"):fe(I)&&(!fe(l)||T?.stroke)&&(E="none");let[B,k]=qe(a,E),[P,U]=ye(c,N),[$,X]=qe(l,I),[rt,ot]=ye(f,R),[at,Y]=ye(g);Ka(X)||(u===void 0&&(u=C),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!x$(d)&&(p=O),!Ka(k)&&_===void 0&&(_=L));let[st,q]=ye(u);return E!==null&&(e.fill=Oe(k,"currentColor"),e.fillOpacity=n0(U,1)),I!==null&&(e.stroke=Oe(X,"none"),e.strokeWidth=n0(q,1),e.strokeOpacity=n0(ot,1),e.strokeLinejoin=Oe(d,"miter"),e.strokeLinecap=Oe(h,"butt"),e.strokeMiterlimit=n0(p,4),e.strokeDasharray=Oe(m,"none"),e.strokeDashoffset=Oe(y,"0")),e.target=rr(s),e.ariaLabel=rr(A),e.ariaDescription=rr(i),e.ariaHidden=rr(o),e.opacity=n0(Y,1),e.mixBlendMode=Oe(x,"normal"),e.imageFilter=Oe(b,"none"),e.paintOrder=Oe(_,"normal"),e.pointerEvents=Oe(v,"auto"),e.shapeRendering=Oe(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:$,scale:"auto",optional:!0},strokeOpacity:{value:rt,scale:"auto",optional:!0},strokeWidth:{value:st,optional:!0},opacity:{value:at,scale:"auto",optional:!0}}}function Git(e,t){t&&e.filter(r=>zg(t[r])).append("title").call(Hit,t)}function Xit(e,t){t&&e.filter(([r])=>zg(t[r])).append("title").call(Qit,t)}function Hit(e,t){t&&e.text(r=>Os(t[r]))}function Qit(e,t){t&&e.text(([r])=>Os(t[r]))}function Wt(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",d=>n[d]),o&&dt(e,"fill",d=>o[d]),s&&dt(e,"fill-opacity",d=>s[d]),a&&dt(e,"stroke",d=>a[d]),c&&dt(e,"stroke-opacity",d=>c[d]),l&&dt(e,"stroke-width",d=>l[d]),u&&dt(e,"opacity",d=>u[d]),f&&Yz(e,d=>f[d],t),r||Git(e,i)}function of(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&dt(e,"aria-label",([d])=>n[d]),o&&dt(e,"fill",([d])=>o[d]),s&&dt(e,"fill-opacity",([d])=>s[d]),a&&dt(e,"stroke",([d])=>a[d]),c&&dt(e,"stroke-opacity",([d])=>c[d]),l&&dt(e,"stroke-width",([d])=>l[d]),u&&dt(e,"opacity",([d])=>u[d]),f&&Yz(e,([d])=>f[d],t),r||Xit(e,i)}function Zit({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,r,n,i,o,s,a,c].filter(u=>u!==void 0)}function i0(e,t,r){let n=Hr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&mn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*MS(e,t,r,n){let{z:i}=r,{z:o}=n,s=Zit(n,r),a=[...t,...s];for(let c of o?i0(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Pe(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Zi(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Zi(s[d][f])!==l[d]){yield u,l=s.map(p=>Zi(p[f])),u=[f];continue t}}u&&(yield u)}}function Kit(e,t,r,n){let i,{clip:o=n.clip}=t;switch(o){case"frame":{e=lt("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=Jit(n,r);break}case"sphere":{i=tot(n);break}}dt(e,"aria-label",t.ariaLabel),dt(e,"aria-description",t.ariaDescription),dt(e,"aria-hidden",t.ariaHidden),dt(e,"clip-path",i)}function Vz(e){let t=new WeakMap;return(r,n)=>{let i=t.get(r);if(!i){let o=cN();Qt(r.ownerSVGElement).append("clipPath").attr("id",o).call(e,r,n),t.set(r,i=`url(#${o})`)}return i}}var Jit=Vz((e,t,r)=>{let{width:n,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:c}=r;e.append("rect").attr("x",o).attr("y",a).attr("width",n-s-o).attr("height",i-a-c)}),tot=Vz((e,t)=>{let{projection:r}=t;if(!r)throw new Error('the "sphere" clip option requires a projection');e.append("path").attr("d",Dr(r)({type:"Sphere"}))});function kt(e,t,r,n){Kit(e,t,r,n),dt(e,"class",t.className),dt(e,"fill",t.fill),dt(e,"fill-opacity",t.fillOpacity),dt(e,"stroke",t.stroke),dt(e,"stroke-width",t.strokeWidth),dt(e,"stroke-opacity",t.strokeOpacity),dt(e,"stroke-linejoin",t.strokeLinejoin),dt(e,"stroke-linecap",t.strokeLinecap),dt(e,"stroke-miterlimit",t.strokeMiterlimit),dt(e,"stroke-dasharray",t.strokeDasharray),dt(e,"stroke-dashoffset",t.strokeDashoffset),dt(e,"shape-rendering",t.shapeRendering),dt(e,"filter",t.imageFilter),dt(e,"paint-order",t.paintOrder);let{pointerEvents:i=n.pointerSticky===!1?"none":void 0}=t;dt(e,"pointer-events",i)}function Et(e,t){eot(e,"mix-blend-mode",t.mixBlendMode),dt(e,"opacity",t.opacity)}function Yz(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(An.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(An.xlink,"href",i),r!=null&&o.setAttribute("target",r),this.parentNode.insertBefore(o,this).appendChild(this)}})}function dt(e,t,r){r!=null&&e.attr(t,r)}function eot(e,t,r){r!=null&&e.style(t,r)}function Rt(e,t,{x:r,y:n},i=We,o=We){i+=t.dx,o+=t.dy,r?.bandwidth&&(i+=r.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function Oe(e,t){if((e=rr(e))!==t)return e}function n0(e,t){if((e=ie(e))!==t)return e}var rot=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function yl(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!rot.test(e))throw new Error(`invalid class name: ${e}`);return e}function Dh(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function Ur({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-o:(n+r-o)/2]}var vt=class{constructor(t,r={},n={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:y=d,className:g,clip:x=i?.clip,channels:b,tip:_,render:v}=n;if(this.data=t,this.sort=Ss(l)?l:null,this.initializer=Ne(n).initializer,this.transform=this.initializer?n.transform:mr(n).transform,o===null||o===!1?this.facet=null:(this.facet=Sr(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===il&&typeof a=="string"?[a]:a,this.fy=t===il&&typeof c=="string"?[c]:c),this.facetAnchor=Fz(s),r=Xg(r),b!==void 0&&(r={...not(b),...r}),i!==void 0&&(r={...ES(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([w,T])=>{if(bi(T.value)){let{value:A,label:E=T.label,scale:N=T.scale}=T.value;T={...T,label:E,scale:N,value:A}}if(t===il&&typeof T.value=="string"){let{value:A}=T;T={...T,value:[A]}}return[w,T]}).filter(([w,{value:T,optional:A}])=>{if(T!=null)return!0;if(A)return!1;throw new Error(`missing channel value: ${w}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=sS(x),this.tip=iot(_),this.className=g?yl(g):null,this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let w in this.channels){let{scale:T}=r[w];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}v!=null&&(this.render=nc(v,this.render))}initialize(t,r,n){let i=Xa(this.data);t===void 0&&i!=null&&(t=[Cn(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,n),i=Xa(i)),t!==void 0&&(t.original=o);let s=pS(this.channels,i);return this.sort!=null&&P$(i,t,s,r,this.sort),{data:i,facets:t,channels:s}}filter(t,r,n){for(let i in r){let{filter:o=Pe}=r[i];if(o!==null){let s=n[i];t=t.filter(a=>o(s[a]))}}return t}project(t,r,n){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&oN(i,o,r,n.projection)}}scale(t,r,n){let i=Ah(t,r);return n.projection&&this.project(t,i,n),i}};function yr(...e){return e.plot=vt.prototype.plot,e}function nc(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,i,o,s,a){return e.call(this,r,n,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function not(e){return Object.fromEntries(Object.entries(Xg(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Ki(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function iot(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Sr(e,"tip",["x","y","xy"]):e}function Do(e,t){return e?.tip===!0?{...e,tip:t}:kr(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function Gz(e,t,r={}){let n=.5-We,i=.5+We,o=.5+We,s=.5-We;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:x}of t)m>n&&(n=m),y>i&&(i=y),g>o&&(o=g),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:n,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=r;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=oot(e,r,{width:d,marginTopDefault:n,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-n+u-o)}=r;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=r.facet??{};y=+y,g=+g,x=+x,b=+b,p.facet={marginTop:y,marginRight:g,marginBottom:x,marginLeft:b}}return p}function oot({x:e,y:t,fy:r,fx:n},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=r&&r.scale.domain().length||1,d=Uz(i);if(d){let p=n?n.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let h=t?Ms(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=Wz("y",t)/(Wz("x",e)*o),m=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||r)*Math.max(1,Math.min(60,h*f))*20+!!n*30+60}function Wz(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,i;switch(r){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[o,s]=ce(n);return Math.abs(i(s)-i(o))}var Xz=new WeakMap;function lN(e,t,{x:r,y:n,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(r??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(n??=null,a={...a,py:{value:o,scale:"y"}}),{x:r,y:n,channels:a,...l,render:nc(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),x=Xz.get(y);x||Xz.set(y,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,A=w?w(u.fx)-h.marginLeft:0,E=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(E+=v.bandwidth()/2);let N=u.fi!=null,I;if(N){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),I=Y.get(this),I||Y.set(this,I=new Map)}let[R,C]=Ur(this,h),{px:S,py:M}=d,O=S?Y=>S[Y]:uN(d,R),L=M?Y=>M[Y]:fN(d,C),B,k,P,U;function $(Y,st){if(N)if(U&&(U=cancelAnimationFrame(U)),Y==null)I.delete(u.fi);else{I.set(u.fi,st),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of I)if(H<st||H===st&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===x.sticky)return;B=Y,P=p.pointerSticky=x.sticky;let st=B==null?[]:[B];N&&(st.fx=u.fx,st.fy=u.fy,st.fi=u.fi);let q=m(st,f,d,h,p);if(k){if(N){let H=k.parentNode,nt=k.getAttribute("transform"),z=q.getAttribute("transform");nt?q.setAttribute("transform",nt):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}if(x.roots[b]=k=q,!(B==null&&I?.size>1)){let H=B==null?null:Qn(g)?g[B]:g.get(B);p.dispatchValue(H)}return q}function rt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[st,q]=an(Y);st-=A,q-=E;let H=st<h.marginLeft||st>h.width-h.marginRight?1:e,nt=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Pt=s*s;for(let ht of u){let Zt=H*(O(ht)-st),Jt=nt*(L(ht)-q),tt=Zt*Zt+Jt*Jt;tt<=Pt&&(z=ht,Pt=tt)}if(z!=null&&(e!==1||t!==1)){let ht=O(z)-st,Zt=L(z)-q;Pt=ht*ht+Zt*Zt}$(z,Pt)}function ot(Y){Y.pointerType==="mouse"&&B!=null&&(x.sticky&&x.roots.some(st=>st?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(st=>st(null))):(x.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function at(Y){Y.pointerType==="mouse"&&(x.sticky||$(null))}return y.addEventListener("pointerenter",rt),y.addEventListener("pointermove",rt),y.addEventListener("pointerdown",ot),y.addEventListener("pointerleave",at),X(null)},c)}}function gl(e){return lN(1,1,e)}function xl(e){return lN(1,.01,e)}function ic(e){return lN(.01,1,e)}function uN({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function fN({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function NS(e){return Ms(e)&&e.interval===void 0?void 0:"tabular-nums"}function Hz(e,t){let{label:r=e.label,tickSize:n=6,width:i=240,height:o=44+n,marginTop:s=18,marginRight:a=0,marginBottom:c=16+n,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=NS(e),round:p=!0,opacity:m,className:y}=t,g=pl(t);y=yl(y),m=ye(m)[1],d===null&&(d=()=>null);let x=lt("svg",g).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(R=>R.append("style").text(`:where(.${y}-ramp) {
|
|
17
17
|
display: block;
|
|
18
18
|
height: auto;
|
|
19
19
|
height: intrinsic;
|
|
@@ -22,9 +22,9 @@ ${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){l
|
|
|
22
22
|
}
|
|
23
23
|
:where(.${y}-ramp text) {
|
|
24
24
|
white-space: pre;
|
|
25
|
-
}`)).call(Ud,u),b=D=>D.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(D,k)=>D.rangeRound(k):(D,k)=>D.range(k),{type:_,domain:T,range:A,interpolate:E,scale:O,pivot:I}=e;if(E){let D=A===void 0?E:Bo(E.length===1?zy(E):E,A);w=v(O.copy(),jn(Ee(l,i-a),Math.min(T.length+(I!==void 0),A===void 0?1/0:A.length)));let k=256,S=g.document.createElement("canvas");S.width=k,S.height=1;let M=S.getContext("2d");for(let N=0,L=k-1;N<k;++N)M.fillStyle=D(N/L),M.fillRect(N,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(_==="threshold"){let D=T,k=d===void 0?S=>S:typeof d=="string"?Ii(d):d;w=v(la().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",(S,M)=>w(M-1)).attr("y",s).attr("width",(S,M)=>w(M)-w(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=Wt(D,(S,M)=>M),d=S=>k(D[S],S)}else w=v(Ic().domain(T),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(T).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",O),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(oE(w).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",be(h,"normal")).call(b).call(D=>D.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var zd=Math.PI/180;function lo(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=e6(n),e.markerMid=e6(r),e.markerEnd=e6(i)}function e6(e){if(e==null||e===!1)return null;if(e===!0)return O$;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return M$("auto");case"arrow-reverse":return M$("auto-start-reverse");case"dot":return Xnt;case"circle":case"circle-fill":return O$;case"circle-stroke":return Hnt;case"tick":return n6("auto");case"tick-x":return n6(90);case"tick-y":return n6(0)}throw new Error(`invalid marker: ${e}`)}function M$(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function Xnt(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function O$(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function Hnt(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function n6(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var Qnt=0;function Da(e,t,{stroke:n},r){return R$(e,t,n&&(i=>n[i]),null,r)}function N$(e,t,{stroke:n,z:r},i){return R$(e,t,n&&(([o])=>n[o]),r,i)}var r6=1,D$=2;function Znt(e,t){let n=new Uint8Array(t.length),r=e.data().filter(o=>o.length>1),i=r.length;for(let o=0,s=Rv;o<i;++o){let a=r[o];if(a.length>1){let c=a[0];s!==(s=Ni(t[c]))&&(n[c]|=r6)}}for(let o=i-1,s=Rv;o>=0;--o){let a=r[o];if(a.length>1){let c=a[0];s!==(s=Ni(t[c]))&&(n[c]|=D$)}}return([o])=>n[o]}function R$(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s,a){if(!t&&!n&&!r)return;let c=new Map,l=s&&Znt(e,s);function u(f,d,h){return function(p){if(h&&!h(p))return;let m=o(p),y=c.get(d);y||c.set(d,y=new Map);let g=y.get(m);if(!g){let x=this.parentNode.insertBefore(d(m,a),this),b=`plot-marker-${++Qnt}`;x.setAttribute("id",b),y.set(m,g=`url(#${b})`)}this.setAttribute(f,g)}}t&&e.each(u("marker-start",t,l&&(f=>l(f)&r6))),n&&l&&e.each(u("marker-start",n,f=>!(l(f)&r6))),n&&e.each(u("marker-mid",n)),r&&e.each(u("marker-end",r,l&&(f=>l(f)&D$)))}function Iu({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=L$(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Tu({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=L$(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function L$(e,t,n){return e===void 0&&t===void 0&&n===void 0?Be?[1,0]:[.5,.5]:[t,n]}function F$(e,{interval:t}){return e={...Di(e)},e.interval=Od(e.interval===void 0?t:e.interval),e}function Cv(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=F$(i,n);if(a==null||c==null&&!r)return n;let l=Pn(i);if(c==null){let h,p={transform:m=>h||(h=gt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Wt(gt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function k$(e,t,n){let{[e]:r}=n,{value:i,interval:o}=F$(r,n);return i==null||o==null?n:t({...n,[e]:{label:Pn(r),transform:s=>{let a=Wt(gt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(ke(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function i6(e={}){return Cv("x",Iu,e,!0)}function o6(e={}){return Cv("y",Tu,e,!0)}function jd(e={}){return Cv("x",Iu,e)}function Vd(e={}){return Cv("y",Tu,e)}function Bv(e={}){return k$("x",Iu,e)}function Pv(e={}){return k$("y",Tu,e)}var C$={ariaLabel:"rule",fill:null,stroke:"currentColor"},Yy=class extends xt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},co(n,"x"),C$),this.insetTop=ee(a),this.insetBottom=ee(c),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s},Be,0).call(b=>b.selectAll().data(t).enter().append("line").call(It,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!ri(a)?w=>l[w]+g:h+g).attr("y2",u&&!ri(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-y-x).call(Yt,this,r).call(Da,this,r,o)).node()}},Gy=class extends xt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},co(n,"y"),C$),this.insetRight=ee(a),this.insetLeft=ee(c),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{y:c&&a},0,Be).call(b=>b.selectAll().data(t).enter().append("line").call(It,this).attr("x1",l&&!ri(s)?w=>l[w]+g:m+g).attr("x2",u&&!ri(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-y)/2).attr("y2",c?w=>c[w]:(h+d-y)/2).call(Yt,this,r).call(Da,this,r,o)).node()}};function ii(e,t){let{x:n=X,y:r,y1:i,y2:o,...s}=Vd(t);return[i,o]=B$(r,i,o),new Yy(e,{...s,x:n,y1:i,y2:o})}function oi(e,t){let{y:n=X,x:r,x1:i,x2:o,...s}=jd(t);return[i,o]=B$(r,i,o),new Gy(e,{...s,y:n,x1:i,x2:o})}function B$(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function uo(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var Knt={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},j$="\xAD",Au=class extends xt{constructor(t,n={}){let{x:r,y:i,text:o=gr(t)&&lv(t)?X:ye,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:x}=n,[b,w]=ae(x,0),[v,_]=nrt(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:YP(b),optional:!0},text:{value:o,filter:Ay,optional:!0}},n,Knt),this.rotate=w,this.textAnchor=be(a,"middle"),this.lineAnchor=un(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=a6(f),this.monospace=!!d,this.fontFamily=Ye(h),this.fontSize=_,this.fontStyle=Ye(m),this.fontVariant=Ye(y),this.fontWeight=Ye(g),this.frameAnchor=ns(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=l6(this),this.clipLine=u6(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,y]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(c6,this,f,i).call(Et,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(It,this).call(Jnt,this,f,d).attr("transform",uo`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Yt,this,r)).node()}};function a6(e){return e==null?null:un(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function Jnt(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(as(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(ar.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ar.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function cs(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new Au(e,{...r,x:t,y:n})}function $v(e,{x:t=X,...n}={}){return new Au(e,Pv({...n,x:t}))}function Uv(e,{y:t=X,...n}={}){return new Au(e,Bv({...n,y:t}))}function c6(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?trt(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function trt(e){return e&&(Sa(e)||ke(e))?"tabular-nums":void 0}var ert=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function nrt(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),ert.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function rrt(e,t,n){let r=[],i,o=0;for(let[s,a,c]of irt(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===j$?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*irt(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case j$:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
|
|
25
|
+
}`)).call(Dh,u),b=R=>R.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(R,C)=>R.rangeRound(C):(R,C)=>R.range(C),{type:w,domain:T,range:A,interpolate:E,scale:N,pivot:I}=e;if(E){let R=A===void 0?E:ss(E.length===1?e0(E):E,A);_=v(N.copy(),cn(Fe(l,i-a),Math.min(T.length+(I!==void 0),A===void 0?1/0:A.length)));let C=256,S=g.document.createElement("canvas");S.width=C,S.height=1;let M=S.getContext("2d");for(let O=0,L=C-1;O<C;++O)M.fillStyle=R(O/L),M.fillRect(O,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let R=T,C=d===void 0?S=>S:typeof d=="string"?Yi(d):d;_=v(Ba().domain([-1,A.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(A).enter().append("rect").attr("x",(S,M)=>_(M-1)).attr("y",s).attr("width",(S,M)=>_(M)-_(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=Xt(R,(S,M)=>M),d=S=>C(R[S],S)}else _=v(Zc().domain(T),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",N),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(yM(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(n).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Oe(h,"normal")).call(b).call(R=>R.select(".domain").remove()),r!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),x.node()}var Lh=Math.PI/180;function Lo(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=dN(r),e.markerMid=dN(n),e.markerEnd=dN(i)}function dN(e){if(e==null||e===!1)return null;if(e===!0)return Zz;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return Qz("auto");case"arrow-reverse":return Qz("auto-start-reverse");case"dot":return sot;case"circle":case"circle-fill":return Zz;case"circle-stroke":return aot;case"tick":return hN("auto");case"tick-x":return hN(90);case"tick-y":return hN(0)}throw new Error(`invalid marker: ${e}`)}function Qz(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function sot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function Zz(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function aot(e,t){return lt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function hN(e){return(t,r)=>lt("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var cot=0;function oc(e,t,{stroke:r},n){return tj(e,t,r&&(i=>r[i]),null,n)}function Kz(e,t,{stroke:r,z:n},i){return tj(e,t,r&&(([o])=>r[o]),n,i)}var pN=1,Jz=2;function lot(e,t){let r=new Uint8Array(t.length),n=e.data().filter(o=>o.length>1),i=n.length;for(let o=0,s=AS;o<i;++o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=pN)}}for(let o=i-1,s=AS;o>=0;--o){let a=n[o];if(a.length>1){let c=a[0];s!==(s=Zi(t[c]))&&(r[c]|=Jz)}}return([o])=>r[o]}function tj(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s,a){if(!t&&!r&&!n)return;let c=new Map,l=s&&lot(e,s);function u(f,d,h){return function(p){if(h&&!h(p))return;let m=o(p),y=c.get(d);y||c.set(d,y=new Map);let g=y.get(m);if(!g){let x=this.parentNode.insertBefore(d(m,a),this),b=`plot-marker-${++cot}`;x.setAttribute("id",b),y.set(m,g=`url(#${b})`)}this.setAttribute(f,g)}}t&&e.each(u("marker-start",t,l&&(f=>l(f)&pN))),r&&l&&e.each(u("marker-start",r,f=>!(l(f)&pN))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,l&&(f=>l(f)&Jz)))}function sf({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=ej(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function af({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=ej(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function ej(e,t,r){return e===void 0&&t===void 0&&r===void 0?We?[1,0]:[.5,.5]:[t,r]}function rj(e,{interval:t}){return e={...Ki(e)},e.interval=wh(e.interval===void 0?t:e.interval),e}function OS(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=rj(i,r);if(a==null||c==null&&!n)return r;let l=en(i);if(c==null){let h,p={transform:m=>h||(h=_t(m,a)),label:l};return{...r,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&n)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Xt(_t(u=h,a),p=>c.floor(p))}return t({...r,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function nj(e,t,r){let{[e]:n}=r,{value:i,interval:o}=rj(n,r);return i==null||o==null?r:t({...r,[e]:{label:en(n),transform:s=>{let a=Xt(_t(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Ve(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function mN(e={}){return OS("x",sf,e,!0)}function yN(e={}){return OS("y",af,e,!0)}function Fh(e={}){return OS("x",sf,e)}function Ch(e={}){return OS("y",af,e)}function RS(e={}){return nj("x",sf,e)}function DS(e={}){return nj("y",af,e)}var ij={ariaLabel:"rule",fill:null,stroke:"currentColor"},o0=class extends vt{constructor(t,r={}){let{x:n,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Do(r,"x"),ij),this.insetTop=ie(a),this.insetBottom=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y1:l,y2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s},We,0).call(b=>b.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",c?_=>c[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!wi(a)?_=>l[_]+g:h+g).attr("y2",u&&!wi(a)?a.bandwidth?_=>u[_]+a.bandwidth()-x:_=>u[_]-x:d-y-x).call(Wt,this,n).call(oc,this,n,o)).node()}},s0=class extends vt{constructor(t,r={}){let{x1:n,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=r;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Do(r,"y"),ij),this.insetRight=ie(a),this.insetLeft=ie(c),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{y:c,x1:l,x2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:x}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{y:c&&a},0,We).call(b=>b.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",l&&!wi(s)?_=>l[_]+g:m+g).attr("x2",u&&!wi(s)?s.bandwidth?_=>u[_]+s.bandwidth()-x:_=>u[_]-x:f-p-x).attr("y1",c?_=>c[_]:(h+d-y)/2).attr("y2",c?_=>c[_]:(h+d-y)/2).call(Wt,this,n).call(oc,this,n,o)).node()}};function vi(e,t){let{x:r=G,y:n,y1:i,y2:o,...s}=Ch(t);return[i,o]=oj(n,i,o),new o0(e,{...s,x:r,y1:i,y2:o})}function Si(e,t){let{y:r=G,x:n,x1:i,x2:o,...s}=Fh(t);return[i,o]=oj(n,i,o),new s0(e,{...s,y:r,x1:i,x2:o})}function oj(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Fo(e,...t){let r=t.length;for(let n=0,i=!0;n<r;++n)typeof t[n]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(n,2,e[n]+t[n]+e[n+1]),t.splice(n,1),--n,--r);return n=>{let i=e[0];for(let o=0;o<r;++o)i+=t[o](n)+e[o+1];return i}}var uot={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},uj="\xAD",lf=class extends vt{constructor(t,r={}){let{x:n,y:i,text:o=kn(t)&&nS(t)?G:Ee,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:x}=r,[b,_]=ye(x,0),[v,w]=pot(p);if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:h$(b),optional:!0},text:{value:o,filter:zg,optional:!0}},r,uot),this.rotate=_,this.textAnchor=Oe(a,"middle"),this.lineAnchor=Sr(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=xN(f),this.monospace=!!d,this.fontFamily=rr(h),this.fontSize=w,this.fontStyle=rr(m),this.fontVariant=rr(y),this.fontWeight=rr(g),this.frameAnchor=Ts(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=_N(this),this.clipLine=wN(this)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=n,{rotate:p}=this,[m,y]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(bN,this,f,i).call(Rt,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Et,this).call(fot,this,f,d).attr("transform",Fo`translate(${c?x=>c[x]:m},${l?x=>l[x]:y})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(dt,"font-size",h&&(x=>h[x])).call(Wt,this,n)).node()}};function xN(e){return e==null?null:Sr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function fot(e,t,r,n){if(!r)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(Os(r[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(An.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!n&&u[0]!==r[l]){let h=this.ownerDocument.createElementNS(An.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function Rs(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new lf(e,{...n,x:t,y:r})}function LS(e,{x:t=G,...r}={}){return new lf(e,DS({...r,x:t}))}function FS(e,{y:t=G,...r}={}){return new lf(e,RS({...r,y:t}))}function bN(e,t,r){dt(e,"text-anchor",t.textAnchor),dt(e,"font-family",t.fontFamily),dt(e,"font-size",t.fontSize),dt(e,"font-style",t.fontStyle),dt(e,"font-variant",t.fontVariant===void 0?dot(r):t.fontVariant),dt(e,"font-weight",t.fontWeight)}function dot(e){return e&&(Za(e)||Ve(e))?"tabular-nums":void 0}var hot=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function pot(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),hot.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function mot(e,t,r){let n=[],i,o=0;for(let[s,a,c]of yot(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===uj?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*yot(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case uj:case"-":++r,yield[t,r,!1],t=r;break;case" ":for(yield[t,r,!1];e[++r]===" ";);t=r;break;case"\r":e[r+1]===`
|
|
26
26
|
`&&++i;case`
|
|
27
|
-
`:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var P$={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function zv(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qd(e,i))r+=P$[e[i]]??(q$(e,i)?120:P$.e);return r}function jv(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qd(e,i))r+=q$(e,i)?126:63;return r}function l6({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?jv:zv,i=t*100;return o=>rrt(o,i,r)}function u6({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?jv:zv,i=t*100;switch(n){case"clip-start":return o=>U$(o,i,r,"");case"clip-end":return o=>$$(o,i,r,"");case"ellipsis-start":return o=>U$(o,i,r,Eu);case"ellipsis-middle":return o=>ort(o,i,r,Eu);case"ellipsis-end":return o=>$$(o,i,r,Eu)}}var Eu="\u2026";function Mu(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=qd(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function $$(e,t,n,r){e=e.trim();let i=n(r),[o]=Mu(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function ort(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Mu(e,t/2,n,o),[c]=Mu(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(qd(e,c)).trimStart()}function U$(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Mu(e,i-t+o,n,-o);return s<0?r:r+e.slice(qd(e,s)).trimStart()}var s6=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,z$=/\p{Extended_Pictographic}/uy;function qd(e,t){return t+=srt(e,t)?2:1,crt(e,t)&&(t=s6.lastIndex),art(e,t)?qd(e,t+1):t}function V$(e,t){return e.charCodeAt(t)<128}function srt(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function art(e,t){return e.charCodeAt(t)===8205}function crt(e,t){return V$(e,t)?!1:(s6.lastIndex=t,s6.test(e))}function q$(e,t){return V$(e,t)?!1:(z$.lastIndex=t,z$.test(e))}var Y$={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},G$=3.5,lrt=G$*5,W$={draw(e,t,n){let r=t*n/lrt;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},X$={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},urt=new Map([["arrow",W$],["spike",X$]]);function frt(e){return e&&typeof e.draw=="function"}function drt(e){if(frt(e))return e;let t=urt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ou=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o=G$,length:s,rotate:a,shape:c=W$,anchor:l="middle",frameAnchor:u}=n,[f,d]=ae(s,12),[h,p]=ae(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,Y$),this.r=+o,this.length=d,this.rotate=p,this.shape=drt(c),this.anchor=un(l,"anchor",["start","middle","end"]),this.frameAnchor=ns(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,x]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(It,this).attr("transform",uo`translate(${c?w=>c[w]:g},${l?w=>l[w]:x})${f?w=>` rotate(${f[w]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${d})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${d/2})`}`).attr("d",u?w=>{let v=ur();return m.draw(v,u[w],y),v}:(()=>{let w=ur();return m.draw(w,d,y),w})()).call(Yt,this,r)).node()}};function f6(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=je(n,r)),new Ou(e,{...i,x:n,y:r})}function Vv(e,t={}){let{x:n=X,...r}=t;return new Ou(e,{...r,x:n})}function qv(e,t={}){let{y:n=X,...r}=t;return new Ou(e,{...r,y:n})}function H$(e,t={}){let{shape:n=X$,stroke:r=Y$.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return f6(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Gc(e,t){return arguments.length<2&&!gr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Yv({anchor:e}={},t){return e===void 0?t[0]:un(e,"anchor",t)}function Q$(e){return Yv(e,["left","right"])}function Z$(e){return Yv(e,["right","left"])}function K$(e){return Yv(e,["bottom","top"])}function J$(e){return Yv(e,["top","bottom"])}function Wy(){let[e,t]=Gc(...arguments);return tU("y",Q$(t),e,t)}function Gv(){let[e,t]=Gc(...arguments);return tU("fy",Z$(t),e,t)}function Xy(){let[e,t]=Gc(...arguments);return eU("x",K$(t),e,t)}function Wv(){let[e,t]=Gc(...arguments);return eU("fx",J$(t),e,t)}function tU(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:v=x===void 0?20:x,marginLeft:_=x===void 0?t==="left"?40:0:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:O,...I}){return p=ee(p),m=ee(m),y=ee(y),A!==void 0&&(A=un(A,"labelAnchor",["center","top","bottom"])),E=lU(E),on(p&&!oe(o)?hrt(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...I}):null,oe(c)?null:mrt(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...I}),!oe(c)&&T!==null?cs([],oU({fill:c,fillOpacity:l,...I},function(D,k,S,M,N){let L=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=A??(L.bandwidth?"center":"top"),H=O??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-B:U==="bottom"?P-3:0,this.dx=t==="right"?H:-H,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[cU(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:E})]}}}})):null)}function eU(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:v=x===void 0?t==="bottom"?30:0:x,marginLeft:_=x===void 0?20:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:O,...I}){return p=ee(p),m=ee(m),y=ee(y),A!==void 0&&(A=un(A,"labelAnchor",["center","left","right"])),E=lU(E),on(p&&!oe(o)?prt(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...I}):null,oe(c)?null:yrt(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:w,marginBottom:v,marginLeft:_,...I}),!oe(c)&&T!==null?cs([],oU({fill:c,fillOpacity:l,...I},function(D,k,S,M,N){let L=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=A??(L.bandwidth?"center":"right"),H=O??(t==="top"?B:P)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-H:H,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[cU(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:E})]}}}})):null)}function hrt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Yd(qv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Be+ +u:+d+Be-f,anchor:"start",length:c,shape:t==="left"?wrt:_rt})}function prt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Yd(Vv,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Be-f:+d+Be+ +u,anchor:"start",length:c,shape:t==="bottom"?xrt:brt})}function mrt(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*zd):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y=e==="y"?void 0:null,...g}){return Yd(Uv,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,v,_){f===void 0&&(this.fontVariant=aU(x)),c===void 0&&(_.text=sU(x,b,w,v,t))})}function yrt(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*zd):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:y=e==="x"?void 0:null,...g}){return Yd($v,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,v,_){f===void 0&&(this.fontVariant=aU(x)),c===void 0&&(_.text=sU(x,b,w,v,t))})}function Xv(){let[e,t]=Gc(...arguments);return nU("y",Q$(t),e,t)}function Hv(){let[e,t]=Gc(...arguments);return nU("fy",Z$(t),e,t)}function Qv(){let[e,t]=Gc(...arguments);return rU("x",K$(t),e,t)}function Zv(){let[e,t]=Gc(...arguments);return rU("fx",J$(t),e,t)}function nU(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Yd(oi,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:r,x1:o,x2:s,...iU(a)})}function rU(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Yd(ii,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:r,y1:o,y2:s,...iU(a)})}function iU({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function oU({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=Fe(e),[,t]=ae(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Yd(e,t,n,r,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:w,tickFormat:v,tickSpacing:_=t==="x"?80:35}=i;if(typeof w=="string"&&uU(g)&&(b=w,w=void 0),w===void 0&&(w=es(b,g.type)??grt(g,_)),u==null){if(gr(w))u=ti(w);else if(kc(w))u=d6(w,...ne(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,O]=ne(x),I=(O-E)/A[Td];A=t3(A,I/w)??A,u=d6(A,E,O)}else{u=x;let E=u.length;A=t3(A,E/w)??A,A!==g.interval&&(u=d6(A,...ne(u)))}if(A===g.interval){let E=Math.round(u.length/w);E>1&&(u=u.filter((O,I)=>I%E===0))}}else g.ticks?u=g.ticks(w):u=x;if(!g.ticks&&u.length&&u!==x){let A=new or(x);u=u.filter(E=>A.has(E)),u.length||Hn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[yr(u)]:s[t]={scale:t,value:X}}o?.call(this,g,u,w,v,s);let T=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:gt(u,E.value)}]));return y&&(f=m.filterFacets(u,T)),{data:u,facets:f,channels:T}}let c=xe(i).initializer,l=e(n,xe({...i,initializer:a},c));return n==null?(s=l.channels,l.channels={}):s={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function grt(e,t){let[n,r]=ne(e.range());return(r-n)/t}function sU(e,t,n,r,i){return{value:Hy(e,t,n,r,i)}}function Hy(e,t,n,r,i){return typeof r=="function"&&!(e.type==="log"&&e.tickFormat)?r:r===void 0&&t&&ke(t)?BP(e.type,t,i)??as:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?as:typeof r=="string"?(ke(e.domain())?Qo:Ii)(r):Ce(r)}function d6(e,t,n){return e.range(t,e.offset(e.floor(n)))}var xrt={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},brt={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},wrt={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},_rt={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function aU(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function cU(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&uU(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=Iv(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function lU(e="auto"){return oe(e)?!1:typeof e=="boolean"?e:un(e,"labelArrow",["auto","up","right","down","left"])}function uU(e){return ke(e.domain())}function fU(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function dU(e,{opacity:t,...n}={}){if(!os(e)&&!U3(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return pU(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ae(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function hU(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:oe(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Fe(t),[f,d]=Fe(r),h=fU(c,l),p=fU(c,f),m=s*s*Math.PI;return n=ae(n)[1],i=ae(i)[1],o=ae(o)[1],pU(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?w=>h.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let v=ur();return e.scale(w).draw(v,m),v}))}function pU(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=kv(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=zc(t);u=Vc(u),i=Hy(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
|
|
27
|
+
`:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var sj={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function CS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=kh(e,i))n+=sj[e[i]]??(dj(e,i)?120:sj.e);return n}function kS(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=kh(e,i))n+=dj(e,i)?126:63;return n}function _N({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?kS:CS,i=t*100;return o=>mot(o,i,n)}function wN({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?kS:CS,i=t*100;switch(r){case"clip-start":return o=>cj(o,i,n,"");case"clip-end":return o=>aj(o,i,n,"");case"ellipsis-start":return o=>cj(o,i,n,cf);case"ellipsis-middle":return o=>got(o,i,n,cf);case"ellipsis-end":return o=>aj(o,i,n,cf)}}var cf="\u2026";function uf(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=kh(e,s);let l=r(e,s,a);if(o+l>t){for(o+=n;o>t&&s>0;)a=s,s=i.pop(),o-=r(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function aj(e,t,r,n){e=e.trim();let i=r(n),[o]=uf(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function got(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=uf(e,t/2,r,o),[c]=uf(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(kh(e,c)).trimStart()}function cj(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=uf(e,i-t+o,r,-o);return s<0?n:n+e.slice(kh(e,s)).trimStart()}var gN=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,lj=/\p{Extended_Pictographic}/uy;function kh(e,t){return t+=xot(e,t)?2:1,_ot(e,t)&&(t=gN.lastIndex),bot(e,t)?kh(e,t+1):t}function fj(e,t){return e.charCodeAt(t)<128}function xot(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function bot(e,t){return e.charCodeAt(t)===8205}function _ot(e,t){return fj(e,t)?!1:(gN.lastIndex=t,gN.test(e))}function dj(e,t){return fj(e,t)?!1:(lj.lastIndex=t,lj.test(e))}var hj={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},pj=3.5,wot=pj*5,mj={draw(e,t,r){let n=t*r/wot;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},yj={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},vot=new Map([["arrow",mj],["spike",yj]]);function Sot(e){return e&&typeof e.draw=="function"}function Iot(e){if(Sot(e))return e;let t=vot.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var ff=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o=pj,length:s,rotate:a,shape:c=mj,anchor:l="middle",frameAnchor:u}=r,[f,d]=ye(s,12),[h,p]=ye(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},r,hj),this.r=+o,this.length=d,this.rotate=p,this.shape=Iot(c),this.anchor=Sr(l,"anchor",["start","middle","end"]),this.frameAnchor=Ts(u)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,length:u,rotate:f}=n,{length:d,rotate:h,anchor:p,shape:m,r:y}=this,[g,x]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Et,this).attr("transform",Fo`translate(${c?_=>c[_]:g},${l?_=>l[_]:x})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=Nn();return m.draw(v,u[_],y),v}:(()=>{let _=Nn();return m.draw(_,d,y),_})()).call(Wt,this,n)).node()}};function vN(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=Ke(r,n)),new ff(e,{...i,x:r,y:n})}function BS(e,t={}){let{x:r=G,...n}=t;return new ff(e,{...n,x:r})}function PS(e,t={}){let{y:r=G,...n}=t;return new ff(e,{...n,y:r})}function gj(e,t={}){let{shape:r=yj,stroke:n=hj.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return vN(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function bl(e,t){return arguments.length<2&&!kn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function US({anchor:e}={},t){return e===void 0?t[0]:Sr(e,"anchor",t)}function xj(e){return US(e,["left","right"])}function bj(e){return US(e,["right","left"])}function _j(e){return US(e,["bottom","top"])}function wj(e){return US(e,["top","bottom"])}function a0(){let[e,t]=bl(...arguments);return vj("y",xj(t),e,t)}function $S(){let[e,t]=bl(...arguments);return vj("fy",bj(t),e,t)}function c0(){let[e,t]=bl(...arguments);return Sj("x",_j(t),e,t)}function zS(){let[e,t]=bl(...arguments);return Sj("fx",wj(t),e,t)}function vj(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:x,marginTop:b=x===void 0?20:x,marginRight:_=x===void 0?t==="right"?40:0:x,marginBottom:v=x===void 0?20:x,marginLeft:w=x===void 0?t==="left"?40:0:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","top","bottom"])),E=Rj(E),yr(p&&!fe(o)?Tot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...I}):null,fe(c)?null:Eot(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Ej({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="y"&&O.inset||O,$=A??(L.bandwidth?"center":"top"),X=N??(t==="right"?k:U)-3;return $==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=$,this.frameAnchor=`${$}-${t}`,this.rotate=0),this.dy=$==="top"?3-B:$==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Oj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Sj(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:_=x===void 0?20:x,marginBottom:v=x===void 0?t==="bottom"?30:0:x,marginLeft:w=x===void 0?20:x,label:T,labelAnchor:A,labelArrow:E,labelOffset:N,...I}){return p=ie(p),m=ie(m),y=ie(y),A!==void 0&&(A=Sr(A,"labelAnchor",["center","left","right"])),E=Rj(E),yr(p&&!fe(o)?Aot(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...I}):null,fe(c)?null:Mot(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:b,marginRight:_,marginBottom:v,marginLeft:w,...I}),!fe(c)&&T!==null?Rs([],Ej({fill:c,fillOpacity:l,...I},function(R,C,S,M,O){let L=M[e],{marginTop:B,marginRight:k,marginBottom:P,marginLeft:U}=e==="x"&&O.inset||O,$=A??(L.bandwidth?"center":"right"),X=N??(t==="top"?B:P)-3;return $==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${$}`,this.textAnchor=$==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=$==="right"?k-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Oj(e,L,{anchor:t,label:T,labelAnchor:$,labelArrow:E})]}}}})):null)}function Tot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Bh(PS,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-We+ +u:+d+We-f,anchor:"start",length:c,shape:t==="left"?Dot:Lot})}function Aot(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Bh(BS,e,r,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-We-f:+d+We+ +u,anchor:"start",length:c,shape:t==="bottom"?Oot:Rot})}function Eot(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Lh):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y=e==="y"?void 0:null,...g}){return Bh(FS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Nj(x)),c===void 0&&(w.text=Mj(x,b,_,v,t))})}function Mot(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Lh):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:y=e==="x"?void 0:null,...g}){return Bh(LS,e,r,{ariaLabel:`${e}-axis tick label`},{facetAnchor:n,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,_,v,w){f===void 0&&(this.fontVariant=Nj(x)),c===void 0&&(w.text=Mj(x,b,_,v,t))})}function jS(){let[e,t]=bl(...arguments);return Ij("y",xj(t),e,t)}function qS(){let[e,t]=bl(...arguments);return Ij("fy",bj(t),e,t)}function VS(){let[e,t]=bl(...arguments);return Tj("x",_j(t),e,t)}function YS(){let[e,t]=bl(...arguments);return Tj("fx",wj(t),e,t)}function Ij(e,t,r,{y:n=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Bh(Si,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:n,x1:o,x2:s,...Aj(a)})}function Tj(e,t,r,{x:n=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Bh(vi,e,r,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:n,y1:o,y2:s,...Aj(a)})}function Aj({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:i=1,...o}){return{stroke:r,strokeOpacity:n,strokeWidth:i,...o}}function Ej({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=qe(e),[,t]=ye(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Bh(e,t,r,n,i,o){let s;function a(u,f,d,h,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=h;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:b,ticks:_,tickFormat:v,tickSpacing:w=t==="x"?80:35}=i;if(typeof _=="string"&&Dj(g)&&(b=_,_=void 0),_===void 0&&(_=Is(b,g.type)??Not(g,w)),u==null){if(kn(_))u=xi(_);else if(cl(_))u=SN(_,...ce(x));else if(g.interval){let A=g.interval;if(g.ticks){let[E,N]=ce(x),I=(N-E)/A[gh];A=f4(A,I/_)??A,u=SN(A,E,N)}else{u=x;let E=u.length;A=f4(A,E/_)??A,A!==g.interval&&(u=SN(A,...ce(u)))}if(A===g.interval){let E=Math.round(u.length/_);E>1&&(u=u.filter((N,I)=>I%E===0))}}else g.ticks?u=g.ticks(_):u=x;if(!g.ticks&&u.length&&u!==x){let A=new In(x);u=u.filter(E=>A.has(E)),u.length||mn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[Cn(u)]:s[t]={scale:t,value:G}}o?.call(this,g,u,_,v,s);let T=Object.fromEntries(Object.entries(s).map(([A,E])=>[A,{...E,value:_t(u,E.value)}]));return y&&(f=m.filterFacets(u,T)),{data:u,facets:f,channels:T}}let c=Ne(i).initializer,l=e(r,Ne({...i,initializer:a},c));return r==null?(s=l.channels,l.channels={}):s={},n!==void 0&&Object.assign(l,n),l.clip===void 0&&(l.clip=!1),l}function Not(e,t){let[r,n]=ce(e.range());return(n-r)/t}function Mj(e,t,r,n,i){return{value:l0(e,t,r,n,i)}}function l0(e,t,r,n,i){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Ve(t)?o$(e.type,t,i)??Os:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?Os:typeof n=="string"?(Ve(e.domain())?bs:Yi)(n):Ye(n)}function SN(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Oot={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Rot={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Dot={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Lot={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function Nj(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Oj(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Dj(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!o)return n;if(o===!0){let s=xS(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function Rj(e="auto"){return fe(e)?!1:typeof e=="boolean"?e:Sr(e,"labelArrow",["auto","up","right","down","left"])}function Dj(e){return Ve(e.domain())}function Lj(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function Fj(e,{opacity:t,...r}={}){if(!Ms(e)&&!Z4(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return kj(e,r,(n,i,o,s)=>n.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ye(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Cj(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:fe(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=qe(t),[f,d]=qe(n),h=Lj(c,l),p=Lj(c,f),m=s*s*Math.PI;return r=ye(r)[1],i=ye(i)[1],o=ye(o)[1],kj(e,a,(y,g,x,b)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",r).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Nn();return e.scale(_).draw(v,m),v}))}function kj(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=NS(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=pl(t);u=yl(u),i=l0(e.scale,e.domain,void 0,i);let p=lt("div",h).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),m;return n!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
|
|
28
28
|
display: flex;
|
|
29
29
|
align-items: center;
|
|
30
30
|
break-inside: avoid;
|
|
@@ -37,7 +37,7 @@ ${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){l
|
|
|
37
37
|
white-space: nowrap;
|
|
38
38
|
overflow: hidden;
|
|
39
39
|
text-overflow: ellipsis;
|
|
40
|
-
}`,p.style("columns",
|
|
40
|
+
}`,p.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(r,e,a,c).call(y=>y.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
|
|
41
41
|
display: flex;
|
|
42
42
|
align-items: center;
|
|
43
43
|
min-height: 33px;
|
|
@@ -47,7 +47,7 @@ ${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){l
|
|
|
47
47
|
display: inline-flex;
|
|
48
48
|
align-items: center;
|
|
49
49
|
margin-right: 1em;
|
|
50
|
-
}`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(
|
|
50
|
+
}`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(r,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(y=>y.insert("style","*").text(`:where(.${u}-swatches) {
|
|
51
51
|
font-family: system-ui, sans-serif;
|
|
52
52
|
font-size: 10px;
|
|
53
53
|
margin-bottom: 0.5em;
|
|
@@ -56,7 +56,7 @@ ${n}`}function Met(e){return e==="time"?ov:e==="utc"?Oy:Eet}function BP(e,t,n){l
|
|
|
56
56
|
margin-right: 0.5em;
|
|
57
57
|
overflow: visible;
|
|
58
58
|
}
|
|
59
|
-
${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",be(o,"normal")).call(Ud,f).node()}var Kv=new Map([["symbol",hU],["color",gU],["opacity",vrt]]);function mU(e={}){for(let[t,n]of Kv){let r=e[t];if(Jo(r)){let i=zc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Jo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Ev(t,r,o),h6(i,r,e),s=>Jo(e[s])?Ev(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function yU(e,t,n={}){return(r,i)=>{if(!Kv.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return Kv.get(r)(e[r],h6(t,n[r],i),o=>e[o])}}function h6({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return ZP(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function gU(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return dU(e,n);case"ramp":return A$(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function vrt({type:e,interpolate:t,...n},{legend:r=!0,color:i=cn(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return gU({type:e,...n,interpolate:Srt(i)},{legend:r,...o})}function Srt(e){let{r:t,g:n,b:r}=cn(e)||cn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function xU(e,t,n){let r=[];for(let[i,o]of Kv){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],h6(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}function Wc(e={}){return l3(e)?e:{...e,x:X}}function Xc(e={}){return u3(e)?e:{...e,y:X}}function Jv(e,t){if(t.length===1)return{data:e,facets:t};let n=Fc(e),r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Lc(e);let o=e[n3]=new Uint32Array(n+i);t=t.map(a=>Lc(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function p6(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Wd(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Md(c,l)}}function _U(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Wd(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function vU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Wd(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function m6(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Wd(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Md(c,l)}}function SU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Wd(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function IU(e={},t={}){arguments.length===1&&([e,t]=Gd(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Wd(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Hc({x:e,x1:t,x2:n,...r}={}){return r=co(r,"y"),t===void 0&&n===void 0?p6({x:e,...r}):([t,n]=f3(e,t,n),{...r,x1:t,x2:n})}function Qc({y:e,y1:t,y2:n,...r}={}){return r=co(r,"x"),t===void 0&&n===void 0?m6({y:e,...r}):([t,n]=f3(e,t,n),{...r,y1:t,y2:n})}function Gd(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var Irt={length:!0};function Wd(e,t=Ry,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Xn(a),[l,u]=Bn(e),[f,d]=wn(t),[h,p]=wn(t);return f.hint=h.hint=Irt,i=Trt(i),o=Mrt(o,i,r),[rn(a,(m,y,g)=>{({data:m,facets:y}=Jv(m,y));let x=e==null?void 0:u(bu(gt(m,e),g?.[n])),b=gt(m,t,Float64Array),w=gt(m,c),v=o&&o(m,x,b,w),_=Fc(m),T=d(new Float64Array(_)),A=p(new Float64Array(_)),E=[];for(let O of y){let I=x?Array.from(Rn(O,D=>x[D]).values()):[O];if(v)for(let D of I)D.sort(v);for(let D of I){let k=0,S=0;s&&D.reverse();for(let M of D){let N=b[M];N<0?k=A[M]=(T[M]=k)+N:N>0?S=A[M]=(T[M]=S)+N:A[M]=T[M]=S}}E.push(I)}return i&&i(E,T,A,w),{data:m,facets:y}}),l,f,h]}function Trt(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Ert;case"center":case"silhouette":return Art;case"wiggle":return EU}throw new Error(`unknown offset: ${e}`)}}function TU(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function Ert(e,t,n){for(let r of e)for(let i of r){let[o,s]=TU(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function Art(e,t,n){for(let r of e){for(let i of r){let[o,s]=TU(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}AU(r,t,n)}MU(e,t,n)}function EU(e,t,n,r){for(let i of e){let o=new ir,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...Hb(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Fn(l);d&&(s-=Fn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}AU(i,t,n)}MU(e,t,n)}function AU(e,t,n){let r=ue(e,i=>ue(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function MU(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ue(a,c=>t[c])+Qt(a,c=>n[c]))/2),s=ue(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function Mrt(e,t,n){if(e===void 0&&t===EU)return bU(xn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?mu:xn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return Ort(i);case"z":return Nrt(i);case"sum":return Drt(i);case"appearance":return Rrt(i);case"inside-out":return bU(i)}return wU(i3(e))}if(typeof e=="function")return(e.length===1?wU:Lrt)(e);if(Rr(e))return Frt(e);throw new Error(`invalid order: ${e}`)}}function Ort(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function Nrt(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function Drt(e){return t2(e,(t,n,r,i)=>Df(yr(t),o=>Fn(o,s=>r[s]),o=>i[o]))}function Rrt(e){return t2(e,(t,n,r,i)=>Df(yr(t),o=>n[zl(o,s=>r[s])],o=>i[o]))}function bU(e){return t2(e,(t,n,r,i)=>{let o=yr(t),s=Df(o,f=>n[zl(f,d=>r[d])],f=>i[f]),a=no(o,f=>Fn(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function wU(e){return t=>{let n=gt(t,e);return(r,i)=>xn(n[r],n[i])}}function Lrt(e){return t=>Rr(t)?(n,r)=>e(t[n],t[r]):(n,r)=>e(t.get(n),t.get(r))}function Frt(e){return t2(xn,()=>e)}function t2(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new ir(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var krt={ariaLabel:"rect"},Nu=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,krt),Qy(this,n),Zy(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:v,insetLeft:_}=this,{rx:T,ry:A,rx1y1:E,rx1y2:O,rx2y1:I,rx2y2:D}=this;(c||u)&&!x&&ri(s)&&(c=u=null),(l||f)&&!x&&ri(a)&&(l=f=null);let k=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(E||O||I||D?N=>N.append("path").call(It,this).call(Ky,c&&u?L=>c[L]+(u[L]<c[L]?-w:_):c?L=>c[L]+_:m+_,l&&f?L=>l[L]+(f[L]<l[L]?-v:b):l?L=>l[L]+b:d+b,c&&u?L=>u[L]-(u[L]<c[L]?-_:w):c?L=>c[L]+k-w:y-h-w,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+S-v:g-p-v,this).call(Yt,this,r):N=>N.append("rect").call(It,this).attr("x",c?u?L=>Math.min(c[L],u[L])+_:L=>c[L]+_:m+_).attr("y",l?f?L=>Math.min(l[L],f[L])+b:L=>l[L]+b:d+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+k-_-w):k-_-w:y-h-m-w-_).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+S-b-v):S-b-v:g-d-p-b-v).call(ft,"rx",T).call(ft,"ry",A).call(Yt,this,r))).node()}};function Qy(e,{inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=ee(n),e.insetRight=ee(r),e.insetBottom=ee(i),e.insetLeft=ee(o)}function Zy(e,{r:t,rx:n,ry:r,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:c=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){c||l||u||f?(e.rx1y1=c,e.rx1y2=l,e.rx2y1=u,e.rx2y2=f):(e.rx=be(n,"auto"),e.ry=be(r,"auto"))}function Ky(e,t,n,r,i,o){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:l}=o;typeof t!="function"&&(t=Ce(t)),typeof n!="function"&&(n=Ce(n)),typeof r!="function"&&(r=Ce(r)),typeof i!="function"&&(i=Ce(i));let u=Math.max(Math.abs(s+c),Math.abs(a+l)),f=Math.max(Math.abs(s+a),Math.abs(c+l));e.attr("d",d=>{let h=t(d),p=n(d),m=r(d),y=i(d),g=h>m,x=p>y,b=g?m:h,w=g?h:m,v=x?y:p,_=x?p:y,T=Math.min(1,(w-b)/u,(_-v)/f),A=T*(g?x?l:c:x?a:s),E=T*(g?x?a:s:x?l:c),O=T*(g?x?s:a:x?c:l),I=T*(g?x?c:l:x?s:a);return`M${b},${v+n2(A,I)}A${A},${A} 0 0 ${A<0?0:1} ${b+e2(A,I)},${v}H${w-e2(E,O)}A${E},${E} 0 0 ${E<0?0:1} ${w},${v+n2(E,O)}V${_-n2(O,E)}A${O},${O} 0 0 ${O<0?0:1} ${w-e2(O,E)},${_}H${b+e2(I,A)}A${I},${I} 0 0 ${I<0?0:1} ${b},${_-n2(I,A)}Z`})}function e2(e,t){return t<0?e:Math.abs(e)}function n2(e,t){return t<0?Math.abs(e):e}function Jy(e,t){return new Nu(e,i6(o6(t)))}function Xd(e,t={}){return _a(t)||(t={...t,y:ye,x2:X,interval:1}),new Nu(e,Hc(o6(Wc(t))))}function Hd(e,t={}){return _a(t)||(t={...t,x:ye,y2:X,interval:1}),new Nu(e,Qc(i6(Xc(t))))}var Crt={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Brt={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},t0=class extends xt{constructor(t={}){let{anchor:n=null}=t;super(Dc,void 0,t,n==null?Crt:Brt),this.anchor=c3(n,"anchor",["top","right","bottom","left"]),Qy(this,t),n||Zy(this,t)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y}=this,{rx:g,ry:x,rx1y1:b,rx1y2:w,rx2y1:v,rx2y2:_}=this,T=l+y,A=u-a-p,E=s+h,O=f-c-m;return ct(d?"svg:line":b||w||v||_?"svg:path":"svg:rect",o).datum(0).call(Rt,this,i,o).call(It,this).call(Yt,this,r).call(Et,this,{}).call(d==="left"?I=>I.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",O):d==="right"?I=>I.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",O):d==="top"?I=>I.attr("x1",T).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?I=>I.attr("x1",T).attr("x2",A).attr("y1",O).attr("y2",O):b||w||v||_?I=>I.call(Ky,T,E,A,O,this):I=>I.attr("x",T).attr("y",E).attr("width",A-T).attr("height",O-E).attr("rx",g).attr("ry",x)).node()}};function Qd(e){return new t0(e)}var y6={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Prt=new Set(["geometry","href","src","ariaLabel","scales"]),e0=class extends xt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&gr(t)&&lv(t)&&(n={...n,title:X});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:v="start",textOverflow:_,textPadding:T=8,title:A,pointerSize:E=12,pathFilter:O="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},n,y6),this.anchor=fv(l,"anchor"),this.preferredAnchor=fv(u,"preferredAnchor"),this.frameAnchor=ns(b),this.textAnchor=be(v,"middle"),this.textPadding=+T,this.pointerSize=+E,this.pathFilter=Ye(O),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=a6(_),this.monospace=!!f,this.fontFamily=Ye(d),this.fontSize=ee(h),this.fontStyle=Ye(p),this.fontVariant=Ye(m),this.fontWeight=Ye(y);for(let I in y6)I in this.channels&&(this[I]=y6[I]);this.splitLines=l6(this),this.clipLine=u6(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:T,x2:A,y2:E,x:O=_??A,y:I=T??E}=r,D=l?l(t.fx)-v:0,k=u?u(t.fy)-w:0,[S,M]=vn(this,i),N=J3(r,S),L=t6(r,M),B=p?jv:zv,C=B(Eu),P,$;"title"in r?(P=OU.call(this,{title:r.channels.title},n),$=jrt):(P=OU.call(this,r.channels,n),$=Vrt);let U=ct("svg:g",o).call(Rt,this,i,o).call(c6,this).call(Et,this,{x:O&&a,y:I&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(N(at))},${Math.round(L(at))})`).call(It,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(G){let st=jt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let V=$.call(s,G,t,P,n,r);if(typeof V=="string")for(let Q of s.splitLines(V))H(st,{value:s.clipLine(Q)});else{let Q=new Set;for(let rt of V){let{label:z=""}=rt;z&&Q.has(z)||(Q.add(z),H(st,rt))}}})));function H(ot,{label:at,value:G,color:st,opacity:V}){at??="",G??="";let Q=st!=null||V!=null,rt,z=y*100,[Ct]=Mu(at,z,B,C);if(Ct>=0)at=at.slice(0,Ct).trimEnd()+Eu,rt=G.trim(),G="";else{(at||!G&&!Q)&&(G=" "+G);let[Xt]=Mu(G,z-B(at),B,C);Xt>=0&&(rt=G.trim(),G=G.slice(0,Xt).trimEnd()+Eu)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),G&&ht.append(()=>d.createTextNode(G)),Q&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",V).style("user-select","none"),rt&&ht.append("title").text(rt)}function nt(){let{width:ot,height:at}=i.facet??i;U.selectChildren().each(function(G){let{x:st,width:V,height:Q}=this.getBBox();V=Math.round(V),Q=Math.round(Q);let rt=h;if(rt===void 0){let ht=N(G)+D,Xt=L(G)+k,Zt=ht+V+x+g*2<ot,tt=ht-V-x-g*2>0,ce=Xt+Q+x+g*2<at,Fr=Xt-Q-x-g*2>0;rt=Zt&&tt?ce&&Fr?s.preferredAnchor:Fr?"bottom":"top":ce&&Fr?Zt?"left":"right":(Zt||tt)&&(ce||Fr)?`${Fr?"bottom":"top"}-${Zt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Ct=this.lastChild;if(z.setAttribute("d",zrt(rt,x,g,V,Q)),st)for(let ht of Ct.childNodes)ht.setAttribute("x",-st);Ct.setAttribute("y",`${+$rt(rt,Ct.childNodes.length,m).toFixed(6)}em`),Ct.setAttribute("transform",`translate(${Urt(rt,x,g,V,Q)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(nt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(nt)),U.node()}};function i2(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new e0(e,{...r,x:t,y:n})}function $rt(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function Urt(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function zrt(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function OU(e,t){let n={},r=this.format;r=NU(r,e,"x"),r=NU(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=$y(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||Prt.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=$y(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;n[i]=o}}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(ke(s)?Qo:Ii)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Hy(s,s.domain()):as}}return n}function NU(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function jrt(e,t,{title:n}){return this.format.title(n.value[e],e)}function*Vrt(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:r2(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:RU(r,n,"x"),value:DU(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:RU(r,n,"y"),value:DU(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ne(a)&&c==null)continue;yield{label:r2(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function DU(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function RU(e,t,n){let r=r2(e,t,`${n}1`,n),i=r2(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function r2(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Zd(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Vc(e.className),l=e.marks===void 0?[]:FU(e.marks);l.push(...Hrt(l));let u=Wrt(t,e),f=new Map;for(let C of l){let P=kU(C,u,e);P&&f.set(C,P)}let d=new Map;u&&n0(d,[u],e),n0(d,f,e);let h=FU(Qrt(l,d,e));for(let C of h){let P=kU(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=c$(d,e);if(p!==void 0){let C=u?Nv(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?Nv(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,H)=>{U?.length>0&&P.add(H)});p.forEach(0<P.size&&P.size<p.length?($,U)=>$.empty=!P.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=f$(U.facetsIndex))}}for(let C of he.keys())Jo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let m=new Map;for(let C of l){if(m.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:H,channels:nt}=C.initialize(P,$,e);b6(nt,e),m.set(C,{data:U,facets:H,channels:nt})}let y=jy(n0(d,m,e),e),g=T$(y,l,e);e$(y,g);let x=P3(y),{fx:b,fy:w}=x,v=b||w?$3(y,g):g,_=b||w?rit(x,g):g,T=zc(e),A=T.document,E=ea("svg").call(A.documentElement),O=E;T.ownerSVGElement=E,T.className=c,T.projection=p$(e,v),T.filterFacets=(C,P)=>Nv(p,{channels:P,groups:Mv(C,P)}),T.getMarkState=C=>{let P=m.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{O.value!==C&&(O.value=C,O.dispatchEvent(new Event("input",{bubbles:!0})))};let I=new Set;for(let[C,P]of m)if(C.initializer!=null){let $=C.facet==="super"?_:v,U=C.initializer(P.data,P.facets,P.channels,x,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:H,fy:nt,...ot}=U.channels;Grt(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:G}=at;G!=null&&!e9(he.get(G))&&(PU(at,e),I.add(G))}(H!=null||nt!=null)&&f.set(C,!0)}}if(I.size){let C=new Map;n0(C,m,e,H=>I.has(H)),n0(d,m,e,H=>I.has(H));let P=nit(jy(C,e),y),{scales:$,...U}=P3(P);Object.assign(y,P),Object.assign(x,U),Object.assign(x.scales,$)}let D,k;p!==void 0&&(D={x:b?.domain(),y:w?.domain()},p=l$(p,D),k=u$(b,w,g));for(let[C,P]of m)P.values=C.scale(P.channels,x,T);let{width:S,height:M}=g;jt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",M).attr("viewBox",`0 0 ${S} ${M}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
|
|
59
|
+
${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",Oe(o,"normal")).call(Dh,f).node()}var WS=new Map([["symbol",Cj],["color",Uj],["opacity",Fot]]);function Bj(e={}){for(let[t,r]of WS){let n=e[t];if(vs(n)){let i=pl(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&vs(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(_S(t,n,o),IN(i,n,e),s=>vs(e[s])?_S(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function Pj(e,t,r={}){return(n,i)=>{if(!WS.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return WS.get(n)(e[n],IN(t,r[n],i),o=>e[o])}}function IN({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return b$(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function Uj(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return Fj(e,r);case"ramp":return Hz(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Fot({type:e,interpolate:t,...r},{legend:n=!0,color:i=wr(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return Uj({type:e,...r,interpolate:Cot(i)},{legend:n,...o})}function Cot(e){let{r:t,g:r,b:n}=wr(e)||wr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function $j(e,t,r){let n=[];for(let[i,o]of WS){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],IN(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}function _l(e={}){return _4(e)?e:{...e,x:G}}function wl(e={}){return w4(e)?e:{...e,y:G}}function GS(e,t){if(t.length===1)return{data:e,facets:t};let r=al(e),n=new Uint8Array(r),i=0;for(let a of t)for(let c of a)n[c]&&++i,n[c]=1;if(i===0)return{data:e,facets:t};e=sl(e);let o=e[h4]=new Uint32Array(r+i);t=t.map(a=>sl(a,Uint32Array));let s=r;n.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];n[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,n[u]=1}return{data:e,facets:t}}function TN(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=Uh(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:_h(c,l)}}function qj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=Uh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function Vj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=Uh(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function AN(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=Uh(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:_h(c,l)}}function Yj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=Uh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Wj(e={},t={}){arguments.length===1&&([e,t]=Ph(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=Uh(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function vl({x:e,x1:t,x2:r,...n}={}){return n=Do(n,"y"),t===void 0&&r===void 0?TN({x:e,...n}):([t,r]=v4(e,t,r),{...n,x1:t,x2:r})}function Sl({y:e,y1:t,y2:r,...n}={}){return n=Do(n,"x"),t===void 0&&r===void 0?AN({y:e,...n}):([t,r]=v4(e,t,r),{...n,y1:t,y2:r})}function Ph(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var kot={length:!0};function Uh(e,t=Wg,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=pn(a),[l,u]=tn(e),[f,d]=Br(t),[h,p]=Br(t);return f.hint=h.hint=kot,i=Bot(i),o=$ot(o,i,n),[mr(a,(m,y,g)=>{({data:m,facets:y}=GS(m,y));let x=e==null?void 0:u(tf(_t(m,e),g?.[r])),b=_t(m,t,Float64Array),_=_t(m,c),v=o&&o(m,x,b,_),w=al(m),T=d(new Float64Array(w)),A=p(new Float64Array(w)),E=[];for(let N of y){let I=x?Array.from(Hr(N,R=>x[R]).values()):[N];if(v)for(let R of I)R.sort(v);for(let R of I){let C=0,S=0;s&&R.reverse();for(let M of R){let O=b[M];O<0?C=A[M]=(T[M]=C)+O:O>0?S=A[M]=(T[M]=S)+O:A[M]=T[M]=S}}E.push(I)}return i&&i(E,T,A,_),{data:m,facets:y}}),l,f,h]}function Bot(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Pot;case"center":case"silhouette":return Uot;case"wiggle":return Xj}throw new Error(`unknown offset: ${e}`)}}function Gj(e,t){let r=0,n=0;for(let i of e){let o=t[i];o<r&&(r=o),o>n&&(n=o)}return[r,n]}function Pot(e,t,r){for(let n of e)for(let i of n){let[o,s]=Gj(i,r);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),r[a]=c*(r[a]-o)}}}function Uot(e,t,r){for(let n of e){for(let i of n){let[o,s]=Gj(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}Hj(n,t,r)}Qj(e,t,r)}function Xj(e,t,r,n){for(let i of e){let o=new Sn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(r[h]-t[h])),u=a.map(h=>{c=n?n[h]:++c;let p=r[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...q_(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=Zr(l);d&&(s-=Zr(l,(h,p)=>(u[p]/2+f[p])*h)/d)}Hj(i,t,r)}Qj(e,t,r)}function Hj(e,t,r){let n=Ht(e,i=>Ht(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function Qj(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Ht(a,c=>t[c])+Kt(a,c=>r[c]))/2),s=Ht(o);for(let a=0;a<n;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,r[l]+=c}}function $ot(e,t,r){if(e===void 0&&t===Xj)return zj(Cr);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?Qu:Cr;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return zot(i);case"z":return jot(i);case"sum":return qot(i);case"appearance":return Vot(i);case"inside-out":return zj(i)}return jj(m4(e))}if(typeof e=="function")return(e.length===1?jj:Yot)(e);if(Qn(e))return Wot(e);throw new Error(`invalid order: ${e}`)}}function zot(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function jot(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function qot(e){return XS(e,(t,r,n,i)=>Sd(Cn(t),o=>Zr(o,s=>n[s]),o=>i[o]))}function Vot(e){return XS(e,(t,r,n,i)=>Sd(Cn(t),o=>r[vu(o,s=>n[s])],o=>i[o]))}function zj(e){return XS(e,(t,r,n,i)=>{let o=Cn(t),s=Sd(o,f=>r[vu(f,d=>n[d])],f=>i[f]),a=Ao(o,f=>Zr(f,d=>n[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function jj(e){return t=>{let r=_t(t,e);return(n,i)=>Cr(r[n],r[i])}}function Yot(e){return t=>Qn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function Wot(e){return XS(Cr,()=>e)}function XS(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Sn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var Got={ariaLabel:"rect"},df=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Got),u0(this,r),f0(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x1:c,y1:l,x2:u,y2:f}=n,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:x}=o,{insetTop:b,insetRight:_,insetBottom:v,insetLeft:w}=this,{rx:T,ry:A,rx1y1:E,rx1y2:N,rx2y1:I,rx2y2:R}=this;(c||u)&&!x&&wi(s)&&(c=u=null),(l||f)&&!x&&wi(a)&&(l=f=null);let C=s?.bandwidth?s.bandwidth():0,S=a?.bandwidth?a.bandwidth():0;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(E||N||I||R?O=>O.append("path").call(Et,this).call(d0,c&&u?L=>c[L]+(u[L]<c[L]?-_:w):c?L=>c[L]+w:m+w,l&&f?L=>l[L]+(f[L]<l[L]?-v:b):l?L=>l[L]+b:d+b,c&&u?L=>u[L]-(u[L]<c[L]?-w:_):c?L=>c[L]+C-_:y-h-_,l&&f?L=>f[L]-(f[L]<l[L]?-b:v):l?L=>l[L]+S-v:g-p-v,this).call(Wt,this,n):O=>O.append("rect").call(Et,this).attr("x",c?u?L=>Math.min(c[L],u[L])+w:L=>c[L]+w:m+w).attr("y",l?f?L=>Math.min(l[L],f[L])+b:L=>l[L]+b:d+b).attr("width",c?u?L=>Math.max(0,Math.abs(u[L]-c[L])+C-w-_):C-w-_:y-h-m-_-w).attr("height",l?f?L=>Math.max(0,Math.abs(l[L]-f[L])+S-b-v):S-b-v:g-d-p-b-v).call(dt,"rx",T).call(dt,"ry",A).call(Wt,this,n))).node()}};function u0(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=ie(r),e.insetRight=ie(n),e.insetBottom=ie(i),e.insetLeft=ie(o)}function f0(e,{r:t,rx:r,ry:n,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:c=i!==void 0?+i:o!==void 0?+o:0,rx1y2:l=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){c||l||u||f?(e.rx1y1=c,e.rx1y2=l,e.rx2y1=u,e.rx2y2=f):(e.rx=Oe(r,"auto"),e.ry=Oe(n,"auto"))}function d0(e,t,r,n,i,o){let{rx1y1:s,rx1y2:a,rx2y1:c,rx2y2:l}=o;typeof t!="function"&&(t=Ye(t)),typeof r!="function"&&(r=Ye(r)),typeof n!="function"&&(n=Ye(n)),typeof i!="function"&&(i=Ye(i));let u=Math.max(Math.abs(s+c),Math.abs(a+l)),f=Math.max(Math.abs(s+a),Math.abs(c+l));e.attr("d",d=>{let h=t(d),p=r(d),m=n(d),y=i(d),g=h>m,x=p>y,b=g?m:h,_=g?h:m,v=x?y:p,w=x?p:y,T=Math.min(1,(_-b)/u,(w-v)/f),A=T*(g?x?l:c:x?a:s),E=T*(g?x?a:s:x?l:c),N=T*(g?x?s:a:x?c:l),I=T*(g?x?c:l:x?s:a);return`M${b},${v+QS(A,I)}A${A},${A} 0 0 ${A<0?0:1} ${b+HS(A,I)},${v}H${_-HS(E,N)}A${E},${E} 0 0 ${E<0?0:1} ${_},${v+QS(E,N)}V${w-QS(N,E)}A${N},${N} 0 0 ${N<0?0:1} ${_-HS(N,E)},${w}H${b+HS(I,A)}A${I},${I} 0 0 ${I<0?0:1} ${b},${w-QS(I,A)}Z`})}function HS(e,t){return t<0?e:Math.abs(e)}function QS(e,t){return t<0?Math.abs(e):e}function h0(e,t){return new df(e,mN(yN(t)))}function $h(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G,interval:1}),new df(e,vl(yN(_l(t))))}function zh(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G,interval:1}),new df(e,Sl(mN(wl(t))))}var Xot={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Hot={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},p0=class extends vt{constructor(t={}){let{anchor:r=null}=t;super(il,void 0,t,r==null?Xot:Hot),this.anchor=b4(r,"anchor",["top","right","bottom","left"]),u0(this,t),r||f0(this,t)}render(t,r,n,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:y}=this,{rx:g,ry:x,rx1y1:b,rx1y2:_,rx2y1:v,rx2y2:w}=this,T=l+y,A=u-a-p,E=s+h,N=f-c-m;return lt(d?"svg:line":b||_||v||w?"svg:path":"svg:rect",o).datum(0).call(kt,this,i,o).call(Et,this).call(Wt,this,n).call(Rt,this,{}).call(d==="left"?I=>I.attr("x1",T).attr("x2",T).attr("y1",E).attr("y2",N):d==="right"?I=>I.attr("x1",A).attr("x2",A).attr("y1",E).attr("y2",N):d==="top"?I=>I.attr("x1",T).attr("x2",A).attr("y1",E).attr("y2",E):d==="bottom"?I=>I.attr("x1",T).attr("x2",A).attr("y1",N).attr("y2",N):b||_||v||w?I=>I.call(d0,T,E,A,N,this):I=>I.attr("x",T).attr("y",E).attr("width",A-T).attr("height",N-E).attr("rx",g).attr("ry",x)).node()}};function jh(e){return new p0(e)}var EN={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Qot=new Set(["geometry","href","src","ariaLabel","scales"]),m0=class extends vt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&kn(t)&&nS(t)&&(r={...r,title:G});let{x:n,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:x=20,frameAnchor:b,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:A,pointerSize:E=12,pathFilter:N="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:o!=null&&s!=null?null:n,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},r,EN),this.anchor=oS(l,"anchor"),this.preferredAnchor=oS(u,"preferredAnchor"),this.frameAnchor=Ts(b),this.textAnchor=Oe(v,"middle"),this.textPadding=+T,this.pointerSize=+E,this.pathFilter=rr(N),this.lineHeight=+g,this.lineWidth=+x,this.textOverflow=xN(w),this.monospace=!!f,this.fontFamily=rr(d),this.fontSize=ie(h),this.fontStyle=rr(p),this.fontVariant=rr(m),this.fontWeight=rr(y);for(let I in EN)I in this.channels&&(this[I]=EN[I]);this.splitLines=_N(this),this.clipLine=wN(this),this.format=typeof _=="string"||typeof _=="function"?{title:_}:{..._}}render(t,r,n,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=r,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:x,pathFilter:b}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:A,y2:E,x:N=w??A,y:I=T??E}=n,R=l?l(t.fx)-v:0,C=u?u(t.fy)-_:0,[S,M]=Ur(this,i),O=uN(n,S),L=fN(n,M),B=p?kS:CS,k=B(cf),P,U;"title"in n?(P=Zj.call(this,{title:n.channels.title},r),U=tst):(P=Zj.call(this,n.channels,r),U=est);let $=lt("svg:g",o).call(kt,this,i,o).call(bN,this).call(Rt,this,{x:N&&a,y:I&&c}).call(ot=>ot.selectAll().data(t).enter().append("g").attr("transform",at=>`translate(${Math.round(O(at))},${Math.round(L(at))})`).call(Et,this).call(at=>at.append("path").attr("filter",b)).call(at=>at.append("text").each(function(Y){let st=Qt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=U.call(s,Y,t,P,r,n);if(typeof q=="string")for(let H of s.splitLines(q))X(st,{value:s.clipLine(H)});else{let H=new Set;for(let nt of q){let{label:z=""}=nt;z&&H.has(z)||(H.add(z),X(st,nt))}}})));function X(ot,{label:at,value:Y,color:st,opacity:q}){at??="",Y??="";let H=st!=null||q!=null,nt,z=y*100,[Pt]=uf(at,z,B,k);if(Pt>=0)at=at.slice(0,Pt).trimEnd()+cf,nt=Y.trim(),Y="";else{(at||!Y&&!H)&&(Y=" "+Y);let[Zt]=uf(Y,z-B(at),B,k);Zt>=0&&(nt=Y.trim(),Y=Y.slice(0,Zt).trimEnd()+cf)}let ht=ot.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");at&&ht.append("tspan").attr("font-weight","bold").text(at),Y&&ht.append(()=>d.createTextNode(Y)),H&&ht.append("tspan").text(" \u25A0").attr("fill",st).attr("fill-opacity",q).style("user-select","none"),nt&&ht.append("title").text(nt)}function rt(){let{width:ot,height:at}=i.facet??i;$.selectChildren().each(function(Y){let{x:st,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let nt=h;if(nt===void 0){let ht=O(Y)+R,Zt=L(Y)+C,Jt=ht+q+x+g*2<ot,tt=ht-q-x-g*2>0,ge=Zt+H+x+g*2<at,Kn=Zt-H-x-g*2>0;nt=Jt&&tt?ge&&Kn?s.preferredAnchor:Kn?"bottom":"top":ge&&Kn?Jt?"left":"right":(Jt||tt)&&(ge||Kn)?`${Kn?"bottom":"top"}-${Jt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Pt=this.lastChild;if(z.setAttribute("d",Jot(nt,x,g,q,H)),st)for(let ht of Pt.childNodes)ht.setAttribute("x",-st);Pt.setAttribute("y",`${+Zot(nt,Pt.childNodes.length,m).toFixed(6)}em`),Pt.setAttribute("transform",`translate(${Kot(nt,x,g,q,H)})`)}),$.attr("visibility",null)}return t.length&&($.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(rt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(rt)),$.node()}};function KS(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new m0(e,{...n,x:t,y:r})}function Zot(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function Kot(e,t,r,n,i){switch(e){case"middle":return[-n/2,i/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,i/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,i/2]}}function Jot(e,t,r,n,i){let o=n+r*2,s=i+r*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function Zj(e,t){let r={},n=this.format;n=Kj(n,e,"x"),n=Kj(n,e,"y"),this.format=n;for(let i in n){let o=n[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")r[i]=!0;else{let s=Jg(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||Qot.has(i)||(i==="x"||i==="y")&&e.geometry)continue;let o=Jg(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;r[i]=o}}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let i in r){let o=this.format[i];if(typeof o=="string"){let s=r[i]?.value??t[i]?.domain()??[];this.format[i]=(Ve(s)?bs:Yi)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?l0(s,s.domain()):Os}}return r}function Kj(e,t,r){if(!(r in e))return e;let n=`${r}1`,i=`${r}2`;if((n in e||!(n in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[r];return o.splice(o.findIndex(([a])=>a===r)+1,0,[n,s],[i,s]),Object.fromEntries(o)}function tst(e,t,{title:r}){return this.format.title(r.value[e],e)}function*est(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:ZS(n,r,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in r||o==="y1"&&"y2"in r)continue;let s=r[o];if(o==="x2"&&"x1"in r)yield{label:tq(n,r,"x"),value:Jj(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:tq(n,r,"y"),value:Jj(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Pe(a)&&c==null)continue;yield{label:ZS(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function Jj(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function tq(e,t,r){let n=ZS(e,t,`${r}1`,r),i=ZS(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function ZS(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function qh(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=yl(e.className),l=e.marks===void 0?[]:rq(e.marks);l.push(...ast(l));let u=ost(t,e),f=new Map;for(let k of l){let P=nq(k,u,e);P&&f.set(k,P)}let d=new Map;u&&y0(d,[u],e),y0(d,f,e);let h=rq(cst(l,d,e));for(let k of h){let P=nq(k,u,e);P&&f.set(k,P)}l.unshift(...h);let p=Oz(d,e);if(p!==void 0){let k=u?IS(p,u):void 0;for(let U of l){if(U.facet===null||U.facet==="super")continue;let $=f.get(U);$!==void 0&&($.facetsIndex=U.fx!=null||U.fy!=null?IS(p,$):k)}let P=new Set;for(let{facetsIndex:U}of f.values())U?.forEach(($,X)=>{$?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?(U,$)=>U.empty=!P.has($):U=>U.empty=!1);for(let U of l)if(U.facet==="exclude"){let $=f.get(U);$!==void 0&&($.facetsIndex=Lz($.facetsIndex))}}for(let k of _e.keys())vs(e[k])&&k!=="fx"&&k!=="fy"&&d.set(k,[]);let m=new Map;for(let k of l){if(m.has(k))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(k)??{},{data:$,facets:X,channels:rt}=k.initialize(P,U,e);ON(rt,e),m.set(k,{data:$,facets:X,channels:rt})}let y=r0(y0(d,m,e),e),g=Gz(y,l,e);Sz(y,g);let x=H4(y),{fx:b,fy:_}=x,v=b||_?Q4(y,g):g,w=b||_?mst(x,g):g,T=pl(e),A=T.document,E=Na("svg").call(A.documentElement),N=E;T.ownerSVGElement=E,T.className=c,T.projection=kz(e,v),T.filterFacets=(k,P)=>IS(p,{channels:P,groups:vS(k,P)}),T.getMarkState=k=>{let P=m.get(k),U=f.get(k);return{...P,channels:{...P.channels,...U?.channels}}},T.dispatchValue=k=>{N.value!==k&&(N.value=k,N.dispatchEvent(new Event("input",{bubbles:!0})))};let I=new Set;for(let[k,P]of m)if(k.initializer!=null){let U=k.facet==="super"?w:v,$=k.initializer(P.data,P.facets,P.channels,x,U,T);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:rt,...ot}=$.channels;ist(ot),Object.assign(P.channels,ot);for(let at of Object.values(ot)){let{scale:Y}=at;Y!=null&&!S$(_e.get(Y))&&(sq(at,e),I.add(Y))}(X!=null||rt!=null)&&f.set(k,!0)}}if(I.size){let k=new Map;y0(k,m,e,X=>I.has(X)),y0(d,m,e,X=>I.has(X));let P=pst(r0(k,e),y),{scales:U,...$}=H4(P);Object.assign(y,P),Object.assign(x,$),Object.assign(x.scales,U)}let R,C;p!==void 0&&(R={x:b?.domain(),y:_?.domain()},p=Rz(p,R),C=Dz(b,_,g));for(let[k,P]of m)P.values=k.scale(P.channels,x,T);let{width:S,height:M}=g;Qt(E).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",M).attr("viewBox",`0 0 ${S} ${M}`).attr("aria-label",s).attr("aria-description",a).call(k=>k.append("style").text(`:where(.${c}) {
|
|
60
60
|
--plot-background: white;
|
|
61
61
|
display: block;
|
|
62
62
|
height: auto;
|
|
@@ -66,4 +66,4 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
|
|
|
66
66
|
:where(.${c} text),
|
|
67
67
|
:where(.${c} tspan) {
|
|
68
68
|
white-space: pre;
|
|
69
|
-
}`)).call(Ud,n);for(let C of l){let{channels:P,values:$,facets:U}=m.get(C);if(p===void 0||C.facet==="super"){let H=null;if(U&&(H=U[0],H=C.filter(H,P,$),H.length===0))continue;let nt=C.render(H,x,$,_,T);if(nt==null)continue;E.appendChild(nt)}else{let H;for(let nt of p){if(!(C.facetAnchor?.(p,D,nt)??!nt.empty))continue;let ot=null;if(U){let G=f.has(C);if(ot=U[G?nt.i:0],ot=C.filter(ot,P,$),ot.length===0)continue;!G&&ot===U[0]&&(ot=va(ot)),ot.fx=nt.x,ot.fy=nt.y,ot.fi=nt.i}let at=C.render(ot,x,$,v,T);if(at!=null){(H??=jt(E).append("g")).append(()=>at).datum(nt);for(let G of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(G)&&(H.attr(G,at.getAttribute(G)),at.removeAttribute(G))}}H?.selectChildren().attr("transform",k)}}let N=xU(y,T,e),{figure:L=r!=null||i!=null||o!=null||N.length>0}=e;L&&(O=A.createElement("figure"),O.className=`${c}-figure`,O.style.maxWidth="initial",r!=null&&O.append(LU(A,r,"h2")),i!=null&&O.append(LU(A,i,"h3")),O.append(...N,E),o!=null&&O.append(qrt(A,o)),"value"in E&&(O.value=E.value,delete E.value)),O.scale=o$(x.scales),O.legend=yU(y,T,e);let B=C9();return B>0&&jt(E).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),O}function LU(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function qrt(e,t){let n=e.createElement("figcaption");return n.append(t),n}function FU(e){return e.flat(1/0).filter(t=>t!=null).map(Yrt)}function Yrt(e){return typeof e.render=="function"?e:new x6(e)}var x6=class extends xt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function b6(e,t){for(let n in e)PU(e[n],t);return e}function PU(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c==null?NaN:c*100:d3(s,i)}=t[n]??{};a!=null&&(e.value=Wt(e.value,a),e.transform=!1)}function Grt(e){for(let t in e)M3(t,e[t])}function n0(e,t,n,r=zP){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!y$(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=x$(s);c&&g6(e,"x",u),l&&g6(e,"y",f)}}}else g6(e,a,s)}return e}function g6(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function Wrt(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=wa(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Ld(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Ld(i,{value:r,scale:"fy"})),b6(o,t);let s=Mv(i,o);return{channels:o,groups:s,data:e.data}}function kU(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=wa(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Ld(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Ld(c,{value:i,scale:"fy"})),b6(l,n),{channels:l,groups:Mv(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&Fc(wa(e.data))===Fc(a)&&Hn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function Xrt(e,t={}){return xe({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function Hrt(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?Yc:/^y$/i.test(i)?Na:qc,r=i(Xrt(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Na?"left":"bottom");let s=i2(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function Qrt(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Jo(i)&&!CU("x",e))&&(h=p=null),(r||!Jo(o)&&!CU("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!a2(e,"x")),m===void 0&&(m=!a2(e,"y")),g===void 0&&(g=!a2(e,"fx")),b===void 0&&(b=!a2(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return s2(v,w,Hv,a),o2(v,b,Gv,"right","left",u,a),s2(v,x,Zv,s),o2(v,g,Wv,"top","bottom",u,s),s2(v,y,Xv,o),o2(v,m,Wy,"left","right",n,o),s2(v,p,Qv,i),o2(v,h,Xy,"bottom","top",n,i),v}function o2(e,t,n,r,i,o,s){if(!t)return;let a=Zrt(t);s=Krt(a?r:t,o,s);let{line:c}=s;(n===Wy||n===Xy)&&c&&!Ia(c)&&e.push(Qd(Jrt(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function s2(e,t,n,r){!t||Ia(t)||e.push(n(tit(t,r)))}function Zrt(e){return/^\s*both\s*$/i.test(e)}function Krt(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function Jrt(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function tit(e,{stroke:t=Cc(e)?e:void 0,ticks:n=eit(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function eit(e){switch(typeof e){case"number":return!0;case"string":return!Cc(e)}return gr(e)||typeof e?.range=="function"}function a2(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function CU(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function nit(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function rit({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tv(n),l=e&&BU(e),u=t&&BU(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function BU(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var iit=new Map([["basis",NM],["basis-closed",DM],["basis-open",RM],["bundle",LM],["bump-x",TM],["bump-y",EM],["cardinal",FM],["cardinal-closed",kM],["cardinal-open",CM],["catmull-rom",BM],["catmull-rom-closed",PM],["catmull-rom-open",$M],["linear",ya],["linear-closed",UM],["monotone-x",jM],["monotone-y",VM],["natural",qM],["step",YM],["step-after",WM],["step-before",GM]]);function r0(e=ya,t){if(typeof e=="function")return e;let n=iit.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function c2(e=Zc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Zc:r0(e,t)}function Zc(e){return ya(e)}function ls(e={y:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=t;return w6(l2(n,t,X),null,null,r,e,Iu(t))}function us(e={x:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=t;return w6(null,l2(r,t,X),n,null,e,Tu(t))}function Ra(e={fill:"count"},t={}){[e,t]=_6(e,t);let{x:n,y:r}=oit(t);return w6(n,r,null,null,e,Iu(Tu(t)))}function zU(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=bv}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function Kd(e={}){return zU(ls,"y",co(e,"x"))}function Jd(e={}){return zU(us,"x",co(e,"y"))}function w6(e,t,n,r,{data:i=xv,filter:o=ky,sort:s,reverse:a,...c}={},l={}){e=$U(e),t=$U(t),c=sit(c,l),i=qU(i,X),s=s==null?void 0:jU("sort",s,l),o=o==null?void 0:VU("filter",o,l),n!=null&&is(c,"x","x1","x2")&&(n=null),r!=null&&is(c,"y","y1","y2")&&(r=null);let[u,f]=Bn(e),[d,h]=Bn(e),[p,m]=Bn(t),[y,g]=Bn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=Bn(x),{x:_,y:T,z:A,fill:E,stroke:O,x1:I,x2:D,y1:k,y2:S,domain:M,cumulative:N,thresholds:L,interval:B,...C}=l,[P,$]=Bn(A),[U]=Fe(E),[H]=Fe(O),[nt,ot]=Bn(U),[at,G]=Bn(H);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:nt||E},..."stroke"in l&&{stroke:at||O},...rn(C,(st,V,Q)=>{let rt=bu(gt(st,x),Q?.[b]),z=gt(st,A),Ct=gt(st,U),ht=gt(st,H),Xt=Py(c,{z,fill:Ct,stroke:ht}),Zt=[],tt=[],ce=rt&&v([]),Fr=z&&$([]),ho=Ct&&ot([]),jV=ht&&G([]),WR=e&&f([]),VV=e&&h([]),XR=t&&m([]),qV=t&&g([]),YV=lit(e,t,st),GV=0;for(let Vu of c)Vu.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Vu of V){let HR=[];for(let qu of c)qu.scope("facet",Vu);s&&s.scope("facet",Vu),o&&o.scope("facet",Vu);for(let[qu,WV]of rs(Vu,Xt))for(let[XV,ag]of rs(WV,rt))for(let[po,gs]of YV(ag))if(Xt&&(gs.z=qu),!(o&&!o.reduce(po,gs))){HR.push(GV++),tt.push(i.reduceIndex(po,st,gs)),rt&&ce.push(XV),z&&Fr.push(Xt===z?qu:z[(po.length>0?po:ag)[0]]),Ct&&ho.push(Xt===Ct?qu:Ct[(po.length>0?po:ag)[0]]),ht&&jV.push(Xt===ht?qu:ht[(po.length>0?po:ag)[0]]),WR&&(WR.push(gs.x1),VV.push(gs.x2)),XR&&(XR.push(gs.y1),qV.push(gs.y2));for(let HV of c)HV.reduce(po,gs);s&&s.reduce(po,gs)}Zt.push(HR)}return T3(Zt,s,a),{data:tt,facets:Zt}}),...!is(c,"x")&&(u?{x1:u,x2:d,x:Md(u,d)}:{x:_,x1:I,x2:D}),...!is(c,"y")&&(p?{y1:p,y2:y,y:Md(p,y)}:{y:T,y1:k,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:st,output:V})=>[st,V]))}}function _6({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function l2(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...Di(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=v6(e.thresholds,e.interval),e}function oit(e){let{x:t,y:n}=e;return t=l2(t,e),n=l2(n,e),[t.value,n.value]=je(t.value,n.value),{x:t,y:n}}function $U(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ne,thresholds:i}=e,o=s=>{let a=gt(s,t),c;if(ke(a)||cit(i)){a=Wt(a,a3,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!kc(i)?i(a,u,f):i;typeof d=="number"&&(d=ny(u,f,d)),kc(d)&&(r===ne&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=nn(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!kc(i)?i(a,u,f):i;if(typeof d=="number")if(r===ne){let h=Ks(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=Ln(u,f,d);else kc(d)&&(r===ne&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?fit:n>0?uit:S6)(l,c,a),l};return o.label=Pn(t),o}function v6(e,t,n=UU){if(e===void 0)return t===void 0?n:es(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return t1;case"scott":return Zp;case"sturges":return dc;case"auto":return UU}return gu(e)}return e}function sit(e,t){return S3(e,t,jU)}function jU(e,t,n){return yv(e,t,n,VU)}function VU(e,t,n){return gv(e,t,n,qU)}function qU(e,t){return Rd(e,t,ait)}function ait(e){switch(`${e}`.toLowerCase()){case"x":return dit;case"x1":return pit;case"x2":return mit;case"y":return hit;case"y1":return yit;case"y2":return git;case"z":return E3}throw new Error(`invalid bin reduce: ${e}`)}function UU(e,t,n){return Math.min(200,Zp(e,t,n))}function cit(e){return qP(e)||gr(e)&&ke(e)}function lit(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function S6(e,t,n){return t=nn(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Qs(t,n[o])-1]?.push(o);return i}}function uit(e,t,n){let r=S6(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function fit(e,t,n){let r=S6(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function YU(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var dit={reduceIndex(e,t,{x1:n,x2:r}){return YU(n,r)}},hit={reduceIndex(e,t,{y1:n,y2:r}){return YU(n,r)}},pit={reduceIndex(e,t,{x1:n}){return n}},mit={reduceIndex(e,t,{x2:n}){return n}},yit={reduceIndex(e,t,{y1:n}){return n}},git={reduceIndex(e,t,{y2:n}){return n}};var xit={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Du=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Xn(n),optional:!0}},n,xit),this.z=a,this.curve=r0(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n,0,0).call(u=>u.selectAll().data(Fv(t,[s,a,c,l],this,r)).enter().append("path").call(It,this).call(Su,this,r).attr("d",yd().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function i0(e,t){return t===void 0?La(e,{x:xu,y:Rc}):new Du(e,t)}function Kc(e,t){let{y:n=ye,...r}=Jd(t);return new Du(e,Hc(Wc({...r,y1:n,y2:void 0})))}function La(e,t){let{x:n=ye,...r}=Kd(t);return new Du(e,Qc(Xc({...r,x1:n,x2:void 0})))}var bit={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},o0=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,bit),this.curve=c2(a,c),lo(this,n)}project(t,n,r){this.curve!==Zc&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(It,this).attr("d",u===Zc&&o.projection?wit(o.projection,s,a,c,l):d=>{let h=ur(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Yt,this,r).call(Da,this,r,o)).node()}};function wit(e,t,n,r,i){let o=mn(e);return t=nn(t),n=nn(n),r=nn(r),i=nn(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function u2(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=s0(t,n,r),[o,s]=s0(i,o,s),new o0(e,{...a,x1:n,x2:r,y1:o,y2:s})}function s0(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var _it={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},a0=class extends xt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,_it),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=vit(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?w=>u[w]:Ce(f===void 0?1:f),x=h*zd/2,b=p/1.5;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(It,this).attr("d",v=>{let _=s[v],T=a[v],A=c[v],E=l[v],O=Math.hypot(A-_,E-T);if(O<=m+y)return null;let I=Math.atan2(E-T,A-_),D=Math.min(b*g(v),O/3),k=this.sweep(_,T,A,E)*d*zd,S=Math.hypot(O/Math.tan(k),O)/2;if(m||y)if(S<1e5){let nt=Math.sign(k),[ot,at]=Sit([_,T],[A,E],S,nt);if(m&&([_,T]=GU([ot,at,S],[_,T,m],-nt*Math.sign(m))),y){let[G,st]=GU([ot,at,S],[A,E,y],nt*Math.sign(y));I+=Math.atan2(st-at,G-ot)-Math.atan2(E-at,A-ot),A=G,E=st}}else{let nt=A-_,ot=E-T,at=Math.hypot(nt,ot);m&&(_+=nt/at*m,T+=ot/at*m),y&&(A-=nt/at*y,E-=ot/at*y)}let M=I+k,N=M+x,L=M-x,B=A-D*Math.cos(N),C=E-D*Math.sin(N),P=A-D*Math.cos(L),$=E-D*Math.sin(L),U=S<1e5?`A${S},${S} 0,0,${k>0?1:0} `:"L",H=D?`M${B},${C}L${A},${E}L${P},${$}`:"";return`M${_},${T}${U}${A},${E}${H}`}).call(Yt,this,r)).node()}};function vit(e=1){if(typeof e=="number")return Ce(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(un(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Nt(t,r);case"-x":return(t,n,r)=>rr(t,r);case"+y":return(t,n,r,i)=>Nt(n,i);case"-y":return(t,n,r,i)=>rr(n,i)}}function Sit([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function GU([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function WU(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=s0(t,n,r),[o,s]=s0(i,o,s),new a0(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Iit={ariaLabel:"bar"},th=class extends xt{constructor(t,n,r={},i=Iit){super(t,n,r,i),Qy(this,r),Zy(this,r)}render(t,n,r,i,o){let{rx:s,ry:a,rx1y1:c,rx1y2:l,rx2y1:u,rx2y2:f}=this,d=this._x(n,r,i),h=this._y(n,r,i),p=this._width(n,r,i),m=this._height(n,r,i);return ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(y=>y.selectAll().data(t).enter().call(c||l||u||f?g=>g.append("path").call(It,this).call(Ky,d,h,XU(d,p),XU(h,m),this).call(Yt,this,r):g=>g.append("rect").call(It,this).attr("x",d).attr("width",p).attr("y",h).attr("height",m).call(ft,"rx",s).call(ft,"ry",a).call(Yt,this,r))).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}};function XU(e,t){return typeof e=="function"&&typeof t=="function"?n=>e(n)+t(n):typeof e=="function"?n=>e(n)+t:typeof t=="function"?n=>e+t(n):e+t}var Ru=class extends th{constructor(t,n={},r){let{x1:i,x2:o,y:s}=n;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return ri(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return ri(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Lu=class extends th{constructor(t,n={},r){let{x:i,y1:o,y2:s}=n;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},n,r)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return ri(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return ri(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function fs(e,t={}){return _a(t)||(t={...t,y:ye,x2:X}),new Ru(e,Hc(jd(Wc(t))))}function ds(e,t={}){return _a(t)||(t={...t,x:ye,y2:X}),new Lu(e,Qc(Vd(Xc(t))))}var Tit={ariaLabel:"cell"},Fu=class extends th{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,Tit)}_transform(t,n){t.call(Et,n,{},0,0)}};function Jc(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new Fu(e,{...r,x:t,y:n})}function HU(e,{x:t=ye,fill:n,stroke:r,...i}={}){return n===void 0&&Fe(r)[0]===void 0&&(n=X),new Fu(e,{...i,x:t,fill:n,stroke:r})}function QU(e,{y:t=ye,fill:n,stroke:r,...i}={}){return n===void 0&&Fe(r)[0]===void 0&&(n=X),new Fu(e,{...i,y:t,fill:n,stroke:r})}var Eit={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function c0(e){return e.sort===void 0&&e.reverse===void 0?pv({channel:"-r"},e):e}var ku=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=ga,frameAnchor:c}=n,[l,u]=ae(s,0),[f,d]=i9(a),[h,p]=ae(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:mr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},c0(n),Eit),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=ns(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[y,g]=vn(this,i),x=m===ga,b=u?void 0:h*h*Math.PI;return Ac(h)&&(t=[]),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(It,this).call(x?v=>{v.attr("cx",c?_=>c[_]:y).attr("cy",l?_=>l[_]:g).attr("r",u?_=>u[_]:h)}:v=>{v.attr("transform",uo`translate(${c?_=>c[_]:y},${l?_=>l[_]:g})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?_=>{let T=ur();return d[_].draw(T,u[_]*u[_]*Math.PI),T}:u?_=>{let T=ur();return m.draw(T,u[_]*u[_]*Math.PI),T}:d?_=>{let T=ur();return d[_].draw(T,b),T}:(()=>{let _=ur();return m.draw(_,b),_})())}).call(Yt,this,r)).node()}};function Li(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new ku(e,{...r,x:t,y:n})}function ZU(e,{x:t=X,...n}={}){return new ku(e,Pv({...n,x:t}))}function KU(e,{y:t=X,...n}={}){return new ku(e,Bv({...n,y:t}))}function JU(e,t){return Li(e,{...t,symbol:"circle"})}function tz(e,t){return Li(e,{...t,symbol:"hexagon"})}var Ait={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Cu=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Xn(n),optional:!0}},n,Ait),this.z=o,this.curve=c2(s,a),lo(this,n)}filter(t){return t}project(t,n,r){this.curve!==Zc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(l=>l.selectAll().data(Fv(t,[s,a],this,r)).enter().append("path").call(It,this).call(Su,this,r).call(N$,this,r,o).attr("d",c===Zc&&o.projection?Mit(o.projection,s,a):fy().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function Mit(e,t,n){let r=mn(e);return t=nn(t),n=nn(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Bu(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new Cu(e,{...r,x:t,y:n})}function tl(e,{x:t=X,y:n=ye,...r}={}){return new Cu(e,Jd({...r,x:t,y:n}))}function el(e,{x:t=ye,y:n=X,...r}={}){return new Cu(e,Kd({...r,x:t,y:n}))}function T6(e,t){t=Oit(t);let{x:n,y:r,color:i,size:o}=t,s=f2(e,n),a=f2(e,r),c=f2(e,i),l=f2(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:w,color:v,reduce:_},size:{value:T,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&T==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&_==null&&h==null&&g==null&&(d==null||De(s))&&(y==null||De(a))&&(A="count"),p===void 0&&(p=d2(h)?!0:void 0),x===void 0&&(x=d2(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");E===void 0&&(E=T!=null||A!=null?"dot":d2(h)||d2(g)||_!=null?"bar":d!=null&&y!=null?De(s)||De(a)||h==null&&g==null&&!l0(s)&&!l0(a)?"dot":"line":d!=null||y!=null?"rule":null);let O,I,D;switch(E){case"dot":D=Li,I="stroke";break;case"line":D=s&&a||h!=null||g!=null?x||g!=null||s&&l0(s)?el:p||h!=null||a&&l0(a)?tl:Bu:s?tl:el,I="stroke",nz(c)&&(O=null);break;case"area":D=!(x||g!=null)&&(p||h!=null||a&&l0(a))?Kc:La,I="fill",nz(c)&&(O=null);break;case"rule":D=s?ii:oi,I="stroke";break;case"bar":D=h!=null?De(a)?ez(h)&&s&&De(s)?Jc:fs:Xd:g!=null?De(s)?ez(g)&&a&&De(a)?Jc:ds:Hd:_!=null||A!=null?s&&De(s)&&a&&De(a)?Jc:s&&De(s)?ds:a&&De(a)?fs:Jy:s&&Sa(s)&&!(a&&Sa(a))?fs:a&&Sa(a)&&!(s&&Sa(s))?ds:Jc,I="fill";break;default:throw new Error(`invalid mark: ${E}`)}let k={fx:u,fy:f,x:s??void 0,y:a??void 0,[I]:c??v,z:O,r:l??void 0,tip:!0},S,M={[I]:_??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=De(s)?Bc:ls):h!=null?(M.x=h,S=De(a)?Pc:us):(_!=null||A!=null)&&(s&&a?S=De(s)&&De(a)?By:De(s)?us:De(a)?ls:Ra:s?S=De(s)?Bc:ls:a&&(S=De(a)?Pc:us)),(S===Ra||S===ls)&&(k.x={value:s,...m}),(S===Ra||S===us)&&(k.y={value:a,...b}),p===void 0&&(p=s&&!(S===Ra||S===ls)&&(D===fs||D===Kc||D===Xd||D===oi)),x===void 0&&(x=a&&!(S===Ra||S===us)&&(D===ds||D===La||D===Hd||D===ii)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:E,markImpl:rz[D],markOptions:k,transformImpl:rz[S],transformOptions:M,colorMode:I}}function iz(e,t){let n=T6(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=I6[n.markImpl],f=I6[n.transformImpl],d=r!=null||i!=null?Qd({strokeOpacity:.1}):null,h=[o?ii([0]):null,s?oi([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?on(d,h,p):on(d,p,h)}function l0(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Nt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function Oit({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return ei(e)||(e=eh(e)),ei(t)||(t=eh(t)),ei(n)||(n=Cc(n)?{color:n}:eh(n)),ei(r)||(r=eh(r)),ei(i)&&({value:i}=eh(i)),ei(o)&&({value:o}=eh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function f2(e,t){let n=gt(e,t.value);return n&&(n.label=Pn(t.value)),n}function eh(e){return Nit(e)?{reduce:e}:{value:e}}function d2(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function ez(e){return/^(?:first|last|mode)$/i.test(e)}function Nit(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&bn(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function nz(e){return e?new or(e).size>e.length>>1:!1}var I6={dot:Li,line:Bu,lineX:tl,lineY:el,areaX:Kc,areaY:La,ruleX:ii,ruleY:oi,barX:fs,barY:ds,rect:Jy,rectX:Xd,rectY:Hd,cell:Jc,bin:Ra,binX:ls,binY:us,group:By,groupX:Bc,groupY:Pc},rz=Object.fromEntries(Object.entries(I6).map(([e,t])=>[t,e]));function nh(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=X});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),Lr(o,t)}function rh(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=X});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),Lr(o,t)}function Lr(e={},t={}){let n=Xn(t),r=Object.entries(e).map(([i,o])=>{let s=cv(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=wn(s);return{key:i,input:s,output:a,setOutput:c,map:Dit(o)}});return{...rn(t,(i,o)=>{let s=gt(i,n),a=r.map(({input:l})=>gt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Rn(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function Dit(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&bn(e))return Rit(e);if(typeof e=="function")return E6(Ad(e));switch(`${e}`.toLowerCase()){case"cumsum":return Fit;case"rank":return E6((t,n)=>Kp(t,r=>n[r]));case"quantile":return E6((t,n)=>Lit(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function Rit(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Lit(e,t){let n=Lo(e,t)-1;return Kp(e,t).map(r=>r/n)}function E6(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var Fit={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function oz(e={},t){return arguments.length===1&&(t=e),nh(ih(e),t)}function sz(e={},t){return arguments.length===1&&(t=e),rh(ih(e),t)}function ih(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=Cit(r),Hn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return Bit(n)(t,kit(i,t),o)}function kit(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function Cit(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Bit(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return h2(Ed(e));switch(e.toLowerCase()){case"deviation":return h2(wi);case"max":return p2((t,n)=>Qt(t,r=>n[r]));case"mean":return Pit;case"median":return h2(ro);case"min":return p2((t,n)=>ue(t,r=>n[r]));case"mode":return p2((t,n)=>kf(t,r=>n[r]));case"sum":return az;case"variance":return h2(fc);case"difference":return zit;case"ratio":return jit;case"first":return Vit;case"last":return qit}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return p2(Ad(e))}function h2(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(va(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(va(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(va(i,c,c+t),a)}}}function p2(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ne(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ne(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(va(i,c,c+t),o)),a-=Ne(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(va(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(va(i,a,a+t),o)}}}function az(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function Pit(e,t,n){if(n){let r=az(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function $it(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ne(o))return o}}function Uit(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ne(o))return o}}function cz(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function lz(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function zit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=lz(i,r,s,e)-cz(i,r,s,e)}}}function jit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=lz(i,r,s,e)/cz(i,r,s,e)}}}function Vit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=$it(i,r,s,e)}}}function qit(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=Uit(i,r,s,e)}}}var Fa={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function uz(e,{x:t=X,y:n,k:r=Fa.k,color:i=Fa.color,opacity:o=Fa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return on(oe(s)?null:Kc(e,Lr({x1:nl({k:-r,...f}),x2:nl({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),oe(c)?null:tl(e,Lr({x:nl(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function fz(e,{x:t,y:n=X,k:r=Fa.k,color:i=Fa.color,opacity:o=Fa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return on(oe(s)?null:La(e,Lr({y1:nl({k:-r,...f}),y2:nl({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),oe(c)?null:el(e,Lr({y:nl(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function nl({n:e=Fa.n,k:t=0,strict:n=Fa.strict,anchor:r=Fa.anchor}={}){return ih({k:e,reduce:i=>Js(i)+t*(wi(i)||0),strict:n,anchor:r})}var Yit={ariaLabel:"tick",fill:null,stroke:"currentColor"},m2=class extends xt{constructor(t,n,r){super(t,n,r,Yit),lo(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(It,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Yt,this,r).call(Da,this,r,o)).node()}},u0=class extends m2{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=ee(s),this.insetBottom=ee(a)}_transform(t,n,{x:r}){t.call(Et,n,{x:r},Be,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},f0=class extends m2{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=ee(s),this.insetLeft=ee(a)}_transform(t,n,{y:r}){t.call(Et,n,{y:r},0,Be)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function y2(e,{x:t=X,...n}={}){return new u0(e,{...n,x:t})}function g2(e,{y:t=X,...n}={}){return new f0(e,{...n,y:t})}function dz(e,{x:t=X,y:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=n!=null?Pc:Cy;return on(oi(e,f({x1:A6,x2:M6},{x:t,y:n,stroke:s,strokeOpacity:a,...u})),fs(e,f({x1:"p25",x2:"p75"},{x:t,y:n,fill:i,fillOpacity:o,...u})),y2(e,f({x:"p50"},{x:t,y:n,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Li(e,Lr({x:pz},{x:t,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function hz(e,{y:t=X,x:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=n!=null?Bc:Cy;return on(ii(e,f({y1:A6,y2:M6},{x:n,y:t,stroke:s,strokeOpacity:a,...u})),ds(e,f({y1:"p25",y2:"p75"},{x:n,y:t,fill:i,fillOpacity:o,...u})),g2(e,f({y:"p50"},{x:n,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),Li(e,Lr({y:pz},{x:n,y:t,z:n,r,stroke:s,strokeOpacity:a,...u})))}function pz(e){let t=A6(e),n=M6(e);return e.map(r=>r<t||r>n?r:NaN)}function A6(e){let t=mz(e)*2.5-yz(e)*1.5;return ue(e,n=>n>=t?n:NaN)}function M6(e){let t=yz(e)*2.5-mz(e)*1.5;return Qt(e,n=>n<=t?n:NaN)}function mz(e){return sr(e,.25)}function yz(e){return sr(e,.75)}var Git={ariaLabel:"raster",stroke:null,pixelSize:1};function oh(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function gz(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var h0=class extends xt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=gz(o,"width")),s!=null&&(s=gz(s,"height")),l!=null&&(l=oh(l,"x1")),u!=null&&(u=oh(u,"y1")),f!=null&&(f=oh(f,"x2")),d!=null&&(d=oh(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=tot(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=eot(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=oh(h,"pixelSize"),this.blur=oh(p,"blur"),this.interpolate=a==null||c==null?null:Wit(m)}},p0=class extends h0{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ae(o)[0]!==void 0&&(n=x2("fillOpacity",n)),Fe(i)[0]!==void 0&&(n=x2("fill",n))}super(t,void 0,n,Git),this.imageRendering=be(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(M=>M),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=bz(r,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let M=g/p,N=x/m,L=Wt(a,C=>(C-u)*M,Float64Array),B=Wt(c,C=>(C-f)*N,Float64Array);w&&(w=this.interpolate(t,g,x,L,B,w)),v&&(v=this.interpolate(t,g,x,L,B,v))}else this.data==null&&t&&(_=t.fi*b);let T=l.createElement("canvas");T.width=g,T.height=x;let A=T.getContext("2d"),E=A.createImageData(g,x),O=E.data,{r:I,g:D,b:k}=cn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let N=M<<2;if(w){let L=s(w[M+_]);if(L==null){O[N+3]=0;continue}({r:I,g:D,b:k}=cn(L))}v&&(S=v[M+_]*255),O[N+0]=I,O[N+1]=D,O[N+2]=k,O[N+3]=S}return this.blur>0&&QT(E,this.blur),A.putImageData(E,0,0),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(M=>M.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(It,this).attr("xlink:href",T.toDataURL())).node()}};function O6(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&GP(t)&&(r=xu,i=Rc,o===void 0&&(o=jP)),[t,{...s,x:r,y:i,[e]:o}]}function xz(){let[e,t]=O6("fill",...arguments);return new p0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:X})}function bz({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function N6({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),bz(Fd(a,i),o,s)}function x2(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return xe({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=N6(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,w=new Array(x*b*(i?i.length:1)),v=m/x,_=y/b,T=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let O=.5;O<x;++O,++T)w[T]=n(l.invert(f+O*v),u.invert(d+E*_),A);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function Wit(e){if(typeof e=="function")return e;if(e==null)return b2;switch(`${e}`.toLowerCase()){case"none":return b2;case"nearest":return y0;case"barycentric":return m0();case"random-walk":return g0()}throw new Error(`invalid interpolate: ${e}`)}function b2(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function m0({random:e=ou(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Si.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=Jit(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],x=a[2*m],b=a[2*y],w=a[2*p+1],v=a[2*m+1],_=a[2*y+1],T=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(w,v,_),O=Math.max(w,v,_),I=(v-_)*(g-b)+(w-_)*(b-x);if(!I)continue;let D=s[t[p]],k=s[t[m]],S=s[t[y]];for(let M=Math.floor(T);M<A;++M)for(let N=Math.floor(E);N<O;++N){if(M<0||M>=n||N<0||N>=r)continue;let L=M+.5,B=N+.5,C=Math.sign(I),P=(v-_)*(L-b)+(B-_)*(b-x);if(P*C<0)continue;let $=(_-w)*(L-b)+(B-_)*(g-b);if($*C<0)continue;let U=I-(P+$);if(U*C<0)continue;let H=M+n*N;u[H]=d(D,P/I,k,$/I,S,U/I,M,N),f[H]=1}}return Xit(u,f,i,o,s,n,r,l,t,d),u}}function Xit(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>Qit(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let w=Hit(n.at(b-1),r.at(b-1),n[b],r[b],g,p);e[y]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function Hit(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function d0(e,t,n,r){return e*r-n*t}function Qit(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(y,g);return(v,_)=>{let T=v-s,A=_-a,E=v-c,O=_-l;return d0(T,A,E,O)>-1e-6&&d0(T,A,d,h)*b-d0(T,A,p,m)*x>-1e-6&&d0(E,O,y,g)*x-d0(E,O,d,h)*w<=0}}function y0(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Si.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function g0({random:e=ou(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Si.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;h=d=u.find(g,x,d),y===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-g,a[r[h]]-x))>t&&w<n;){let v=e(y,p,w)*2*Math.PI;g+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(g,x,h),++w}l[m]=c[r[h]]}}return l}}function Zit(e,t,n,r,i,o){return t*e+r*n+o*i}function Kit(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function Jit(e,t){return Sa(e)||ke(e)?Zit:Kit(t)}function tot(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function eot(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var wz={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},x0=class extends h0{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=Lv({},i,wz);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:Pn(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=x2("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=X),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},not(i),wz);let s={geometry:{value:X}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=mn();return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(It,this).attr("d",l=>a(s[l])).call(Yt,this,r)}).node()}};function not({thresholds:e,interval:t,...n}){return e=v6(e,t,dc),xe(n,function(r,i,o,s,a,c){let[l,u,f,d]=N6(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/h,b=g/p,w=o.value.value,v=[];if(this.interpolate){let{x:O,y:I}=ss(o,s,c),D=Wt(O,N=>(N-l)*x,Float64Array),k=Wt(I,N=>(N-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[D,k,w];for(let N of i){let L=this.filter(N,S,M);v.push(this.interpolate(L,y,g,D,k,w))}}else if(i){let O=y*g,I=i.length;for(let D=0;D<I;++D)v.push(w.slice(D*O,D*O+O))}else v.push(w);if(this.blur>0)for(let O of v)Wp({data:O,width:y,height:g},this.blur);let _=rot(e,w,...iot(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=bc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let O of v)E.push(qe(A.length,A.push(...Wt(_,I=>T(O,I)))));for(let{coordinates:O}of A)for(let I of O)for(let D of I)for(let k of D)k[0]=k[0]/x+l,k[1]=k[1]/b+u;return{data:A,facets:E,channels:wv(this.contourChannels,A)}})}function rot(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return ti(e);let i=Ln(...Lf(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function vz(){return new x0(...O6("value",...arguments))}function iot(e){return[ue(e,t=>ue(t,_z)),Qt(e,t=>Qt(t,_z))]}function _z(e){return isFinite(e)?e:NaN}function Tz(e,t){return D6(qc,e,t)}function Ez(e,t={}){return D6(Yc,e,t)}function Az(e,t={}){return D6(Na,e,t)}function D6(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(ii(t,Sz("x",{...s,inset:-6},n))),i!=null&&a.push(oi(t,Sz("y",{...s,inset:-6},n))),r!=null&&a.push(cs(t,Iz("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(cs(t,Iz("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return on(...a)}function Mz(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:oot(e,u)}}function oot(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function Sz(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...Mz(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function Iz(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...Mz(e,t,sot(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function sot(e,t){return xe(t,(n,r,i)=>({channels:{text:{value:$y(i,e)?.value}}}))}var aot={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},cot={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},lot={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},uot={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},fot={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},R6=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,aot),this.curve=r0(s,a),lo(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=vn(this,i),p=c?x=>c[x]:Ce(d),m=l?x=>l[x]:Ce(h),y=this;function g(x){let b=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],T=[],A=[],E=[];function O(S,M){S=x[S],M=x[M],w.push(++b),_[b]=p(S),A[b]=m(S),T[b]=p(M),E[b]=m(M);for(let N in r)v[N].push(r[N][M])}let{halfedges:I,hull:D,triangles:k}=Si.from(x,p,m);for(let S=0;S<I.length;++S){let M=I[S];M>S&&O(k[S],k[M])}for(let S=0;S<D.length;++S)O(D[S],D[(S+1)%D.length]);jt(this).selectAll().data(w).enter().append("path").call(It,y).attr("d",S=>{let M=ur(),N=f(M);return N.lineStart(),N.point(_[S],A[S]),N.point(T[S],E[S]),N.lineEnd(),M}).call(Yt,y,v).call(Da,y,v,o)}return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Rn(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},b0=class extends xt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=vn(this,i),h=c?g=>c[g]:Ce(f),p=l?g=>l[g]:Ce(d),m=this;function y(g){let x=Si.from(g,h,p);jt(this).append("path").datum(g[0]).call(It,m).attr("d",m._render(x,i)).call(Yt,m,r)}return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Rn(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},L6=class extends b0{constructor(t,n={}){super(t,n,cot),this.fill="none"}_render(t){return t.render()}},F6=class extends b0{constructor(t,n={}){super(t,n,lot,Xn)}_render(t){return t.renderHull()}},k6=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},xe(n,function(s,a,c,l,u,f){let{x:d,y:h,z:p}=c;({x:d,y:h}=ss(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=vn(this,u),x=d?w=>d[w]:Ce(y),b=h?w=>h[w]:Ce(g);for(let w of a){d&&(w=w.filter(v=>Ne(x(v)))),h&&(w=w.filter(v=>Ne(b(v))));for(let[,v]of rs(w,p)){let _=Si.from(v,x,b),T=Oz(_,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=T.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),uot)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,cells:u}=r;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(f=>{f.selectAll().data(t).enter().append("path").call(It,this).attr("d",d=>u[d]).call(Yt,this,r)}).node()}},C6=class extends b0{constructor(t,n){super(t,n,fot),this.fill="none"}_render(t,n){return Oz(t,n).render()}};function Oz(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function w0(e,t,{x:n,y:r,...i}={}){return[n,r]=je(n,r),new e(t,{...i,x:n,y:r})}function Nz(e,t){return w0(R6,e,t)}function Dz(e,t){return w0(L6,e,t)}function Rz(e,t){return w0(F6,e,t)}function Lz(e,{x:t,y:n,initializer:r,...i}={}){return w0(k6,e,{...rn({...i,x:t,y:n},Jv),initializer:r})}function Fz(e,t){return w0(C6,e,t)}var dot={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},_0=class extends xt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=kz(s)&&(s="currentColor",!0),u=kz(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Xn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},pot({...c,fill:s,stroke:a},l,u),dot),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=mn();return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(It,this).call(Yt,this,r).attr("d",l=>a(s[l]))).node()}};function Cz(e,{x:t,y:n,...r}={}){return[t,n]=je(t,n),new _0(e,{...r,x:t,y:n})}var hot=new Set(["x","y","z","weight"]);function pot(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?nn(o):+o,xe(e,function(s,a,c,l,u,f){let d=c.weight?nn(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=vn(this,u),{width:g,height:x}=u,{x:b,y:w}=ss(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!hot.has(k)).map(([k,S])=>[k,{...S,value:[]}])),_=t&&[],T=n&&[],A=PE().x(b?k=>b[k]:m).y(w?k=>w[k]:y).weight(d?k=>d[k]:1).size([g,x]).bandwidth(i),E=[];for(let k of a){let S=[];E.push(S);for(let M of h?qy(k,h,p):[k]){let N=A.contours(M);S.push([M,N])}}let O=o;if(!(O instanceof Dy)){let k=0;for(let S of E)for(let[,M]of S){let N=M.max;N>k&&(k=N)}O=Float64Array.from({length:o-1},(S,M)=>k*100*(M+1)/o)}let I=[],D=[];for(let k of E){let S=[];I.push(S);for(let[M,N]of k)for(let L of O){S.push(D.length),D.push(N(L/100)),_&&_.push(L),T&&T.push(L);for(let B in v)v[B].value.push(c[B].value[M[0]])}}return _&&_.push(0),T&&T.push(0),{data:s,facets:I,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:D}}}})}function kz(e){return/^density$/i.test(e)}function $z(e,t){return zz("x",e,t)}function Uz(e,t){return zz("y",e,t)}function zz(e,t,{x1:n,x2:r,y1:i,y2:o,x:s=n===void 0&&r===void 0?e==="y"?ye:X:void 0,y:a=i===void 0&&o===void 0?e==="x"?ye:X:void 0,fill:c,positiveFill:l="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:p,strokeOpacity:m,z:y=Fe(p)[0],clip:g,tip:x,render:b,...w}={}){return[n,r]=Bz(s,n,r),[i,o]=Bz(a,i,o),n===r&&i===o&&(e==="y"?i=ka(0):n=ka(0)),{tip:x}=co({tip:x},e==="y"?"x":"y"),on(oe(l)?null:Object.assign(i0(t,{x1:n,x2:r,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:Oa(b,Pz(e,!0)),clip:g,...w}),{ariaLabel:"positive difference"}),oe(u)?null:Object.assign(i0(t,{x1:n,x2:r,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:Oa(b,Pz(e,!1)),clip:g,...w}),{ariaLabel:"negative difference"}),Bu(t,{x:r,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,...w}))}function Bz(e,t,n){return t===void 0&&n===void 0?t=n=ka(e):t===void 0?(n=ka(n),t=e===void 0?n:ka(e)):n===void 0?(t=ka(t),n=e===void 0?t:ka(e)):(t=ka(t),n=ka(n)),[t,n]}function ka(e){let t,{value:n,label:r=Pn(n)}=Di(e);return{transform:i=>t||(t=gt(i,n)),label:r}}function Pz(e,t){let n=e==="x"?"y":"x",r=`${n}1`,i=`${n}2`,o=`${e}1`,s=`${e}2`;return(a,c,l,u,f,d)=>{let{[r]:h,[i]:p}=l,m=new Float32Array(h.length),y=new Float32Array(p.length),g=u[e==="y"?"height":"width"];(t===Iv(c[e])<0?m:y).fill(g);let x=d(a,c,{...l,[i]:h,[s]:y},u,f),b=d(a,c,{...l,[r]:p,[o]:m},u,f),w=x.querySelector("g")??x,v=b.querySelector("g")??b;for(let _=0;w.firstChild;_+=2){let T=Z3(),A=ct("svg:clipPath",f).attr("id",T).node();A.appendChild(w.firstChild),v.childNodes[_].setAttribute("clip-path",`url(#${T})`),v.insertBefore(A,v.childNodes[_])}return b}}function w2({geometry:e=X,...t}={}){let n=jc(r=>gt(r,e));return xe({...t,x:null,y:null,geometry:{transform:n}},(r,i,o,s,a,{projection:c})=>{let l=n(r),u=l.length,f=new Float64Array(u),d=new Float64Array(u),h=mn(c);for(let p=0;p<u;++p)[f[p],d[p]]=h.centroid(l[p]);return{data:r,facets:i,channels:{x:{value:f,scale:c==null?"x":null,source:null},y:{value:d,scale:c==null?"y":null,source:null}}}})}function jz({geometry:e=X,...t}={}){let n=jc(i=>gt(i,e)),r=jc(i=>gt(n(i),tA));return{...t,x:{transform:i=>Float64Array.from(r(i),([o])=>o)},y:{transform:i=>Float64Array.from(r(i),([,o])=>o)},geometry:{transform:n}}}var mot={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},v0=class extends xt{constructor(t,n={}){let[r,i]=ae(n.r,3);super(t,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:mr,optional:!0},geometry:{value:n.geometry,scale:"projection"}},c0(n),mot),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=mn(o.projection??yot(n)),{r:l}=this;return Ac(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(It,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Yt,this,r)}).node()}};function yot({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,ru({point(n,r){this.stream.point(e(n),t(r))}})}function _2(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=w2(t):t.geometry===void 0&&(t={...t,geometry:X}),new v0(e,t)}function Vz({strokeWidth:e=1.5,...t}={}){return _2({type:"Sphere"},{strokeWidth:e,...t})}function qz({strokeOpacity:e=.1,...t}={}){return _2(sA(),{strokeOpacity:e,...t})}var sh=.5,ah=0;function Yz(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:ee(t),e=I3(e,n),is(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!is(e,"r")&&(n.r=t/2),xe(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=ss(s,a,l)),d=d?d.value:gt(i,r),h=h?.value,p=p?.value,m=m?.value;let y=Py(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],w=m&&[],v=[],_=[],T=[],A=-1;for(let D of e)D.initialize(i);for(let D of o){let k=[];for(let S of e)S.scope("facet",D);for(let[S,M]of rs(D,y))for(let{index:N,extent:L}of got(i,M,u,f,t)){k.push(++A),_.push(L.x),T.push(L.y),d&&g.push(y===d?S:d[N[0]]),h&&x.push(y===h?S:h[N[0]]),p&&b.push(y===p?S:p[N[0]]),m&&w.push(y===m?S:m[N[0]]);for(let B of e)B.reduce(N,L)}v.push(k)}let E=s.x.scale,O=s.y.scale,I={x:{value:_,source:a[E]?{value:Wt(_,a[E].invert),scale:E}:null},y:{value:T,source:a[O]?{value:Wt(T,a[O].invert),scale:O}:null},...d&&{z:{value:g}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:D,output:k})=>[D,{scale:"auto",label:k.label,radius:D==="r"?t/2:void 0,value:k.transform()}]))};return{data:i,facets:v,channels:I}})}function got(e,t,n,r,i){let o=i*(1.5/p3),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-ah)/o),f=Math.round(c=(c-sh)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+d*d>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+sh,y:u*o+ah}},s.set(h,p)),p.index.push(a)}return s.values()}var xot={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function Gz(e){return new S0(e)}var S0=class extends xt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Dc,void 0,{clip:n,...r},xot),this.binWidth=ee(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-sh,p=f-c-sh,m=a-ah,y=d-l-ah,g=s/2,x=g*m3,b=x/2,w=g*2,v=x*1.5,_=Math.floor(h/w),T=Math.ceil(p/w),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,O=`m0,${rl(-x)}l${rl(g)},${rl(b)}v${rl(x)}l${rl(-g)},${rl(b)}`,I=O;for(let D=A;D<E;++D)for(let k=_;k<T;++k)I+=`M${rl(k*w+(D&1)*g)},${rl(D*v)}${O}`;return ct("svg:g",o).datum(0).call(Rt,this,i,o).call(Et,this,{},Be+sh,Be+ah).call(D=>D.append("path").call(It,this).call(Yt,this,r).attr("d",I)).node()}};function rl(e){return Math.round(e*1e3)/1e3}var bot={ariaLabel:"image",fill:null,stroke:null};function wot(e){return/^\.*\//.test(e)}function _ot(e){return/^(blob|data|file|http|https):/i.test(e)}function vot(e){return typeof e=="string"&&(wot(e)||_ot(e))?[void 0,e]:[e,void 0]}var I0=class extends xt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=vot(l),[y,g]=ae(o),[x,b]=ae(s,g!==void 0?g*2:void 0),[w,v]=ae(a,g!==void 0?g*2:void 0),[_,T]=ae(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:mr,optional:!0},width:{value:x,filter:mr,optional:!0},height:{value:w,filter:mr,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},c0(n),bot),this.src=m,this.width=b,this.rotate=T,this.height=v,this.r=g,this.preserveAspectRatio=be(u,"xMidYMid"),this.crossOrigin=Ye(f),this.frameAnchor=ns(d),this.imageRendering=be(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:y,height:g,rotate:x}=this,[b,w]=vn(this,i);return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(It,this).attr("x",Wz(c,u,d,b,y,m)).attr("y",Wz(l,f,d,w,g,m)).attr("width",u?_=>u[_]:y!==void 0?y:d?_=>d[_]*2:m*2).attr("height",f?_=>f[_]:g!==void 0?g:d?_=>d[_]*2:m*2).attr("transform",h?_=>`rotate(${h[_]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?uo`${c?_=>c[_]:b}px ${l?_=>l[_]:w}px`:null).call(ft,"href",p?_=>p[_]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?_=>`circle(${d[_]}px)`:m!==void 0?`circle(${m}px)`:null).call(Yt,this,r)).node()}};function Wz(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function Xz(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=je(t,n)),new I0(e,{...r,x:t,y:n})}function Sot(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(n*y*(1-e),1/n)),g=-ch(t)-ch(n)+ch(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Iot(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Iot(e,t,n){var r=e===0||e===1?0:Math.exp(ch(t+n)-ch(t)-ch(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*Hz(e,t,n)/t:1-r*Hz(1-e,n,t)/n}function Hz(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function ch(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function Qz(e,t){var n=Sot(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Tot={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},v2=class extends xt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Xn(n),optional:!0}},n,Tot),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(Rt,this,i,o).call(Et,this,n).call(u=>u.selectAll().data(c?qy(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(It,this).call(Su,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ia(this.fill)?d=>d.select(Eot).attr("stroke","none").call(It,this).call(Su,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function Eot(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ar.svg,"path"),this)}var B6=class extends v2{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ne(t,u=>r[u]),c=S2(t,r,n),l=Jz(t,r,n,(1-i)/2,c);return yd().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(qe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ne(t,a=>r[a]),s=S2(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},P6=class extends v2{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ne(t,u=>n[u]),c=S2(t,n,r),l=Jz(t,n,r,(1-i)/2,c);return yd().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(qe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ne(t,a=>n[a]),s=S2(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function Zz(e,{y:t=ye,x:n=X,stroke:r,fill:i=oe(r)?"currentColor":r,...o}={}){return new B6(e,Jd({...o,x:n,y:t,fill:i,stroke:r}))}function Kz(e,{x:t=ye,y:n=X,stroke:r,fill:i=oe(r)?"currentColor":r,...o}={}){return new P6(e,Kd({...o,x:t,y:n,fill:i,stroke:r}))}function S2(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function Jz(e,t,n,r,i){let o=Fn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=Qz(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function T0({path:e=X,delimiter:t,frameAnchor:n,treeLayout:r=iu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=A2(s),i=nj(i),a!=null&&(a=U6(a)),n===void 0&&(n=s.frameAnchor);let l=rj(t),u=uj(c,U6),[f,d]=wn(),[h,p]=wn();return{x:f,y:h,frameAnchor:n,...rn(c,(m,y)=>{let g=l(gt(m,e)),x=d([]),b=p([]),w=-1,v=[],_=[],T=ww().path(O=>g[O]),A=Rr(m)?O=>O.data=m[O.data]:O=>O.data=m.get(O.data),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Ry);for(let O of u)O[T2]=O[cj]([]);for(let O of y){let I=[],D=T(O.filter(k=>g[k]!=null)).each(A);i!=null&&D.sort(i),E(D);for(let k of D.descendants())if(!(a!=null&&!a(k))){I.push(++w),v[w]=k.data,s.position(k,w,x,b);for(let S of u)S[T2][w]=S[lj](k)}_.push(I)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function E2({path:e=X,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=iu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=A2(l),a=nj(a),u!=null&&(u=ej(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=rj(t),h=uj(f,ej),[p,m]=wn(),[y,g]=wn(),[x,b]=wn(),[w,v]=wn();return{x1:p,x2:y,y1:x,y2:w,...rn(f,(_,T)=>{let A=d(gt(_,e)),E=m([]),O=g([]),I=b([]),D=v([]),k=-1,S=[],M=[],N=ww().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Ry);for(let B of h)B[T2]=B[cj]([]);for(let B of T){let C=[],P=N(B.filter($=>A[$]!=null)).each($=>$.data=_[$.data]);a!=null&&P.sort(a),L(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++k),S[k]=U.data,l.position($,k,E,I),l.position(U,k,O,D);for(let H of h)H[T2][k]=H[lj](U,$)}M.push(C)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function A2(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Aot;case"right":return Mot}throw new Error(`invalid tree anchor: ${e}`)}var Aot={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Mot={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function nj(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?tj(U6(e)):tj(Oot(e))}function tj(e){return(t,n)=>xn(e(t),e(n))}function Oot(e){return t=>t.data?.[e]}function rj(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>Not(r,t))}var $6=92,ij=47;function Not(e,t){if(t===$6)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case $6:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case ij:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function Dot(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case $6:if(!t){t=!0;continue}case ij:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function oj(e){return bn(e)&&typeof e.node=="function"}function Rot(e){return bn(e)&&typeof e.link=="function"}function U6(e){if(oj(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return j6;case"node:path":return z6;case"node:internal":return sj;case"node:external":return aj;case"node:depth":return V6;case"node:height":return q6}throw new Error(`invalid node value: ${e}`)}}function ej(e){if(oj(e))return e.node;if(Rot(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return I2(j6);case"parent:path":return I2(z6);case"parent:depth":return I2(V6);case"parent:height":return I2(q6);case"node:name":return j6;case"node:path":return z6;case"node:internal":return sj;case"node:external":return aj;case"node:depth":return V6;case"node:height":return q6}throw new Error(`invalid link value: ${e}`)}}function z6(e){return e.id}function j6(e){return Lot(e.id)}function V6(e){return e.depth}function q6(e){return e.height}function sj(e){return!!e.children}function aj(e){return!e.children}function I2(e){return(t,n)=>n==null?void 0:e(n)}function Lot(e){let t=e.length;for(;--t>0&&!Fot(e,t););return Dot(e.slice(t+1))}function Fot(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var cj=2,lj=3,T2=4;function uj(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...wn(i),o])}return n}function Y6(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=oe(f)&&oe(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:w=iu,textLayout:v=w===iu||w===xw?"mirrored":"normal",tip:_,...T}={}){if(g===void 0&&(g=A2(T.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=un(v,"textLayout",["mirrored","normal"]);function A(E){return cs(e,T0({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...T}))}return on(u2(e,E2({treeLayout:w,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?Li(e,T0({treeLayout:w,fill:t===void 0?"node:internal":t,title:y,tip:_,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function fj(e,t){return Y6(e,{...t,treeLayout:xw})}var hj={ariaLabel:"waffle"},E0=class extends Ru{constructor(t,{unit:n=1,gap:r=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:Oa(o,pj("x"))},hj),this.unit=Math.max(0,n),this.gap=+r,this.round=mj(i),this.multiple=yj(s)}},A0=class extends Lu{constructor(t,{unit:n=1,gap:r=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:Oa(o,pj("y"))},hj),this.unit=Math.max(0,n),this.gap=+r,this.round=mj(i),this.multiple=yj(s)}};function pj(e){return function(t,n,r,i,o){let{unit:s,gap:a,rx:c,ry:l,round:u}=this,{document:f}=o,d=r.channels[`${e}1`].value,h=r.channels[`${e}2`].value,p=this[e==="y"?"_width":"_height"](n,r,i),m=this[e==="y"?"_x":"_y"](n,r,i),y=s*kot(n.scales[e]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,x=Math.min(p/g,y*g),b=y*g,w=e==="y"?([I,D])=>[I*x,-D*b]:([I,D])=>[D*b,I*x],v=(p-g*x)/2,_=typeof m=="function"?I=>m(I)+v:m+v,T=n[e](0),A=_$(),E=f.createElementNS(ar.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let O=E.appendChild(f.createElementNS(ar.svg,"rect"));return O.setAttribute("x",a/2),O.setAttribute("y",a/2),O.setAttribute("width",(e==="y"?x:b)-a),O.setAttribute("height",(e==="y"?b:x)-a),c!=null&&O.setAttribute("rx",c),l!=null&&O.setAttribute("ry",l),ct("svg:g",o).call(Rt,this,i,o).call(this._transform,this,n).call(I=>I.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",D=>`${A}-${D}`).select("rect").call(It,this).call(Yt,this,r)).call(I=>I.selectAll().data(t).enter().append("path").attr("transform",e==="y"?uo`translate(${_},${T})`:uo`translate(${T},${_})`).attr("d",D=>`M${G6(u(d[D]/s),u(h[D]/s),g).map(w).join("L")}Z`).attr("fill",D=>`url(#${A}-${D})`).attr("stroke",this.stroke==null?null:D=>`url(#${A}-${D})`)).node()}}function G6(e,t,n){if(e<0||t<0){let r=Math.ceil(-Math.min(e,t)/n);return G6(e+r*n,t+r*n,n).map(([i,o])=>[i,o-r])}return t<e?G6(t,e,n):[[0,Math.ceil(e/n)],[Math.floor(e%n),Math.ceil(e/n)],[Math.floor(e%n),Math.floor(e/n)+e%1],[Math.ceil(e%n),Math.floor(e/n)+e%1],...e%n>n-1?[]:[[Math.ceil(e%n),Math.floor(e/n)],[n,Math.floor(e/n)]],[n,Math.floor(t/n)],[Math.ceil(t%n),Math.floor(t/n)],[Math.ceil(t%n),Math.floor(t/n)+t%1],[Math.floor(t%n),Math.floor(t/n)+t%1],...t%n<1?[]:[[Math.floor(t%n),Math.ceil(t/n)],[0,Math.ceil(t/n)]]]}function mj(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function yj(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function kot({domain:e,range:t}){return dj(t)/dj(e)}function dj(e){let[t,n]=ne(e);return n-t}function gj(e,t={}){return _a(t)||(t={...t,y:ye,x2:X}),new E0(e,Hc(jd(Wc(t))))}function xj(e,t={}){return _a(t)||(t={...t,x:ye,y2:X}),new A0(e,Qc(Vd(Xc(t))))}var Oj=nq(Mj(),1);var Vot=({marginLeft:e})=>[1,e],qot=({width:e,marginRight:t})=>[-1,e-t],Yot=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],Got=({marginTop:e})=>[1,e],Wot=({height:e,marginBottom:t})=>[-1,e-t],Xot=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function Nj(e){return typeof e=="string"?{anchor:e}:e}function Dj(e={},t={}){arguments.length===1&&([e,t]=Lj(e));let{anchor:n="left",padding:r=1,r:i=t.r}=Nj(e);switch(`${n}`.toLowerCase()){case"left":n=Vot;break;case"right":n=qot;break;case"middle":n=Yot;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Fj("x","y",n,ee(r),i,t)}function Rj(e={},t={}){arguments.length===1&&([e,t]=Lj(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=Nj(e);switch(`${n}`.toLowerCase()){case"top":n=Got;break;case"bottom":n=Wot;break;case"middle":n=Xot;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Fj("y","x",n,ee(r),i,t)}function Lj(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function Fj(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Fy(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return xe(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=ss(c,l,f));let p=h?void 0:i!==void 0?ee(i):this.r!==void 0?this.r:3;h&&(h=gt(h.value,l[h.scale]||X,Float64Array));let[m,y]=n(u),g=m?Qot:Hot,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let v=(0,Oj.default)();w=w.filter(h?T=>_d(d[T])&&mr(h[T]):T=>_d(d[T]));let _=new Float64Array(2*w.length+2);for(let T of w){let A=b(T),E=m?A+r:0,O=d[T]-A,I=d[T]+A,D=2;v.queryInterval(O-r,I+r,([,,S])=>{let M=x[S]-E,N=d[T]-d[S],L=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-N*N);_[D++]=M-B,_[D++]=M+B});let k=_.slice(0,D);m&&(k=k.filter(S=>S>=0));t:for(let S of k.sort(g)){for(let M=0;M<D;M+=2)if(_[M]+1e-6<S&&S<_[M+1]-1e-6)continue t;x[T]=S+E;break}v.insert([O,I,T])}}m||(m=1);for(let w of a)for(let v of w)x[v]=x[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function Hot(e,t){return Math.abs(e)-Math.abs(t)}function Qot(e,t){return e-t}function Cj(e,t){return arguments.length===1&&({basis:e,...t}=e),nh(N2(e),t)}function Bj(e,t){return arguments.length===1&&({basis:e,...t}=e),rh(N2(e),t)}function N2(e){if(e===void 0)return kj;if(typeof e=="function")return D2(Ad(e));if(/^p\d{2}$/i.test(e))return dh(Ed(e));switch(`${e}`.toLowerCase()){case"deviation":return Jot;case"first":return kj;case"last":return Kot;case"max":return tst;case"mean":return est;case"median":return nst;case"min":return rst;case"sum":return ist;case"extent":return Zot}throw new Error(`invalid basis: ${e}`)}function D2(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function dh(e){return D2((t,n)=>e(t,r=>n[r]))}var Zot={mapIndex(e,t,n){let[r,i]=ne(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},kj=D2((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ne(r))return r}}),Kot=D2((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ne(r))return r}}),Jot={mapIndex(e,t,n){let r=Js(e,o=>t[o]),i=wi(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},tst=dh(Qt),est=dh(Js),nst=dh(ro),rst=dh(ue),ist=dh(Fn);function Pj(e,t){return Uj("x",e,t)}function $j(e,t){return Uj("y",e,t)}function Uj(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=av(t.replace(/^[+-]/,"")),i*=l}t=Od(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Lr({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ne(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function zj(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return N0(t);case"last":return D0(t)}if(typeof e=="function")return il(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=ost(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return il(n,r,t)}function ost(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return K6;case"max":return J6}throw new Error(`unknown selector: ${e}`)}function N0(e){return il(null,sst,e)}function D0(e){return il(null,ast,e)}function R2(e){return il("x",K6,e)}function L2(e){return il("y",K6,e)}function F2(e){return il("x",J6,e)}function k2(e){return il("y",J6,e)}function*sst(e){yield e[0]}function*ast(e){yield e[e.length-1]}function*K6(e,t){yield n1(e,n=>t[n])}function*J6(e,t){yield zl(e,n=>t[n])}function il(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Xn(n);return rn(n,(i,o)=>{let s=gt(i,r),a=gt(i,e),c=[];for(let l of o){let u=[];for(let f of s?Rn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}xt.prototype.plot=function({marks:e=[],...t}={}){return Zd({...t,marks:[...e,this]})};var cst=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function lst(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function jj(e,t,n){for(let r in e){let i=cst.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&lst(t,i.split("."),o)}}var ust=new Set(["frame","hexgrid","sphere","graticule"]),fst=new Map([["first",N0],["last",D0],["maxX",F2],["maxY",k2],["minX",R2],["minY",L2],["nearest",qc],["nearestX",Yc],["nearestXY",Na]]);async function qj(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;jj(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=fst.get(f)?.(d)??d,p=ust.has(c)?[h]:[l,h];t.marks.push(t4[c](...p)),o.push(a.index)}hst(t,e);let s=Zd(t);pst(s,o),dst(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function dst(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===Ro){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function hst(e,t){let{marks:n}=t;C2("x",e,n),C2("y",e,n),C2("fx",e,n),C2("fy",e,n)}function C2(e,t,n){let r=t[e]||{};if(r.axis===null||r.label!==void 0)return;let i=n.map(l=>l.channelField(e)?.field);if(i.every(l=>l==null))return;let o,s,a;for(let l=0;l<i.length;++l){let{column:u,label:f}=i[l]||{};u===void 0&&f===void 0||(o===void 0&&s===void 0?(o=u,s=f,a=mst(n[l].data,e)||"number"):s!==f?s=void 0:o!==u&&(o=void 0))}let c=s||o;if(c!==void 0){if((a==="number"||a==="date")&&(e==="x"||e==="y")){r.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(r.reverse?-1:1);e==="x"||r.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...r,label:c}}}function pst(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)Vj(r,t);else Vj(e,t)}function Vj(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function mst(e,t){if(!e)return;let{columns:n}=e,r=n[t]??n[t+"1"]??n[t+"2"];if(r){for(let i of r)if(i!=null)return i instanceof Date?"date":typeof i}}var yst={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},R0=class{constructor(t){this.attributes={...yst},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=HT()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(t=400){let{top:n,bottom:r}=this.margins(),i=this.getAttribute("height");return i==null&&(i=gst(this,n,r)||t,this.setAttribute("height",i,{silent:!0})),i-n-r}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await qj(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return qh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function gst(e,t,n){let r=e.getAttribute("aspectRatio");if(r==null)return;let i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;let s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(r*s)+t+n}function B2(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Xr(e)!==null)}var xst=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function Yj(e){return xst.has(e)}var bst=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function Gj(e){return bst.has(`${e}`.toLowerCase())}var Wj=e=>e==="stroke"||e==="fill",wst=e=>/opacity$/i.test(e),_st=e=>e==="symbol",vst=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),e4=(e,t)=>({channel:e,field:t,as:t instanceof _r?t.column:e}),n4=(e,t)=>({channel:e,value:t}),P2=e=>Array.isArray(e),fn=class extends xr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,P2(this.source)&&(this.data=Nr(this.source));let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Yp]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")Yj(l)||Wj(l)&&B2(u)||_st(l)&&Gj(u)?o.push(n4(l,u)):o.push(e4(l,Va(u)));else if(vs(u))if(Array.isArray(u.columns))o.push(e4(l,u)),a.add(u);else{let d=n4(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&vst(l,u)?o.push(e4(l,u)):u!==void 0&&o.push(n4(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||P2(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){let r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r:null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=i.get(c)??i.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let n=Object.fromEntries(t.map(r=>[r.column,r]));for(let r of this.channels){let{field:i}=r;i&&Object.assign(r,n[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return L0(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Nr(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this;return r4(t,r,i,n)}};function Qn(e,t){let n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:Wj(e.channel)?{value:n,scale:"color"}:wst(e.channel)?{value:n,scale:"opacity"}:n}function L0(e,t,n=[]){let r=pt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function r4(e,t,n,r,i={}){let{numRows:o,values:s,columns:a}=r??{},c={};for(let f of n){let d=t.has(f.channel)?c:i;d[f.channel]=Qn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(r?{length:o}:null),options:i}]}function $u(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{type:o}=e.channelField(t);r=o==="date"?"time":"linear"}let i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return zh(i)}function si(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=$u(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=r.map(x=>c(x)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(n-i)/(d-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${d} - ${h}::DOUBLE)${y}`:q`(${h}::DOUBLE - ${f})${y}`,p]}var i4={x:["min","max"]},o4={y:["min","max"]},$2={...i4,...o4};function Xj(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Nn])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=s4(t,c)||(a?la().domain([l,u]).nice().domain():[l,u]);return s!==Ro&&(f[Nn]=!0),o.setAttribute(r,f,{silent:!0}),f}}function hs(e,t){return Xj(e,t,"x","xDomain","xNice")}function ps(e,t){return Xj(e,t,"y","yDomain","yNice")}function s4(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var F0=class extends fn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:d,max:h}=this.channelField(r);if(o&&(f==="date"||f==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=s4(t,l)||[d,h],[x]=si(this,r,m,[y,g],1,u),b=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return Sst(s,x,u,c,b)}else return s.orderby(l)}};function Sst(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>pt.from(e).select(a).groupby(o,i);return pt.union(s([{[n]:fi(n),[r]:Ju(r,n)},...i]),s([{[n]:ui(n),[r]:tf(r,n)},...i]),s([{[n]:Ju(n,r),[r]:fi(r)},...i]),s([{[n]:tf(n,r),[r]:ui(r)},...i])).orderby(i,n)}function Hj(e,t=[]){return new t.constructor(e)}function Qj(e,t,n){let r=Hj(e,n),i=n.length;for(let o=0;o<i;++o)r[t[o]]=n[o];return r}function Zj(e,t,n,r,i,o,s){let a=n.length,c=e*t,l=i.map(h=>r[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>r[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=n.map(y=>y%e),p=n.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,w)=>s(m[w],e,t,h,p,x))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>Hj(c,m));for(let g=0;g<a;++g)y[d[g]][n[g]]=m[g]});return{numRows:f.length,columns:u}}function k0(e){let t=1/0,n=-1/0;return e.forEach(r=>{let i=r.length;for(let o=0;o<i;++o){let s=r[o];s<t&&(t=s),s>n&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function Kj(e){let t=new or;return e.forEach(n=>{let r=n.length;for(let i=0;i<r;++i)t.add(n[i])}),Array.from(t).sort(Nt)}function Ge(e,t){return Sr(e)?(e.addEventListener("value",t),e.value):e}function C0(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Ist(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Ist(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function Jj(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);U2(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);U2(t,u,i,r,o,s,a,u)}return c}function U2(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Tst){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function Tst(e,t,n,r,i,o,s,a,c,l,u,f=.5){let d=Math.abs(r)*n,h=r<0?d+r:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+r*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Ca="density",fo=class extends fn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Est(u);super(t,n,u,$2),this.densityMap=f,this.bandwidth=Ge(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=Ge(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=Ge(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=Ge(a,d=>(this.pad=d,this.requestUpdate())),this.width=Ge(c,d=>(this.width=d,this.requestUpdate())),this.height=Ge(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Nn]&&!n[Nn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=hs(this,t),[l,u]=this.extentY=ps(this,t),[f,d]=this.bins=this.binDimensions(),[h,p]=si(this,"x",f,[a,c],r),[m,y]=si(this,"y",d,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Es(+a,p),Ts(p,+c),Es(+l,y),Ts(y,+u)],x=pt.from(s.table).where(t.concat(g)),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:T,channel:A,field:E}=_;E.aggregate?(w[A]=E,o[A]=!0):A==="weight"?w[Ca]=Pr(E):A!=="x"&&A!=="y"&&(x.select({[T]:E}),b.push(T))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(Ca),w.density=Zn()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Ost(x,h,m,w[Ca],f,b)}else return Mst(x,h,m,w,f,b)}binDimensions(){let{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins,i=Ast(this.interpolate),{columns:o}=Nr(t);return this.grids0=Zj(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){let s=t.length===1?t[0]:t.includes(Ca)?Ca:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=r,d=a.some(m=>m.some(y=>y<0)),h=C0(n*(u-1)/c,d),p=C0(n*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>Jj(h,p,m,r))}}}return this}};function Est(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Ast(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return y0;case"barycentric":return m0();case"random-walk":return g0()}throw new Error(`invalid interpolate: ${e}`)}function Mst(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Ost(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return pt.from(pt.unionAll(c,l,u,f)).select({index:"i",density:Pr("w")},o).groupby("index",o).having(yl("density",0))}var B0=class extends fo{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Ge(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r,c=i,l;if(Array.isArray(c))l=c;else{let[,I]=k0(a.density);l=Array.from({length:c-1},(D,k)=>I*(k+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,x=+d,b=+p,w=I=>x+I*y,v=I=>b+I*g,_=bc().size(t),T=this.contourData=Array(s*l.length),{density:A,...E}=a,O=Object.entries(E);for(let I=0,D=0;I<s;++I){let k=A[I],S=O.reduce((M,[N,L])=>(M[N]=L[I],M),{});for(let M=0;M<l.length;++M,++D)T[D]=Object.assign(Nst(_.contour(k,l[M]),w,v),S)}return this}plotSpecs(){let{type:t,channels:n,densityMap:r,contourData:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Qn(s))}for(let s in r)r[s]&&(o[s]=Qn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Nst(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function P0(e){return Array.from({length:e},(t,n)=>n)}function z2(e,t){let n=t.reduce((i,o,s)=>(i[o]=s,i),{}),r=P0(e.length);return r.sort((i,o)=>n[e[i]]-n[e[o]]),r}function j2(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function tV(e=1){let t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<r;++a,s+=4)n[s+3]=t}}function eV(e){let{apply:t}=e;return(n,r,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*r;c<r;++c,a+=4)n[a+3]=255*t(o[c+l])|0}}function nV(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?cn(e):e,o=new Uint8ClampedArray([t,n,r,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function rV(e){let{domain:t,range:n}=e,r=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=n.length;for(let a=0;a<=o;++a){let c=n[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?cn(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,r[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=r[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=r[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function iV(e,t,n){let{interpolate:r}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=r(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?cn(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*n(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var ol=class extends fo{constructor(t,n){super("image",t,n),this.image=null}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=Fst(this,r,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=a4(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?z2(m,this.plot.getAttribute("colorDomain")):P0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}},$0=class extends ol{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function a4(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(Ca),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":B2(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?Ca:null),d=c?.as??(u==="grid"?Ca:null),h=l!=="grid"&&l!=="group"?nV(l):Rst(e,f),p=u!=="grid"?tV(u):Dst(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Dst(e,t){let{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===Ro,s=i?.[Nn],a=!o&&!s&&i||k0(r.columns[t]);(o||s||!i)&&(o||(a[Nn]=!0),n.setAttribute("opacityDomain",a));let c=$c({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return eV(c)}function Rst(e,t){let{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),c=a===Ro,l=a?.[Nn],u=!c&&!l&&a||(o?i.slice().sort(Nt):s?Kj(i):k0(i));(c||l||!a)&&(c||(u[Nn]=!0),n.setAttribute("colorDomain",u));let f=$c({color:{type:n.getAttribute("colorScale"),domain:u,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(s)return rV(f);{let d=$c({x:{type:Lst(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return iV(1024,f,d.apply)}}function Lst(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Fst(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=j2(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}var U0=class extends ol{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),this.normalize=Ge(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:n,normalize:r,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=si(this,"x",s,hs(this,t),o),[l]=si(this,"y",a,ps(this,t),o),u=pt.from(i.table).where(kst(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of n)if(Object.hasOwn(h,"field")){let{channel:p,field:m}=h;p==="z"?(u.select({[p]:m}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return Cst(u,c,l,d,s,a,f,r)}};function kst(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:n}=e.channelField("x"),{column:r}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?vr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function Cst(e,t,n,r,i,o,s=[],a=!0){e.select({x:q`FLOOR(${t})::INTEGER`,y:q`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=pt.from(e).select(c,{x0:"x",y0:"y",dx:q`(lead(x) OVER sw - x)`,dy:q`(lead(y) OVER sw - y)`}).window({sw:q`${l}ORDER BY x ASC`}).qualify(vr(q`(x0 < ${i} OR x0 + dx < ${i})`,q`(y0 < ${o} OR y0 + dy < ${o})`,q`(x0 > 0 OR x0 + dx > 0)`,q`(y0 > 0 OR y0 + dy > 0)`)),f=pt.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=pt.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=pt.unionAll(pt.select(c,{x:q`x0 + i`,y:q`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(q`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),pt.select(c,{x:q`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:q`y0 + SIGN(dy) * i`}).from("pairs","indices").where(q`ABS(dy) > ABS(dx) AND i < ABS(dy)`),pt.select(c,{x:"x0",y:"y0"}).from("pairs").where(ml("dx"))),p=["x"].concat(c).join(", "),m=pt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(vr(We("x",[0,i],!0),We("y",[0,o],!0)));return pt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Pr("w"):Zn()}).groupby("index",s)}var hh=class extends fn{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?i4:o4),this.dim=a,this.bins=Ge(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=Ge(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[Nn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?hs:ps)(this,t),[a,c]=si(this,i,n,s),l=L0(r,o,[i]).where(t.concat(We(c,s))),u=this.channelField("weight")?"weight":null;return Bst(l,a,u)}queryResult(t){let{columns:{index:n,density:r}}=Nr(t);return this.grid=Qj(this.bins,n,r),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=C0(n*(t-1)/l,c),f=U2(u,i,t),d=r==="x"?"y":"x",h=this.channelField(r).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[h]:g,[d]:x}},this}plotSpecs(){let{type:t,data:{numRows:n,columns:r},channels:i,dim:o}=this,s=o==="x"?{y:r.y}:{x:r.x};for(let a of i)s[a.channel]=Qn(a,r);return[{type:t,data:{length:n},options:s}]}};function Bst(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER`,w:q`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER + 1`,w:q`(p - FLOOR(p))${r}`});return pt.from(pt.unionAll(i,o)).select({index:"i",density:Pr("w")}).groupby("index").having(Lh("density",0))}var z0=class extends fo{constructor(t,n){let{type:r="dot",...i}=n;super(r,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:n,extentX:r,extentY:i}=this,[o,s]=t,a=$u(this,"x"),c=$u(this,"y"),[l,u]=r.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=Pst(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:Qn(a,o)}for(let a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function Pst(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let v in b)g[v]=new b[v].constructor(h);let w=0;for(let v=0;v<e.numRows;++v){for(let T in b)g[T].fill(b[T][v],w,w+d);let _=x[v];for(let T=0,A=0;A<f;++A)for(let E=0;E<u;++E,++w,++T)p[w]=s(n+(E+c)*i),m[w]=a(r+(A+c)*o),y[w]=_[T]*l}return{numRows:h,columns:g}}function $st(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(n*y*(1-e),1/n)),g=-ph(t)-ph(n)+ph(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Ust(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Ust(e,t,n){var r=e===0||e===1?0:Math.exp(ph(t+n)-ph(t)-ph(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*oV(e,t,n)/t:1-r*oV(1-e,n,t)/n}function oV(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function ph(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function sV(e,t){var n=$st(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}function aV(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}var mh=class extends fn{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=r;super(t,n,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=Ge(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:n,field:r,source:{table:i}}=this,o=n.concat([{field:kh(r),as:"__avg__"},{field:Zn(r),as:"__n__"},{field:Ch(r),as:"__sd__"}]);return L0(o,i).where(t)}queryResult(t){return this.data=Nr(t),this}plotSpecs(){let{type:t,dim:n,detail:r,data:i,ci:o,channels:s}=this,a=Math.SQRT2*aV(o),{columns:{__avg__:c,__sd__:l,__n__:u}}=i,f={[`${n}1`]:c.map((d,h)=>d-a*l[h]/Math.sqrt(u[h])),[`${n}2`]:c.map((d,h)=>d+a*l[h]/Math.sqrt(u[h]))};return r4(t,r,s,i,f)}};var zst="geom",j0=class extends fn{constructor(t,n={},r){!P2(t)&&!n?.geometry&&(n.geometry=Ph(zst)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}};var V0=class extends fn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},$2),this.binWidth=Ge(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Nn]&&!n[Nn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,s,a,c=new Set,l={};for(let w of i)if(w.channel!=="orderby"){if(w.channel==="x")s=w;else if(w.channel==="y")a=w;else if(Object.hasOwn(w,"field")){let{as:v,field:_}=w;l[v]=_,_.aggregate||c.add(v)}}let[u,f]=hs(this,t),[d,h]=ps(this,t),p=.5-n.getAttribute("marginLeft"),m=0-n.getAttribute("marginTop"),y=`${r}::DOUBLE`,g=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,x=`${n.innerWidth()/(f-u)}::DOUBLE`,b=`${n.innerHeight()/(h-d)}::DOUBLE`;return pt.select({[s.as]:q`${u}::DOUBLE + ((_x + 0.5 * (_y & 1)) * ${y} + ${p})::DOUBLE / ${x}`,[a.as]:q`${h}::DOUBLE - (_y * ${g} + ${m})::DOUBLE / ${b}`,...l}).groupby("_x","_y",...c).from(pt.select({_py:q`(${b} * (${h}::DOUBLE - ${a.field}) - ${m}) / ${g}`,_pj:q`ROUND(_py)::INTEGER`,_px:q`(${x} * (${s.field} - ${u}::DOUBLE) - ${p}) / ${y} - 0.5 * (_pj & 1)`,_pi:q`ROUND(_px)::INTEGER`,_tt:q`ABS(_py-_pj) * 3 > 1 AND (_px-_pi)**2 + (_py-_pj)**2 > (_px - _pi - 0.5 * CASE WHEN _px < _pi THEN -1 ELSE 1 END)**2 + (_py - _pj - CASE WHEN _py < _pj THEN -1 ELSE 1 END)**2`,_x:q`CASE WHEN _tt THEN (_pi + (CASE WHEN _px < _pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN _pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE _pi END`,_y:q`CASE WHEN _tt THEN (_pj + CASE WHEN _py < _pj THEN -1 ELSE 1 END)::INTEGER ELSE _pj END`},"*").from(o.table).where(Is(s.field),Is(a.field),t))}};var q0=class extends fo{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=si(this,"x",f,[a,c],r),[m,y]=si(this,"y",d,[l,u],r),g=r?[We(p,[+a,+c]),We(y,[+l,+u])]:[Es(+a,p),Ts(p,+c),Es(+l,y),Ts(y,+u)],x=pt.from(s.table).where(g),b=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:T,channel:A,field:E}=_;E.aggregate?(w[A]=E,o[A]=!0):A==="weight"?w.density=Pr(E):A!=="x"&&A!=="y"&&(x.select({[T]:E}),b.push(T))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),w.density=Zn()),n==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Gst(x,h,m,w.density,f,b)}else return Yst(x,h,m,w,f,b)}async requestTiles(){let t=di();this.prefetch&&t.cancel(this.prefetch);let{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=hs(this,this._filter),[f,d]=ps(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),y=Math.floor((f-s)*(c-n)/p),g=(I,D)=>[[o+I*h,o+(I+1)*h],[s+D*p,s+(D+1)*p]],x=Math.floor((l-o)/h),b=r?cV((u-o)/h):x,w=Math.floor((f-s)/p),v=i?cV((d-s)/p):w,_=[];for(let I=x;I<=b;++I)for(let D=w;D<=v;++D)_.push([I,D]);let T=_.map(([I,D])=>t.query(this.tileQuery(g(I,D)))),A=[];if(r)for(let I=w;I<=v;++I)A.push([b+1,I]),A.push([x-1,I]);if(i){let I=r?x-1:x,D=r?b+1:b;for(let k=I;k<=D;++k)A.push([k,v+1]),A.push([k,w-1])}this.prefetch=A.map(([I,D])=>t.prefetch(this.tileQuery(g(I,D))));let E=await Promise.all(T),O=jst(a,c,m,y,_,E);this.grids0={numRows:O.length,columns:{density:[O]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=qst(this,r,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=a4(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?z2(m,this.plot.getAttribute("colorDomain")):P0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,r,i,m[y[x]]),u?.(l.data,r,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}};function jst(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;Vst(e,t,s,a,f,d)}),s}function Vst(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function qst(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=j2(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function Yst(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Gst(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return pt.from(pt.unionAll(c,l,u,f)).select({index:"i",density:Pr("w")},o).groupby("index",o).having(yl("density",0))}function cV(e){let t=Math.floor(e);return t===e?t-1:t}var Y0=class extends fn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=Ge(r,a=>(this.ci=a,s())),this.precision=Ge(i,a=>(this.precision=a,s()))}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return pt.from(super.query(t)).select({intercept:aI(r,n),slope:cI(r,n),n:lI(r,n),ssy:uI(r,n),ssx:fI(r,n),xm:dI(r,n),x0:ef(fi(n).where(Is(r))),x1:ef(ui(n).where(Is(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Nr(t),this.lineData=Wst(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?Xst(n,t,r,o):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of r)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Qn(l,s);break;case"stroke":a.stroke=Qn(l,o),c.fill=Qn(l,s);break;case"strokeOpacity":a.strokeOpacity=Qn(l,o);break;case"fillOpacity":c.fillOpacity=Qn(l,s);break;default:a[l.channel]=Qn(l,o),c[l.channel]=Qn(l,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function c4(e,t){if(e.concat)return e.concat(t);let n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function Wst(e){let{x0:t=[],x1:n=[],xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=c4(t,n),d=c4(t.map(u),n.map(u));for(let h in l)l[h]=c4(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function Xst(e,t,n,r){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=n*(s[y]-o[y])/r,x=sV((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));qe(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let w=c[y]+b*l[y],v=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(w-v),m.y2.push(w+v),p.forEach(_=>m[_].push(h[_][y]))})}return{numRows:m.x.length,columns:m}}function lV(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function yh(e){let t={};for(let n in e)t[lV(n)]=e[n];return t}function Hst(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var G0=class{constructor(t,{selection:n,channels:r={}}){this.mark=Hst(t),this.selection=n;let i=Object.entries(yh(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",bh(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await Qst(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=l.__data__,d=a(Array.isArray(f)?f[0]:f);for(let h=0;h<r.length;++h){let[p,m]=r[h];l.setAttribute(p,d?u[h]:m)}}}};async function Qst(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:vr(n)},o=e.query(r);(o.queries||[o]).forEach(c=>{c.groupby().length?c.select(i):c.$select(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function l4(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function uV(){return l4(LE())}function fV(){return l4(DE())}function dV(){return l4(RE())}function W0(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function ms(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function X0(e,t,n=1){return t.invert(n*Math.floor(e/n))}function V2(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var sl=class{constructor(t,{channel:n,selection:r,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||ms(t,n),this.style=a&&yh(a),this.brush=n==="y"?dV():fV(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>X0(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),W0(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return $l(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:o,pixelSize:r})}init(t,n){let{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;r.extent([[ue(s),ue(a)],[Qt(s),Qt(a)]]);let c=this.value?.map(this.scale.apply).sort(Nt),l=jt(t).selectAll('g[aria-label="facet"]');if(n=l.size()?l:jt(n??t),this.g=n.append("g").attr("class",`interval-${i}`).each(V2).call(r).call(r.moveSilent,c),o){let u=this.g.selectAll("rect.selection");for(let f in o)u.attr(f,o[f])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var H0=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||ms(t,"x"),this.yfield=i||ms(t,"y"),this.style=a&&yh(a),this.brush=uV(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>X0(u,i,r)).sort(Nt),a=[c[1],l[1]].map(u=>X0(u,o,r)).sort(Nt)}(!W0(s,n?.[0])||!W0(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return GT([i,o],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ue(s),ue(a)],[Qt(s),Qt(a)]]);let c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t);if(this.g=l.append("g").attr("class","interval-xy").each(V2).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(Nt),[d,h]=this.value[1].map(o.apply).sort(Nt);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var Uu=class{constructor(t,{selection:n,pointer:r,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.pointer=r,this.channels=i||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>ms(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:n,fields:r}=this,i={source:this,clients:n};return r.length>1?Pl(r,t&&[t],i):Bl(r[0],t?.[0],i)}init(t){let n=this,{mark:r,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=r,c=i.map(x=>r.channelField(x).as),l=!$r(o),u=jt(t).selectAll('g[aria-label="facet"]'),f=u.size()?u:jt(t),d=t.scale("x").apply,h=t.scale("y").apply,p=Array.from(a[r.channelField("x").as],d),m=Array.from(a[r.channelField("y").as],h),y=this.pointer==="y"?.01:1,g=this.pointer==="x"?.01:1;f.on("pointerenter pointerdown pointermove",function(x){let[b,w]=zn(x,this),v=Zst(p,m,b,w,y,g,s);if(v!==this.valueIndex){this.valueIndex=v;let _=v<0?void 0:c.map(T=>a[T][v]);o.update(l?!_||_.length>1?_:_[0]:n.clause(_))}}),!l&&(f.on("pointerleave",()=>{o.update(n.clause(void 0))}),t.addEventListener("pointerenter",x=>{if(!x.buttons){let b=this.channels.map(()=>0);o.activate(this.clause(b))}}))}};function Zst(e,t,n,r,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-n),f=o*(t[l]-r),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var hV=(e,t)=>e-t,Q0=class{constructor(t,{x:n=new bo,y:r=new bo,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||ms(t,"x"),this.yfield=o||ms(t,"y"),this.zoom=u4(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=Kst(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=Jst(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return $l(n,t,{source:this,clients:this.mark.plot.markSet,scale:r})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(hV),c=this.yscale.range.slice().sort(hV),l=u4(n,[-1/0,1/0],a),u=u4(r,[-1/0,1/0],c),f=QM().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Jr(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(jt(i).call(f),n||r){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(n){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(r){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function u4(e,t,n){return e?Array.isArray(e)?e:t:n}function Kst(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Jst(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var zu=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i;let o=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:n,mark:r}=this;return Pl(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(t,n,r){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;r??=l=>o.map(u=>{let f=l.__data__;return a[u][Array.isArray(f)?f[0]:f]}),n??=`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(tat(c,f)){let h=r(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>f4(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!f4(u[0],h)?d=null:d=[h]}this.value=d,eat(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function tat(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function eat(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>f4(n,t[r]))}function f4(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var mV=":scope > div, :scope > span",q2="swatch",pV="ramp",gh=class{constructor(t,n){let{as:r,field:i,...o}=n;this.channel=t,this.options=o,this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let n=nat(this,t);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:t,handler:n}=this,{single:r,value:i}=t,o=r?i:t.valueFor(n),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(mV);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function nat(e,t){let{channel:n,plot:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?q2:pV,a={label:r.getAttribute(`${n}Label`)??null,...e.options},c=s===q2?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},l=t.legend(n,c);e.legend=l;let u=!!i;if(u&&s===pV){let f=c.width??240,d=sat(o,f);d?l.scale=function(h){return h==="x"?{range:[0,f]}:h==="y"?{range:[-10,0]}:h===n?d:void 0}:u=!1}if(u){let f=rat(e,s);s===q2?(f.init(l,mV,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function rat(e,t){let{channel:n,handler:r,selection:i}=e;if(r)return r;let o=iat(e);return t===q2?(e.handler=new zu(o,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new sl(o,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function iat(e){let{channel:t,plot:n}=e,r=e.field??oat(n.marks,t)??"value";if(r){let i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function oat(e,t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)for(let i of n){let o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function sat(e,t){let{apply:n,invert:r,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return $c({x:{...o,type:a,range:[0,t]}})}function Y2(e,t,n=0,r=Math.LN10){let i,o=Math.ceil(Math.log(t)/r),s=Math.max(n,Math.pow(10,Math.round(Math.log(e)/r)-o));for(;Math.ceil(e/s)>t;)s*=10;let a=[5,2];for(let c=0,l=a.length;c<l;++c)i=s/a[c],i>=n&&e/i<=t&&(s=i);return s}function yV(e,t,n){let{step:r,steps:i,minstep:o=0,nice:s=!0}=n;if(s!==!1){let a=t-e,c=Math.LN10;r=r||Y2(a,i||25,o,c);let l=Math.log(r),u=l>=0?0:~~(-l/c)+1,f=Math.pow(10,-u-1);l=Math.floor(e/r+f)*r,e=e<l?l-r:l,t=Math.ceil(t/r)*r,i=Math.round((t-e)/r)}return{min:e,max:t,steps:i}}var wV="year",gV="month",xV="day",G2="hour",W2="minute",X2="second",aat="millisecond",K0=1e3,J0=K0*60,tg=J0*60,H2=tg*24,cat=H2*7,bV=H2*30,_V=H2*365,Z0=[[X2,1,K0],[X2,5,5*K0],[X2,15,15*K0],[X2,30,30*K0],[W2,1,J0],[W2,5,5*J0],[W2,15,15*J0],[W2,30,30*J0],[G2,1,tg],[G2,3,3*tg],[G2,6,6*tg],[G2,12,12*tg],[xV,1,H2],[xV,7,cat],[gV,1,bV],[gV,3,3*bV],[wV,1,_V]];function vV(e,t,n){let r=t-e,i=r/n,o=eo(s=>s[2]).right(Z0,i);return o===Z0.length?{interval:wV,step:Y2(r/_V,n)}:o?(o=Z0[i/Z0[o-1][2]<Z0[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:aat,step:Y2(r,n,1)}}var lat=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function uat(e,t){return lat.has(`${e.type}-${t}`)}function Q2(e,t={}){let n=(r,i)=>uat(r,i)?{[`${i}1`]:d4(r,i,e,t),[`${i}2`]:d4(r,i,e,{...t,offset:1})}:{[i]:d4(r,i,e,t)};return n[Yp]=!0,n}function d4(e,t,n,r){return{column:n,label:n,get columns(){return[n]},get basis(){return n},get stats(){return{column:n,stats:["min","max"]}},toString(){let{type:i,min:o,max:s}=e.channelField(t),{interval:a,steps:c,offset:l=0}=r,u=a??(i==="date"||fat(e,t)?"date":"number");if(u==="number"){let{apply:f,sqlApply:d,sqlInvert:h}=$u(e,t),p=yV(f(o),f(s),r),m=d(n),y=p.min===0?m:`(${m} - ${p.min})`,g=`${(p.max-p.min)/p.steps}::DOUBLE`,x=l?`${l} + `:"",b=`${p.min} + ${g} * (${x}FLOOR(${y} / ${g}))`;return`${h(b)}`}else{let{interval:f,step:d=1}=u==="date"?vV(o,s,c||40):r,h=l?` + INTERVAL ${l*d} ${f}`:"";return`(${bI(n,f,d)}${h})`}}}}function fat(e,t){let n=e.plot.getAttribute(`${t}Scale`);return n==="utc"||n==="time"}var dat=e=>e&&typeof e=="object"&&!Array.isArray(e);var eg=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(n),this.from=r,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>dat(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!$r(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,field:r}=this;if($r(n)){t===""&&(t=void 0);let i=Bl(r,t,{source:this});n.update(i)}else Sr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r,selection:i}=this;r.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??n(o),this.select.appendChild(a)}if(i){let o=$r(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var hat=0;var ng=class extends xr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(n),this.id="search_"+ ++hat,this.type=s,this.from=r,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),$r(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,field:r,type:i}=this;if($r(n)){let o=WT(r,t,{source:this,method:i});n.update(o)}else Sr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?pt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var pat=0;var rg=class extends xr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,select:f="point",field:d=c,width:h}={}){if(super(n),this.id="slider_"+ ++pat,this.from=a,this.column=c||"value",this.selection=r,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!$r(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:pt.select({min:fi(r),max:ui(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:n,selectionType:r,selection:i}=this;if($r(i))if(r==="interval"){let o=[this.min??0,t];i.update($l(n,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(Bl(n,t,{source:this}));else Sr(this.selection)&&i.update(t)}};var p4=SV(e=>{let t=Z2(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?m4(n):`${n}`}),Z2=SV(e=>t=>t===0?"0":t.toLocaleString(e)),Fte=p4(),kte=Z2();function m4(e){return vd(e,"Invalid Date")}function SV(e){let t=null,n;return(r="en")=>r===t?n:n=e(t=r)}var mat=-1;var ig=class extends xr{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100,as:f}={}){super(n),this.id=`table-${++mat}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let d=-1;this.element.addEventListener("scroll",h=>{let{pending:p,loaded:m}=this,{scrollHeight:y,scrollTop:g,clientHeight:x}=h.target,b=g<d;d=g,!(b||p||m)&&y-g<2*x&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",h=>{let p=yat(h.target);p>-1&&p!==this.currentRow&&(this.currentRow=p,this.selection.update(this.clause([p])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}clause(t=[]){let{data:n,limit:r,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{let{columns:c}=n[~~(a/r)];return o.map(l=>c[l][a%r])});return Pl(o,s,{source:this})}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),di().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Va(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=gat(this.format,t),this.style.innerText=wat(this.id,xat(this.align,t),bat(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return pt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?TS(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Nr(t)),this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=r.length-1,c=o*a,{numRows:l,columns:u}=r[a],f=i.map(d=>u[d.column]);for(let d=0;d<l;++d){let h=document.createElement("tr");Object.assign(h,{__row__:c+d});for(let p=0;p<s;++p){let m=f[p][d],y=document.createElement("td");y.innerText=m==null?"":n[p](m),h.appendChild(y)}t.appendChild(h)}return l<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function yat(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function gat(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return Z2(n);case"date":return m4;default:return p4(n)}})}function xat(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function bat(e={},t){return t.map(({column:n})=>e[n])}function wat(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function og(e,...t){let n=e?.context?.coordinator??di();for(let r of t)n.connect(r)}function K2(e,t,n){let r=new t(n);return og(e,r),r.element}function IV(e){return K2(this,eg,e)}function TV(e){return K2(this,ng,e)}function EV(e){return K2(this,rg,e)}function AV(e){return K2(this,ig,e)}function MV({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),Object.assign(r,{value:{element:r}}),r}function OV(...e){return MV({direction:"vertical"},e.flat())}function NV(...e){return MV({direction:"horizontal"},e.flat())}function DV({dim:e="width",size:t=10}){let n=document.createElement("span");return n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(n,{value:{element:n}})}function RV(e){return DV({dim:"height",size:e})}function LV(e){return DV({dim:"width",size:e})}var CV={};kr(CV,{align:()=>N4,aspectRatio:()=>D4,axis:()=>R4,colorBase:()=>bD,colorClamp:()=>aD,colorConstant:()=>_D,colorDomain:()=>oD,colorExponent:()=>wD,colorInterpolate:()=>fD,colorLabel:()=>pD,colorN:()=>cD,colorNice:()=>lD,colorPercent:()=>mD,colorPivot:()=>dD,colorRange:()=>sD,colorReverse:()=>yD,colorScale:()=>iD,colorScheme:()=>uD,colorSymmetric:()=>hD,colorTickFormat:()=>xD,colorZero:()=>gD,facetGrid:()=>iN,facetLabel:()=>oN,facetMargin:()=>JO,facetMarginBottom:()=>eN,facetMarginLeft:()=>nN,facetMarginRight:()=>rN,facetMarginTop:()=>tN,fxAlign:()=>dN,fxAriaDescription:()=>NN,fxAriaLabel:()=>ON,fxAxis:()=>yN,fxDomain:()=>sN,fxFontVariant:()=>MN,fxGrid:()=>SN,fxInset:()=>cN,fxInsetLeft:()=>lN,fxInsetRight:()=>uN,fxLabel:()=>TN,fxLabelAnchor:()=>EN,fxLabelOffset:()=>AN,fxLine:()=>IN,fxPadding:()=>hN,fxPaddingInner:()=>pN,fxPaddingOuter:()=>mN,fxRange:()=>aN,fxReverse:()=>DN,fxRound:()=>fN,fxTickFormat:()=>_N,fxTickPadding:()=>wN,fxTickRotate:()=>vN,fxTickSize:()=>xN,fxTickSpacing:()=>bN,fxTicks:()=>gN,fyAlign:()=>PN,fyAriaDescription:()=>nD,fyAriaLabel:()=>eD,fyAxis:()=>jN,fyDomain:()=>RN,fyFontVariant:()=>tD,fyGrid:()=>HN,fyInset:()=>FN,fyInsetBottom:()=>CN,fyInsetTop:()=>kN,fyLabel:()=>ZN,fyLabelAnchor:()=>KN,fyLabelOffset:()=>JN,fyLine:()=>QN,fyPadding:()=>$N,fyPaddingInner:()=>UN,fyPaddingOuter:()=>zN,fyRange:()=>LN,fyReverse:()=>rD,fyRound:()=>BN,fyTickFormat:()=>WN,fyTickPadding:()=>GN,fyTickRotate:()=>XN,fyTickSize:()=>qN,fyTickSpacing:()=>YN,fyTicks:()=>VN,grid:()=>F4,height:()=>T4,inset:()=>L4,label:()=>k4,lengthBase:()=>n8,lengthClamp:()=>KD,lengthConstant:()=>i8,lengthDomain:()=>QD,lengthExponent:()=>r8,lengthNice:()=>JD,lengthPercent:()=>t8,lengthRange:()=>ZD,lengthScale:()=>HD,lengthZero:()=>e8,margin:()=>_4,marginBottom:()=>O4,marginLeft:()=>E4,marginRight:()=>A4,marginTop:()=>M4,margins:()=>w4,name:()=>x4,opacityBase:()=>RD,opacityClamp:()=>TD,opacityConstant:()=>FD,opacityDomain:()=>SD,opacityExponent:()=>LD,opacityLabel:()=>AD,opacityNice:()=>ED,opacityPercent:()=>MD,opacityRange:()=>ID,opacityReverse:()=>OD,opacityScale:()=>vD,opacityTickFormat:()=>DD,opacityZero:()=>ND,padding:()=>C4,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,rBase:()=>GD,rClamp:()=>zD,rConstant:()=>XD,rDomain:()=>$D,rExponent:()=>WD,rLabel:()=>VD,rNice:()=>jD,rPercent:()=>qD,rRange:()=>UD,rScale:()=>PD,rZero:()=>YD,style:()=>S4,symbolDomain:()=>CD,symbolRange:()=>BD,symbolScale:()=>kD,width:()=>I4,xAlign:()=>G4,xAriaDescription:()=>fO,xAriaLabel:()=>uO,xAxis:()=>Q4,xBase:()=>mO,xClamp:()=>q4,xConstant:()=>gO,xDomain:()=>P4,xExponent:()=>yO,xFontVariant:()=>lO,xGrid:()=>rO,xInset:()=>z4,xInsetLeft:()=>j4,xInsetRight:()=>V4,xLabel:()=>oO,xLabelAnchor:()=>sO,xLabelArrow:()=>aO,xLabelOffset:()=>cO,xLine:()=>iO,xNice:()=>U4,xPadding:()=>W4,xPaddingInner:()=>X4,xPaddingOuter:()=>H4,xPercent:()=>dO,xRange:()=>$4,xReverse:()=>hO,xRound:()=>Y4,xScale:()=>B4,xTickFormat:()=>eO,xTickPadding:()=>tO,xTickRotate:()=>nO,xTickSize:()=>K4,xTickSpacing:()=>J4,xTicks:()=>Z4,xZero:()=>pO,xyDomain:()=>v4,yAlign:()=>AO,yAriaDescription:()=>GO,yAriaLabel:()=>YO,yAxis:()=>DO,yBase:()=>QO,yClamp:()=>TO,yConstant:()=>KO,yDomain:()=>bO,yExponent:()=>ZO,yFontVariant:()=>qO,yGrid:()=>PO,yInset:()=>vO,yInsetBottom:()=>IO,yInsetTop:()=>SO,yLabel:()=>UO,yLabelAnchor:()=>zO,yLabelArrow:()=>jO,yLabelOffset:()=>VO,yLine:()=>$O,yNice:()=>_O,yPadding:()=>MO,yPaddingInner:()=>OO,yPaddingOuter:()=>NO,yPercent:()=>WO,yRange:()=>wO,yReverse:()=>XO,yRound:()=>EO,yScale:()=>xO,yTickFormat:()=>CO,yTickPadding:()=>kO,yTickRotate:()=>BO,yTickSize:()=>LO,yTickSpacing:()=>FO,yTicks:()=>RO,yZero:()=>HO});var sg=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}clear(){return this.waiting?.clear(),super.clear()}},y4=new sg;function g4(e,t,n){(e?.context?.namedPlots??y4).request(t,n)}function FV(e,t,n){(e?.context?.namedPlots??y4).set(t,n)}function x4(e){return t=>FV(this,e,t)}function kV(e,t,n){Sr(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function _at(e,t){return n=>{kV(n,e,t)}}function b4(e){return t=>{for(let[n,r]of Object.entries(e))kV(t,n,r)}}function w4(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),b4(o)}function _4(e){return b4({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function v4(e){return b4({xDomain:e,yDomain:e})}var F=e=>t=>_at(e,t),S4=F("style"),I4=F("width"),T4=F("height"),E4=F("marginLeft"),A4=F("marginRight"),M4=F("marginTop"),O4=F("marginBottom"),N4=F("align"),D4=F("aspectRatio"),R4=F("axis"),L4=F("inset"),F4=F("grid"),k4=F("label"),C4=F("padding"),B4=F("xScale"),P4=F("xDomain"),$4=F("xRange"),U4=F("xNice"),z4=F("xInset"),j4=F("xInsetLeft"),V4=F("xInsetRight"),q4=F("xClamp"),Y4=F("xRound"),G4=F("xAlign"),W4=F("xPadding"),X4=F("xPaddingInner"),H4=F("xPaddingOuter"),Q4=F("xAxis"),Z4=F("xTicks"),K4=F("xTickSize"),J4=F("xTickSpacing"),tO=F("xTickPadding"),eO=F("xTickFormat"),nO=F("xTickRotate"),rO=F("xGrid"),iO=F("xLine"),oO=F("xLabel"),sO=F("xLabelAnchor"),aO=F("xLabelArrow"),cO=F("xLabelOffset"),lO=F("xFontVariant"),uO=F("xAriaLabel"),fO=F("xAriaDescription"),dO=F("xPercent"),hO=F("xReverse"),pO=F("xZero"),mO=F("xBase"),yO=F("xExponent"),gO=F("xConstant"),xO=F("yScale"),bO=F("yDomain"),wO=F("yRange"),_O=F("yNice"),vO=F("yInset"),SO=F("yInsetTop"),IO=F("yInsetBottom"),TO=F("yClamp"),EO=F("yRound"),AO=F("yAlign"),MO=F("yPadding"),OO=F("yPaddingInner"),NO=F("yPaddingOuter"),DO=F("yAxis"),RO=F("yTicks"),LO=F("yTickSize"),FO=F("yTickSpacing"),kO=F("yTickPadding"),CO=F("yTickFormat"),BO=F("yTickRotate"),PO=F("yGrid"),$O=F("yLine"),UO=F("yLabel"),zO=F("yLabelAnchor"),jO=F("yLabelArrow"),VO=F("yLabelOffset"),qO=F("yFontVariant"),YO=F("yAriaLabel"),GO=F("yAriaDescription"),WO=F("yPercent"),XO=F("yReverse"),HO=F("yZero"),QO=F("yBase"),ZO=F("yExponent"),KO=F("yConstant"),JO=F("facetMargin"),tN=F("facetMarginTop"),eN=F("facetMarginBottom"),nN=F("facetMarginLeft"),rN=F("facetMarginRight"),iN=F("facetGrid"),oN=F("facetLabel"),sN=F("fxDomain"),aN=F("fxRange"),cN=F("fxInset"),lN=F("fxInsetLeft"),uN=F("fxInsetRight"),fN=F("fxRound"),dN=F("fxAlign"),hN=F("fxPadding"),pN=F("fxPaddingInner"),mN=F("fxPaddingOuter"),yN=F("fxAxis"),gN=F("fxTicks"),xN=F("fxTickSize"),bN=F("fxTickSpacing"),wN=F("fxTickPadding"),_N=F("fxTickFormat"),vN=F("fxTickRotate"),SN=F("fxGrid"),IN=F("fxLine"),TN=F("fxLabel"),EN=F("fxLabelAnchor"),AN=F("fxLabelOffset"),MN=F("fxFontVariant"),ON=F("fxAriaLabel"),NN=F("fxAriaDescription"),DN=F("fxReverse"),RN=F("fyDomain"),LN=F("fyRange"),FN=F("fyInset"),kN=F("fyInsetTop"),CN=F("fyInsetBottom"),BN=F("fyRound"),PN=F("fyAlign"),$N=F("fyPadding"),UN=F("fyPaddingInner"),zN=F("fyPaddingOuter"),jN=F("fyAxis"),VN=F("fyTicks"),qN=F("fyTickSize"),YN=F("fyTickSpacing"),GN=F("fyTickPadding"),WN=F("fyTickFormat"),XN=F("fyTickRotate"),HN=F("fyGrid"),QN=F("fyLine"),ZN=F("fyLabel"),KN=F("fyLabelAnchor"),JN=F("fyLabelOffset"),tD=F("fyFontVariant"),eD=F("fyAriaLabel"),nD=F("fyAriaDescription"),rD=F("fyReverse"),iD=F("colorScale"),oD=F("colorDomain"),sD=F("colorRange"),aD=F("colorClamp"),cD=F("colorN"),lD=F("colorNice"),uD=F("colorScheme"),fD=F("colorInterpolate"),dD=F("colorPivot"),hD=F("colorSymmetric"),pD=F("colorLabel"),mD=F("colorPercent"),yD=F("colorReverse"),gD=F("colorZero"),xD=F("colorTickFormat"),bD=F("colorBase"),wD=F("colorExponent"),_D=F("colorConstant"),vD=F("opacityScale"),SD=F("opacityDomain"),ID=F("opacityRange"),TD=F("opacityClamp"),ED=F("opacityNice"),AD=F("opacityLabel"),MD=F("opacityPercent"),OD=F("opacityReverse"),ND=F("opacityZero"),DD=F("opacityTickFormat"),RD=F("opacityBase"),LD=F("opacityExponent"),FD=F("opacityConstant"),kD=F("symbolScale"),CD=F("symbolDomain"),BD=F("symbolRange"),PD=F("rScale"),$D=F("rDomain"),UD=F("rRange"),zD=F("rClamp"),jD=F("rNice"),VD=F("rLabel"),qD=F("rPercent"),YD=F("rZero"),GD=F("rBase"),WD=F("rExponent"),XD=F("rConstant"),HD=F("lengthScale"),QD=F("lengthDomain"),ZD=F("lengthRange"),KD=F("lengthClamp"),JD=F("lengthNice"),t8=F("lengthPercent"),e8=F("lengthZero"),n8=F("lengthBase"),r8=F("lengthExponent"),i8=F("lengthConstant"),o8=F("projectionType"),s8=F("projectionParallels"),a8=F("projectionPrecision"),c8=F("projectionRotate"),l8=F("projectionDomain"),u8=F("projectionInset"),f8=F("projectionInsetLeft"),d8=F("projectionInsetRight"),h8=F("projectionInsetTop"),p8=F("projectionInsetBottom"),m8=F("projectionClip");function BV(e,t){return{table:e,options:t}}var PV={};kr(PV,{area:()=>y8,areaX:()=>g8,areaY:()=>x8,arrow:()=>fR,axisFx:()=>yR,axisFy:()=>gR,axisX:()=>pR,axisY:()=>mR,barX:()=>v8,barY:()=>S8,cell:()=>I8,cellX:()=>T8,cellY:()=>E8,circle:()=>L8,contour:()=>Z8,delaunayLink:()=>cR,delaunayMesh:()=>lR,denseLine:()=>Q8,density:()=>H8,densityX:()=>W8,densityY:()=>X8,dot:()=>N8,dotX:()=>D8,dotY:()=>R8,errorbarX:()=>iR,errorbarY:()=>oR,frame:()=>hR,geo:()=>vR,graticule:()=>IR,gridFx:()=>wR,gridFy:()=>_R,gridX:()=>xR,gridY:()=>bR,heatmap:()=>K8,hexagon:()=>F8,hexbin:()=>eR,hexgrid:()=>nR,hull:()=>uR,image:()=>G8,line:()=>b8,lineX:()=>w8,lineY:()=>_8,link:()=>dR,raster:()=>J8,rasterTile:()=>tR,rect:()=>A8,rectX:()=>M8,rectY:()=>O8,regressionY:()=>rR,ruleX:()=>P8,ruleY:()=>$8,sphere:()=>SR,spike:()=>Y8,text:()=>k8,textX:()=>C8,textY:()=>B8,tickX:()=>U8,tickY:()=>z8,vector:()=>j8,vectorX:()=>V8,vectorY:()=>q8,voronoi:()=>sR,voronoiMesh:()=>aR});var vat=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Tt(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=vat.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?F0:fn;return J2(r,e,t,n)}function J2(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ys(e,t,n){return r=>{r.addMark(new e(t,n))}}var y8=(...e)=>Tt("area",...e),g8=(...e)=>Tt("areaX",...e),x8=(...e)=>Tt("areaY",...e),b8=(...e)=>Tt("line",...e),w8=(...e)=>Tt("lineX",...e),_8=(...e)=>Tt("lineY",...e),v8=(...e)=>Tt("barX",...e),S8=(...e)=>Tt("barY",...e),I8=(...e)=>Tt("cell",...e),T8=(...e)=>Tt("cellX",...e),E8=(...e)=>Tt("cellY",...e),A8=(...e)=>Tt("rect",...e),M8=(...e)=>Tt("rectX",...e),O8=(...e)=>Tt("rectY",...e),N8=(...e)=>Tt("dot",...e),D8=(...e)=>Tt("dotX",...e),R8=(...e)=>Tt("dotY",...e),L8=(...e)=>Tt("circle",...e),F8=(...e)=>Tt("hexagon",...e),k8=(...e)=>Tt("text",...e),C8=(...e)=>Tt("textX",...e),B8=(...e)=>Tt("textY",...e),P8=(...e)=>Tt("ruleX",...e),$8=(...e)=>Tt("ruleY",...e),U8=(...e)=>Tt("tickX",...e),z8=(...e)=>Tt("tickY",...e),j8=(...e)=>Tt("vector",...e),V8=(...e)=>Tt("vectoX",...e),q8=(...e)=>Tt("vectorY",...e),Y8=(...e)=>Tt("spike",...e),G8=(...e)=>Tt("image",...e),W8=(...e)=>J2(hh,"areaX",...e),X8=(...e)=>J2(hh,"areaY",...e),H8=(...e)=>ys(z0,...e),Q8=(...e)=>ys(U0,...e),Z8=(...e)=>ys(B0,...e),K8=(...e)=>ys($0,...e),J8=(...e)=>ys(ol,...e),tR=(...e)=>ys(q0,...e),eR=(...e)=>ys(V0,...e),nR=(...e)=>Tt("hexgrid",...e),rR=(...e)=>ys(Y0,...e),iR=(...e)=>J2(mh,"ruleY",...e),oR=(...e)=>ys(mh,"ruleX",...e),sR=(...e)=>Tt("voronoi",...e),aR=(...e)=>Tt("voronoiMesh",...e),cR=(...e)=>Tt("delaunayLink",...e),lR=(...e)=>Tt("delaunayMesh",...e),uR=(...e)=>Tt("hull",...e),fR=(...e)=>Tt("arrow",...e),dR=(...e)=>Tt("link",...e),hR=(...e)=>Tt("frame",...e),pR=(...e)=>Tt("axisX",...e),mR=(...e)=>Tt("axisY",...e),yR=(...e)=>Tt("axisFx",...e),gR=(...e)=>Tt("axisFy",...e),xR=(...e)=>Tt("gridX",...e),bR=(...e)=>Tt("gridY",...e),wR=(...e)=>Tt("gridFx",...e),_R=(...e)=>Tt("gridFy",...e),vR=(...e)=>ys(j0,...e),SR=(...e)=>Tt("sphere",...e),IR=(...e)=>Tt("graticule",...e);var $V={};kr($V,{highlight:()=>TR,intervalX:()=>LR,intervalXY:()=>kR,intervalY:()=>FR,nearest:()=>NR,nearestX:()=>DR,nearestY:()=>RR,pan:()=>CR,panX:()=>BR,panY:()=>PR,panZoom:()=>$R,panZoomX:()=>UR,panZoomY:()=>zR,toggle:()=>ju,toggleColor:()=>OR,toggleX:()=>ER,toggleY:()=>AR,toggleZ:()=>MR});function Ba(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function TR({by:e,...t}){return Ba(G0,{selection:e,channels:t})}function ju({as:e,...t}){return Ba(zu,{...t,selection:e})}function ER(e){return ju({...e,channels:["x"]})}function AR(e){return ju({...e,channels:["y"]})}function MR(e){return ju({...e,channels:["z"]})}function OR(e){return ju({...e,channels:["color"]})}function NR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"xy"})}function DR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"x"})}function RR({as:e,...t}){return Ba(Uu,{...t,selection:e,pointer:"y"})}function LR({as:e,...t}){return Ba(sl,{...t,selection:e,channel:"x"})}function FR({as:e,...t}){return Ba(sl,{...t,selection:e,channel:"y"})}function kR({as:e,...t}){return Ba(H0,{...t,selection:e})}function xh(e){return Ba(Q0,e)}function CR(e={}){return xh({...e,zoom:!1})}function BR(e={}){return xh({...e,zoom:!1,pany:!1})}function PR(e={}){return xh({...e,zoom:!1,panx:!1})}function $R(e={}){return xh(e)}function UR(e={}){return xh({...e,pany:!1})}function zR(e={}){return xh({...e,panx:!1})}var UV={};kr(UV,{colorLegend:()=>VR,opacityLegend:()=>qR,symbolLegend:()=>YR});function jR(e,t={}){if(t.for){let{for:n,...r}=t,i=new gh(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?g4(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new gh(e,t))}function VR(e){return jR.call(this,"color",e)}function qR(e){return jR.call(this,"opacity",e)}function YR(e){return jR.call(this,"symbol",e)}function zV(...e){let t=new R0;return e.flat().forEach(n=>n(t)),og(this,...t.marks),t.update(),t.element}function Sat({coordinator:e=di(),namedPlots:t=new sg,extensions:n=null,...r}={}){return{...GR,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Vh as Coordinator,Ro as Fixed,xr as MosaicClient,Ga as Param,pt as Query,bo as Selection,Vt as agg,N4 as align,vr as and,y8 as area,g8 as areaX,x8 as areaY,tf as argmax,Ju as argmin,yI as arrayAgg,fR as arrow,D4 as aspectRatio,CV as attributeDirectives,kh as avg,R4 as axis,yR as axisFx,gR as axisFy,pR as axisX,mR as axisY,v8 as barX,S8 as barY,Q2 as bin,Bh as cast,ef as castDouble,gI as castInteger,I8 as cell,T8 as cellX,E8 as cellY,$h as centroid,SI as centroidX,II as centroidY,L8 as circle,bD as colorBase,aD as colorClamp,_D as colorConstant,oD as colorDomain,wD as colorExponent,fD as colorInterpolate,pD as colorLabel,VR as colorLegend,cD as colorN,lD as colorNice,mD as colorPercent,dD as colorPivot,sD as colorRange,yD as colorReverse,iD as colorScale,uD as colorScheme,hD as colorSymmetric,xD as colorTickFormat,gD as colorZero,Va as column,og as connect,Z8 as contour,di as coordinator,iI as corr,Zn as count,sI as covarPop,oI as covariance,Ya as create,Sat as createAPIContext,$S as cume_dist,vI as dateDay,wI as dateMonth,_I as dateMonthDay,cR as delaunayLink,lR as delaunayMesh,Q8 as denseLine,BS as dense_rank,H8 as density,W8 as densityX,X8 as densityY,N8 as dot,D8 as dotX,R8 as dotY,eI as entropy,AS as eq,iR as errorbarX,oR as errorbarY,iN as facetGrid,oN as facetLabel,JO as facetMargin,eN as facetMarginBottom,nN as facetMarginLeft,rN as facetMarginRight,tN as facetMarginTop,hI as first,VS as first_value,hR as frame,BV as from,dN as fxAlign,NN as fxAriaDescription,ON as fxAriaLabel,yN as fxAxis,sN as fxDomain,MN as fxFontVariant,SN as fxGrid,cN as fxInset,lN as fxInsetLeft,uN as fxInsetRight,TN as fxLabel,EN as fxLabelAnchor,AN as fxLabelOffset,IN as fxLine,hN as fxPadding,pN as fxPaddingInner,mN as fxPaddingOuter,aN as fxRange,DN as fxReverse,fN as fxRound,_N as fxTickFormat,wN as fxTickPadding,vN as fxTickRotate,xN as fxTickSize,bN as fxTickSpacing,gN as fxTicks,PN as fyAlign,nD as fyAriaDescription,eD as fyAriaLabel,jN as fyAxis,RN as fyDomain,tD as fyFontVariant,HN as fyGrid,FN as fyInset,CN as fyInsetBottom,kN as fyInsetTop,ZN as fyLabel,KN as fyLabelAnchor,JN as fyLabelOffset,QN as fyLine,$N as fyPadding,UN as fyPaddingInner,zN as fyPaddingOuter,LN as fyRange,rD as fyReverse,BN as fyRound,WN as fyTickFormat,GN as fyTickPadding,XN as fyTickRotate,qN as fyTickSize,YN as fyTickSpacing,VN as fyTicks,vR as geo,Ph as geojson,IR as graticule,F4 as grid,wR as gridFx,_R as gridFy,xR as gridX,bR as gridY,Lh as gt,MS as gte,NV as hconcat,K8 as heatmap,T4 as height,F8 as hexagon,eR as hexbin,nR as hexgrid,TR as highlight,LV as hspace,uR as hull,G8 as image,L4 as inset,$V as interactorDirectives,LR as intervalX,kR as intervalXY,FR as intervalY,We as isBetween,OS as isDistinct,NS as isNotBetween,Ku as isNotDistinct,Is as isNotNull,ml as isNull,tI as kurtosis,k4 as label,zS as lag,pI as last,qS as last_value,jS as lead,UV as legendDirectives,n8 as lengthBase,KD as lengthClamp,i8 as lengthConstant,QD as lengthDomain,r8 as lengthExponent,JD as lengthNice,t8 as lengthPercent,ZD as lengthRange,HD as lengthScale,e8 as lengthZero,b8 as line,w8 as lineX,_8 as lineY,dR as link,hl as literal,MI as loadCSV,EI as loadExtension,OI as loadJSON,RI as loadObjects,NI as loadParquet,DI as loadSpatial,Ts as lt,Es as lte,WS as mad,_4 as margin,O4 as marginBottom,E4 as marginLeft,A4 as marginRight,M4 as marginTop,w4 as margins,PV as markDirectives,ui as max,HS as median,IV as menu,fi as min,ZS as mode,x4 as name,y4 as namedPlots,NR as nearest,DR as nearestX,RR as nearestY,yl as neq,ES as not,YS as nth_value,US as ntile,RD as opacityBase,TD as opacityClamp,FD as opacityConstant,SD as opacityDomain,LD as opacityExponent,AD as opacityLabel,qR as opacityLegend,ED as opacityNice,MD as opacityPercent,ID as opacityRange,OD as opacityReverse,vD as opacityScale,DD as opacityTickFormat,ND as opacityZero,pl as or,C4 as padding,CR as pan,BR as panX,PR as panY,$R as panZoom,UR as panZoomX,zR as panZoomY,PS as percent_rank,zV as plot,XS as product,m8 as projectionClip,l8 as projectionDomain,u8 as projectionInset,p8 as projectionInsetBottom,f8 as projectionInsetLeft,d8 as projectionInsetRight,h8 as projectionInsetTop,s8 as projectionParallels,a8 as projectionPrecision,c8 as projectionRotate,o8 as projectionType,QS as quantile,GD as rBase,zD as rClamp,XD as rConstant,$D as rDomain,WD as rExponent,VD as rLabel,jD as rNice,qD as rPercent,UD as rRange,PD as rScale,YD as rZero,CS as rank,J8 as raster,tR as rasterTile,A8 as rect,M8 as rectX,O8 as rectY,rR as regressionY,g4 as requestNamedPlot,ZL as restConnector,kS as row_number,P8 as ruleX,$8 as ruleY,TV as search,JS as skewness,EV as slider,rx as socketConnector,SR as sphere,Y8 as spike,q as sql,Ch as stddev,rI as stddevPop,mI as stringAgg,S4 as style,Pr as sum,CD as symbolDomain,YR as symbolLegend,BD as symbolRange,kD as symbolScale,AV as table,k8 as text,C8 as textX,B8 as textY,U8 as tickX,z8 as tickY,ju as toggle,OR as toggleColor,ER as toggleX,AR as toggleY,MR as toggleZ,nI as varPop,KS as variance,OV as vconcat,j8 as vector,V8 as vectorX,q8 as vectorY,sR as voronoi,aR as voronoiMesh,RV as vspace,Hk as wasmConnector,I4 as width,G4 as xAlign,fO as xAriaDescription,uO as xAriaLabel,Q4 as xAxis,mO as xBase,q4 as xClamp,gO as xConstant,P4 as xDomain,yO as xExponent,lO as xFontVariant,rO as xGrid,z4 as xInset,j4 as xInsetLeft,V4 as xInsetRight,oO as xLabel,sO as xLabelAnchor,aO as xLabelArrow,cO as xLabelOffset,iO as xLine,U4 as xNice,W4 as xPadding,X4 as xPaddingInner,H4 as xPaddingOuter,dO as xPercent,$4 as xRange,hO as xReverse,Y4 as xRound,B4 as xScale,eO as xTickFormat,tO as xTickPadding,nO as xTickRotate,K4 as xTickSize,J4 as xTickSpacing,Z4 as xTicks,pO as xZero,v4 as xyDomain,AO as yAlign,GO as yAriaDescription,YO as yAriaLabel,DO as yAxis,QO as yBase,TO as yClamp,KO as yConstant,bO as yDomain,ZO as yExponent,qO as yFontVariant,PO as yGrid,vO as yInset,IO as yInsetBottom,SO as yInsetTop,UO as yLabel,zO as yLabelAnchor,jO as yLabelArrow,VO as yLabelOffset,$O as yLine,_O as yNice,MO as yPadding,OO as yPaddingInner,NO as yPaddingOuter,WO as yPercent,wO as yRange,XO as yReverse,EO as yRound,xO as yScale,CO as yTickFormat,kO as yTickPadding,BO as yTickRotate,LO as yTickSize,FO as yTickSpacing,RO as yTicks,HO as yZero};
|
|
69
|
+
}`)).call(Dh,r);for(let k of l){let{channels:P,values:U,facets:$}=m.get(k);if(p===void 0||k.facet==="super"){let X=null;if($&&(X=$[0],X=k.filter(X,P,U),X.length===0))continue;let rt=k.render(X,x,U,w,T);if(rt==null)continue;E.appendChild(rt)}else{let X;for(let rt of p){if(!(k.facetAnchor?.(p,R,rt)??!rt.empty))continue;let ot=null;if($){let Y=f.has(k);if(ot=$[Y?rt.i:0],ot=k.filter(ot,P,U),ot.length===0)continue;!Y&&ot===$[0]&&(ot=Qa(ot)),ot.fx=rt.x,ot.fy=rt.y,ot.fi=rt.i}let at=k.render(ot,x,U,v,T);if(at!=null){(X??=Qt(E).append("g")).append(()=>at).datum(rt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])at.hasAttribute(Y)&&(X.attr(Y,at.getAttribute(Y)),at.removeAttribute(Y))}}X?.selectChildren().attr("transform",C)}}let O=$j(y,T,e),{figure:L=n!=null||i!=null||o!=null||O.length>0}=e;L&&(N=A.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",n!=null&&N.append(eq(A,n,"h2")),i!=null&&N.append(eq(A,i,"h3")),N.append(...O,E),o!=null&&N.append(rst(A,o)),"value"in E&&(N.value=E.value,delete E.value)),N.scale=Ez(x.scales),N.legend=Pj(y,T,e);let B=iz();return B>0&&Qt(E).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),N}function eq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function rst(e,t){let r=e.createElement("figcaption");return r.append(t),r}function rq(e){return e.flat(1/0).filter(t=>t!=null).map(nst)}function nst(e){return typeof e.render=="function"?e:new NN(e)}var NN=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function ON(e,t){for(let r in e)sq(e[r],t);return e}function sq(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c==null?NaN:c*100:S4(s,i)}=t[r]??{};a!=null&&(e.value=Xt(e.value,a),e.transform=!1)}function ist(e){for(let t in e)U4(t,e[t])}function y0(e,t,r,n=l$){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&n(a))if(a==="projection"){if(!Pz(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=$z(s);c&&MN(e,"x",u),l&&MN(e,"y",f)}}}else MN(e,a,s)}return e}function MN(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function ost(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Xa(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Th(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Th(i,{value:n,scale:"fy"})),ON(o,t);let s=vS(i,o);return{channels:o,groups:s,data:e.data}}function nq(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Xa(e.data??n??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return n!=null&&(l.fx=Th(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Th(c,{value:i,scale:"fy"})),ON(l,r),{channels:l,groups:vS(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&al(Xa(e.data))===al(a)&&mn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function sst(e,t={}){return Ne({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function ast(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:i,preferredAnchor:o}=n;i=/^x$/i.test(i)?xl:/^y$/i.test(i)?ic:gl,n=i(sst(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===ic?"left":"bottom");let s=KS(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function cst(e,t,r){let{projection:n,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:x=g===null?null:d}=s,fy:{axis:b=f,grid:_=b===null?null:d}=a}=r;(n||!vs(i)&&!iq("x",e))&&(h=p=null),(n||!vs(o)&&!iq("y",e))&&(m=y=null),t.has("fx")||(g=x=null),t.has("fy")||(b=_=null),h===void 0&&(h=!eI(e,"x")),m===void 0&&(m=!eI(e,"y")),g===void 0&&(g=!eI(e,"fx")),b===void 0&&(b=!eI(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),g===!0&&(g=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let v=[];return tI(v,_,qS,a),JS(v,b,$S,"right","left",u,a),tI(v,x,YS,s),JS(v,g,zS,"top","bottom",u,s),tI(v,y,jS,o),JS(v,m,a0,"left","right",r,o),tI(v,p,VS,i),JS(v,h,c0,"bottom","top",r,i),v}function JS(e,t,r,n,i,o,s){if(!t)return;let a=lst(t);s=ust(a?n:t,o,s);let{line:c}=s;(r===a0||r===c0)&&c&&!Ka(c)&&e.push(jh(fst(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function tI(e,t,r,n){!t||Ka(t)||e.push(r(dst(t,n)))}function lst(e){return/^\s*both\s*$/i.test(e)}function ust(e,t,{line:r=t.line,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:r,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function fst(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function dst(e,{stroke:t=ll(e)?e:void 0,ticks:r=hst(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function hst(e){switch(typeof e){case"number":return!0;case"string":return!ll(e)}return kn(e)||typeof e?.range=="function"}function eI(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function iq(e,t){for(let r of t)for(let n in r.channels){let{scale:i}=r.channels[n];if(i===e||i==="projection")return!0}return!1}function pst(e,t){for(let r in e){let n=e[r],i=t[r];n.label===void 0&&i&&(n.label=i.label)}return e}function mst({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=bS(r),l=e&&oq(e),u=t&&oq(t);return{marginTop:t?u[0]:n,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:a,height:c}}function oq(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let r=e(t[0]),n=e(t[t.length-1]);return n<r&&([r,n]=[n,r]),[r,n+e.bandwidth()]}var yst=new Map([["basis",z6],["basis-closed",j6],["basis-open",q6],["bundle",V6],["bump-x",k6],["bump-y",B6],["cardinal",Y6],["cardinal-closed",W6],["cardinal-open",G6],["catmull-rom",X6],["catmull-rom-closed",H6],["catmull-rom-open",Q6],["linear",Va],["linear-closed",Z6],["monotone-x",J6],["monotone-y",t4],["natural",e4],["step",r4],["step-after",i4],["step-before",n4]]);function g0(e=Va,t){if(typeof e=="function")return e;let r=yst.get(`${e}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in r)return r.beta(t);if("tension"in r)return r.tension(t);if("alpha"in r)return r.alpha(t)}return r}function rI(e=Il,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Il:g0(e,t)}function Il(e){return Va(e)}function Ds(e={y:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(nI(r,t,G),null,null,n,e,sf(t))}function Ls(e={x:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=t;return RN(null,nI(n,t,G),r,null,e,af(t))}function sc(e={fill:"count"},t={}){[e,t]=DN(e,t);let{x:r,y:n}=gst(t);return RN(r,n,null,null,e,sf(af(t)))}function lq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=hS}=r,i={filter:null};return r[t]!=null&&(i[t]=n),r[`${t}1`]!=null&&(i[`${t}1`]=n),r[`${t}2`]!=null&&(i[`${t}2`]=n),e(i,r)}function Vh(e={}){return lq(Ds,"y",Do(e,"x"))}function Yh(e={}){return lq(Ls,"x",Do(e,"y"))}function RN(e,t,r,n,{data:i=dS,filter:o=Hg,sort:s,reverse:a,...c}={},l={}){e=aq(e),t=aq(t),c=xst(c,l),i=dq(i,G),s=s==null?void 0:uq("sort",s,l),o=o==null?void 0:fq("filter",o,l),r!=null&&Es(c,"x","x1","x2")&&(r=null),n!=null&&Es(c,"y","y1","y2")&&(n=null);let[u,f]=tn(e),[d,h]=tn(e),[p,m]=tn(t),[y,g]=tn(t),[x,b]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=tn(x),{x:w,y:T,z:A,fill:E,stroke:N,x1:I,x2:R,y1:C,y2:S,domain:M,cumulative:O,thresholds:L,interval:B,...k}=l,[P,U]=tn(A),[$]=qe(E),[X]=qe(N),[rt,ot]=tn($),[at,Y]=tn(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:rt||E},..."stroke"in l&&{stroke:at||N},...mr(k,(st,q,H)=>{let nt=tf(_t(st,x),H?.[b]),z=_t(st,A),Pt=_t(st,$),ht=_t(st,X),Zt=Kg(c,{z,fill:Pt,stroke:ht}),Jt=[],tt=[],ge=nt&&v([]),Kn=z&&U([]),Bo=Pt&&ot([]),wW=ht&&Y([]),cC=e&&f([]),vW=e&&h([]),lC=t&&m([]),SW=t&&g([]),IW=wst(e,t,st),TW=0;for(let Af of c)Af.initialize(st);s&&s.initialize(st),o&&o.initialize(st);for(let Af of q){let uC=[];for(let Ef of c)Ef.scope("facet",Af);s&&s.scope("facet",Af),o&&o.scope("facet",Af);for(let[Ef,AW]of As(Af,Zt))for(let[EW,vx]of As(AW,nt))for(let[Po,zs]of IW(vx))if(Zt&&(zs.z=Ef),!(o&&!o.reduce(Po,zs))){uC.push(TW++),tt.push(i.reduceIndex(Po,st,zs)),nt&&ge.push(EW),z&&Kn.push(Zt===z?Ef:z[(Po.length>0?Po:vx)[0]]),Pt&&Bo.push(Zt===Pt?Ef:Pt[(Po.length>0?Po:vx)[0]]),ht&&wW.push(Zt===ht?Ef:ht[(Po.length>0?Po:vx)[0]]),cC&&(cC.push(zs.x1),vW.push(zs.x2)),lC&&(lC.push(zs.y1),SW.push(zs.y2));for(let MW of c)MW.reduce(Po,zs);s&&s.reduce(Po,zs)}Jt.push(uC)}return k4(Jt,s,a),{data:tt,facets:Jt}}),...!Es(c,"x")&&(u?{x1:u,x2:d,x:_h(u,d)}:{x:w,x1:I,x2:R}),...!Es(c,"y")&&(p?{y1:p,y2:y,y:_h(p,y)}:{y:T,y1:C,y2:S}),..._&&{[b]:_},...Object.fromEntries(c.map(({name:st,output:q})=>[st,q]))}}function DN({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function nI(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Ki(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=LN(e.thresholds,e.interval),e}function gst(e){let{x:t,y:r}=e;return t=nI(t,e),r=nI(r,e),[t.value,r.value]=Ke(t.value,r.value),{x:t,y:r}}function aq(e){if(e==null)return;let{value:t,cumulative:r,domain:n=ce,thresholds:i}=e,o=s=>{let a=_t(s,t),c;if(Ve(a)||_st(i)){a=Xt(a,x4,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!cl(i)?i(a,u,f):i;typeof d=="number"&&(d=yg(u,f,d)),cl(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=pr(a);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!cl(i)?i(a,u,f):i;if(typeof d=="number")if(n===ce){let h=Aa(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let y=m-p+1;d=new Float64Array(y);for(let g=0;g<y;++g)d[g]=(p+g)/h}else d=[u];else d=[u]}else d=Qr(u,f,d);else cl(d)&&(n===ce&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(r<0?Sst:r>0?vst:FN)(l,c,a),l};return o.label=en(t),o}function LN(e,t,r=cq){if(e===void 0)return t===void 0?r:Is(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return X_;case"scott":return fy;case"sturges":return Uc;case"auto":return cq}return Ku(e)}return e}function xst(e,t){return F4(e,t,uq)}function uq(e,t,r){return uS(e,t,r,fq)}function fq(e,t,r){return fS(e,t,r,dq)}function dq(e,t){return Ih(e,t,bst)}function bst(e){switch(`${e}`.toLowerCase()){case"x":return Ist;case"x1":return Ast;case"x2":return Est;case"y":return Tst;case"y1":return Mst;case"y2":return Nst;case"z":return B4}throw new Error(`invalid bin reduce: ${e}`)}function cq(e,t,r){return Math.min(200,fy(e,t,r))}function _st(e){return d$(e)||kn(e)&&Ve(e)}function wst(e,t,r){let n=e?.(r),i=t?.(r);return n&&i?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:r,x1:c,y1:d,x2:l,y2:h}]}}:n?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries())yield[s[a],{data:r,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:r,y1:c,y2:l}]}}function FN(e,t,r){return t=pr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Ia(t,r[o])-1]?.push(o);return i}}function vst(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function Sst(e,t,r){let n=FN(e,t,r);return i=>{let o=n(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function hq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var Ist={reduceIndex(e,t,{x1:r,x2:n}){return hq(r,n)}},Tst={reduceIndex(e,t,{y1:r,y2:n}){return hq(r,n)}},Ast={reduceIndex(e,t,{x1:r}){return r}},Est={reduceIndex(e,t,{x2:r}){return r}},Mst={reduceIndex(e,t,{y1:r}){return r}},Nst={reduceIndex(e,t,{y2:r}){return r}};var Ost={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},hf=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:pn(r),optional:!0}},r,Ost),this.z=a,this.curve=g0(c,l)}filter(t){return t}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r,0,0).call(u=>u.selectAll().data(MS(t,[s,a,c,l],this,n)).enter().append("path").call(Et,this).call(of,this,n).attr("d",ch().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function x0(e,t){return t===void 0?ac(e,{x:Ju,y:ol}):new hf(e,t)}function Tl(e,t){let{y:r=Ee,...n}=Yh(t);return new hf(e,vl(_l({...n,y1:r,y2:void 0})))}function ac(e,t){let{x:r=Ee,...n}=Vh(t);return new hf(e,Sl(wl({...n,x1:r,x2:void 0})))}var Rst={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},b0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,curve:a,tension:c}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Rst),this.curve=rI(a,c),Lo(this,r)}project(t,r,n){this.curve!==Il&&super.project(t,r,n)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n,{curve:u}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Et,this).attr("d",u===Il&&o.projection?Dst(o.projection,s,a,c,l):d=>{let h=Nn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Wt,this,n).call(oc,this,n,o)).node()}};function Dst(e,t,r,n,i){let o=Dr(e);return t=pr(t),r=pr(r),n=pr(n),i=pr(i),s=>o({type:"LineString",coordinates:[[t[s],r[s]],[n[s],i[s]]]})}function iI(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new b0(e,{...a,x1:r,x2:n,y1:o,y2:s})}function _0(e,t,r){if(e===void 0){if(t===void 0){if(r!==void 0)return[r]}else if(r===void 0)return[t]}else{if(t===void 0)return r===void 0?[e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}var Lst={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},w0=class extends vt{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Lst),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=Fst(h)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=n,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:y}=this,g=u?_=>u[_]:Ye(f===void 0?1:f),x=h*Lh/2,b=p/1.5;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Et,this).attr("d",v=>{let w=s[v],T=a[v],A=c[v],E=l[v],N=Math.hypot(A-w,E-T);if(N<=m+y)return null;let I=Math.atan2(E-T,A-w),R=Math.min(b*g(v),N/3),C=this.sweep(w,T,A,E)*d*Lh,S=Math.hypot(N/Math.tan(C),N)/2;if(m||y)if(S<1e5){let rt=Math.sign(C),[ot,at]=Cst([w,T],[A,E],S,rt);if(m&&([w,T]=pq([ot,at,S],[w,T,m],-rt*Math.sign(m))),y){let[Y,st]=pq([ot,at,S],[A,E,y],rt*Math.sign(y));I+=Math.atan2(st-at,Y-ot)-Math.atan2(E-at,A-ot),A=Y,E=st}}else{let rt=A-w,ot=E-T,at=Math.hypot(rt,ot);m&&(w+=rt/at*m,T+=ot/at*m),y&&(A-=rt/at*y,E-=ot/at*y)}let M=I+C,O=M+x,L=M-x,B=A-R*Math.cos(O),k=E-R*Math.sin(O),P=A-R*Math.cos(L),U=E-R*Math.sin(L),$=S<1e5?`A${S},${S} 0,0,${C>0?1:0} `:"L",X=R?`M${B},${k}L${A},${E}L${P},${U}`:"";return`M${w},${T}${$}${A},${E}${X}`}).call(Wt,this,n)).node()}};function Fst(e=1){if(typeof e=="number")return Ye(Math.sign(e));if(typeof e=="function")return(t,r,n,i)=>Math.sign(e(t,r,n,i));switch(Sr(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>Ft(t,n);case"-x":return(t,r,n)=>vn(t,n);case"+y":return(t,r,n,i)=>Ft(r,i);case"-y":return(t,r,n,i)=>vn(r,i)}}function Cst([e,t],[r,n],i,o){let s=r-e,a=n-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+r)/2-a*l,(t+n)/2+s*l]}function pq([e,t,r],[n,i,o],s){let a=n-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+r*r)/(2*l),f=s*Math.sqrt(r*r-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function mq(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=_0(t,r,n),[o,s]=_0(i,o,s),new w0(e,{...a,x1:r,x2:n,y1:o,y2:s})}var kst={ariaLabel:"bar"},Wh=class extends vt{constructor(t,r,n={},i=kst){super(t,r,n,i),u0(this,n),f0(this,n)}render(t,r,n,i,o){let{rx:s,ry:a,rx1y1:c,rx1y2:l,rx2y1:u,rx2y2:f}=this,d=this._x(r,n,i),h=this._y(r,n,i),p=this._width(r,n,i),m=this._height(r,n,i);return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(y=>y.selectAll().data(t).enter().call(c||l||u||f?g=>g.append("path").call(Et,this).call(d0,d,h,yq(d,p),yq(h,m),this).call(Wt,this,n):g=>g.append("rect").call(Et,this).attr("x",d).attr("width",p).attr("y",h).attr("height",m).call(dt,"rx",s).call(dt,"ry",a).call(Wt,this,n))).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r?o=>r[o]+i:n+i}_y(t,{y:r},{marginTop:n}){let{insetTop:i}=this;return r?o=>r[o]+i:n+i}_width({x:t},{x:r},{marginRight:n,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}_height({y:t},{y:r},{marginTop:n,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}};function yq(e,t){return typeof e=="function"&&typeof t=="function"?r=>e(r)+t(r):typeof e=="function"?r=>e(r)+t:typeof t=="function"?r=>e+t(r):e+t}var pf=class extends Wh{constructor(t,r={},n){let{x1:i,x2:o,y:s}=r;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},r,n)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},0,0)}_x({x:t},{x1:r,x2:n},{marginLeft:i}){let{insetLeft:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_width({x:t},{x1:r,x2:n},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}},mf=class extends Wh{constructor(t,r={},n){let{x:i,y1:o,y2:s}=r;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},r,n)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:i}){let{insetTop:o}=this;return wi(t)?i+o:s=>Math.min(r[s],n[s])+o}_height({y:t},{y1:r,y2:n},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return wi(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}};function Fs(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new pf(e,vl(Fh(_l(t))))}function Cs(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new mf(e,Sl(Ch(wl(t))))}var Bst={ariaLabel:"cell"},yf=class extends Wh{constructor(t,{x:r,y:n,...i}={}){super(t,{x:{value:r,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},i,Bst)}_transform(t,r){t.call(Rt,r,{},0,0)}};function Al(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new yf(e,{...n,x:t,y:r})}function gq(e,{x:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,x:t,fill:r,stroke:n})}function xq(e,{y:t=Ee,fill:r,stroke:n,...i}={}){return r===void 0&&qe(n)[0]===void 0&&(r=G),new yf(e,{...i,y:t,fill:r,stroke:n})}var Pst={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function v0(e){return e.sort===void 0&&e.reverse===void 0?cS({channel:"-r"},e):e}var gf=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=Ya,frameAnchor:c}=r,[l,u]=ye(s,0),[f,d]=A$(a),[h,p]=ye(o,f==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:Fn,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},v0(r),Pst),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Ts(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:x}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,r:u,rotate:f,symbol:d}=n,{r:h,rotate:p,symbol:m}=this,[y,g]=Ur(this,i),x=m===Ya,b=u?void 0:h*h*Math.PI;return tl(h)&&(t=[]),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(x?"circle":"path").call(Et,this).call(x?v=>{v.attr("cx",c?w=>c[w]:y).attr("cy",l?w=>l[w]:g).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",Fo`translate(${c?w=>c[w]:y},${l?w=>l[w]:g})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Nn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Nn();return m.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Nn();return d[w].draw(T,b),T}:(()=>{let w=Nn();return m.draw(w,b),w})())}).call(Wt,this,n)).node()}};function to(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new gf(e,{...n,x:t,y:r})}function bq(e,{x:t=G,...r}={}){return new gf(e,DS({...r,x:t}))}function _q(e,{y:t=G,...r}={}){return new gf(e,RS({...r,y:t}))}function wq(e,t){return to(e,{...t,symbol:"circle"})}function vq(e,t){return to(e,{...t,symbol:"hexagon"})}var Ust={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xf=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,Ust),this.z=o,this.curve=rI(s,a),Lo(this,r)}filter(t){return t}project(t,r,n){this.curve!==Il&&super.project(t,r,n)}render(t,r,n,i,o){let{x:s,y:a}=n,{curve:c}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(l=>l.selectAll().data(MS(t,[s,a],this,n)).enter().append("path").call(Et,this).call(of,this,n).call(Kz,this,n,o).attr("d",c===Il&&o.projection?$st(o.projection,s,a):Tg().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function $st(e,t,r){let n=Dr(e);return t=pr(t),r=pr(r),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],r[a]]);return n({type:"MultiLineString",coordinates:s})}}function bf(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new xf(e,{...n,x:t,y:r})}function El(e,{x:t=G,y:r=Ee,...n}={}){return new xf(e,Yh({...n,x:t,y:r}))}function Ml(e,{x:t=Ee,y:r=G,...n}={}){return new xf(e,Vh({...n,x:t,y:r}))}function kN(e,t){t=zst(t);let{x:r,y:n,color:i,size:o}=t,s=oI(e,r),a=oI(e,n),c=oI(e,i),l=oI(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:y,reduce:g,zero:x,...b},color:{value:_,color:v,reduce:w},size:{value:T,reduce:A},mark:E}=t;if(h===void 0&&(h=g==null&&d==null&&T==null&&y!=null?"count":null),g===void 0&&(g=h==null&&y==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&w==null&&h==null&&g==null&&(d==null||Ue(s))&&(y==null||Ue(a))&&(A="count"),p===void 0&&(p=sI(h)?!0:void 0),x===void 0&&(x=sI(g)?!0:void 0),d==null&&y==null)throw new Error("must specify x or y");if(h!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&d==null)throw new Error("reducing y requires x");E===void 0&&(E=T!=null||A!=null?"dot":sI(h)||sI(g)||w!=null?"bar":d!=null&&y!=null?Ue(s)||Ue(a)||h==null&&g==null&&!S0(s)&&!S0(a)?"dot":"line":d!=null||y!=null?"rule":null);let N,I,R;switch(E){case"dot":R=to,I="stroke";break;case"line":R=s&&a||h!=null||g!=null?x||g!=null||s&&S0(s)?Ml:p||h!=null||a&&S0(a)?El:bf:s?El:Ml,I="stroke",Iq(c)&&(N=null);break;case"area":R=!(x||g!=null)&&(p||h!=null||a&&S0(a))?Tl:ac,I="fill",Iq(c)&&(N=null);break;case"rule":R=s?vi:Si,I="stroke";break;case"bar":R=h!=null?Ue(a)?Sq(h)&&s&&Ue(s)?Al:Fs:$h:g!=null?Ue(s)?Sq(g)&&a&&Ue(a)?Al:Cs:zh:w!=null||A!=null?s&&Ue(s)&&a&&Ue(a)?Al:s&&Ue(s)?Cs:a&&Ue(a)?Fs:h0:s&&Za(s)&&!(a&&Za(a))?Fs:a&&Za(a)&&!(s&&Za(s))?Cs:Al,I="fill";break;default:throw new Error(`invalid mark: ${E}`)}let C={fx:u,fy:f,x:s??void 0,y:a??void 0,[I]:c??v,z:N,r:l??void 0,tip:!0},S,M={[I]:w??void 0,r:A??void 0};if(h!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(M.y=g,S=Ue(s)?ul:Ds):h!=null?(M.x=h,S=Ue(a)?fl:Ls):(w!=null||A!=null)&&(s&&a?S=Ue(s)&&Ue(a)?Zg:Ue(s)?Ls:Ue(a)?Ds:sc:s?S=Ue(s)?ul:Ds:a&&(S=Ue(a)?fl:Ls)),(S===sc||S===Ds)&&(C.x={value:s,...m}),(S===sc||S===Ls)&&(C.y={value:a,...b}),p===void 0&&(p=s&&!(S===sc||S===Ds)&&(R===Fs||R===Tl||R===$h||R===Si)),x===void 0&&(x=a&&!(S===sc||S===Ls)&&(R===Cs||R===ac||R===zh||R===vi)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!x,...b},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:E,markImpl:Tq[R],markOptions:C,transformImpl:Tq[S],transformOptions:M,colorMode:I}}function Aq(e,t){let r=kN(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=CN[r.markImpl],f=CN[r.transformImpl],d=n!=null||i!=null?jh({strokeOpacity:.1}):null,h=[o?vi([0]):null,s?Si([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?yr(d,h,p):yr(d,p,h)}function S0(e){let t,r;for(let n of e){if(n==null)continue;if(t===void 0){t=n;continue}let i=Math.sign(Ft(t,n));if(i){if(r!==void 0&&i!==r)return!1;t=n,r=i}}return!0}function zst({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return bi(e)||(e=Gh(e)),bi(t)||(t=Gh(t)),bi(r)||(r=ll(r)?{color:r}:Gh(r)),bi(n)||(n=Gh(n)),bi(i)&&({value:i}=Gh(i)),bi(o)&&({value:o}=Gh(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function oI(e,t){let r=_t(e,t.value);return r&&(r.label=en(t.value)),r}function Gh(e){return jst(e)?{reduce:e}:{value:e}}function sI(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Sq(e){return/^(?:first|last|mode)$/i.test(e)}function jst(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&kr(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function Iq(e){return e?new In(e).size>e.length>>1:!1}var CN={dot:to,line:bf,lineX:El,lineY:Ml,areaX:Tl,areaY:ac,ruleX:vi,ruleY:Si,barX:Fs,barY:Cs,rect:h0,rectX:$h,rectY:zh,cell:Al,bin:sc,binX:Ds,binY:Ls,group:Zg,groupX:ul,groupY:fl},Tq=Object.fromEntries(Object.entries(CN).map(([e,t])=>[t,e]));function Xh(e,t={}){let{x:r,x1:n,x2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,x:r=G});let o={};return r!=null&&(o.x=e),n!=null&&(o.x1=e),i!=null&&(o.x2=e),Zn(o,t)}function Hh(e,t={}){let{y:r,y1:n,y2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,y:r=G});let o={};return r!=null&&(o.y=e),n!=null&&(o.y1=e),i!=null&&(o.y2=e),Zn(o,t)}function Zn(e={},t={}){let r=pn(t),n=Object.entries(e).map(([i,o])=>{let s=rS(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=Br(s);return{key:i,input:s,output:a,setOutput:c,map:qst(o)}});return{...mr(t,(i,o)=>{let s=_t(i,r),a=n.map(({input:l})=>_t(i,l)),c=n.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Hr(l,f=>s[f]).values():[l])n.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(n.map(({key:i,output:o})=>[i,o]))}}function qst(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&kr(e))return Vst(e);if(typeof e=="function")return BN(bh(e));switch(`${e}`.toLowerCase()){case"cumsum":return Wst;case"rank":return BN((t,r)=>dy(t,n=>r[n]));case"quantile":return BN((t,r)=>Yst(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Vst(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Yst(e,t){let r=rs(e,t)-1;return dy(e,t).map(n=>n/r)}function BN(e){return{mapIndex(t,r,n){let i=e(t,r);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)n[t[o]]=i[o]}}}var Wst={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function Eq(e={},t){return arguments.length===1&&(t=e),Xh(Qh(e),t)}function Mq(e={},t){return arguments.length===1&&(t=e),Hh(Qh(e),t)}function Qh(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:r,shift:n,anchor:i,strict:o}=e;if(i===void 0&&n!==void 0&&(i=Xst(n),mn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return Hst(r)(t,Gst(i,t),o)}function Gst(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function Xst(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Hst(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return aI(xh(e));switch(e.toLowerCase()){case"deviation":return aI(zi);case"max":return cI((t,r)=>Kt(t,n=>r[n]));case"mean":return Qst;case"median":return aI(Eo);case"min":return cI((t,r)=>Ht(t,n=>r[n]));case"mode":return cI((t,r)=>Ed(t,n=>r[n]));case"sum":return Nq;case"variance":return aI(Pc);case"difference":return Jst;case"ratio":return tat;case"first":return eat;case"last":return rat}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return cI(bh(e))}function aI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+r]]=c===0?e(Qa(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-r;c<0;++c)s[i[c+r]]=e(Qa(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(Qa(i,c,c+t),a)}}}function cI(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Pe(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Pe(o[i[c+t-1]]),a===t&&(s[i[c+r]]=e(Qa(i,c,c+t),o)),a-=Pe(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-r;a<0;++a)s[i[a+r]]=e(Qa(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(Qa(i,a,a+t),o)}}}function Nq(e,t,r){return r?{mapIndex(n,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[n[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=n.length-e+1;c<l;++c){let u=i[n[c]],f=i[n[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[n[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(n,i,o){let s=0,a=n.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[n[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[n[c+e-1]]||0,o[n[c+t]]=s,s-=+i[n[c]]||0}}}function Qst(e,t,r){if(r){let n=Nq(e,t,r);return{mapIndex(i,o,s){n.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(n,i,o){let s=0,a=0,c=n.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[n[l+e-1]],d=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[n[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function Zst(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(Pe(o))return o}}function Kst(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(Pe(o))return o}}function Oq(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(o!==null&&!isNaN(o=+o))return o}}function Rq(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function Jst(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Rq(i,n,s,e)-Oq(i,n,s,e)}}}function tat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Rq(i,n,s,e)/Oq(i,n,s,e)}}}function eat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Zst(i,n,s,e)}}}function rat(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s+e-1]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=Kst(i,n,s,e)}}}var cc={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function Dq(e,{x:t=G,y:r,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:Tl(e,Zn({x1:Nl({k:-n,...f}),x2:Nl({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),fe(c)?null:El(e,Zn({x:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Lq(e,{x:t,y:r=G,k:n=cc.k,color:i=cc.color,opacity:o=cc.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return yr(fe(s)?null:ac(e,Zn({y1:Nl({k:-n,...f}),y2:Nl({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),fe(c)?null:Ml(e,Zn({y:Nl(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Nl({n:e=cc.n,k:t=0,strict:r=cc.strict,anchor:n=cc.anchor}={}){return Qh({k:e,reduce:i=>Ea(i)+t*(zi(i)||0),strict:r,anchor:n})}var nat={ariaLabel:"tick",fill:null,stroke:"currentColor"},lI=class extends vt{constructor(t,r,n){super(t,r,n,nat),Lo(this,n)}render(t,r,n,i,o){return lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(s=>s.selectAll().data(t).enter().append("line").call(Et,this).attr("x1",this._x1(r,n,i)).attr("x2",this._x2(r,n,i)).attr("y1",this._y1(r,n,i)).attr("y2",this._y2(r,n,i)).call(Wt,this,n).call(oc,this,n,o)).node()}},I0=class extends lI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},r),this.insetTop=ie(s),this.insetBottom=ie(a)}_transform(t,r,{x:n}){t.call(Rt,r,{x:n},We,0)}_x1(t,{x:r}){return n=>r[n]}_x2(t,{x:r}){return n=>r[n]}_y1({y:t},{y:r},{marginTop:n}){let{insetTop:i}=this;return r&&t?o=>r[o]+i:n+i}_y2({y:t},{y:r},{height:n,marginBottom:i}){let{insetBottom:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}},T0=class extends lI{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=r;super(t,{y:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r),this.insetRight=ie(s),this.insetLeft=ie(a)}_transform(t,r,{y:n}){t.call(Rt,r,{y:n},0,We)}_x1({x:t},{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r&&t?o=>r[o]+i:n+i}_x2({x:t},{x:r},{width:n,marginRight:i}){let{insetRight:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}_y1(t,{y:r}){return n=>r[n]}_y2(t,{y:r}){return n=>r[n]}};function uI(e,{x:t=G,...r}={}){return new I0(e,{...r,x:t})}function fI(e,{y:t=G,...r}={}){return new T0(e,{...r,y:t})}function Fq(e,{x:t=G,y:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?fl:Qg;return yr(Si(e,f({x1:PN,x2:UN},{x:t,y:r,stroke:s,strokeOpacity:a,...u})),Fs(e,f({x1:"p25",x2:"p75"},{x:t,y:r,fill:i,fillOpacity:o,...u})),uI(e,f({x:"p50"},{x:t,y:r,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({x:kq},{x:t,y:r,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function Cq(e,{y:t=G,x:r=null,r:n,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:c=2,sort:l,...u}={}){let f=r!=null?ul:Qg;return yr(vi(e,f({y1:PN,y2:UN},{x:r,y:t,stroke:s,strokeOpacity:a,...u})),Cs(e,f({y1:"p25",y2:"p75"},{x:r,y:t,fill:i,fillOpacity:o,...u})),fI(e,f({y:"p50"},{x:r,y:t,stroke:s,strokeOpacity:a,strokeWidth:c,sort:l,...u})),to(e,Zn({y:kq},{x:r,y:t,z:r,r:n,stroke:s,strokeOpacity:a,...u})))}function kq(e){let t=PN(e),r=UN(e);return e.map(n=>n<t||n>r?n:NaN)}function PN(e){let t=Bq(e)*2.5-Pq(e)*1.5;return Ht(e,r=>r>=t?r:NaN)}function UN(e){let t=Pq(e)*2.5-Bq(e)*1.5;return Kt(e,r=>r<=t?r:NaN)}function Bq(e){return Tn(e,.25)}function Pq(e){return Tn(e,.75)}var iat={ariaLabel:"raster",stroke:null,pixelSize:1};function Zh(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function Uq(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var E0=class extends vt{constructor(t,r,n={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=n;if(o!=null&&(o=Uq(o,"width")),s!=null&&(s=Uq(s,"height")),l!=null&&(l=Zh(l,"x1")),u!=null&&(u=Zh(u,"y1")),f!=null&&(f=Zh(f,"x2")),d!=null&&(d=Zh(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=dat(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=hat(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...r},n,i),this.width=o,this.height=s,this.pixelSize=Zh(h,"pixelSize"),this.blur=Zh(p,"blur"),this.interpolate=a==null||c==null?null:oat(m)}},M0=class extends E0{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;ye(o)[0]!==void 0&&(r=dI("fillOpacity",r)),qe(i)[0]!==void 0&&(r=dI("fill",r))}super(t,void 0,r,iat),this.imageRendering=Oe(n,"auto")}scale(t,{color:r,...n},i){return super.scale(t,n,i)}render(t,r,n,i,o){let s=r[n.channels.fill?.scale]??(M=>M),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=zq(n,i,o),p=d-u,m=h-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:x=Math.round(Math.abs(m)/y)}=this,b=g*x,{fill:_,fillOpacity:v}=n,w=0;if(this.interpolate){let M=g/p,O=x/m,L=Xt(a,k=>(k-u)*M,Float64Array),B=Xt(c,k=>(k-f)*O,Float64Array);_&&(_=this.interpolate(t,g,x,L,B,_)),v&&(v=this.interpolate(t,g,x,L,B,v))}else this.data==null&&t&&(w=t.fi*b);let T=l.createElement("canvas");T.width=g,T.height=x;let A=T.getContext("2d"),E=A.createImageData(g,x),N=E.data,{r:I,g:R,b:C}=wr(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<b;++M){let O=M<<2;if(_){let L=s(_[M+w]);if(L==null){N[O+3]=0;continue}({r:I,g:R,b:C}=wr(L))}v&&(S=v[M+w]*255),N[O+0]=I,N[O+1]=R,N[O+2]=C,N[O+3]=S}return this.blur>0&&aM(E,this.blur),A.putImageData(E,0,0),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(M=>M.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(dt,"image-rendering",this.imageRendering).call(Et,this).attr("xlink:href",T.toDataURL())).node()}};function $N(e,t,r){arguments.length<3&&(r=t,t=null);let{x:n,y:i,[e]:o,...s}=r;return n===void 0&&i===void 0&&p$(t)&&(n=Ju,i=ol,o===void 0&&(o=u$)),[t,{...s,x:n,y:i,[e]:o}]}function $q(){let[e,t]=$N("fill",...arguments);return new M0(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function zq({x1:e,y1:t,x2:r,y2:n},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,r&&o==null?r[0]:s-l,n&&o==null?n[0]:a-u]}function zN({x1:e,y1:t,x2:r,y2:n},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),r&&(a.x2=r),n&&(a.y2=n),zq(Ah(a,i),o,s)}function dI(e,t={}){let{[e]:r}=t;if(typeof r!="function")throw new Error(`invalid ${e}: not a function`);return Ne({...t,[e]:void 0},function(n,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=zN(o,s,a,c),m=h-f,y=p-d,{pixelSize:g}=this,{width:x=Math.round(Math.abs(m)/g),height:b=Math.round(Math.abs(y)/g)}=t,_=new Array(x*b*(i?i.length:1)),v=m/x,w=y/b,T=0;for(let A of i??[void 0])for(let E=.5;E<b;++E)for(let N=.5;N<x;++N,++T)_[T]=r(l.invert(f+N*v),u.invert(d+E*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function oat(e){if(typeof e=="function")return e;if(e==null)return hI;switch(`${e}`.toLowerCase()){case"none":return hI;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}function hI(e,t,r,n,i,o){let s=new Array(t*r);for(let a of e)n[a]<0||n[a]>=t||i[a]<0||i[a]>=r||(s[Math.floor(i[a])*t+Math.floor(n[a])]=o[a]);return s}function N0({random:e=$u(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=Vi.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=fat(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],y=c[h+2],g=a[2*p],x=a[2*m],b=a[2*y],_=a[2*p+1],v=a[2*m+1],w=a[2*y+1],T=Math.min(g,x,b),A=Math.max(g,x,b),E=Math.min(_,v,w),N=Math.max(_,v,w),I=(v-w)*(g-b)+(_-w)*(b-x);if(!I)continue;let R=s[t[p]],C=s[t[m]],S=s[t[y]];for(let M=Math.floor(T);M<A;++M)for(let O=Math.floor(E);O<N;++O){if(M<0||M>=r||O<0||O>=n)continue;let L=M+.5,B=O+.5,k=Math.sign(I),P=(v-w)*(L-b)+(B-w)*(b-x);if(P*k<0)continue;let U=(w-_)*(L-b)+(B-w)*(g-b);if(U*k<0)continue;let $=I-(P+U);if($*k<0)continue;let X=M+r*O;u[X]=d(R,P/I,C,U/I,S,$/I,M,O),f[X]=1}}return sat(u,f,i,o,s,r,n,l,t,d),u}}function sat(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>cat(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let y=m+o*h;if(!t[y]){let g=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](g,p)){let _=aat(r.at(b-1),n.at(b-1),r[b],n[b],g,p);e[y]=l(i.at(b-1),_,i[b],1-_,i[b],0,m,h),d=b;break}}}}}}function aat(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function A0(e,t,r,n){return e*n-r*t}function cat(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,m=o-a,y=c-u,g=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),_=Math.hypot(y,g);return(v,w)=>{let T=v-s,A=w-a,E=v-c,N=w-l;return A0(T,A,E,N)>-1e-6&&A0(T,A,d,h)*b-A0(T,A,p,m)*x>-1e-6&&A0(E,N,y,g)*x-A0(E,N,d,h)*_<=0}}function O0(e,t,r,n,i,o){let s=new o.constructor(t*r),a=Vi.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function R0({random:e=$u(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Vi.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let y=.5;y<i;++y,++m){let g=y,x=p;h=d=u.find(g,x,d),y===.5&&(f=d);let b,_=0;for(;(b=Math.hypot(s[n[h]]-g,a[n[h]]-x))>t&&_<r;){let v=e(y,p,_)*2*Math.PI;g+=Math.cos(v)*b,x+=Math.sin(v)*b,h=u.find(g,x,h),++_}l[m]=c[n[h]]}}return l}}function lat(e,t,r,n,i,o){return t*e+n*r+o*i}function uat(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function fat(e,t){return Za(e)||Ve(e)?lat:uat(t)}function dat(e,t,r){return{transform(n){let i=n.length,o=new Float64Array(i),s=(t-e)/r,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%r*s+a;return o}}}function hat(e,t,r,n){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/n,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/r)%n*a+c;return s}}}var jq={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},D0=class extends E0{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=ES({},i,jq);if(n===void 0){for(let a in o)if(o[a].value!=null){if(n!==void 0)throw new Error("ambiguous contour value");n=i[a],i[a]="value"}}if(n!=null){let a={transform:c=>c.map(l=>l.value),label:en(n)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(n==null)throw new Error("missing contour value");i=dI("value",{value:n,...i}),n=null}else{let{interpolate:a}=i;n===void 0&&(n=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:n,optional:!0}},pat(i),jq);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!r}filter(t,{x:r,y:n,value:i,...o},s){return super.filter(t,o,s)}render(t,r,n,i,o){let{geometry:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(c=>{c.selectAll().data(t).enter().append("path").call(Et,this).attr("d",l=>a(s[l])).call(Wt,this,n)}).node()}};function pat({thresholds:e,interval:t,...r}){return e=LN(e,t,Uc),Ne(r,function(n,i,o,s,a,c){let[l,u,f,d]=zN(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:y=Math.round(Math.abs(h)/m),height:g=Math.round(Math.abs(p)/m)}=this,x=y/h,b=g/p,_=o.value.value,v=[];if(this.interpolate){let{x:N,y:I}=Ns(o,s,c),R=Xt(N,O=>(O-l)*x,Float64Array),C=Xt(I,O=>(O-u)*b,Float64Array),S=[o.x,o.y,o.value],M=[R,C,_];for(let O of i){let L=this.filter(O,S,M);v.push(this.interpolate(L,y,g,R,C,_))}}else if(i){let N=y*g,I=i.length;for(let R=0;R<I;++R)v.push(_.slice(R*N,R*N+N))}else v.push(_);if(this.blur>0)for(let N of v)ay({data:N,width:y,height:g},this.blur);let w=mat(e,_,...yat(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Wc().size([y,g]).smooth(this.smooth),A=[],E=[];for(let N of v)E.push(er(A.length,A.push(...Xt(w,I=>T(N,I)))));for(let{coordinates:N}of A)for(let I of N)for(let R of I)for(let C of R)C[0]=C[0]/x+l,C[1]=C[1]/b+u;return{data:A,facets:E,channels:pS(this.contourChannels,A)}})}function mat(e,t,r,n){if(typeof e?.range=="function")return e.range(e.floor(r),n);if(typeof e=="function"&&(e=e(t,r,n)),typeof e!="number")return xi(e);let i=Qr(...Td(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function Vq(){return new D0(...$N("value",...arguments))}function yat(e){return[Ht(e,t=>Ht(t,qq)),Kt(e,t=>Kt(t,qq))]}function qq(e){return isFinite(e)?e:NaN}function Gq(e,t){return jN(gl,e,t)}function Xq(e,t={}){return jN(xl,e,t)}function Hq(e,t={}){return jN(ic,e,t)}function jN(e,t,r={}){let{x:n,y:i,maxRadius:o}=r,s=e({px:n,py:i,maxRadius:o}),a=[];n!=null&&a.push(vi(t,Yq("x",{...s,inset:-6},r))),i!=null&&a.push(Si(t,Yq("y",{...s,inset:-6},r))),n!=null&&a.push(Rs(t,Wq("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(Rs(t,Wq("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return yr(...a)}function Qq(e,{channels:t,...r},{facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...r,facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:gat(e,u)}}function gat(e,t){return t==null?t:function(r,n,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,r,n,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function Yq(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...Qq(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function Wq(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...Qq(e,t,xat(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function xat(e,t){return Ne(t,(r,n,i)=>({channels:{text:{value:Jg(i,e)?.value}}}))}var bat={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},_at={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},wat={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},vat={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Sat={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},qN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,bat),this.curve=g0(s,a),Lo(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,{curve:f}=this,[d,h]=Ur(this,i),p=c?x=>c[x]:Ye(d),m=l?x=>l[x]:Ye(h),y=this;function g(x){let b=-1,_=[],v={};for(let S in n)v[S]=[];let w=[],T=[],A=[],E=[];function N(S,M){S=x[S],M=x[M],_.push(++b),w[b]=p(S),A[b]=m(S),T[b]=p(M),E[b]=m(M);for(let O in n)v[O].push(n[O][M])}let{halfedges:I,hull:R,triangles:C}=Vi.from(x,p,m);for(let S=0;S<I.length;++S){let M=I[S];M>S&&N(C[S],C[M])}for(let S=0;S<R.length;++S)N(R[S],R[(S+1)%R.length]);Qt(this).selectAll().data(_).enter().append("path").call(Et,y).attr("d",S=>{let M=Nn(),O=f(M);return O.lineStart(),O.point(w[S],A[S]),O.point(T[S],E[S]),O.lineEnd(),M}).call(Wt,y,v).call(oc,y,v,o)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(Hr(t,b=>u[b]).values()).enter().append("g").each(g):x=>x.datum(t).each(g)).node()}},L0=class extends vt{constructor(t,r={},n,i=({z:o})=>o){let{x:o,y:s}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(r),optional:!0}},r,n)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=Ur(this,i),h=c?g=>c[g]:Ye(f),p=l?g=>l[g]:Ye(d),m=this;function y(g){let x=Vi.from(g,h,p);Qt(this).append("path").datum(g[0]).call(Et,m).attr("d",m._render(x,i)).call(Wt,m,n)}return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(Hr(t,x=>u[x]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},VN=class extends L0{constructor(t,r={}){super(t,r,_at),this.fill="none"}_render(t){return t.render()}},YN=class extends L0{constructor(t,r={}){super(t,r,wat,pn)}_render(t){return t.renderHull()}},WN=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},Ne(r,function(s,a,c,l,u,f){let{x:d,y:h,z:p}=c;({x:d,y:h}=Ns(c,l,f)),p=p?.value;let m=new Array((d??h).length).fill(null),[y,g]=Ur(this,u),x=d?_=>d[_]:Ye(y),b=h?_=>h[_]:Ye(g);for(let _ of a){d&&(_=_.filter(v=>Pe(x(v)))),h&&(_=_.filter(v=>Pe(b(v))));for(let[,v]of As(_,p)){let w=Vi.from(v,x,b),T=Zq(w,u);for(let A=0,E=v.length;A<E;++A)m[v[A]]=T.renderCell(A)}}return{data:s,facets:a,channels:{cells:{value:m}}}}),vat)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,cells:u}=n;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(f=>{f.selectAll().data(t).enter().append("path").call(Et,this).attr("d",d=>u[d]).call(Wt,this,n)}).node()}},GN=class extends L0{constructor(t,r){super(t,r,Sat),this.fill="none"}_render(t,r){return Zq(t,r).render()}};function Zq(e,t){let{width:r,height:n,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,r-o,n-s])}function F0(e,t,{x:r,y:n,...i}={}){return[r,n]=Ke(r,n),new e(t,{...i,x:r,y:n})}function Kq(e,t){return F0(qN,e,t)}function Jq(e,t){return F0(VN,e,t)}function tV(e,t){return F0(YN,e,t)}function eV(e,{x:t,y:r,initializer:n,...i}={}){return F0(WN,e,{...mr({...i,x:t,y:r},GS),initializer:n})}function rV(e,t){return F0(GN,e,t)}var Iat={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},C0=class extends vt{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=nV(s)&&(s="currentColor",!0),u=nV(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:pn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Aat({...c,fill:s,stroke:a},l,u),Iat),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,r,n,i,o){let{contours:s}=n,a=Dr();return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Et,this).call(Wt,this,n).attr("d",l=>a(s[l]))).node()}};function iV(e,{x:t,y:r,...n}={}){return[t,r]=Ke(t,r),new C0(e,{...n,x:t,y:r})}var Tat=new Set(["x","y","z","weight"]);function Aat(e,t,r){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?pr(o):+o,Ne(e,function(s,a,c,l,u,f){let d=c.weight?pr(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,y]=Ur(this,u),{width:g,height:x}=u,{x:b,y:_}=Ns(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([C])=>!Tat.has(C)).map(([C,S])=>[C,{...S,value:[]}])),w=t&&[],T=r&&[],A=HM().x(b?C=>b[C]:m).y(_?C=>_[C]:y).weight(d?C=>d[C]:1).size([g,x]).bandwidth(i),E=[];for(let C of a){let S=[];E.push(S);for(let M of h?i0(C,h,p):[C]){let O=A.contours(M);S.push([M,O])}}let N=o;if(!(N instanceof Yg)){let C=0;for(let S of E)for(let[,M]of S){let O=M.max;O>C&&(C=O)}N=Float64Array.from({length:o-1},(S,M)=>C*100*(M+1)/o)}let I=[],R=[];for(let C of E){let S=[];I.push(S);for(let[M,O]of C)for(let L of N){S.push(R.length),R.push(O(L/100)),w&&w.push(L),T&&T.push(L);for(let B in v)v[B].value.push(c[B].value[M[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:I,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:R}}}})}function nV(e){return/^density$/i.test(e)}function aV(e,t){return lV("x",e,t)}function cV(e,t){return lV("y",e,t)}function lV(e,t,{x1:r,x2:n,y1:i,y2:o,x:s=r===void 0&&n===void 0?e==="y"?Ee:G:void 0,y:a=i===void 0&&o===void 0?e==="x"?Ee:G:void 0,fill:c,positiveFill:l="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:d=f,negativeFillOpacity:h=f,stroke:p,strokeOpacity:m,z:y=qe(p)[0],clip:g,tip:x,render:b,..._}={}){return[r,n]=oV(s,r,n),[i,o]=oV(a,i,o),r===n&&i===o&&(e==="y"?i=lc(0):r=lc(0)),{tip:x}=Do({tip:x},e==="y"?"x":"y"),yr(fe(l)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:l,fillOpacity:d,render:nc(b,sV(e,!0)),clip:g,..._}),{ariaLabel:"positive difference"}),fe(u)?null:Object.assign(x0(t,{x1:r,x2:n,y1:i,y2:o,z:y,fill:u,fillOpacity:h,render:nc(b,sV(e,!1)),clip:g,..._}),{ariaLabel:"negative difference"}),bf(t,{x:n,y:o,z:y,stroke:p,strokeOpacity:m,tip:x,clip:!0,..._}))}function oV(e,t,r){return t===void 0&&r===void 0?t=r=lc(e):t===void 0?(r=lc(r),t=e===void 0?r:lc(e)):r===void 0?(t=lc(t),r=e===void 0?t:lc(e)):(t=lc(t),r=lc(r)),[t,r]}function lc(e){let t,{value:r,label:n=en(r)}=Ki(e);return{transform:i=>t||(t=_t(i,r)),label:n}}function sV(e,t){let r=e==="x"?"y":"x",n=`${r}1`,i=`${r}2`,o=`${e}1`,s=`${e}2`;return(a,c,l,u,f,d)=>{let{[n]:h,[i]:p}=l,m=new Float32Array(h.length),y=new Float32Array(p.length),g=u[e==="y"?"height":"width"];(t===xS(c[e])<0?m:y).fill(g);let x=d(a,c,{...l,[i]:h,[s]:y},u,f),b=d(a,c,{...l,[n]:p,[o]:m},u,f),_=x.querySelector("g")??x,v=b.querySelector("g")??b;for(let w=0;_.firstChild;w+=2){let T=cN(),A=lt("svg:clipPath",f).attr("id",T).node();A.appendChild(_.firstChild),v.childNodes[w].setAttribute("clip-path",`url(#${T})`),v.insertBefore(A,v.childNodes[w])}return b}}function pI({geometry:e=G,...t}={}){let r=ml(n=>_t(n,e));return Ne({...t,x:null,y:null,geometry:{transform:r}},(n,i,o,s,a,{projection:c})=>{let l=r(n),u=l.length,f=new Float64Array(u),d=new Float64Array(u),h=Dr(c);for(let p=0;p<u;++p)[f[p],d[p]]=h.centroid(l[p]);return{data:n,facets:i,channels:{x:{value:f,scale:c==null?"x":null,source:null},y:{value:d,scale:c==null?"y":null,source:null}}}})}function uV({geometry:e=G,...t}={}){let r=ml(i=>_t(i,e)),n=ml(i=>_t(r(i),f3));return{...t,x:{transform:i=>Float64Array.from(n(i),([o])=>o)},y:{transform:i=>Float64Array.from(n(i),([,o])=>o)},geometry:{transform:r}}}var Eat={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},k0=class extends vt{constructor(t,r={}){let[n,i]=ye(r.r,3);super(t,{x:{value:r.tip?r.x:null,scale:"x",optional:!0},y:{value:r.tip?r.y:null,scale:"y",optional:!0},r:{value:n,scale:"r",filter:Fn,optional:!0},geometry:{value:r.geometry,scale:"projection"}},v0(r),Eat),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=Dr(o.projection??Mat(r)),{r:l}=this;return tl(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>{u.selectAll().data(t).enter().append("path").call(Et,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Wt,this,n)}).node()}};function Mat({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Pu({point(r,n){this.stream.point(e(r),t(n))}})}function mI(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=pI(t):t.geometry===void 0&&(t={...t,geometry:G}),new k0(e,t)}function fV({strokeWidth:e=1.5,...t}={}){return mI({type:"Sphere"},{strokeWidth:e,...t})}function dV({strokeOpacity:e=.1,...t}={}){return mI(g3(),{strokeOpacity:e,...t})}var Kh=.5,Jh=0;function hV(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:ie(t),e=C4(e,r),Es(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!Es(e,"r")&&(r.r=t/2),Ne(r,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=Ns(s,a,l)),d=d?d.value:_t(i,n),h=h?.value,p=p?.value,m=m?.value;let y=Kg(e,{z:d,fill:h,stroke:p,symbol:m}),g=d&&[],x=h&&[],b=p&&[],_=m&&[],v=[],w=[],T=[],A=-1;for(let R of e)R.initialize(i);for(let R of o){let C=[];for(let S of e)S.scope("facet",R);for(let[S,M]of As(R,y))for(let{index:O,extent:L}of Nat(i,M,u,f,t)){C.push(++A),w.push(L.x),T.push(L.y),d&&g.push(y===d?S:d[O[0]]),h&&x.push(y===h?S:h[O[0]]),p&&b.push(y===p?S:p[O[0]]),m&&_.push(y===m?S:m[O[0]]);for(let B of e)B.reduce(O,L)}v.push(C)}let E=s.x.scale,N=s.y.scale,I={x:{value:w,source:a[E]?{value:Xt(w,a[E].invert),scale:E}:null},y:{value:T,source:a[N]?{value:Xt(T,a[N].invert),scale:N}:null},...d&&{z:{value:g}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:R,output:C})=>[R,{scale:"auto",label:C.label,radius:R==="r"?t/2:void 0,value:C.transform()}]))};return{data:i,facets:v,channels:I}})}function Nat(e,t,r,n,i){let o=i*(1.5/T4),s=new Map;for(let a of t){let c=r[a],l=n[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-Jh)/o),f=Math.round(c=(c-Kh)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),x=c-y,b=l-g;m*m+d*d>x*x+b*b&&(f=y+(u&1?1:-1)/2,u=g)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Kh,y:u*o+Jh}},s.set(h,p)),p.index.push(a)}return s.values()}var Oat={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function pV(e){return new B0(e)}var B0=class extends vt{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(il,void 0,{clip:r,...n},Oat),this.binWidth=ie(t)}render(t,r,n,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-Kh,p=f-c-Kh,m=a-Jh,y=d-l-Jh,g=s/2,x=g*A4,b=x/2,_=g*2,v=x*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),A=Math.floor((m+b)/v),E=Math.ceil((y-b)/v)+1,N=`m0,${Ol(-x)}l${Ol(g)},${Ol(b)}v${Ol(x)}l${Ol(-g)},${Ol(b)}`,I=N;for(let R=A;R<E;++R)for(let C=w;C<T;++C)I+=`M${Ol(C*_+(R&1)*g)},${Ol(R*v)}${N}`;return lt("svg:g",o).datum(0).call(kt,this,i,o).call(Rt,this,{},We+Kh,We+Jh).call(R=>R.append("path").call(Et,this).call(Wt,this,n).attr("d",I)).node()}};function Ol(e){return Math.round(e*1e3)/1e3}var Rat={ariaLabel:"image",fill:null,stroke:null};function Dat(e){return/^\.*\//.test(e)}function Lat(e){return/^(blob|data|file|http|https):/i.test(e)}function Fat(e){return typeof e=="string"&&(Dat(e)||Lat(e))?[void 0,e]:[e,void 0]}var P0=class extends vt{constructor(t,r={}){let{x:n,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=r;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=Fat(l),[y,g]=ye(o),[x,b]=ye(s,g!==void 0?g*2:void 0),[_,v]=ye(a,g!==void 0?g*2:void 0),[w,T]=ye(c,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:Fn,optional:!0},width:{value:x,filter:Fn,optional:!0},height:{value:_,filter:Fn,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},v0(r),Rat),this.src=m,this.width=b,this.rotate=T,this.height=v,this.r=g,this.preserveAspectRatio=Oe(u,"xMidYMid"),this.crossOrigin=rr(f),this.frameAnchor=Ts(d),this.imageRendering=Oe(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=n,{r:m,width:y,height:g,rotate:x}=this,[b,_]=Ur(this,i);return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Et,this).attr("x",mV(c,u,d,b,y,m)).attr("y",mV(l,f,d,_,g,m)).attr("width",u?w=>u[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?Fo`${c?w=>c[w]:b}px ${l?w=>l[w]:_}px`:null).call(dt,"href",p?w=>p[w]:this.src).call(dt,"preserveAspectRatio",this.preserveAspectRatio).call(dt,"crossorigin",this.crossOrigin).call(dt,"image-rendering",this.imageRendering).call(dt,"clip-path",d?w=>`circle(${d[w]}px)`:m!==void 0?`circle(${m}px)`:null).call(Wt,this,n)).node()}};function mV(e,t,r,n,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>n-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?n-i/2:r&&e?s=>e[s]-r[s]:r?s=>n-r[s]:e?s=>e[s]-o:n-o}function yV(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ke(t,r)),new P0(e,{...n,x:t,y:r})}function Cat(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-tp(t)-tp(r)+tp(t+r);s<10;s++){if(h===0||h===1)return h;if(d=kat(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function kat(e,t,r){var n=e===0||e===1?0:Math.exp(tp(t+r)-tp(t)-tp(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*gV(e,t,r)/t:1-n*gV(1-e,r,t)/r}function gV(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function tp(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function xV(e,t){var r=Cat(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Bat={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yI=class extends vt{constructor(t,r={}){let{x:n,y:i,z:o,ci:s=.95,precision:a=4}=r;if(super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:pn(r),optional:!0}},r,Bat),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,r,n,i,o){let{x:s,y:a,z:c}=n,{ci:l}=this;return lt("svg:g",o).call(kt,this,i,o).call(Rt,this,r).call(u=>u.selectAll().data(c?i0(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Et,this).call(of,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Ka(this.fill)?d=>d.select(Pat).attr("stroke","none").call(Et,this).call(of,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function Pat(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(An.svg,"path"),this)}var XN=class extends yI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>n[u]),c=gI(t,n,r),l=wV(t,n,r,(1-i)/2,c);return ch().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>n[a]),s=gI(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},HN=class extends yI{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=ce(t,u=>r[u]),c=gI(t,r,n),l=wV(t,r,n,(1-i)/2,c);return ch().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(er(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=ce(t,a=>r[a]),s=gI(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function bV(e,{y:t=Ee,x:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new XN(e,Yh({...o,x:r,y:t,fill:i,stroke:n}))}function _V(e,{x:t=Ee,y:r=G,stroke:n,fill:i=fe(n)?"currentColor":n,...o}={}){return new HN(e,Vh({...o,x:t,y:r,fill:i,stroke:n}))}function gI(e,t,r){let n=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=r[u];n+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-n*i)/(a*s-n*n),l=(i-c*n)/a;return u=>c*u+l}function wV(e,t,r,n,i){let o=Zr(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(r[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=xV(n,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function U0({path:e=G,delimiter:t,frameAnchor:r,treeLayout:n=Uu,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=wI(s),i=IV(i),a!=null&&(a=ZN(a)),r===void 0&&(r=s.frameAnchor);let l=TV(t),u=DV(c,ZN),[f,d]=Br(),[h,p]=Br();return{x:f,y:h,frameAnchor:r,...mr(c,(m,y)=>{let g=l(_t(m,e)),x=d([]),b=p([]),_=-1,v=[],w=[],T=pv().path(N=>g[N]),A=Qn(m)?N=>N.data=m[N.data]:N=>N.data=m.get(N.data),E=n();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Wg);for(let N of u)N[bI]=N[OV]([]);for(let N of y){let I=[],R=T(N.filter(C=>g[C]!=null)).each(A);i!=null&&R.sort(i),E(R);for(let C of R.descendants())if(!(a!=null&&!a(C))){I.push(++_),v[_]=C.data,s.position(C,_,x,b);for(let S of u)S[bI][_]=S[RV](C)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function _I({path:e=G,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Uu,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=wI(l),a=IV(a),u!=null&&(u=SV(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=TV(t),h=DV(f,SV),[p,m]=Br(),[y,g]=Br(),[x,b]=Br(),[_,v]=Br();return{x1:p,x2:y,y1:x,y2:_,...mr(f,(w,T)=>{let A=d(_t(w,e)),E=m([]),N=g([]),I=b([]),R=v([]),C=-1,S=[],M=[],O=pv().path(B=>A[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??Wg);for(let B of h)B[bI]=B[OV]([]);for(let B of T){let k=[],P=O(B.filter(U=>A[U]!=null)).each(U=>U.data=w[U.data]);a!=null&&P.sort(a),L(P);for(let{source:U,target:$}of P.links())if(!(u!=null&&!u($,U))){k.push(++C),S[C]=$.data,l.position(U,C,E,I),l.position($,C,N,R);for(let X of h)X[bI][C]=X[RV]($,U)}M.push(k)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function wI(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Uat;case"right":return $at}throw new Error(`invalid tree anchor: ${e}`)}var Uat={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},$at={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function IV(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?vV(ZN(e)):vV(zat(e))}function vV(e){return(t,r)=>Cr(e(t),e(r))}function zat(e){return t=>t.data?.[e]}function TV(e="/"){if(e=`${e}`,e==="/")return r=>r;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return r=>r.map(n=>jat(n,t))}var QN=92,AV=47;function jat(e,t){if(t===QN)throw new Error("delimiter cannot be backslash");let r=!1;for(let n=0,i=e.length;n<i;++n){switch(e.charCodeAt(n)){case QN:if(!r){r=!0;continue}break;case t:r?(e=e.slice(0,n-1)+e.slice(n),--n,--i):e=e.slice(0,n)+"/"+e.slice(n+1);break;case AV:r?(e=e.slice(0,n)+"\\\\"+e.slice(n),n+=2,i+=2):(e=e.slice(0,n)+"\\"+e.slice(n),++n,++i);break}r=!1}return e}function qat(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case QN:if(!t){t=!0;continue}case AV:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function EV(e){return kr(e)&&typeof e.node=="function"}function Vat(e){return kr(e)&&typeof e.link=="function"}function ZN(e){if(EV(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return JN;case"node:path":return KN;case"node:internal":return MV;case"node:external":return NV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid node value: ${e}`)}}function SV(e){if(EV(e))return e.node;if(Vat(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return xI(JN);case"parent:path":return xI(KN);case"parent:depth":return xI(t8);case"parent:height":return xI(e8);case"node:name":return JN;case"node:path":return KN;case"node:internal":return MV;case"node:external":return NV;case"node:depth":return t8;case"node:height":return e8}throw new Error(`invalid link value: ${e}`)}}function KN(e){return e.id}function JN(e){return Yat(e.id)}function t8(e){return e.depth}function e8(e){return e.height}function MV(e){return!!e.children}function NV(e){return!e.children}function xI(e){return(t,r)=>r==null?void 0:e(r)}function Yat(e){let t=e.length;for(;--t>0&&!Wat(e,t););return qat(e.slice(t+1))}function Wat(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var OV=2,RV=3,bI=4;function DV(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...Br(i),o])}return r}function r8(e,{fill:t,stroke:r,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=fe(f)&&fe(d),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:x,textAnchor:b,treeLayout:_=Uu,textLayout:v=_===Uu||_===dv?"mirrored":"normal",tip:w,...T}={}){if(g===void 0&&(g=wI(T.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Sr(v,"textLayout",["mirrored","normal"]);function A(E){return Rs(e,U0({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:x,title:y,...E,...T}))}return yr(iI(e,_I({treeLayout:_,markerStart:f,markerEnd:d,stroke:r!==void 0?r:t===void 0?"node:internal":t,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?to(e,U0({treeLayout:_,fill:t===void 0?"node:internal":t,title:y,tip:w,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:A():null)}function LV(e,t){return r8(e,{...t,treeLayout:dv})}var CV={ariaLabel:"waffle"},$0=class extends pf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,kV("x"))},CV),this.unit=Math.max(0,r),this.gap=+n,this.round=BV(i),this.multiple=PV(s)}},z0=class extends mf{constructor(t,{unit:r=1,gap:n=1,round:i,render:o,multiple:s,...a}={}){super(t,{...a,render:nc(o,kV("y"))},CV),this.unit=Math.max(0,r),this.gap=+n,this.round=BV(i),this.multiple=PV(s)}};function kV(e){return function(t,r,n,i,o){let{unit:s,gap:a,rx:c,ry:l,round:u}=this,{document:f}=o,d=n.channels[`${e}1`].value,h=n.channels[`${e}2`].value,p=this[e==="y"?"_width":"_height"](r,n,i),m=this[e==="y"?"_x":"_y"](r,n,i),y=s*Gat(r.scales[e]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,x=Math.min(p/g,y*g),b=y*g,_=e==="y"?([I,R])=>[I*x,-R*b]:([I,R])=>[R*b,I*x],v=(p-g*x)/2,w=typeof m=="function"?I=>m(I)+v:m+v,T=r[e](0),A=qz(),E=f.createElementNS(An.svg,"pattern");E.setAttribute("width",e==="y"?x:b),E.setAttribute("height",e==="y"?b:x),E.setAttribute("patternUnits","userSpaceOnUse");let N=E.appendChild(f.createElementNS(An.svg,"rect"));return N.setAttribute("x",a/2),N.setAttribute("y",a/2),N.setAttribute("width",(e==="y"?x:b)-a),N.setAttribute("height",(e==="y"?b:x)-a),c!=null&&N.setAttribute("rx",c),l!=null&&N.setAttribute("ry",l),lt("svg:g",o).call(kt,this,i,o).call(this._transform,this,r).call(I=>I.selectAll().data(t).enter().append(()=>E.cloneNode(!0)).attr("id",R=>`${A}-${R}`).select("rect").call(Et,this).call(Wt,this,n)).call(I=>I.selectAll().data(t).enter().append("path").attr("transform",e==="y"?Fo`translate(${w},${T})`:Fo`translate(${T},${w})`).attr("d",R=>`M${n8(u(d[R]/s),u(h[R]/s),g).map(_).join("L")}Z`).attr("fill",R=>`url(#${A}-${R})`).attr("stroke",this.stroke==null?null:R=>`url(#${A}-${R})`)).node()}}function n8(e,t,r){if(e<0||t<0){let n=Math.ceil(-Math.min(e,t)/r);return n8(e+n*r,t+n*r,r).map(([i,o])=>[i,o-n])}return t<e?n8(t,e,r):[[0,Math.ceil(e/r)],[Math.floor(e%r),Math.ceil(e/r)],[Math.floor(e%r),Math.floor(e/r)+e%1],[Math.ceil(e%r),Math.floor(e/r)+e%1],...e%r>r-1?[]:[[Math.ceil(e%r),Math.floor(e/r)],[r,Math.floor(e/r)]],[r,Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)],[Math.ceil(t%r),Math.floor(t/r)+t%1],[Math.floor(t%r),Math.floor(t/r)+t%1],...t%r<1?[]:[[Math.floor(t%r),Math.ceil(t/r)],[0,Math.ceil(t/r)]]]}function BV(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function PV(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function Gat({domain:e,range:t}){return FV(t)/FV(e)}function FV(e){let[t,r]=ce(e);return r-t}function UV(e,t={}){return Ha(t)||(t={...t,y:Ee,x2:G}),new $0(e,vl(Fh(_l(t))))}function $V(e,t={}){return Ha(t)||(t={...t,x:Ee,y2:G}),new z0(e,Sl(Ch(wl(t))))}var ZV=CW(QV(),1);var ect=({marginLeft:e})=>[1,e],rct=({width:e,marginRight:t})=>[-1,e-t],nct=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],ict=({marginTop:e})=>[1,e],oct=({height:e,marginBottom:t})=>[-1,e-t],sct=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function KV(e){return typeof e=="string"?{anchor:e}:e}function JV(e={},t={}){arguments.length===1&&([e,t]=eY(e));let{anchor:r="left",padding:n=1,r:i=t.r}=KV(e);switch(`${r}`.toLowerCase()){case"left":r=ect;break;case"right":r=rct;break;case"middle":r=nct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return rY("x","y",r,ie(n),i,t)}function tY(e={},t={}){arguments.length===1&&([e,t]=eY(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=KV(e);switch(`${r}`.toLowerCase()){case"top":r=ict;break;case"bottom":r=oct;break;case"middle":r=sct;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return rY("y","x",r,ie(n),i,t)}function eY(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function rY(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Xg(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return Ne(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=Ns(c,l,f));let p=h?void 0:i!==void 0?ie(i):this.r!==void 0?this.r:3;h&&(h=_t(h.value,l[h.scale]||G,Float64Array));let[m,y]=r(u),g=m?cct:act,x=new Float64Array(d.length),b=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,ZV.default)();_=_.filter(h?T=>hh(d[T])&&Fn(h[T]):T=>hh(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let A=b(T),E=m?A+n:0,N=d[T]-A,I=d[T]+A,R=2;v.queryInterval(N-n,I+n,([,,S])=>{let M=x[S]-E,O=d[T]-d[S],L=n+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-O*O);w[R++]=M-B,w[R++]=M+B});let C=w.slice(0,R);m&&(C=C.filter(S=>S>=0));t:for(let S of C.sort(g)){for(let M=0;M<R;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;x[T]=S+E;break}v.insert([N,I,T])}}m||(m=1);for(let _ of a)for(let v of _)x[v]=x[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function act(e,t){return Math.abs(e)-Math.abs(t)}function cct(e,t){return e-t}function iY(e,t){return arguments.length===1&&({basis:e,...t}=e),Xh(II(e),t)}function oY(e,t){return arguments.length===1&&({basis:e,...t}=e),Hh(II(e),t)}function II(e){if(e===void 0)return nY;if(typeof e=="function")return TI(bh(e));if(/^p\d{2}$/i.test(e))return ip(xh(e));switch(`${e}`.toLowerCase()){case"deviation":return fct;case"first":return nY;case"last":return uct;case"max":return dct;case"mean":return hct;case"median":return pct;case"min":return mct;case"sum":return yct;case"extent":return lct}throw new Error(`invalid basis: ${e}`)}function TI(e){return{mapIndex(t,r,n){let i=+e(t,r);for(let o of t)n[o]=r[o]===null?NaN:r[o]/i}}}function ip(e){return TI((t,r)=>e(t,n=>r[n]))}var lct={mapIndex(e,t,r){let[n,i]=ce(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},nY=TI((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(Pe(n))return n}}),uct=TI((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(Pe(n))return n}}),fct={mapIndex(e,t,r){let n=Ea(e,o=>t[o]),i=zi(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},dct=ip(Kt),hct=ip(Ea),pct=ip(Eo),mct=ip(Ht),yct=ip(Zr);function sY(e,t){return cY("x",e,t)}function aY(e,t){return cY("y",e,t)}function cY(e,t,r={}){let n,i=1;if(typeof t=="number")i=t,n=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=eS(t.replace(/^[+-]/,"")),i*=l}t=wh(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Zn({[o]:l=>l.map(u=>n(u,i)),[s]:l=>l},r),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ce(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function lY(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return V0(t);case"last":return Y0(t)}if(typeof e=="function")return Rl(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=gct(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Rl(r,n,t)}function gct(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return l8;case"max":return u8}throw new Error(`unknown selector: ${e}`)}function V0(e){return Rl(null,xct,e)}function Y0(e){return Rl(null,bct,e)}function AI(e){return Rl("x",l8,e)}function EI(e){return Rl("y",l8,e)}function MI(e){return Rl("x",u8,e)}function NI(e){return Rl("y",u8,e)}function*xct(e){yield e[0]}function*bct(e){yield e[e.length-1]}function*l8(e,t){yield Q_(e,r=>t[r])}function*u8(e,t){yield vu(e,r=>t[r])}function Rl(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=pn(r);return mr(r,(i,o)=>{let s=_t(i,n),a=_t(i,e),c=[];for(let l of o){let u=[];for(let f of s?Hr(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}vt.prototype.plot=function({marks:e=[],...t}={}){return qh({...t,marks:[...e,this]})};var _ct=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function wct(e,t,r){for(let n=0;n<t.length;++n){let i=t[n];n===t.length-1?e[i]=r:e=e[i]||(e[i]={})}}function uY(e,t,r){for(let n in e){let i=_ct.get(n);if(i==null)throw new Error(`Unrecognized plot attribute: ${n}`);let o=e[n];typeof o=="symbol"?r.push(n):o!==void 0&&wct(t,i.split("."),o)}}var vct=new Set(["frame","hexgrid","sphere","graticule"]),Sct=new Map([["first",V0],["last",Y0],["maxX",MI],["maxY",NI],["minX",AI],["minY",EI],["nearest",gl],["nearestX",xl],["nearestXY",ic]]);async function fY(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;uY(n,t,r);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...d}=u,h=Sct.get(f)?.(d)??d,p=vct.has(c)?[h]:[l,h];t.marks.push(f8[c](...p)),o.push(a.index)}Tct(t,e);let s=qh(t);Ect(s,o),Ict(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Ict(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===es){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,r[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Tct(e,t){let{marks:r}=t;OI("x",e,r),OI("y",e,r),OI("fx",e,r),OI("fy",e,r)}function OI(e,t,r){let n=t[e]||{};if(n.axis===null||n.label!==void 0)return;let i=r.map(s=>s.channelField(e)?.field);if(i.every(s=>s==null))return;let o;for(let s=0;s<i.length;++s){let a=dY(i[s]);a!==void 0&&(o===void 0?o=a:o!==a&&(o=void 0))}o!==void 0&&(t[e]={...n,label:o})}function dY(e){if(e){switch(e.type){case"COLUMN_REF":return e.column;case"CAST":return dY(e.expr);case"FUNCTION":if(e.name==="make_date")return"date";break}return Act(e)}}function Act(e){let t=`${e}`.replaceAll('"',"").replaceAll("(*)","()");return t.endsWith("()")?t.slice(0,-2):t}function Ect(e,t){let r=-1;for(let n of e.children){let i=n.getAttribute("aria-label")||"";n.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||n.setAttribute("data-index",t[++r])}}var Mct={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},W0=class{constructor(t){this.attributes={...Mct},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=sM()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:r}=this.margins();return this.getAttribute("width")-t-r}innerHeight(t=400){let{top:r,bottom:n}=this.margins(),i=this.getAttribute("height");return i==null&&(i=Nct(this,r,n)||t,this.setAttribute("height",i,{silent:!0})),i-r-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await fY(this),r=this.legends.flatMap(({legend:n,include:i})=>{let o=n.init(t);return i?o:[]});this.element.replaceChildren(t,...r),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,r,n){return om(this.attributes[t],r)?(r===void 0?delete this.attributes[t]:this.attributes[t]=r,n?.silent||this.listeners?.get(t)?.forEach(i=>i(t,r)),!0):!1}addAttributeListener(t,r){let n=this.listeners||(this.listeners=new Map);return n.has(t)||n.set(t,new Set),n.get(t).add(r),this}removeAttributeListener(t,r){return this.listeners?.get(t)?.delete(r)}addParams(t,r){let{params:n}=this;for(let i of r)n.has(i)?n.get(i).push(t):(n.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(n.get(i).map(o=>o.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,r=!0){t.setPlot(this),this.legends.push({legend:t,include:r})}};function Nct(e,t,r){let n=e.getAttribute("aspectRatio");if(n==null)return;let i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;let s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(n*s)+t+r}function RI(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||di(e)!==null)}var Oct=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function hY(e){return Oct.has(e)}var Rct=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function pY(e){return Rct.has(`${e}`.toLowerCase())}var mY=e=>e==="stroke"||e==="fill",Dct=e=>/opacity$/i.test(e),Lct=e=>e==="symbol",Fct=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),d8=(e,t)=>({channel:e,field:t,as:yc(t)?t.column:e}),h8=(e,t)=>({channel:e,value:t}),DI=e=>Array.isArray(e),Ir=class extends Bn{constructor(t,r,n,i={}){super(r?.options?.filterBy),this.type=t,this.reqs=i,this.source=r;let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set;DI(r)?this.data=Xn(r):or(r?.table)&&a.add(r.table);let c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[oy]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")hY(l)||mY(l)&&RI(u)||Lct(l)&&pY(u)?o.push(h8(l,u)):o.push(d8(l,Gs(u)));else if(io(u)){let d=h8(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else nn(u)?(MA(u).forEach(d=>a.add(d)),o.push(d8(l,u))):f==="object"&&Fct(l,u)?o.push(d8(l,u)):u!==void 0&&o.push(h8(l,u))};for(let l in n)c(l,n[l])}setPlot(t,r){this.plot=t,this.index=r,t.addParams(this,this.params),this.source?.table&&this.queryPending()}sourceTable(){let t=this.source?.table;return t?or(t)?t.value:t:null}hasOwnData(){return this.source==null||DI(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(r=>r.channel===t)}channelField(t,{exact:r=!1}={}){let n=r?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return n?.field?n:null}fields(){if(this.hasOwnData())return null;let{channels:t,reqs:r}=this,n=new Map;for(let{channel:o,field:s}of t){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=n.get(c)??n.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}let i=this.sourceTable();return Array.from(n,([o,s])=>({table:i,column:o,stats:s}))}fieldInfo(t){let r=Object.fromEntries(t.map(n=>[n.column,n]));for(let n of this.channels){let{field:i}=n;i&&Object.assign(n,r[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){return this.hasOwnData()?null:G0(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Xn(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this;return p8(t,n,i,r)}};function yn(e,t){let r=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:mY(e.channel)?{value:r,scale:"color"}:Dct(e.channel)?{value:r,scale:"opacity"}:r}function G0(e,t,r=[]){let n=ft.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!r.includes(a)){if(a==="orderby")n.orderby(s.value);else if(c){if(ni(c))o=!0;else{if(i.has(l))continue;i.add(l)}n.select({[l]:c})}}}return o&&n.groupby(Array.from(i)),n}function p8(e,t,r,n,i={}){let{numRows:o,values:s,columns:a}=n??{},c={};for(let f of r){let d=t.has(f.channel)?c:i;d[f.channel]=yn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(n?{length:o}:null),options:i}]}function wf(e,t){let{plot:r}=e,n=r.getAttribute(`${t}Scale`);if(!n){let{type:o}=e.channelField(t);n=o==="date"?"time":"linear"}let i={type:n};switch(n){case"log":i.base=r.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=r.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=r.getAttribute(`${t}Constant`)??1;break}return rm(i)}function Ii(e,t,r,n,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=wf(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=n.map(m=>c(m)),h=l(o),p=a==="time"||a==="utc"?h:o;return[BA(h,f,d,r-i,u),p]}var m8={x:["min","max"]},y8={y:["min","max"]},LI={...m8,...y8};function yY(e,t,r,n,i){let{plot:o}=e,s=o.getAttribute(n),a=o.getAttribute(i);if(Array.isArray(s)&&!s[Gr])return s;{let{column:c,min:l,max:u}=e.channelField(r),f=g8(t,c)||(a?Ba().domain([l,u]).nice().domain():[l,u]);return s!==es&&(f[Gr]=!0),o.setAttribute(n,f,{silent:!0}),f}}function ks(e,t){return yY(e,t,"x","xDomain","xNice")}function Bs(e,t){return yY(e,t,"y","yDomain","yNice")}function g8(e,t){if(!e)return;let r,n;return[e].flat().forEach(i=>zo(i,o=>{if(o instanceof Hl&&`${o.expr}`===t){let s=(o.extent??[]).map(a=>a?.value??a);(r==null||s[0]<r)&&(r=s[0]),(n==null||s[1]>n)&&(n=s[1])}})),r!=null&&n!=null&&r!==n?[r,n]:void 0}var X0=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["count","min","max"]}:void 0;super(t,r,n,o),this.dim=i}query(t=[]){let{plot:r,dim:n,source:i}=this,o=i.options?.optimize,s=super.query(t);if(!n)return s;let a=n==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,count:d,min:h,max:p}=this.channelField(n),m=f==="date"||f==="number",y=n==="x"?r.innerWidth():r.innerHeight();if(o??=d/y>10,o&&m&&c){let[g,x]=g8(t,l)||[h,p],[b]=Ii(this,n,y,[g,x],1,u),_=s._select.map(v=>v.alias).filter(v=>v!==u&&v!==c);return jA(s,b,u,c,_)}else return s.orderby(l)}};function gY(e,t=[]){return new t.constructor(e)}function xY(e,t,r){let n=gY(e,r),i=r.length;for(let o=0;o<i;++o)n[t[o]]=r[o];return n}function bY(e,t,r,n,i,o,s){let a=r.length,c=e*t,l=i.map(h=>n[h]),u={},f=[],d=new Int32Array(a);if(o?.length){let h=o.map(m=>n[m]),p={};for(let m=0;m<a;++m){let y=h.map(g=>g[m]);d[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let h=r.map(y=>y%e),p=r.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[d[y]].push(y);i.forEach((y,g)=>{let x=l[g];u[y]=f.map((b,_)=>s(m[_],e,t,h,p,x))})}else i.forEach((h,p)=>{let m=l[p],y=u[h]=f.map(()=>gY(c,m));for(let g=0;g<a;++g)y[d[g]][r[g]]=m[g]});return{numRows:f.length,columns:u}}function H0(e){let t=1/0,r=-1/0;return e.forEach(n=>{let i=n.length;for(let o=0;o<i;++o){let s=n[o];s<t&&(t=s),s>r&&(r=s)}}),Number.isFinite(t)&&Number.isFinite(r)?[t,r]:[0,1]}function _Y(e){let t=new In;return e.forEach(r=>{let n=r.length;for(let i=0;i<n;++i)t.add(r[i])}),Array.from(t).sort(Ft)}function nr(e,t){return or(e)?(e.addEventListener("value",t),e.value):e}function Q0(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);Cct(r,n,e);let i=Float64Array.of(0,n[1]-r[1]*n[0],n[2]-r[2]*n[0],n[3]-r[3]*n[0],-r[4]*n[0]),o=1+r[1]+r[2]+r[3]+r[4],s=(n[0]+n[1]+n[2]+n[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:r,b_causal:n,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Cct(e,t,r){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/r),s=Math.exp(-1.723/r),a=.6318/r,c=1.997/r,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=r*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function wY(e,t,r,[n,i]){let o=new Float64Array(Math.max(n,i)),s=new Float64Array(Math.max(n,i)),a=new Float64Array(5),c=new Float64Array(r.length);for(let l=0,u=0;l<i;++l,u+=n){let f=c.subarray(u);FI(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);FI(t,u,i,n,o,s,a,u)}return c}function FI(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=kct){let l=n*2,u=n*3,f=n*4,d=n*r,h,p;for(c(i,t,r,n,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<r;++p,h+=n)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-n]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,r,-n,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-n*5;p<r;++p,h-=n)o[p]=e.b_anticausal[1]*t[h+n]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<r;++p,h+=n)a[h]=i[p]+o[r-p-1];else for(p=0,h=0;p<r;++p,h+=n)a[h]=Math.max(0,i[p]+o[r-p-1]);return a}function kct(e,t,r,n,i,o,s,a,c,l,u,f=.5){let d=Math.abs(n)*r,h=n<0?d+n:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=h+n*m,p>=0&&p<d&&(e[y]+=l[y-m]*t[p]);let g=t[h],x=Math.ceil(u*10);for(m=0;m<x;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Co="density",ko=class extends Ir{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=Bct(u);super(t,r,u,LI),this.densityMap=f,this.bandwidth=nr(i,d=>(this.bandwidth=d,this.grids?this.convolve().update():null)),this.interpolate=nr(o,d=>(this.interpolate=d,this.requestUpdate())),this.pixelSize=nr(s,d=>(this.pixelSize=d,this.requestUpdate())),this.pad=nr(a,d=>(this.pad=d,this.requestUpdate())),this.width=nr(c,d=>(this.width=d,this.requestUpdate())),this.height=nr(l,d=>(this.height=d,this.requestUpdate()))}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",n),t.addAttributeListener("yDomain",n),super.setPlot(t,r)}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[s,a]=this.extentX=ks(this,t),[c,l]=this.extentY=Bs(this,t),[u,f]=this.bins=this.binDimensions(),[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(t.concat(y)),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;ni(A)?(b[T]=A,o[T]=!0):T==="weight"?b[Co]=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(Co),b[Co]=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b[Co])throw new Error("Linear binning not applicable to custom aggregates.");let v=Gf(b[Co])[0];return $A(g,d,p,v,u,x)}else return PA(g,d,p,b,u,x)}binDimensions(){let{plot:t,pixelSize:r,width:n,height:i}=this;return[n??Math.round(t.innerWidth()/r),i??Math.round(t.innerHeight()/r)]}queryResult(t){let[r,n]=this.bins,i=Pct(this.interpolate),{columns:o}=Xn(t);return this.grids0=bY(r,n,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:r,bins:n,grids0:i,plot:o}=this;if(this.grids=i,r>0){let s=t.length===1?t[0]:t.includes(Co)?Co:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=n,d=a.some(m=>m.some(y=>y<0)),h=Q0(r*(u-1)/c,d),p=Q0(r*(f-1)/l,d);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>wY(h,p,m,n))}}}return this}};function Bct(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function Pct(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return O0;case"barycentric":return N0();case"random-walk":return R0()}throw new Error(`invalid interpolate: ${e}`)}var Z0=class extends ko{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=nr(n,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:r,grids:n,thresholds:i,plot:o}=this,{numRows:s,columns:a}=n,c=i,l;if(Array.isArray(c))l=c;else{let[,I]=H0(a.density);l=Array.from({length:c-1},(R,C)=>I*(C+1)/c)}(r.fill||r.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[d,h]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(h-d)/u,g=(m-p)/f,x=+d,b=+p,_=I=>x+I*y,v=I=>b+I*g,w=Wc().size(t),T=this.contourData=Array(s*l.length),{density:A,...E}=a,N=Object.entries(E);for(let I=0,R=0;I<s;++I){let C=A[I],S=N.reduce((M,[O,L])=>(M[O]=L[I],M),{});for(let M=0;M<l.length;++M,++R)T[R]=Object.assign(Uct(w.contour(C,l[M]),_,v),S)}return this}plotSpecs(){let{type:t,channels:r,densityMap:n,contourData:i}=this,o={};for(let s of r){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=yn(s))}for(let s in n)n[s]&&(o[s]=yn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function Uct(e,t,r){function n(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=r(s[1])}return e.coordinates.forEach(n),e}function K0(e){return Array.from({length:e},(t,r)=>r)}function CI(e,t){let r=t.reduce((i,o,s)=>(i[o]=s,i),{}),n=K0(e.length);return n.sort((i,o)=>r[e[i]]-r[e[o]]),n}function kI(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.setAttribute("width",e),r.setAttribute("height",t),r}throw new Error("Can not create a canvas instance.")}function vY(e=1){let t=255*e|0;return(r,n,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<n;++a,s+=4)r[s+3]=t}}function SY(e){let{apply:t}=e;return(r,n,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*n;c<n;++c,a+=4)r[a+3]=255*t(o[c+l])|0}}function IY(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?wr(e):e,o=new Uint8ClampedArray([t,r,n,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function TY(e){let{domain:t,range:r}=e,n=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=r.length;for(let a=0;a<=o;++a){let c=r[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?wr(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,n[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=n[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=n[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function AY(e,t,r){let{interpolate:n}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=n(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?wr(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*r(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var Dl=class extends ko{constructor(t,r){super("image",t,r),this.image=null}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=qct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?CI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}},J0=class extends Dl{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function x8(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(Co),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(n.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=r.fill||t.includes("fill")?"grid":n.includes(a?.as)?"group":RI(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=r.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?Co:null),d=c?.as??(u==="grid"?Co:null),h=l!=="grid"&&l!=="group"?IY(l):zct(e,f),p=u!=="grid"?vY(u):$ct(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function $ct(e,t){let{plot:r,grids:n}=e,i=r.getAttribute("opacityDomain"),o=i===es,s=i?.[Gr],a=!o&&!s&&i||H0(n.columns[t]);(o||s||!i)&&(o||(a[Gr]=!0),r.setAttribute("opacityDomain",a));let c=dl({opacity:{type:r.getAttribute("opacityScale"),domain:a,range:r.getAttribute("opacityRange"),clamp:r.getAttribute("opacityClamp"),nice:r.getAttribute("opacityNice"),reverse:r.getAttribute("opacityReverse"),zero:r.getAttribute("opacityZero"),base:r.getAttribute("opacityBase"),exponent:r.getAttribute("opacityExponent"),constant:r.getAttribute("opacityConstant")}});return SY(c)}function zct(e,t){let{plot:r,grids:n}=e,i=n.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=r.getAttribute("colorDomain"),c=a===es,l=a?.[Gr],u=!c&&!l&&a||(o?i.slice().sort(Ft):s?_Y(i):H0(i));(c||l||!a)&&(c||(u[Gr]=!0),r.setAttribute("colorDomain",u));let f=dl({color:{type:r.getAttribute("colorScale"),domain:u,range:r.getAttribute("colorRange"),clamp:r.getAttribute("colorClamp"),n:r.getAttribute("colorN"),nice:r.getAttribute("colorNice"),reverse:r.getAttribute("colorReverse"),scheme:r.getAttribute("colorScheme"),interpolate:r.getAttribute("colorInterpolate"),pivot:r.getAttribute("colorPivot"),symmetric:r.getAttribute("colorSymmetric"),zero:r.getAttribute("colorZero"),base:r.getAttribute("colorBase"),exponent:r.getAttribute("colorExponent"),constant:r.getAttribute("colorConstant")}});if(s)return TY(f);{let d=dl({x:{type:jct(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return AY(1024,f,d.apply)}}function jct(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function qct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=kI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}var tx=class extends Dl{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),this.normalize=nr(n,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:r,normalize:n,pad:i}=this,[o,s]=this.bins=this.binDimensions(),[a]=Ii(this,"x",o,ks(this,t),i),[c]=Ii(this,"y",s,Bs(this,t),i),l=ft.from(this.sourceTable()).where(Vct(this,t));this.aggr=["density"];let u=this.groupby=[],f=[];for(let d of r)if(Object.hasOwn(d,"field")){let{channel:h,field:p}=d;h==="z"?(l.select({[h]:p}),f.push("z")):h!=="x"&&h!=="y"&&(l.select({[h]:p}),u.push(h))}return zA(l,a,c,f,o,s,u,n)}};function Vct(e,t){if(Array.isArray(t)&&!t.length)return t;let r=e.channelField("x").column,n=e.channelField("y").column,i=s=>{let a=`${s.expr}`;return s.type!=="BETWEEN"||a!==r&&a!==n},o=s=>s.op==="AND"?on(s.clauses.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}var op=class extends Ir{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,...s}=n,a=t.endsWith("X")?"y":"x";super(t,r,s,a==="x"?m8:y8),this.dim=a,this.bins=nr(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=nr(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterStable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[Gr]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:r,channels:n,dim:i}=this,o=this.extent=(i==="x"?ks:Bs)(this,t),[s,a]=Ii(this,i,r,o),c=G0(n,this.sourceTable(),[i]).where(t.concat(jr(a,o))),l=this.channelField("weight")?"weight":null;return UA(c,s,l)}queryResult(t){let{columns:{index:r,density:n}}=Xn(t);return this.grid=xY(this.bins,r,n),this.convolve()}convolve(){let{bins:t,bandwidth:r,dim:n,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=n==="x"?o.innerWidth():o.innerHeight(),u=Q0(r*(t-1)/l,c),f=FI(u,i,t),d=n==="x"?"y":"x",h=this.channelField(n).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),x=new Float64Array(t);for(let b=0;b<t;++b)g[b]=p+b*m,x[b]=f[b]*y;return this.data={numRows:t,columns:{[h]:g,[d]:x}},this}plotSpecs(){let{type:t,data:{numRows:r,columns:n},channels:i,dim:o}=this,s=o==="x"?{y:n.y}:{x:n.x};for(let a of i)s[a.channel]=yn(a,n);return[{type:t,data:{length:r},options:s}]}};var ex=class extends ko{constructor(t,r){let{type:n="dot",...i}=r;super(n,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:r,extentX:n,extentY:i}=this,[o,s]=t,a=wf(this,"x"),c=wf(this,"y"),[l,u]=n.map(y=>a.apply(y)),[f,d]=i.map(y=>c.apply(y)),h=(u-l)/(o-r),p=(d-f)/(s-r),m=r?0:.5;return this.data=Yct(this.grids,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:{numRows:i,columns:o}}=this,s={};for(let a of r){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:yn(a,o)}for(let a in n)n[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function Yct(e,t,r,n,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=u*f,h=d*e.numRows,p=new Float64Array(h),m=new Float64Array(h),y=new Float64Array(h),g={x:p,y:m,density:y},{density:x,...b}=e.columns;for(let v in b)g[v]=new b[v].constructor(h);let _=0;for(let v=0;v<e.numRows;++v){for(let T in b)g[T].fill(b[T][v],_,_+d);let w=x[v];for(let T=0,A=0;A<f;++A)for(let E=0;E<u;++E,++_,++T)p[_]=s(r+(E+c)*i),m[_]=a(n+(A+c)*o),y[_]=w[T]*l}return{numRows:h,columns:g}}function Wct(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,m,y,g;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*r-1)),y=h*Math.sqrt(p+m)/m-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+r*Math.exp(2*y))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,y=u+f,e<u/y?h=Math.pow(t*y*e,1/t):h=1-Math.pow(r*y*(1-e),1/r)),g=-sp(t)-sp(r)+sp(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Gct(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+g),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Gct(e,t,r){var n=e===0||e===1?0:Math.exp(sp(t+r)-sp(t)-sp(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+r+2)?n*EY(e,t,r)/t:1-n*EY(1-e,r,t)/r}function EY(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function sp(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function MY(e,t){var r=Wct(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}function NY(e){let t=-Math.log((1-e)*(1+e)),r;return t<6.25?(t-=3.125,r=-364441206401782e-35,r=-16850591381820166e-35+r*t,r=128584807152564e-32+r*t,r=11157877678025181e-33+r*t,r=-1333171662854621e-31+r*t,r=20972767875968562e-33+r*t,r=6637638134358324e-30+r*t,r=-4054566272975207e-29+r*t,r=-8151934197605472e-29+r*t,r=26335093153082323e-28+r*t,r=-12975133253453532e-27+r*t,r=-5415412054294628e-26+r*t,r=10512122733215323e-25+r*t,r=-4112633980346984e-24+r*t,r=-29070369957882005e-24+r*t,r=42347877827932404e-23+r*t,r=-13654692000834679e-22+r*t,r=-13882523362786469e-21+r*t,r=.00018673420803405714+r*t,r=-.000740702534166267+r*t,r=-.006033670871430149+r*t,r=.24015818242558962+r*t,r=1.6536545626831027+r*t):t<16?(t=Math.sqrt(t)-3.25,r=22137376921775787e-25,r=9075656193888539e-23+r*t,r=-27517406297064545e-23+r*t,r=18239629214389228e-24+r*t,r=15027403968909828e-22+r*t,r=-4013867526981546e-21+r*t,r=29234449089955446e-22+r*t,r=12475304481671779e-21+r*t,r=-47318229009055734e-21+r*t,r=6828485145957318e-20+r*t,r=24031110387097894e-21+r*t,r=-.0003550375203628475+r*t,r=.0009532893797373805+r*t,r=-.0016882755560235047+r*t,r=.002491442096107851+r*t,r=-.003751208507569241+r*t,r=.005370914553590064+r*t,r=1.0052589676941592+r*t,r=3.0838856104922208+r*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,r=-27109920616438573e-27,r=-2555641816996525e-25+r*t,r=15076572693500548e-25+r*t,r=-3789465440126737e-24+r*t,r=761570120807834e-23+r*t,r=-1496002662714924e-23+r*t,r=2914795345090108e-23+r*t,r=-6771199775845234e-23+r*t,r=22900482228026655e-23+r*t,r=-99298272942317e-20+r*t,r=4526062597223154e-21+r*t,r=-1968177810553167e-20+r*t,r=7599527703001776e-20+r*t,r=-.00021503011930044477+r*t,r=-.00013871931833623122+r*t,r=1.0103004648645344+r*t,r=4.849906401408584+r*t):r=1/0,r*e}var ap=class extends Ir{constructor(t,r,n){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=n;super(t,r,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=nr(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:r,field:n}=this,i=r.concat([{field:Xp(n),as:"__avg__"},{field:se(Zp(n),Hs(Mr(n))),as:"__se__"}]);return G0(i,this.sourceTable()).where(t)}queryResult(t){return this.data=Xn(t),this}plotSpecs(){let{type:t,dim:r,detail:n,data:i,ci:o,channels:s}=this,a=Math.SQRT2*NY(o),{columns:{__avg__:c,__se__:l}}=i,u={[`${r}1`]:c.map((f,d)=>f-a*l[d]),[`${r}2`]:c.map((f,d)=>f+a*l[d])};return p8(t,n,s,i,u)}};var Xct="geom",rx=class extends Ir{constructor(t,r={},n){!DI(t)&&!r?.geometry&&(r.geometry=Jp(Xct)),super("geo",t,r,n)}queryResult(t){super.queryResult(t);let r=this.channelField("geometry")?.as;if(r){let{columns:n}=this.data;typeof n[r][0]=="string"&&(n[r]=n[r].map(i=>JSON.parse(i)))}return this}};var nx=class extends Ir{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},LI),this.binWidth=nr(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[Gr]&&!r[Gr]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i}=this,o,s,a=new Set,c={};for(let N of i)if(N.channel!=="orderby"){if(N.channel==="x")o=N;else if(N.channel==="y")s=N;else if(Object.hasOwn(N,"field")){let{as:I,field:R}=N;c[I]=R,ni(R)||a.add(I)}}let[l,u]=ks(this,t),[f,d]=Bs(this,t),h=.5-r.getAttribute("marginLeft"),p=0-r.getAttribute("marginTop"),m=Ge(n),y=Ge(n*(1.5/Math.sqrt(3))),g=Ge(r.innerWidth()/(u-l)),x=Ge(r.innerHeight()/(d-f)),b="_x",_="_y",v="_px",w="_py",T="_pi",A="_pj",E="_tt";return ft.select({[o.as]:te(Ge(l),se(te(Nt(te(b,Nt(.5,Kp(_,1))),m),h),g)),[s.as]:It(Ge(d),se(te(Nt(_,y),p),x)),...c}).groupby(b,_,...a).from(ft.select({[w]:se(Nt(x,It(It(d,s.field),p)),y),[A]:ve(Qs(w)),[v]:It(se(It(Nt(g,It(o.field,l)),h),m),Nt(.5,Kp(A,1))),[T]:ve(Qs(v)),[E]:on(Di(Nt(Nr(It(w,A)),3),1),Di(te(ir(It(v,T),2),ir(It(w,A),2)),te(ir(It(It(v,T),Nt(.5,Xs(ze(v,T),-1,1))),2),ir(It(It(w,A),Xs(ze(w,A),-1,1)),2)))),[b]:Xs(E,ve(te(te(T,Xs(ze(v,T),-.5,.5)),Xs(so(Kp(A,1),0),.5,-.5))),T),[_]:Xs(E,ve(te(A,Xs(ze(w,A),-1,1))),A)},"*").from(this.sourceTable()).where(Ri(o.field),Ri(s.field),t))}};var ix=class extends ko{constructor(t,r){let{origin:n=[0,0],dim:i="xy",...o}=r;super("image",t,o),this.image=null,this.origin=n,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,r){let n=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:r,pad:n,channels:i,densityMap:o}=this,[[s,a],[c,l]]=t,[u,f]=this.bins,[d,h]=Ii(this,"x",u,[s,a],n),[p,m]=Ii(this,"y",f,[c,l],n),y=n?[jr(h,[+s,+a]),jr(m,[+c,+l])]:[ri(+s,h),ze(h,+a),ri(+c,m),ze(m,+l)],g=ft.from(this.sourceTable()).where(y),x=this.groupby=[],b={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:w,channel:T,field:A}=v;A.aggregate?(b[T]=A,o[T]=!0):T==="weight"?b.density=de(A):T!=="x"&&T!=="y"&&(g.select({[w]:A}),x.push(w))}let _=this.aggr=Object.keys(b);if(b.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),b.density=Mr()),r==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!b.density)throw new Error("Linear binning not applicable to custom aggregates.");return Jct(g,d,p,b.density,u,x)}else return Kct(g,d,p,b,u,x)}async requestTiles(){let t=Li();this.prefetch&&t.cancel(this.prefetch);let{pad:r,tileX:n,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=ks(this,this._filter),[f,d]=Bs(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-r)/h),y=Math.floor((f-s)*(c-r)/p),g=(I,R)=>[[o+I*h,o+(I+1)*h],[s+R*p,s+(R+1)*p]],x=Math.floor((l-o)/h),b=n?OY((u-o)/h):x,_=Math.floor((f-s)/p),v=i?OY((d-s)/p):_,w=[];for(let I=x;I<=b;++I)for(let R=_;R<=v;++R)w.push([I,R]);let T=w.map(([I,R])=>t.query(this.tileQuery(g(I,R)))),A=[];if(n)for(let I=_;I<=v;++I)A.push([b+1,I]),A.push([x-1,I]);if(i){let I=n?x-1:x,R=n?b+1:b;for(let C=I;C<=R;++C)A.push([C,v+1]),A.push([C,_-1])}this.prefetch=A.map(([I,R])=>t.prefetch(this.tileQuery(g(I,R))));let E=await Promise.all(T),N=Hct(a,c,m,y,w,E);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:r}=this,[n,i]=t,{numRows:o,columns:s}=r,{canvas:a,ctx:c,img:l}=Zct(this,n,i),{alpha:u,alphaProp:f,color:d,colorProp:h}=x8(this),p=s[f]??[],m=s[h]??[],y=o>1&&h&&this.groupby?.includes(h)?CI(m,this.plot.getAttribute("colorDomain")):K0(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,x)=>(d?.(l.data,n,i,m[y[x]]),u?.(l.data,n,i,p[y[x]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:r,data:{numRows:n,columns:i}}=this,o={src:i.src,width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:n},options:o}]}};function Hct(e,t,r,n,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-r,d=u*t-n;Qct(e,t,s,a,f,d)}),s}function Qct(e,t,r,n,i,o){let s=n.numRows;if(s===0)return;let a=n.getChild("index").toArray(),c=n.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(r[f+d*e]=c[l])}}function Zct(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=kI(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}function Kct(e,t,r,n,i,o){return e.select({index:tr`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function Jct(e,t,r,n,i,o){let s=n.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(tr`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(tr`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(tr`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(tr`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,tr`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return ft.from(ft.unionAll(c,l,u,f)).select({index:"i",density:de("w")},o).groupby("index",o).having(so("density",0))}function OY(e){let t=Math.floor(e);return t===e?t-1:t}var ox=class extends Ir{constructor(t,r){let{ci:n=.95,precision:i=4,...o}=r;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=nr(n,a=>(this.ci=a,s())),this.precision=nr(i,a=>(this.precision=a,s()))}query(t=[]){let r=this.channelField("x").as,n=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return ft.from(super.query(t)).select({intercept:UT(n,r),slope:jT(n,r),n:Qp(n,r),ssy:zT(n,r),ssx:$T(n,r),xm:Hp(n,r),x0:Ge(zn(r).where(Ri(n))),x1:Ge(zr(r).where(Ri(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Xn(t),this.lineData=tlt(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?elt(r,t,n,o):null,this}plotSpecs(){let{lineData:t,areaData:r,channels:n,ci:i}=this,o=t.columns,s=i?r.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of n)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=yn(l,s);break;case"stroke":a.stroke=yn(l,o),c.fill=yn(l,s);break;case"strokeOpacity":a.strokeOpacity=yn(l,o);break;case"fillOpacity":c.fillOpacity=yn(l,s);break;default:a[l.channel]=yn(l,o),c[l.channel]=yn(l,s);break}return[...i?[{type:"areaY",data:{length:r.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function b8(e,t){if(e.concat)return e.concat(t);let r=new e.constructor(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function tlt(e){let{x0:t=[],x1:r=[],xm:n,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(h,p)=>i[p]+h*o[p],f=b8(t,r),d=b8(t.map(u),r.map(u));for(let h in l)l[h]=b8(l[h],l[h]);return{numRows:f.length,columns:{x:f,y:d,...l}}}function elt(e,t,r,n){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:d,...h}=e.columns,p=Object.keys(h),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=r*(s[y]-o[y])/n,x=MY((1-t)/2,u[y]-2)*Math.sqrt(d[y]/(u[y]-2));er(o[y],s[y]-g/2,g).concat(s[y]).forEach(b=>{let _=c[y]+b*l[y],v=x*Math.sqrt(1/u[y]+(b-a[y])**2/f[y]);m.x.push(b),m.y1.push(_-v),m.y2.push(_+v),p.forEach(w=>m[w].push(h[w][y]))})}return{numRows:m.x.length,columns:m}}function cp(e){e.tagName==="a"&&(e=e.children[0]);let t=e.__data__;return Array.isArray(t)?t[0]:t}function RY(e){let t=e.toLowerCase(),r=e.length,n="";for(let i=0;i<r;++i)n+=(e[i]!==t[i]?"-":"")+t[i];return n}function Ll(e){let t={};for(let r in e)t[RY(r)]=e[r];return t}function rlt(e){let{channels:t}=e,r=new Set,n=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")n=!0;else if(a)if(ni(a))i=!0;else{if(r.has(c))continue;r.add(c)}}return!n&&i&&r.size&&e.channels.push({channel:"orderby",value:Array.from(r)}),e}var sx=class{constructor(t,{selection:r,channels:n={}}){this.mark=rlt(t),this.selection=r;let i=Object.entries(Ll(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",fp(()=>this.update()))}init(t){this.svg=t;let r=this.values=[],i=`g[data-index="${this.mark.index}"]`,o=`${i} > *:not(g), ${i} > g > *`,s=this.nodes=t.querySelectorAll(o),{channels:a}=this;for(let c=0;c<s.length;++c){let l=s[c];r.push(a.map(u=>l.getAttribute(u[0])))}return this.update()}async update(){let{svg:t,nodes:r,channels:n,values:i,mark:o,selection:s}=this;if(!t)return;let a=await nlt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(cp(l));for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function nlt(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:on(r)},o=e.query(n);(o.queries||[o]).forEach(c=>{c._groupby.length?c.select(i):c.setSelect(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.at(c):c=>s[c].__:()=>!1}function BI(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}function _8(e){let t=e.on,r=!0;function n(i){r=!1,i(),r=!0}return e.reset=(...i)=>{n(()=>e.clear(...i))},e.moveSilent=(...i)=>{n(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>r&&o(...s)}return t(...i)},e}function PI(){return _8(VM())}function DY(){return _8(jM())}function LY(){return _8(qM())}function UI(e,t,r,n,i){let o=Qt(t??e).append("g").attr("class",i),s=e.scale("fx"),a=e.scale("fy");if(s||a){let c=s?.domain.map(u=>s.apply(u)-r),l=a?.domain.map(u=>a.apply(u)-n);if(c&&l)for(let u=0;u<c.length;++u)for(let f=0;f<l.length;++f)o.append("g").attr("transform",`translate(${c[u]}, ${l[f]})`);else if(c)for(let u=0;u<c.length;++u)o.append("g").attr("transform",`translate(${c[u]}, 0})`);else if(l)for(let u=0;u<l.length;++u)o.append("g").attr("transform",`translate(0, ${l[u]})`);o=o.selectAll("g")}return o.each(BI)}function ax(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function FY(e){if(nn(e)){if(e.type==="COLUMN_REF")return e.column;if(e.type==="AGGREGATE")return e.args[0]??e}return e}function Ps(e,t){return FY(e.channelField(t)?.field)}function CY(e,t){let r=[],n=[];return t.forEach(i=>{let o=i==="color"?["color","fill","stroke"]:i==="x"?["x","x1","x2"]:i==="y"?["y","y1","y2"]:[i];for(let s=0;s<o.length;++s){let a=e.channelField(o[s],{exact:!0});if(a){r.push(FY(a.field)),n.push(a.as);return}}throw new Error(`Missing channel: ${i}`)}),{fields:r,as:n}}function cx(e,t,r=1){return t.invert(r*Math.floor(e/r))}var Fl=class{constructor(t,{channel:r,selection:n,field:i=void 0,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||Ps(t,r),this.style=a&&Ll(a),this.brush=r==="y"?LY():DY(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let r;t&&(r=t.map(n=>cx(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),ax(r,this.value)||(this.value=r,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(r)))}clause(t){let{mark:r,pixelSize:n,field:i,scale:o}=this;return _u(i,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scale:o,pixelSize:n})}init(t,r){let{brush:n,channel:i,style:o}=this;this.scale=t.scale(i);let s=this.value?.map(this.scale.apply).sort(Ft),a=t.scale("x").range,c=t.scale("y").range;if(n.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=UI(t,r,Ht(a),Ht(c),`interval-${i}`).call(n).call(n.moveSilent,s),o){let l=this.g.selectAll("rect.selection");for(let u in o)l.attr(u,o[u])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var lx=class{constructor(t,{selection:r,xfield:n,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=r,this.peers=s,this.xfield=n||Ps(t,"x"),this.yfield=i||Ps(t,"y"),this.style=a&&Ll(a),this.brush=PI(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:r,pixelSize:n,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>cx(u,i,n)).sort(Ft),a=[c[1],l[1]].map(u=>cx(u,o,n)).sort(Ft)}(!ax(s,r?.[0])||!ax(a,r?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:r,pixelSize:n,xfield:i,yfield:o,xscale:s,yscale:a}=this;return nM([i,o],t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r),scales:[s,a],pixelSize:n})}init(t){let{brush:r,style:n,value:i}=this,o=this.xscale=t.scale("x"),s=this.yscale=t.scale("y"),a=o.range,c=s.range;if(r.extent([[Ht(a),Ht(c)],[Kt(a),Kt(c)]]),this.g=UI(t,null,Ht(a),Ht(c),"interval-xy").call(r),n){let l=this.g.selectAll("rect.selection");for(let u in n)l.attr(u,n[u])}if(i){let[l,u]=i[0].map(o.apply).sort(Ft),[f,d]=i[1].map(s.apply).sort(Ft);this.g.call(r.moveSilent,[[l,f],[u,d]])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var vf=class{constructor(t,{selection:r,pointer:n,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=r,this.clients=new Set().add(t),this.pointer=n,this.channels=i||(n==="x"?["x"]:n==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>Ps(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:r,fields:n}=this,i={source:this,clients:r};return n.length>1?Sa(n,t&&[t],i):bu(n[0],t?.[0],i)}init(t){let r=this,{mark:n,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=n,c=i.map(m=>n.channelField(m).as),l=!ii(o),[u,f]=ilt(t,n),d=this.pointer==="y"?.01:1,h=this.pointer==="x"?.01:1,p=Qt(t);p.on("pointerenter pointerdown pointermove",function(m){let[y,g]=an(m,this),x=olt(u,f,y,g,d,h,s);if(x!==this.valueIndex){this.valueIndex=x;let b=x<0?void 0:c.map(_=>a[_][x]);o.update(l?!b||b.length>1?b:b[0]:r.clause(b))}}),!l&&(p.on("pointerleave",()=>{o.update(r.clause(void 0))}),t.addEventListener("pointerenter",m=>{if(!m.buttons){let y=this.channels.map(()=>0);o.activate(this.clause(y))}}))}};function ilt(e,t){let{data:{columns:r}}=t,n=f=>r[t.channelField(f)?.as],i=f=>e.scale(f),o=e.scale("x"),s=e.scale("y"),a=i("fx")?.apply,c=i("fy")?.apply,l=Array.from(n("x"),o.apply),u=Array.from(n("y"),s.apply);if(a){let f=Ht(o.range),d=n("fx");for(let h=0;h<d.length;++h)l[h]+=a(d[h])-f}if(c){let f=Ht(s.range),d=n("fy");for(let h=0;h<d.length;++h)u[h]+=c(d[h])-f}return[l,u]}function olt(e,t,r,n,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-r),f=o*(t[l]-n),d=u*u+f*f;d<=a&&(a=d,c=l)}return c}var kY=(e,t)=>e-t,ux=class{constructor(t,{x:r=new qo,y:n=new qo,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=r,this.ysel=n,this.xfield=i||Ps(t,"x"),this.yfield=o||Ps(t,"y"),this.zoom=w8(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let r=slt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=alt(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return _u(r,t,{source:this,clients:this.mark.plot.markSet,scale:n})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:r,pany:n,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(kY),c=this.yscale.range.slice().sort(kY),l=w8(r,[-1/0,1/0],a),u=w8(n,[-1/0,1/0],c),f=a4().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new gi(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(Qt(i).call(f),r||n){let d=!1;i.addEventListener("pointerenter",h=>{if(!d&&(d=!0,!h.buttons)){if(r){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(n){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>d=!1)}}};function w8(e,t,r){return e?Array.isArray(e)?e:t:r}function slt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function alt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var clt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},llt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,ult=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,flt=/^((\s+,?\s*)|(,\s*))/,dlt=/^[01]/,BY=e=>`Invalid SVG path, incorrect parameter ${e}`;function PY(e){let t=[];return(e.match(llt)||[]).forEach(n=>{let i=n[0],o=i.toLowerCase(),s=clt[o],a=hlt(o,s,n.slice(1).trim()),c=a.length;if(c<s||c&&c%s!==0)throw new Error(BY("count"));if(t.push([i,...a.slice(0,s)]),c!==s){o==="m"&&(i=i==="M"?"L":"l");for(let l=s;l<c;l+=s)t.push([i,...a.slice(l,l+s)])}}),t}function hlt(e,t,r){let n=[];for(let i=0;t&&i<r.length;)for(let o=0;o<t;++o){let s=e==="a"&&(o===3||o===4)?dlt:ult,a=r.slice(i).match(s);if(a===null)throw new Error(BY("type"));i+=a[0].length,n.push(+a[0]);let c=r.slice(i).match(flt);c!==null&&(i+=c[0].length)}return n}function qY(e,t,r){let{x:n,y:i}=e.getBoundingClientRect(),o=e.createSVGMatrix(),s=[];for(let a of t.children)if(a.tagName==="g"){let c=VY(a)??o;for(let l of a.children)UY(r,n,i,l,c)&&s.push(l)}else UY(r,n,i,a,o)&&s.push(a);return s}function UY(e,t,r,n,i){let[[o,s],[a,c]]=e,{e:l,f:u}=i,f=n.getBoundingClientRect(),d=f.left-t,h=f.right-t,p=f.top-r,m=f.bottom-r;if(d>=o&&h<=a&&p>=s&&m<=c)return!0;if(d<=a&&h>=o&&p<=c&&m>=s){let y=n.tagName;if(y==="a"&&(n=n.children[0],y=n.tagName),y==="rect"||y==="text"||y==="image")return!0;switch(o-=l,s-=u,a-=l,c-=u,y){case"circle":return YY(o,s,a,c,Sf(n.cx),Sf(n.cy),Sf(n.r));case"line":return WY(o,s,a,c,Sf(n.x1),Sf(n.y1),Sf(n.x2),Sf(n.y2));case"path":return plt(o,s,a,c,n)}}return!1}function Sf(e){return e.baseVal.value}function VY(e){let t=e.transform.baseVal,r=t.length,n=t[0]?.matrix;for(let i=1;i<r;++i)n=n.multiply(t[i].matrix);return n}function YY(e,t,r,n,i,o,s){let a=e<=i&&i<=r,c=t<=o&&o<=n;if(a&&c)return!0;let l=Math.min(Math.abs(e-i),Math.abs(r-i));if(c&&l<=s)return!0;let u=Math.min(Math.abs(t-o),Math.abs(n-o));return a&&u<=s||l*l+u*u<=s*s}function WY(e,t,r,n,i,o,s,a){let c=Math.max(Math.min(i,s),e),l=Math.min(Math.max(i,s),r);if(c>l)return!1;let u=o,f=a,d=s-i;if(Math.abs(d)>1e-8){let m=(a-o)/d,y=o-m*i;u=m*c+y,f=m*l+y}let h=Math.max(Math.min(u,f),t),p=Math.min(Math.max(u,f),n);return h<=p}function plt(e,t,r,n,i){let o=i.__path__||(i.__path__=PY(i.getAttribute("d"))),s=0,a=0,c=0,l=0,u=!1,f=[0,0],d=2,h=VY(i),p=(x,b)=>{f.length=d=2,f[0]=c=s=x,f[1]=l=a=b},m=h?(x,b)=>p($Y(h,x,b),zY(h,x,b)):(x,b)=>p(x,b),y=(x,b)=>(f[d]=x,f[d+1]=b,d+=2,WY(e,t,r,n,f[d-4],f[d-3],x,b)),g=h?(x,b)=>{u=y($Y(h,c=x,l=b),zY(h,x,b))}:(x,b)=>{u=y(c=x,l=b)};for(let x=0;x<o.length;++x){let b=o[x];switch(b[0]){case"M":m(b[1],b[2]);break;case"m":m(c+b[1],l+b[2]);break;case"L":case"T":g(b[1],b[2]);break;case"H":g(b[1],l);break;case"V":g(c,b[1]);break;case"l":case"t":g(c+b[1],l+b[2]);break;case"h":g(c+b[1],l);break;case"v":g(c,l+b[1]);break;case"C":g(b[5],b[6]);break;case"c":g(c+b[5],l+b[6]);break;case"S":case"Q":g(b[3],b[4]);break;case"s":case"q":g(c+b[3],l+b[4]);break;case"A":g(b[6],b[7]);break;case"a":if(mlt(o,x))return YY(e,t,r,n,c,l-b[2],b[2]);g(c+b[6],c+b[7]);break;case"z":case"Z":if(g(s,a),ylt(e,t,f)>0)return!0;m(s,a);break;default:return console.warn("SVG path command not supported: ",b[0]),!1}if(u)return!0}return!1}function $Y(e,t,r){return e.a*t+e.c*r+e.e}function zY(e,t,r){return e.b*t+e.d*r+e.f}function mlt(e,t){let r=e[t],n=e[t+1];return n&&n[0]==="a"&&e[t+2]?.[0]==="z"&&r[1]===r[2]&&n[1]===n[2]&&r[1]===n[1]&&r[7]===-n[7]}function ylt(e,t,r){let n=0,i=r.length-2;for(let o=0;o<i;o+=2)r[o+1]<=t?r[o+3]>t&&jY(e,t,r,o)>0&&++n:r[o+3]<=t&&jY(e,t,r[o])<0&&--n;return n}function jY(e,t,r,n){return(r[n+2]-r[n])*(t-r[n+1])-(e-r[n])*(r[n+3]-r[n+1])}function $I(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>zI(r,t[n]))}function zI(e,t){let r=e.length;if(t.length!==r)return!0;for(let n=0;n<r;++n)if(e[n]!==t[n])return!0;return!1}var fx=class{constructor(t,{channels:r,selection:n,peers:i=!0,brush:o={fill:"none",stroke:"currentColor",strokeDasharray:"1,1"}}){this.mark=t,this.selection=n,this.peers=i,this.style=o&&Ll(o),this.brush=PI(),this.brush.on("brush end",c=>this.publish(c.selection)),this.extent=null,this.groups=null;let{fields:s,as:a}=CY(t,r);this.fields=s,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}publish(t){let{as:r,group:n,mark:i,svg:o}=this,s;if(t){let{data:{columns:a={}}={}}=i,c=new Map;qY(o,n,t).forEach(l=>{let u=cp(l),f=r.map(d=>a[d][u]);c.set(f.join("|"),f)}),s=Array.from(c.values())}this.extent=t,$I(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(t){let{brush:r,extent:n,mark:i,style:o}=this;this.svg=t;let s=t.width.baseVal.value,a=t.height.baseVal.value;if(r.extent([[0,0],[s,a]]),this.group=t.querySelector(`[data-index="${i.index}"]`),this.g=Qt(t).append("g").attr("class","region-xy").each(BI).call(r).call(r.moveSilent,n),o){let c=this.g.selectAll("rect.selection");for(let l in o)c.attr(l,o[l])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}};var If=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.value=null,this.mark=t,this.selection=r,this.peers=i;let o=this.fields=[],s=this.as=[];n.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:r,mark:n}=this;return Sa(r,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n)})}init(t,r,n){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;n??=l=>o.map(u=>a[u][cp(l)]),r??=`[data-index="${i.index}"]`;let c=Array.from(t.querySelectorAll(r));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(glt(c,f)){let h=n(f);(l.shiftKey||l.metaKey)&&u?.length?(d=u.filter(p=>zI(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!zI(u[0],h)?d=null:d=[h]}this.value=d,$I(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function glt(e,t){return e.some(r=>r.contains(t))}var XY=":scope > div, :scope > span",jI="swatch",GY="ramp",lp=class{constructor(t,r){let{as:n,field:i,...o}=r;this.channel=t,this.options=o,this.type=null,this.handler=null,this.selection=n,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let r=xlt(this,t);return this.element.replaceChildren(r),this.element}update(){if(!this.legend)return;let{selection:t,handler:r}=this,{single:n,value:i}=t,o=n?i:t.valueFor(r),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(XY);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function xlt(e,t){let{channel:r,plot:n,selection:i}=e,o=t.scale(r),s=o.type==="ordinal"?jI:GY,a={label:n.getAttribute(`${r}Label`)??null,...e.options},c=s===jI?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},l=t.legend(r,c);e.legend=l;let u=!!i;if(u&&s===GY){let f=c.width??240,d=vlt(o,f);d?l.scale=function(h){return h==="x"?{range:[0,f]}:h==="y"?{range:[-10,0]}:h===r?d:void 0}:u=!1}if(u){let f=blt(e,s);s===jI?(f.init(l,XY,d=>[d.__data__]),e.update()):f.init(l,l.querySelector("g:last-of-type"))}return l}function blt(e,t){let{channel:r,handler:n,selection:i}=e;if(n)return n;let o=_lt(e);return t===jI?(e.handler=new If(o,{selection:i,channels:[r],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new Fl(o,{selection:i,channel:r,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function _lt(e){let{channel:t,plot:r}=e,n=e.field??wlt(r.marks,t)??"value";if(n){let i={field:n};return{plot:r,channelField:o=>t===o?i:void 0}}}function wlt(e,t){let r=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(r==null)return null;for(let n=e.length-1;n>-1;--n)for(let i of r){let o=e[n].channelField(i,{exact:!0});if(o)return o.field}return null}function vlt(e,t){let{apply:r,invert:n,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return dl({x:{...o,type:a,range:[0,t]}})}function qI(e,t,r=0,n=Math.LN10){let i,o=Math.ceil(Math.log(t)/n),s=Math.max(r,Math.pow(10,Math.round(Math.log(e)/n)-o));for(;Math.ceil(e/s)>t;)s*=10;let a=[5,2];for(let c=0,l=a.length;c<l;++c)i=s/a[c],i>=r&&e/i<=t&&(s=i);return s}function HY(e,t,r){let{step:n,steps:i,minstep:o=0,nice:s=!0}=r;if(s!==!1){let a=t-e,c=Math.LN10;n=n||qI(a,i||25,o,c);let l=Math.log(n),u=l>=0?0:~~(-l/c)+1,f=Math.pow(10,-u-1);l=Math.floor(e/n+f)*n,e=e<l?l-n:l,t=Math.ceil(t/n)*n,i=Math.round((t-e)/n)}return{min:e,max:t,steps:i}}var JY="year",QY="month",ZY="day",VI="hour",YI="minute",WI="second",Slt="millisecond",hx=1e3,px=hx*60,mx=px*60,GI=mx*24,Ilt=GI*7,KY=GI*30,tW=GI*365,dx=[[WI,1,hx],[WI,5,5*hx],[WI,15,15*hx],[WI,30,30*hx],[YI,1,px],[YI,5,5*px],[YI,15,15*px],[YI,30,30*px],[VI,1,mx],[VI,3,3*mx],[VI,6,6*mx],[VI,12,12*mx],[ZY,1,GI],[ZY,7,Ilt],[QY,1,KY],[QY,3,3*KY],[JY,1,tW]];function eW(e,t,r){let n=t-e,i=n/r,o=To(s=>s[2]).right(dx,i);return o===dx.length?{interval:JY,step:qI(n/tW,r)}:o?(o=dx[i/dx[o-1][2]<dx[o][2]/i?o-1:o],{interval:o[0],step:o[1]}):{interval:Slt,step:qI(n,r,1)}}var Tlt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function Alt(e,t){return Tlt.has(`${e.type}-${t}`)}function I8(e,t={}){let r=(n,i)=>Alt(n,i)?{[`${i}1`]:v8(n,i,e,t),[`${i}2`]:v8(n,i,e,{...t,offset:1})}:{[i]:v8(n,i,e,t)};return r[oy]=!0,r}function v8(e,t,r,n){return new S8(r,e,t,n)}function Elt(e,t){let r=e.plot.getAttribute(`${t}Scale`);return r==="utc"||r==="time"}var S8=class extends Bt{constructor(t,r,n,i){super("COLUMN_REF"),this.column=t,this.mark=r,this.channel=n,this.options=i}get stats(){return{column:this.column,stats:["min","max"]}}toString(){let{mark:t,channel:r,column:n,options:i}=this,{type:o,min:s,max:a}=t.channelField(r),{interval:c,steps:l,offset:u=0}=i,f=c??(o==="date"||Elt(t,r)?"date":"number"),d;if(f==="number"){let{apply:h,sqlApply:p,sqlInvert:m}=wf(t,r),y=HY(h(s),h(a),i),g=p(n),x=Ge((y.max-y.min)/y.steps),b=Or(se(y.min===0?g:It(g,y.min),x)),_=te(y.min,Nt(x,u?te(u,b):b));d=m(_)}else{let{interval:h,step:p=1}=f==="date"?eW(s,a,l||40):i,m=QT(n,h,p);d=u?te(m,Wb(h,u*p)):m}return`${d}`}};var Mlt=e=>e&&typeof e=="object"&&!Array.isArray(e);var yx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o=i,format:s=f=>f,options:a,value:c,field:l=i,as:u}={}){super(r),this.from=n,this.column=i,this.format=s,this.field=l;let f=this.selection=u;this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this});let d=document.createElement("label");if(d.innerText=o||i,this.element.appendChild(d),this.select=document.createElement("select"),this.element.appendChild(this.select),a&&(this.data=a.map(h=>Mlt(h)?h:{value:h}),this.selectedValue(c??""),this.update()),f){let h=!ii(f);c!=null&&(!h||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),h&&this.selection.addEventListener("value",p=>{p!==this.select.value&&this.selectedValue(p)})}}selectedValue(t){if(arguments.length===0){let r=this.select.selectedIndex;return this.data[r].value}else{let r=this.data?.findIndex(n=>n.value===t);r>=0?this.select.selectedIndex=r:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:r,field:n}=this;if(ii(r)){t===""&&(t=void 0);let i=bu(n,t,{source:this});r.update(i)}else or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({value:n}).distinct().where(t).orderby(n):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:r,select:n,selection:i}=this;n.replaceChildren();for(let{value:o,label:s}of t){let a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??r(o),this.select.appendChild(a)}if(i){let o=ii(i)?i.valueFor(this):i.value;this.selectedValue(o??"")}return this}};var Nlt=0;var gx=class extends Bn{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",field:a=i,as:c}={}){if(super(r),this.id="search_"+ ++Nlt,this.type=s,this.from=n,this.column=i,this.selection=c,this.field=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),o){let l=document.createElement("label");l.setAttribute("for",this.id),l.innerText=o,this.element.appendChild(l)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ii(this.selection)||this.selection.addEventListener("value",l=>{l!==this.searchbox.value&&(this.searchbox.value=l)}))}reset(){this.searchbox.value=""}publish(t){let{selection:r,field:n,type:i}=this;if(ii(r)){let o=iM(n,t,{source:this,method:i});r.update(o)}else or(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?ft.from(r).select({list:n}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),r=`${this.id}_list`;t.setAttribute("id",r);for(let n of this.data){let i=document.createElement("option");i.setAttribute("value",n.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",r),this}};var Olt=0;var xx=class extends Bn{constructor({element:t,filterBy:r,as:n,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=n?.value,select:f="point",field:d=c,width:h}={}){if(super(r),this.id="slider_"+ ++Olt,this.from=a,this.column=c||"value",this.selection=n,this.selectionType=f,this.field=d,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),Object.defineProperty(this.element,"value",{value:this}),l){let p=document.createElement("label");p.setAttribute("for",this.id),p.innerText=l,this.element.appendChild(p)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),h!=null&&(this.slider.style.width=`${+h}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{let{value:p}=this.slider;this.curval.innerText=p,this.selection&&this.publish(+p)}),this.selection&&!ii(this.selection)&&this.selection.addEventListener("value",p=>{p!==+this.slider.value&&(this.slider.value=p,this.curval.innerText=p)})}query(t=[]){let{from:r,column:n}=this;return!r||this.min!=null&&this.max!=null?null:ft.select({min:zn(n),max:zr(n)}).from(r).where(t)}queryResult(t){let{min:r,max:n}=Array.from(t)[0];return this.min==null&&(this.min=r,this.slider.setAttribute("min",`${r}`)),this.max==null&&(this.max=n,this.slider.setAttribute("max",`${n}`)),this.step==null&&(this.step=(n-r)/500,this.slider.setAttribute("step",`${this.step}`)),this}publish(t){let{field:r,selectionType:n,selection:i}=this;if(ii(i))if(n==="interval"){let o=[this.min??0,t];i.update(_u(r,o,{source:this,bin:"ceil",scale:{type:"identity",domain:o},pixelSize:this.step}))}else i.update(bu(r,t,{source:this}));else or(this.selection)&&i.update(t)}};var A8=rW(e=>{let t=XI(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?E8(r):`${r}`}),XI=rW(e=>t=>t===0?"0":t.toLocaleString(e)),Vce=A8(),Yce=XI();function E8(e){return ph(e,"Invalid Date")}function rW(e){let t=null,r;return(n="en")=>n===t?r:r=e(t=n)}var Rlt=-1;var bx=class extends Bn{constructor({element:t,filterBy:r,from:n,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100,as:f}={}){super(r),this.id=`table-${++Rlt}`,this.from=n,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},or(n)&&n.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.pending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),Object.defineProperty(this.element,"value",{value:this}),typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let d=-1;this.element.addEventListener("scroll",h=>{let{pending:p,loaded:m}=this,{scrollHeight:y,scrollTop:g,clientHeight:x}=h.target,b=g<d;d=g,!(b||p||m)&&y-g<2*x&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.selection&&(this.body.addEventListener("pointerover",h=>{let p=Dlt(h.target);p>-1&&p!==this.currentRow&&(this.currentRow=p,this.selection.update(this.clause([p])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}sourceTable(){return or(this.from)?this.from.value:this.from}clause(t=[]){let{data:r,limit:n,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{let{columns:c}=r[~~(a/n)];return o.map(l=>c[l][a%n])});return Sa(o,s,{source:this})}requestData(t=0){this.offset=t;let r=this.query(this.filterBy?.predicate(this));this.requestQuery(r),Li().prefetch(r.clone().offset(t+this.limit))}fields(){let t=this.sourceTable();return this.columns.map(r=>Gs(r,t))}fieldInfo(t){this.schema=t;let r=this.head;r.innerHTML="";let n=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),n.appendChild(o)}return r.appendChild(n),this.formats=Llt(this.format,t),this.style.innerText=klt(this.id,Flt(this.align,t),Clt(this.widths,t)),this}query(t=[]){let{limit:r,offset:n,schema:i,sortColumn:o,sortDesc:s}=this;return ft.from(this.sourceTable()).select(i.map(a=>a.column)).where(t).orderby(o?s?uA(o):o:[]).limit(r).offset(n)}queryResult(t){return this.pending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Xn(t)),this}update(){let{body:t,formats:r,data:n,schema:i,limit:o}=this,s=i.length,a=n.length-1,c=o*a,{numRows:l,columns:u}=n[a],f=i.map(d=>u[d.column]);for(let d=0;d<l;++d){let h=document.createElement("tr");Object.assign(h,{__row__:c+d});for(let p=0;p<s;++p){let m=f[p][d],y=document.createElement("td");y.innerText=m==null?"":r[p](m),h.appendChild(y)}t.appendChild(h)}return l<o&&(this.loaded=!0),this.pending=!1,this}sort(t,r){r===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=r,this.sortDesc=!1);let n=t.currentTarget,i=this.sortHeader;i===n&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=n,n.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Dlt(e){let t=e.parentElement;return Object.hasOwn(t,"__row__")?+t.__row__:-1}function Llt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return XI(r);case"date":return E8;default:return A8(r)}})}function Flt(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function Clt(e={},t){return t.map(({column:r})=>e[r])}function klt(e,t,r){let n=[];return t.forEach((i,o)=>{let s=+r[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";n.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),n.join(" ")}function _x(e,...t){let r=e?.context?.coordinator??Li();for(let n of t)r.connect(n)}function HI(e,t,r){let n=new t(r);return _x(e,n),n.element}function nW(e){return HI(this,yx,e)}function iW(e){return HI(this,gx,e)}function oW(e){return HI(this,xx,e)}function sW(e){return HI(this,bx,e)}function aW({direction:e="vertical",wrap:t=!1},r){let n=document.createElement("div");return n.style.display="flex",n.style.flexDirection=e==="vertical"?"column":"row",n.style.flexWrap=t?t===!0?"wrap":t:"nowrap",n.style.justifyContent="flex-start",n.style.alignItems="flex-start",r.forEach(i=>n.appendChild(i)),Object.assign(n,{value:{element:n}}),n}function cW(...e){return aW({direction:"vertical"},e.flat())}function lW(...e){return aW({direction:"horizontal"},e.flat())}function uW({dim:e="width",size:t=10}){let r=document.createElement("span");return r.style.display="inline-block",r.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(r,{value:{element:r}})}function fW(e){return uW({dim:"height",size:e})}function dW(e){return uW({dim:"width",size:e})}var mW={};Jn(mW,{align:()=>j8,ariaDescription:()=>Q8,ariaLabel:()=>H8,aspectRatio:()=>q8,axis:()=>V8,clip:()=>G8,colorBase:()=>LD,colorClamp:()=>wD,colorConstant:()=>CD,colorDomain:()=>bD,colorExponent:()=>FD,colorInterpolate:()=>TD,colorLabel:()=>MD,colorN:()=>vD,colorNice:()=>SD,colorPercent:()=>ND,colorPivot:()=>AD,colorRange:()=>_D,colorReverse:()=>OD,colorScale:()=>xD,colorScheme:()=>ID,colorSymmetric:()=>ED,colorTickFormat:()=>DD,colorZero:()=>RD,facetGrid:()=>xR,facetLabel:()=>bR,facetMargin:()=>hR,facetMarginBottom:()=>mR,facetMarginLeft:()=>yR,facetMarginRight:()=>gR,facetMarginTop:()=>pR,fxAlign:()=>AR,fxAriaDescription:()=>VR,fxAriaLabel:()=>qR,fxAxis:()=>OR,fxDomain:()=>_R,fxFontVariant:()=>jR,fxGrid:()=>BR,fxInset:()=>vR,fxInsetLeft:()=>SR,fxInsetRight:()=>IR,fxLabel:()=>UR,fxLabelAnchor:()=>$R,fxLabelOffset:()=>zR,fxLine:()=>PR,fxPadding:()=>ER,fxPaddingInner:()=>MR,fxPaddingOuter:()=>NR,fxRange:()=>wR,fxReverse:()=>YR,fxRound:()=>TR,fxTickFormat:()=>CR,fxTickPadding:()=>FR,fxTickRotate:()=>kR,fxTickSize:()=>DR,fxTickSpacing:()=>LR,fxTicks:()=>RR,fyAlign:()=>KR,fyAriaDescription:()=>yD,fyAriaLabel:()=>mD,fyAxis:()=>rD,fyDomain:()=>WR,fyFontVariant:()=>pD,fyGrid:()=>lD,fyInset:()=>XR,fyInsetBottom:()=>QR,fyInsetTop:()=>HR,fyLabel:()=>fD,fyLabelAnchor:()=>dD,fyLabelOffset:()=>hD,fyLine:()=>uD,fyPadding:()=>JR,fyPaddingInner:()=>tD,fyPaddingOuter:()=>eD,fyRange:()=>GR,fyReverse:()=>gD,fyRound:()=>ZR,fyTickFormat:()=>aD,fyTickPadding:()=>sD,fyTickRotate:()=>cD,fyTickSize:()=>iD,fyTickSpacing:()=>oD,fyTicks:()=>nD,grid:()=>W8,height:()=>B8,inset:()=>Y8,lengthBase:()=>yL,lengthClamp:()=>dL,lengthConstant:()=>xL,lengthDomain:()=>uL,lengthExponent:()=>gL,lengthNice:()=>hL,lengthPercent:()=>pL,lengthRange:()=>fL,lengthScale:()=>lL,lengthZero:()=>mL,margin:()=>L8,marginBottom:()=>z8,marginLeft:()=>P8,marginRight:()=>U8,marginTop:()=>$8,margins:()=>D8,name:()=>O8,opacityBase:()=>WD,opacityClamp:()=>UD,opacityConstant:()=>XD,opacityDomain:()=>BD,opacityExponent:()=>GD,opacityLabel:()=>zD,opacityNice:()=>$D,opacityPercent:()=>jD,opacityRange:()=>PD,opacityReverse:()=>qD,opacityScale:()=>kD,opacityTickFormat:()=>YD,opacityZero:()=>VD,padding:()=>X8,projectionClip:()=>NL,projectionDomain:()=>SL,projectionInset:()=>IL,projectionInsetBottom:()=>ML,projectionInsetLeft:()=>TL,projectionInsetRight:()=>AL,projectionInsetTop:()=>EL,projectionParallels:()=>_L,projectionPrecision:()=>wL,projectionRotate:()=>vL,projectionType:()=>bL,rBase:()=>sL,rClamp:()=>eL,rConstant:()=>cL,rDomain:()=>JD,rExponent:()=>aL,rLabel:()=>nL,rNice:()=>rL,rPercent:()=>iL,rRange:()=>tL,rScale:()=>KD,rZero:()=>oL,style:()=>C8,symbolDomain:()=>QD,symbolRange:()=>ZD,symbolScale:()=>HD,width:()=>k8,xAlign:()=>sO,xAriaDescription:()=>TO,xAriaLabel:()=>IO,xAxis:()=>uO,xBase:()=>NO,xClamp:()=>iO,xConstant:()=>RO,xDomain:()=>K8,xExponent:()=>OO,xFontVariant:()=>SO,xGrid:()=>gO,xInset:()=>eO,xInsetLeft:()=>rO,xInsetRight:()=>nO,xLabel:()=>bO,xLabelAnchor:()=>_O,xLabelArrow:()=>wO,xLabelOffset:()=>vO,xLine:()=>xO,xNice:()=>tO,xPadding:()=>aO,xPaddingInner:()=>cO,xPaddingOuter:()=>lO,xPercent:()=>AO,xRange:()=>J8,xReverse:()=>EO,xRound:()=>oO,xScale:()=>Z8,xTickFormat:()=>mO,xTickPadding:()=>pO,xTickRotate:()=>yO,xTickSize:()=>dO,xTickSpacing:()=>hO,xTicks:()=>fO,xZero:()=>MO,xyDomain:()=>F8,yAlign:()=>zO,yAriaDescription:()=>sR,yAriaLabel:()=>oR,yAxis:()=>YO,yBase:()=>uR,yClamp:()=>UO,yConstant:()=>dR,yDomain:()=>LO,yExponent:()=>fR,yFontVariant:()=>iR,yGrid:()=>KO,yInset:()=>kO,yInsetBottom:()=>PO,yInsetTop:()=>BO,yLabel:()=>tR,yLabelAnchor:()=>eR,yLabelArrow:()=>rR,yLabelOffset:()=>nR,yLine:()=>JO,yNice:()=>CO,yPadding:()=>jO,yPaddingInner:()=>qO,yPaddingOuter:()=>VO,yPercent:()=>aR,yRange:()=>FO,yReverse:()=>cR,yRound:()=>$O,yScale:()=>DO,yTickFormat:()=>QO,yTickPadding:()=>HO,yTickRotate:()=>ZO,yTickSize:()=>GO,yTickSpacing:()=>XO,yTicks:()=>WO,yZero:()=>lR});var wx=class extends Map{request(t,r){if(this.has(t))r(this.get(t));else{let n=this.waiting||(this.waiting=new Map),i=n.get(t)||[];n.set(t,i.concat(r))}}set(t,r){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:n}=this;return n?.has(t)&&(n.get(t).forEach(i=>i(r)),n.delete(t)),super.set(t,r)}clear(){return this.waiting?.clear(),super.clear()}},M8=new wx;function N8(e,t,r){(e?.context?.namedPlots??M8).request(t,r)}function hW(e,t,r){(e?.context?.namedPlots??M8).set(t,r)}function O8(e){return t=>hW(this,e,t)}function pW(e,t,r){or(r)?(r.addEventListener("value",n=>{e.setAttribute(t,n),e.update()}),r.value!==void 0&&e.setAttribute(t,r.value)):e.setAttribute(t,r)}function Blt(e,t){return r=>{pW(r,e,t)}}function R8(e){return t=>{for(let[r,n]of Object.entries(e))pW(t,r,n)}}function D8(e){let{top:t,bottom:r,left:n,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),r!==void 0&&(o.marginBottom=r),n!==void 0&&(o.marginLeft=n),i!==void 0&&(o.marginRight=i),R8(o)}function L8(e){return R8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function F8(e){return R8({xDomain:e,yDomain:e})}var F=e=>t=>Blt(e,t),C8=F("style"),k8=F("width"),B8=F("height"),P8=F("marginLeft"),U8=F("marginRight"),$8=F("marginTop"),z8=F("marginBottom"),j8=F("align"),q8=F("aspectRatio"),V8=F("axis"),Y8=F("inset"),W8=F("grid"),G8=F("clip"),X8=F("padding"),H8=F("ariaLabel"),Q8=F("ariaDescription"),Z8=F("xScale"),K8=F("xDomain"),J8=F("xRange"),tO=F("xNice"),eO=F("xInset"),rO=F("xInsetLeft"),nO=F("xInsetRight"),iO=F("xClamp"),oO=F("xRound"),sO=F("xAlign"),aO=F("xPadding"),cO=F("xPaddingInner"),lO=F("xPaddingOuter"),uO=F("xAxis"),fO=F("xTicks"),dO=F("xTickSize"),hO=F("xTickSpacing"),pO=F("xTickPadding"),mO=F("xTickFormat"),yO=F("xTickRotate"),gO=F("xGrid"),xO=F("xLine"),bO=F("xLabel"),_O=F("xLabelAnchor"),wO=F("xLabelArrow"),vO=F("xLabelOffset"),SO=F("xFontVariant"),IO=F("xAriaLabel"),TO=F("xAriaDescription"),AO=F("xPercent"),EO=F("xReverse"),MO=F("xZero"),NO=F("xBase"),OO=F("xExponent"),RO=F("xConstant"),DO=F("yScale"),LO=F("yDomain"),FO=F("yRange"),CO=F("yNice"),kO=F("yInset"),BO=F("yInsetTop"),PO=F("yInsetBottom"),UO=F("yClamp"),$O=F("yRound"),zO=F("yAlign"),jO=F("yPadding"),qO=F("yPaddingInner"),VO=F("yPaddingOuter"),YO=F("yAxis"),WO=F("yTicks"),GO=F("yTickSize"),XO=F("yTickSpacing"),HO=F("yTickPadding"),QO=F("yTickFormat"),ZO=F("yTickRotate"),KO=F("yGrid"),JO=F("yLine"),tR=F("yLabel"),eR=F("yLabelAnchor"),rR=F("yLabelArrow"),nR=F("yLabelOffset"),iR=F("yFontVariant"),oR=F("yAriaLabel"),sR=F("yAriaDescription"),aR=F("yPercent"),cR=F("yReverse"),lR=F("yZero"),uR=F("yBase"),fR=F("yExponent"),dR=F("yConstant"),hR=F("facetMargin"),pR=F("facetMarginTop"),mR=F("facetMarginBottom"),yR=F("facetMarginLeft"),gR=F("facetMarginRight"),xR=F("facetGrid"),bR=F("facetLabel"),_R=F("fxDomain"),wR=F("fxRange"),vR=F("fxInset"),SR=F("fxInsetLeft"),IR=F("fxInsetRight"),TR=F("fxRound"),AR=F("fxAlign"),ER=F("fxPadding"),MR=F("fxPaddingInner"),NR=F("fxPaddingOuter"),OR=F("fxAxis"),RR=F("fxTicks"),DR=F("fxTickSize"),LR=F("fxTickSpacing"),FR=F("fxTickPadding"),CR=F("fxTickFormat"),kR=F("fxTickRotate"),BR=F("fxGrid"),PR=F("fxLine"),UR=F("fxLabel"),$R=F("fxLabelAnchor"),zR=F("fxLabelOffset"),jR=F("fxFontVariant"),qR=F("fxAriaLabel"),VR=F("fxAriaDescription"),YR=F("fxReverse"),WR=F("fyDomain"),GR=F("fyRange"),XR=F("fyInset"),HR=F("fyInsetTop"),QR=F("fyInsetBottom"),ZR=F("fyRound"),KR=F("fyAlign"),JR=F("fyPadding"),tD=F("fyPaddingInner"),eD=F("fyPaddingOuter"),rD=F("fyAxis"),nD=F("fyTicks"),iD=F("fyTickSize"),oD=F("fyTickSpacing"),sD=F("fyTickPadding"),aD=F("fyTickFormat"),cD=F("fyTickRotate"),lD=F("fyGrid"),uD=F("fyLine"),fD=F("fyLabel"),dD=F("fyLabelAnchor"),hD=F("fyLabelOffset"),pD=F("fyFontVariant"),mD=F("fyAriaLabel"),yD=F("fyAriaDescription"),gD=F("fyReverse"),xD=F("colorScale"),bD=F("colorDomain"),_D=F("colorRange"),wD=F("colorClamp"),vD=F("colorN"),SD=F("colorNice"),ID=F("colorScheme"),TD=F("colorInterpolate"),AD=F("colorPivot"),ED=F("colorSymmetric"),MD=F("colorLabel"),ND=F("colorPercent"),OD=F("colorReverse"),RD=F("colorZero"),DD=F("colorTickFormat"),LD=F("colorBase"),FD=F("colorExponent"),CD=F("colorConstant"),kD=F("opacityScale"),BD=F("opacityDomain"),PD=F("opacityRange"),UD=F("opacityClamp"),$D=F("opacityNice"),zD=F("opacityLabel"),jD=F("opacityPercent"),qD=F("opacityReverse"),VD=F("opacityZero"),YD=F("opacityTickFormat"),WD=F("opacityBase"),GD=F("opacityExponent"),XD=F("opacityConstant"),HD=F("symbolScale"),QD=F("symbolDomain"),ZD=F("symbolRange"),KD=F("rScale"),JD=F("rDomain"),tL=F("rRange"),eL=F("rClamp"),rL=F("rNice"),nL=F("rLabel"),iL=F("rPercent"),oL=F("rZero"),sL=F("rBase"),aL=F("rExponent"),cL=F("rConstant"),lL=F("lengthScale"),uL=F("lengthDomain"),fL=F("lengthRange"),dL=F("lengthClamp"),hL=F("lengthNice"),pL=F("lengthPercent"),mL=F("lengthZero"),yL=F("lengthBase"),gL=F("lengthExponent"),xL=F("lengthConstant"),bL=F("projectionType"),_L=F("projectionParallels"),wL=F("projectionPrecision"),vL=F("projectionRotate"),SL=F("projectionDomain"),IL=F("projectionInset"),TL=F("projectionInsetLeft"),AL=F("projectionInsetRight"),EL=F("projectionInsetTop"),ML=F("projectionInsetBottom"),NL=F("projectionClip");function yW(e,t){return{table:e,options:t}}var gW={};Jn(gW,{area:()=>OL,areaX:()=>RL,areaY:()=>DL,arrow:()=>TF,axisFx:()=>OF,axisFy:()=>RF,axisX:()=>MF,axisY:()=>NF,barX:()=>kL,barY:()=>BL,cell:()=>PL,cellX:()=>UL,cellY:()=>$L,circle:()=>GL,contour:()=>fF,delaunayLink:()=>vF,delaunayMesh:()=>SF,denseLine:()=>uF,density:()=>lF,densityX:()=>aF,densityY:()=>cF,dot:()=>VL,dotX:()=>YL,dotY:()=>WL,errorbarX:()=>xF,errorbarY:()=>bF,frame:()=>EF,geo:()=>kF,graticule:()=>PF,gridFx:()=>FF,gridFy:()=>CF,gridX:()=>DF,gridY:()=>LF,heatmap:()=>dF,hexagon:()=>XL,hexbin:()=>mF,hexgrid:()=>yF,hull:()=>IF,image:()=>sF,line:()=>LL,lineX:()=>FL,lineY:()=>CL,link:()=>AF,raster:()=>hF,rasterTile:()=>pF,rect:()=>zL,rectX:()=>jL,rectY:()=>qL,regressionY:()=>gF,ruleX:()=>KL,ruleY:()=>JL,sphere:()=>BF,spike:()=>oF,text:()=>HL,textX:()=>QL,textY:()=>ZL,tickX:()=>tF,tickY:()=>eF,vector:()=>rF,vectorX:()=>nF,vectorY:()=>iF,voronoi:()=>_F,voronoiMesh:()=>wF});var Plt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Mt(e,t,r={}){arguments.length===2&&!Array.isArray(t)&&(r=t,t=Plt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?X0:Ir;return QI(n,e,t,r)}function QI(e,t,r,n){return i=>{i.addMark(new e(t,r,n))}}function Us(e,t,r){return n=>{n.addMark(new e(t,r))}}var OL=(...e)=>Mt("area",...e),RL=(...e)=>Mt("areaX",...e),DL=(...e)=>Mt("areaY",...e),LL=(...e)=>Mt("line",...e),FL=(...e)=>Mt("lineX",...e),CL=(...e)=>Mt("lineY",...e),kL=(...e)=>Mt("barX",...e),BL=(...e)=>Mt("barY",...e),PL=(...e)=>Mt("cell",...e),UL=(...e)=>Mt("cellX",...e),$L=(...e)=>Mt("cellY",...e),zL=(...e)=>Mt("rect",...e),jL=(...e)=>Mt("rectX",...e),qL=(...e)=>Mt("rectY",...e),VL=(...e)=>Mt("dot",...e),YL=(...e)=>Mt("dotX",...e),WL=(...e)=>Mt("dotY",...e),GL=(...e)=>Mt("circle",...e),XL=(...e)=>Mt("hexagon",...e),HL=(...e)=>Mt("text",...e),QL=(...e)=>Mt("textX",...e),ZL=(...e)=>Mt("textY",...e),KL=(...e)=>Mt("ruleX",...e),JL=(...e)=>Mt("ruleY",...e),tF=(...e)=>Mt("tickX",...e),eF=(...e)=>Mt("tickY",...e),rF=(...e)=>Mt("vector",...e),nF=(...e)=>Mt("vectoX",...e),iF=(...e)=>Mt("vectorY",...e),oF=(...e)=>Mt("spike",...e),sF=(...e)=>Mt("image",...e),aF=(...e)=>QI(op,"areaX",...e),cF=(...e)=>QI(op,"areaY",...e),lF=(...e)=>Us(ex,...e),uF=(...e)=>Us(tx,...e),fF=(...e)=>Us(Z0,...e),dF=(...e)=>Us(J0,...e),hF=(...e)=>Us(Dl,...e),pF=(...e)=>Us(ix,...e),mF=(...e)=>Us(nx,...e),yF=(...e)=>Mt("hexgrid",...e),gF=(...e)=>Us(ox,...e),xF=(...e)=>QI(ap,"ruleY",...e),bF=(...e)=>Us(ap,"ruleX",...e),_F=(...e)=>Mt("voronoi",...e),wF=(...e)=>Mt("voronoiMesh",...e),vF=(...e)=>Mt("delaunayLink",...e),SF=(...e)=>Mt("delaunayMesh",...e),IF=(...e)=>Mt("hull",...e),TF=(...e)=>Mt("arrow",...e),AF=(...e)=>Mt("link",...e),EF=(...e)=>Mt("frame",...e),MF=(...e)=>Mt("axisX",...e),NF=(...e)=>Mt("axisY",...e),OF=(...e)=>Mt("axisFx",...e),RF=(...e)=>Mt("axisFy",...e),DF=(...e)=>Mt("gridX",...e),LF=(...e)=>Mt("gridY",...e),FF=(...e)=>Mt("gridFx",...e),CF=(...e)=>Mt("gridFy",...e),kF=(...e)=>Us(rx,...e),BF=(...e)=>Mt("sphere",...e),PF=(...e)=>Mt("graticule",...e);var xW={};Jn(xW,{highlight:()=>UF,intervalX:()=>$F,intervalXY:()=>jF,intervalY:()=>zF,nearest:()=>qF,nearestX:()=>VF,nearestY:()=>YF,pan:()=>ZF,panX:()=>KF,panY:()=>JF,panZoom:()=>tC,panZoomX:()=>eC,panZoomY:()=>rC,region:()=>WF,toggle:()=>Tf,toggleColor:()=>QF,toggleX:()=>GF,toggleY:()=>XF,toggleZ:()=>HF});function $s(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function UF({by:e,...t}){return $s(sx,{selection:e,channels:t})}function $F({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"x"})}function zF({as:e,...t}){return $s(Fl,{...t,selection:e,channel:"y"})}function jF({as:e,...t}){return $s(lx,{...t,selection:e})}function qF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"xy"})}function VF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"x"})}function YF({as:e,...t}){return $s(vf,{...t,selection:e,pointer:"y"})}function WF({as:e,...t}){return $s(fx,{...t,selection:e})}function Tf({as:e,...t}){return $s(If,{...t,selection:e})}function GF(e){return Tf({...e,channels:["x"]})}function XF(e){return Tf({...e,channels:["y"]})}function HF(e){return Tf({...e,channels:["z"]})}function QF(e){return Tf({...e,channels:["color"]})}function up(e){return $s(ux,e)}function ZF(e={}){return up({...e,zoom:!1})}function KF(e={}){return up({...e,zoom:!1,pany:!1})}function JF(e={}){return up({...e,zoom:!1,panx:!1})}function tC(e={}){return up(e)}function eC(e={}){return up({...e,pany:!1})}function rC(e={}){return up({...e,panx:!1})}var bW={};Jn(bW,{colorLegend:()=>iC,opacityLegend:()=>oC,symbolLegend:()=>sC});function nC(e,t={}){if(t.for){let{for:r,...n}=t,i=new lp(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?N8(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new lp(e,t))}function iC(e){return nC.call(this,"color",e)}function oC(e){return nC.call(this,"opacity",e)}function sC(e){return nC.call(this,"symbol",e)}function _W(...e){let t=new W0;return e.flat().forEach(r=>r(t)),_x(this,...t.marks),t.update(),t.element}function Ult({coordinator:e=Li(),namedPlots:t=new wx,extensions:r=null,...n}={}){return{...aC,...r,context:{coordinator:e,namedPlots:t,...n}}}export{im as Coordinator,es as Fixed,Bn as MosaicClient,vc as Param,ft as Query,qo as Selection,j8 as align,on as and,OL as area,RL as areaX,DL as areaY,xc as argmax,bc as argmin,Q8 as ariaDescription,H8 as ariaLabel,TT as arrayAgg,TF as arrow,q8 as aspectRatio,mW as attributeDirectives,Xp as avg,V8 as axis,OF as axisFx,RF as axisFy,MF as axisX,NF as axisY,kL as barX,BL as barY,I8 as bin,qf as cast,PL as cell,UL as cellX,$L as cellY,tm as centroid,fA as centroidX,dA as centroidY,GL as circle,G8 as clip,LD as colorBase,wD as colorClamp,CD as colorConstant,bD as colorDomain,FD as colorExponent,TD as colorInterpolate,MD as colorLabel,iC as colorLegend,vD as colorN,SD as colorNice,ND as colorPercent,AD as colorPivot,_D as colorRange,OD as colorReverse,xD as colorScale,ID as colorScheme,ED as colorSymmetric,DD as colorTickFormat,RD as colorZero,Gs as column,_x as connect,fF as contour,Li as coordinator,AT as corr,Mr as count,MT as covarPop,ET as covariance,Ult as createAPIContext,NA as createSchema,_c as createTable,wA as cume_dist,JT as dateDay,ZT as dateMonth,KT as dateMonthDay,vF as delaunayLink,SF as delaunayMesh,uF as denseLine,bA as dense_rank,lF as density,aF as densityX,cF as densityY,VL as dot,YL as dotX,WL as dotY,NT as entropy,iA as eq,xF as errorbarX,bF as errorbarY,xR as facetGrid,bR as facetLabel,hR as facetMargin,mR as facetMarginBottom,yR as facetMarginLeft,gR as facetMarginRight,pR as facetMarginTop,OT as first,IA as first_value,XT as float32,Ge as float64,EF as frame,yW as from,AR as fxAlign,VR as fxAriaDescription,qR as fxAriaLabel,OR as fxAxis,_R as fxDomain,jR as fxFontVariant,BR as fxGrid,vR as fxInset,SR as fxInsetLeft,IR as fxInsetRight,UR as fxLabel,$R as fxLabelAnchor,zR as fxLabelOffset,PR as fxLine,ER as fxPadding,MR as fxPaddingInner,NR as fxPaddingOuter,wR as fxRange,YR as fxReverse,TR as fxRound,CR as fxTickFormat,FR as fxTickPadding,kR as fxTickRotate,DR as fxTickSize,LR as fxTickSpacing,RR as fxTicks,KR as fyAlign,yD as fyAriaDescription,mD as fyAriaLabel,rD as fyAxis,WR as fyDomain,pD as fyFontVariant,lD as fyGrid,XR as fyInset,QR as fyInsetBottom,HR as fyInsetTop,fD as fyLabel,dD as fyLabelAnchor,hD as fyLabelOffset,uD as fyLine,JR as fyPadding,tD as fyPaddingInner,eD as fyPaddingOuter,GR as fyRange,gD as fyReverse,ZR as fyRound,aD as fyTickFormat,sD as fyTickPadding,cD as fyTickRotate,iD as fyTickSize,oD as fyTickSpacing,nD as fyTicks,kF as geo,Jp as geojson,PF as graticule,W8 as grid,FF as gridFx,CF as gridFy,DF as gridX,LF as gridY,Di as gt,oA as gte,lW as hconcat,dF as heatmap,B8 as height,XL as hexagon,mF as hexbin,yF as hexgrid,UF as highlight,dW as hspace,IF as hull,sF as image,Y8 as inset,ve as int32,xW as interactorDirectives,$F as intervalX,jF as intervalXY,zF as intervalY,jr as isBetween,sA as isDistinct,aA as isNotBetween,Yf as isNotDistinct,Ri as isNotNull,Kl as isNull,RT as kurtosis,SA as lag,CT as last,TA as last_value,Wf as lead,bW as legendDirectives,yL as lengthBase,dL as lengthClamp,xL as lengthConstant,uL as lengthDomain,gL as lengthExponent,hL as lengthNice,pL as lengthPercent,fL as lengthRange,lL as lengthScale,mL as lengthZero,LL as line,FL as lineX,CL as lineY,AF as link,Er as literal,DA as loadCSV,OA as loadExtension,LA as loadJSON,kA as loadObjects,FA as loadParquet,CA as loadSpatial,ze as lt,ri as lte,DT as mad,L8 as margin,z8 as marginBottom,P8 as marginLeft,U8 as marginRight,$8 as marginTop,D8 as margins,gW as markDirectives,zr as max,LT as median,nW as menu,zn as min,FT as mode,O8 as name,M8 as namedPlots,qF as nearest,VF as nearestX,YF as nearestY,so as neq,nA as not,AA as nth_value,vA as ntile,WD as opacityBase,UD as opacityClamp,XD as opacityConstant,BD as opacityDomain,GD as opacityExponent,zD as opacityLabel,oC as opacityLegend,$D as opacityNice,jD as opacityPercent,PD as opacityRange,qD as opacityReverse,kD as opacityScale,YD as opacityTickFormat,VD as opacityZero,Oi as or,X8 as padding,ZF as pan,KF as panX,JF as panY,tC as panZoom,eC as panZoomX,rC as panZoomY,_A as percent_rank,_W as plot,kT as product,NL as projectionClip,SL as projectionDomain,IL as projectionInset,ML as projectionInsetBottom,TL as projectionInsetLeft,AL as projectionInsetRight,EL as projectionInsetTop,_L as projectionParallels,wL as projectionPrecision,vL as projectionRotate,bL as projectionType,BT as quantile,sL as rBase,eL as rClamp,cL as rConstant,JD as rDomain,aL as rExponent,nL as rLabel,rL as rNice,iL as rPercent,tL as rRange,KD as rScale,oL as rZero,xA as rank,hF as raster,pF as rasterTile,zL as rect,jL as rectX,qL as rectY,WF as region,gF as regressionY,N8 as requestNamedPlot,yk as restConnector,gA as row_number,KL as ruleX,JL as ruleY,iW as search,qT as skewness,oW as slider,xb as socketConnector,BF as sphere,oF as spike,tr as sql,Zp as stddev,VT as stddevPop,YT as stringAgg,C8 as style,de as sum,QD as symbolDomain,sC as symbolLegend,ZD as symbolRange,HD as symbolScale,sW as table,HL as text,QL as textX,ZL as textY,tF as tickX,eF as tickY,Tf as toggle,QF as toggleColor,GF as toggleX,XF as toggleY,HF as toggleZ,GT as varPop,WT as variance,cW as vconcat,rF as vector,nF as vectorX,iF as vectorY,_F as voronoi,wF as voronoiMesh,fW as vspace,g5 as wasmConnector,k8 as width,sO as xAlign,TO as xAriaDescription,IO as xAriaLabel,uO as xAxis,NO as xBase,iO as xClamp,RO as xConstant,K8 as xDomain,OO as xExponent,SO as xFontVariant,gO as xGrid,eO as xInset,rO as xInsetLeft,nO as xInsetRight,bO as xLabel,_O as xLabelAnchor,wO as xLabelArrow,vO as xLabelOffset,xO as xLine,tO as xNice,aO as xPadding,cO as xPaddingInner,lO as xPaddingOuter,AO as xPercent,J8 as xRange,EO as xReverse,oO as xRound,Z8 as xScale,mO as xTickFormat,pO as xTickPadding,yO as xTickRotate,dO as xTickSize,hO as xTickSpacing,fO as xTicks,MO as xZero,F8 as xyDomain,zO as yAlign,sR as yAriaDescription,oR as yAriaLabel,YO as yAxis,uR as yBase,UO as yClamp,dR as yConstant,LO as yDomain,fR as yExponent,iR as yFontVariant,KO as yGrid,kO as yInset,PO as yInsetBottom,BO as yInsetTop,tR as yLabel,eR as yLabelAnchor,rR as yLabelArrow,nR as yLabelOffset,JO as yLine,CO as yNice,jO as yPadding,qO as yPaddingInner,VO as yPaddingOuter,aR as yPercent,FO as yRange,cR as yReverse,$O as yRound,DO as yScale,QO as yTickFormat,HO as yTickPadding,ZO as yTickRotate,GO as yTickSize,XO as yTickSpacing,WO as yTicks,lR as yZero};
|